blob: 548fefd99999dd877e6e8a9b71ca60b5f6f53e8a [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
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530187 pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
Kiet Lam64c1b492013-07-12 13:56:44 +0530188 if ( NULL == pCmd )
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530189 {
190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
191 FL("fail to allocate memory %lu"),
192 (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530194 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530196 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530197 status = eHAL_STATUS_SUCCESS;
198
199 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
200 pMac->sme.pSmeCmdBufAddr = pCmd;
201
202 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
203 {
204 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530205 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700209 /* This timer is only to debug the active list command timeout */
210
211 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
212 if (cmdTimeoutTimer)
213 {
214 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
215 vosStatus =
216 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
217 VOS_TIMER_TYPE_SW,
218 activeListCmdTimeoutHandle,
219 (void*) pMac);
220
221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
222 {
223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
224 "Init Timer fail for active list command process time out");
225 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
226 }
227 else
228 {
229 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
230 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
231 }
232 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530233end:
234 if (!HAL_STATUS_SUCCESS(status))
235 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
236 status);
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return (status);
239}
240
241
242void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
243{
244 pCmd->command = eSmeNoCommand;
245 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
246}
247
248
249
250static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
251{
252 tListElem *pEntry;
253 tSmeCmd *pCommand;
254
255 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
256 {
257 //TODO: base on command type to call release functions
258 //reinitialize different command types so they can be reused
259 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
260 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
261 }
262}
263
264static void purgeSmeCmdList(tpAniSirGlobal pMac)
265{
266 //release any out standing commands back to free command list
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700271}
272
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530273void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
274 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275{
276 //release any out standing commands back to free command list
277 tListElem *pEntry, *pNext;
278 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 tDblLinkList localList;
280
281 vos_mem_zero(&localList, sizeof(tDblLinkList));
282 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
283 {
284 smsLog(pMac, LOGE, FL(" failed to open list"));
285 return;
286 }
287
288 csrLLLock(pList);
289 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
290 while(pEntry != NULL)
291 {
292 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
293 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
294 if(pCommand->sessionId == sessionId)
295 {
296 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
297 {
298 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
299 }
300 }
301 pEntry = pNext;
302 }
303 csrLLUnlock(pList);
304
305 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
306 {
307 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
308 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
309 }
310 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311}
312
313
314static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
315{
316 eHalStatus status = eHAL_STATUS_SUCCESS;
317
318 purgeSmeCmdList(pMac);
319 csrLLClose(&pMac->sme.smeCmdPendingList);
320 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530321 csrLLClose(&pMac->sme.smeScanCmdPendingList);
322 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 csrLLClose(&pMac->sme.smeCmdFreeList);
324
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700325 /*destroy active list command time out timer */
326 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
327 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
328 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
329
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
331 if(status != eHAL_STATUS_SUCCESS)
332 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800333 smsLog(pMac, LOGE,
334 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800335 goto done;
336 }
337
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 if(NULL != pMac->sme.pSmeCmdBufAddr)
339 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530340 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 pMac->sme.pSmeCmdBufAddr = NULL;
342 }
343
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
345 if(status != eHAL_STATUS_SUCCESS)
346 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800347 smsLog(pMac, LOGE,
348 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800349 }
350done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 return (status);
352}
353
354
355void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
356{
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 switch( pCmd->command )
358 {
359 case eSmeCommandScan:
360 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
361 break;
362
363 case eSmeCommandRoam:
364 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
365 break;
366
367 case eSmeCommandWmStatusChange:
368 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
369 break;
370
371 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
374 break;
375
376 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800377 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
379 break;
380
381 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700382 smsLog( pMac, LOGE, " default: Unhandled command %d",
383 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 break;
385 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700386}
387
388tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
389{
390 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
391 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530392 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
394
395 // If we can get another MS Msg buffer, then we are ok. Just link
396 // the entry onto the linked list. (We are using the linked list
397 // to keep track of tfhe message buffers).
398 if ( pEntry )
399 {
400 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530401 /* reset when free list is available */
402 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else {
405 int idx = 1;
406
407 //Cannot change pRetCmd here since it needs to return later.
408 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
409 if( pEntry )
410 {
411 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
412 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800413 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
415 if(pTempCmd)
416 {
417 if( eSmeCsrCommandMask & pTempCmd->command )
418 {
419 //CSR command is stuck. See what the reason code is for that command
420 dumpCsrCommandInfo(pMac, pTempCmd);
421 }
422 } //if(pTempCmd)
423
424 //dump what is in the pending queue
425 csrLLLock(&pMac->sme.smeCmdPendingList);
426 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530427 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 {
429 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530430 /* Print only 1st five commands from pending queue. */
431 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800432 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530433 idx, pTempCmd->command );
434 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 if( eSmeCsrCommandMask & pTempCmd->command )
436 {
437 //CSR command is stuck. See what the reason code is for that command
438 dumpCsrCommandInfo(pMac, pTempCmd);
439 }
440 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
441 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530442 /* Increament static variable so that it prints pending command only once*/
443 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 csrLLUnlock(&pMac->sme.smeCmdPendingList);
445
446 //There may be some more command in CSR's own pending queue
447 csrLLLock(&pMac->roam.roamCmdPendingList);
448 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
449 while(pEntry)
450 {
451 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800452 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 idx++, pTempCmd->command );
454 dumpCsrCommandInfo(pMac, pTempCmd);
455 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
456 }
457 csrLLUnlock(&pMac->roam.roamCmdPendingList);
458 }
459
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530460 if( pRetCmd )
461 {
462 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
463 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
464 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
465 }
466
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 return( pRetCmd );
468}
469
470
471void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
472{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530473 if (!SME_IS_START(pMac))
474 {
475 smsLog( pMac, LOGE, FL("Sme in stop state"));
476 return;
477 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 if ( fHighPriority )
479 {
480 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
481 }
482 else
483 {
484 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
485 }
486
487 // process the command queue...
488 smeProcessPendingQueue( pMac );
489
490 return;
491}
492
493
494static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
495{
496 eSmeCommandType pmcCommand = eSmeNoCommand;
497 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
498 tPmcState pmcState;
499 eHalStatus status;
500
501 do
502 {
503 pmcState = pmcGetPmcState(pMac);
504
505 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
506 if( !HAL_STATUS_SUCCESS(status) )
507 {
508 //PMC state is not right for the command, drop it
509 return ( eSmeDropCommand );
510 }
511 if( fFullPowerNeeded ) break;
512 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
513 ( eSmeCommandDelTs == pCommand->command ) );
514 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700515#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700516 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700517 eSmeCommandOemDataReq == pCommand->command);
518 if(fFullPowerNeeded) break;
519#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700520 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 eSmeCommandRemainOnChannel == pCommand->command);
522 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 } while(0);
524
525 if( fFullPowerNeeded )
526 {
527 switch( pmcState )
528 {
529 case IMPS:
530 case STANDBY:
531 pmcCommand = eSmeCommandExitImps;
532 break;
533
534 case BMPS:
535 pmcCommand = eSmeCommandExitBmps;
536 break;
537
538 case UAPSD:
539 pmcCommand = eSmeCommandExitUapsd;
540 break;
541
542 case WOWL:
543 pmcCommand = eSmeCommandExitWowl;
544 break;
545
546 default:
547 break;
548 }
549 }
550
551 return ( pmcCommand );
552}
553
554
555//For commands that need to do extra cleanup.
556static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
557{
558 if( eSmePmcCommandMask & pCommand->command )
559 {
560 pmcAbortCommand( pMac, pCommand, fStopping );
561 }
562 else if ( eSmeCsrCommandMask & pCommand->command )
563 {
564 csrAbortCommand( pMac, pCommand, fStopping );
565 }
566 else
567 {
568 switch( pCommand->command )
569 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 case eSmeCommandRemainOnChannel:
571 if (NULL != pCommand->u.remainChlCmd.callback)
572 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700573 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 pCommand->u.remainChlCmd.callback;
575 /* process the msg */
576 if( callback )
577 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700578 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 eCSR_SCAN_ABORT );
580 }
581 }
582 smeReleaseCommand( pMac, pCommand );
583 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 default:
585 smeReleaseCommand( pMac, pCommand );
586 break;
587 }
588 }
589}
590
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530591tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
592 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
593{
594 tListElem *pCurEntry = NULL;
595 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700596
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530597 /* Go through the list and return the command whose session id is not
598 * matching with the current ongoing scan cmd sessionId */
599 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
600 while (pCurEntry)
601 {
602 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
603 if (pCommand->sessionId != sessionId)
604 {
605 smsLog(pMac, LOG1, "selected the command with different sessionId");
606 return pCurEntry;
607 }
608
609 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
610 }
611
612 smsLog(pMac, LOG1, "No command pending with different sessionId");
613 return NULL;
614}
615
616tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
617{
618 tListElem *pEntry;
619 tSmeCmd *pCommand;
620 tListElem *pSmeEntry;
621 tSmeCmd *pSmeCommand;
622 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
623
624 csrLLLock( &pMac->sme.smeScanCmdActiveList );
625 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
626 LL_ACCESS_NOLOCK ))
627 {
628 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
629 LL_ACCESS_LOCK))
630 {
631 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
632 LL_ACCESS_LOCK );
633 if (pEntry)
634 {
635 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
636 //We cannot execute any command in wait-for-key state until setKey is through.
637 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
638 {
639 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
640 {
641 smsLog(pMac, LOGE,
642 " Cannot process command(%d) while waiting for key",
643 pCommand->command);
644 status = eANI_BOOLEAN_FALSE;
645 goto end;
646 }
647 }
648
649 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
650 LL_ACCESS_LOCK )))
651 {
652 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
653 LL_ACCESS_LOCK);
654 if (pEntry)
655 {
656 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
657 Link) ;
658
659 /* if scan is running on one interface and SME recei
660 ves the next command on the same interface then
661 dont the allow the command to be queued to
662 smeCmdPendingList. If next scan is allowed on
663 the same interface the CSR state machine will
664 get screwed up. */
665 if (pSmeCommand->sessionId == pCommand->sessionId)
666 {
667 status = eANI_BOOLEAN_FALSE;
668 goto end;
669 }
670 }
671 }
672 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
673 pEntry, LL_ACCESS_LOCK ) )
674 {
675 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
676 &pCommand->Link, LL_ACCESS_NOLOCK );
677
678 switch (pCommand->command)
679 {
680 case eSmeCommandScan:
681 smsLog(pMac, LOG1,
682 " Processing scan offload command ");
683 csrProcessScanCommand( pMac, pCommand );
684 break;
685 default:
686 smsLog(pMac, LOGE,
687 " Something wrong, wrong command enqueued"
688 " to smeScanCmdPendingList");
689 pEntry = csrLLRemoveHead(
690 &pMac->sme.smeScanCmdActiveList,
691 LL_ACCESS_NOLOCK );
692 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
693 smeReleaseCommand( pMac, pCommand );
694 break;
695 }
696 }
697 }
698 }
699 }
700end:
701 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
702 return status;
703}
Jeff Johnson295189b2012-06-20 16:38:30 -0700704
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530705eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
706{
707 tpSirPNOScanReq pnoReqBuf;
708 tSirMsgQ msgQ;
709
710 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
711 if ( NULL == pnoReqBuf )
712 {
713 smsLog(pMac, LOGE, FL("failed to allocate memory"));
714 return eHAL_STATUS_FAILURE;
715 }
716
717 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
718
719 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
720 msgQ.type = WDA_SET_PNO_REQ;
721 msgQ.reserved = 0;
722 msgQ.bodyptr = pnoReqBuf;
723 msgQ.bodyval = 0;
724 wdaPostCtrlMsg( pMac, &msgQ);
725
726 return eHAL_STATUS_SUCCESS;
727}
728
Jeff Johnson295189b2012-06-20 16:38:30 -0700729tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
730{
731 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
732 eHalStatus status = eHAL_STATUS_SUCCESS;
733 tListElem *pEntry;
734 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530735 tListElem *pSmeEntry;
736 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 eSmeCommandType pmcCommand = eSmeNoCommand;
738
739 // if the ActiveList is empty, then nothing is active so we can process a
740 // pending command...
741 //alwasy lock active list before locking pending list
742 csrLLLock( &pMac->sme.smeCmdActiveList );
743 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
744 {
745 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
746 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530747 /* If scan command is pending in the smeScanCmdActive list
748 * then pick the command from smeCmdPendingList which is
749 * not matching with the scan command session id.
750 * At any point of time only one command will be allowed
751 * on a single session. */
752 if ((pMac->fScanOffload) &&
753 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
754 LL_ACCESS_LOCK)))
755 {
756 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
757 LL_ACCESS_LOCK);
758 if (pSmeEntry)
759 {
760 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
761
762 pEntry = csrGetCmdToProcess(pMac,
763 &pMac->sme.smeCmdPendingList,
764 pSmeCommand->sessionId,
765 LL_ACCESS_LOCK);
766 goto sme_process_cmd;
767 }
768 }
769
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 //Peek the command
771 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530772sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 if( pEntry )
774 {
775 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530776
Abhishek Singhf4669da2014-05-26 15:07:49 +0530777 /* Allow only disconnect command
778 * in wait-for-key state until setKey is through.
779 */
780 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
781 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 {
783 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
784 {
785 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530786 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
787 "command(%d) while waiting for key"),
788 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530789 fContinue = eANI_BOOLEAN_FALSE;
790 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 }
792 }
793 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
794 if( eSmeDropCommand == pmcCommand )
795 {
796 //This command is not ok for current PMC state
797 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
798 {
799 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
800 }
801 csrLLUnlock( &pMac->sme.smeCmdActiveList );
802 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530803 fContinue = eANI_BOOLEAN_TRUE;
804 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 }
806 else if( eSmeNoCommand != pmcCommand )
807 {
808 tExitBmpsInfo exitBmpsInfo;
809 void *pv = NULL;
810 tANI_U32 size = 0;
811 tSmeCmd *pPmcCmd = NULL;
812
813 if( eSmeCommandExitBmps == pmcCommand )
814 {
815 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
816 pv = (void *)&exitBmpsInfo;
817 size = sizeof(tExitBmpsInfo);
818 }
819 //pmcCommand has to be one of the exit power save command
820 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
821 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
822 {
823 //Force this command to wake up the chip
824 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
825 csrLLUnlock( &pMac->sme.smeCmdActiveList );
826 fContinue = pmcProcessCommand( pMac, pPmcCmd );
827 if( fContinue )
828 {
829 //The command failed, remove it
830 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
831 {
832 pmcReleaseCommand( pMac, pPmcCmd );
833 }
834 }
835 }
836 else
837 {
838 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800839 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 -0700840 //Let it retry
841 fContinue = eANI_BOOLEAN_TRUE;
842 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530843 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 }
845 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
846 {
847 // we can reuse the pCommand
848
849 // Insert the command onto the ActiveList...
850 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
851
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530852 if( pMac->deferImps )
853 {
854 /* IMPS timer is already running so stop it and
855 * it will get restarted when no command is pending
856 */
857 csrScanStopIdleScanTimer( pMac );
858 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
859 pMac->deferImps = eANI_BOOLEAN_FALSE;
860 }
861
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 // .... and process the command.
863
Katya Nigambcb705f2013-12-26 14:26:22 +0530864 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700865 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 switch ( pCommand->command )
867 {
868
869 case eSmeCommandScan:
870 csrLLUnlock( &pMac->sme.smeCmdActiveList );
871 status = csrProcessScanCommand( pMac, pCommand );
872 break;
873
874 case eSmeCommandRoam:
875 csrLLUnlock( &pMac->sme.smeCmdActiveList );
876 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800877 if(!HAL_STATUS_SUCCESS(status))
878 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700879 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800880 &pCommand->Link, LL_ACCESS_LOCK ) )
881 {
882 csrReleaseCommandRoam( pMac, pCommand );
883 }
884 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 break;
886
887 case eSmeCommandWmStatusChange:
888 csrLLUnlock( &pMac->sme.smeCmdActiveList );
889 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
890 break;
891
892 case eSmeCommandSetKey:
893 csrLLUnlock( &pMac->sme.smeCmdActiveList );
894 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
895 if(!HAL_STATUS_SUCCESS(status))
896 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700897 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 &pCommand->Link, LL_ACCESS_LOCK ) )
899 {
900 csrReleaseCommandSetKey( pMac, pCommand );
901 }
902 }
903 break;
904
905 case eSmeCommandRemoveKey:
906 csrLLUnlock( &pMac->sme.smeCmdActiveList );
907 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
908 if(!HAL_STATUS_SUCCESS(status))
909 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700910 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 &pCommand->Link, LL_ACCESS_LOCK ) )
912 {
913 csrReleaseCommandRemoveKey( pMac, pCommand );
914 }
915 }
916 break;
917
918 case eSmeCommandAddStaSession:
919 csrLLUnlock( &pMac->sme.smeCmdActiveList );
920 csrProcessAddStaSessionCommand( pMac, pCommand );
921 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700922 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 csrLLUnlock( &pMac->sme.smeCmdActiveList );
924 csrProcessDelStaSessionCommand( pMac, pCommand );
925 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530926 case eSmeCommandMacSpoofRequest:
927 csrLLUnlock( &pMac->sme.smeCmdActiveList );
928 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +0530929 //We need to re-run the command
930 fContinue = eANI_BOOLEAN_TRUE;
931
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530932 // No Rsp expected, free cmd from active list
933 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
934 &pCommand->Link, LL_ACCESS_LOCK ) )
935 {
936 csrReleaseCommand( pMac, pCommand );
937 }
938
939 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700940
Jeff Johnsone7245742012-09-05 17:12:55 -0700941#ifdef FEATURE_OEM_DATA_SUPPORT
942 case eSmeCommandOemDataReq:
943 csrLLUnlock(&pMac->sme.smeCmdActiveList);
944 oemData_ProcessOemDataReqCommand(pMac, pCommand);
945 break;
946#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 case eSmeCommandRemainOnChannel:
948 csrLLUnlock(&pMac->sme.smeCmdActiveList);
949 p2pProcessRemainOnChannelCmd(pMac, pCommand);
950 break;
951 case eSmeCommandNoAUpdate:
952 csrLLUnlock( &pMac->sme.smeCmdActiveList );
953 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 case eSmeCommandEnterImps:
955 case eSmeCommandExitImps:
956 case eSmeCommandEnterBmps:
957 case eSmeCommandExitBmps:
958 case eSmeCommandEnterUapsd:
959 case eSmeCommandExitUapsd:
960 case eSmeCommandEnterWowl:
961 case eSmeCommandExitWowl:
962 csrLLUnlock( &pMac->sme.smeCmdActiveList );
963 fContinue = pmcProcessCommand( pMac, pCommand );
964 if( fContinue )
965 {
966 //The command failed, remove it
967 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
968 &pCommand->Link, LL_ACCESS_LOCK ) )
969 {
970 pmcReleaseCommand( pMac, pCommand );
971 }
972 }
973 break;
974
975 //Treat standby differently here because caller may not be able to handle
976 //the failure so we do our best here
977 case eSmeCommandEnterStandby:
978 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
979 {
980 //It can continue
981 csrLLUnlock( &pMac->sme.smeCmdActiveList );
982 fContinue = pmcProcessCommand( pMac, pCommand );
983 if( fContinue )
984 {
985 //The command failed, remove it
986 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
987 &pCommand->Link, LL_ACCESS_LOCK ) )
988 {
989 pmcReleaseCommand( pMac, pCommand );
990 }
991 }
992 }
993 else
994 {
995 //Need to issue a disconnect first before processing this command
996 tSmeCmd *pNewCmd;
997
998 //We need to re-run the command
999 fContinue = eANI_BOOLEAN_TRUE;
1000 //Pull off the standby command first
1001 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1002 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1003 {
1004 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1005 //Need to call CSR function here because the disconnect command
1006 //is handled by CSR
1007 pNewCmd = csrGetCommandBuffer( pMac );
1008 if( NULL != pNewCmd )
1009 {
1010 //Put the standby command to the head of the pending list first
1011 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1012 LL_ACCESS_LOCK );
1013 pNewCmd->command = eSmeCommandRoam;
1014 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1015 //Put the disassoc command before the standby command
1016 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1017 LL_ACCESS_LOCK );
1018 }
1019 else
1020 {
1021 //Continue the command here
1022 fContinue = pmcProcessCommand( pMac, pCommand );
1023 if( fContinue )
1024 {
1025 //The command failed, remove it
1026 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1027 &pCommand->Link, LL_ACCESS_LOCK ) )
1028 {
1029 pmcReleaseCommand( pMac, pCommand );
1030 }
1031 }
1032 }
1033 }
1034 else
1035 {
1036 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001037 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 VOS_ASSERT(0);
1039 }
1040 }
1041 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301042 case eSmeCommandPnoReq:
1043 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1044 status = smeProcessPnoCommand(pMac, pCommand);
1045 if (!HAL_STATUS_SUCCESS(status)){
1046 smsLog(pMac, LOGE,
1047 FL("failed to post SME PNO SCAN %d"), status);
1048 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301049 //We need to re-run the command
1050 fContinue = eANI_BOOLEAN_TRUE;
1051
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301052 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1053 &pCommand->Link, LL_ACCESS_LOCK))
1054 {
1055 csrReleaseCommand(pMac, pCommand);
1056 }
1057 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 case eSmeCommandAddTs:
1059 case eSmeCommandDelTs:
1060 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1061#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1062 fContinue = qosProcessCommand( pMac, pCommand );
1063 if( fContinue )
1064 {
1065 //The command failed, remove it
1066 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1067 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1068 {
1069//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1070 qosReleaseCommand( pMac, pCommand );
1071//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1072 }
1073 }
1074#endif
1075 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001076#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001077 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001078 case eSmeCommandTdlsAddPeer:
1079 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301080 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301081 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001082#ifdef FEATURE_WLAN_TDLS_INTERNAL
1083 case eSmeCommandTdlsDiscovery:
1084 case eSmeCommandTdlsLinkSetup:
1085 case eSmeCommandTdlsLinkTear:
1086 case eSmeCommandTdlsEnterUapsd:
1087 case eSmeCommandTdlsExitUapsd:
1088#endif
1089 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001090 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001091 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001092
1093 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1094 status = csrTdlsProcessCmd( pMac, pCommand );
1095 }
1096 break ;
1097#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001098
1099 default:
1100 //something is wrong
1101 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001102 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1104 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1105 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1106 smeReleaseCommand( pMac, pCommand );
1107 status = eHAL_STATUS_FAILURE;
1108 break;
1109 }
1110 if(!HAL_STATUS_SUCCESS(status))
1111 {
1112 fContinue = eANI_BOOLEAN_TRUE;
1113 }
1114 }//if(pEntry)
1115 else
1116 {
1117 //This is odd. Some one else pull off the command.
1118 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1119 }
1120 }
1121 else
1122 {
1123 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1124 }
1125 }
1126 else
1127 {
1128 //No command waiting
1129 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1130 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1131 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1132 {
1133 tANI_U32 nTime = 0;
1134
1135 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1136 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1137 {
1138 csrScanStartIdleScanTimer(pMac, nTime);
1139 }
1140 }
1141 }
1142 }
1143 else {
1144 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1145 }
1146
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301147sme_process_scan_queue:
1148 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1149 fContinue = eANI_BOOLEAN_FALSE;
1150
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 return ( fContinue );
1152}
1153
1154void smeProcessPendingQueue( tpAniSirGlobal pMac )
1155{
1156 while( smeProcessCommand( pMac ) );
1157}
1158
1159
1160tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1161{
1162 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1163 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1164}
1165
1166
1167
1168//Global APIs
1169
1170/*--------------------------------------------------------------------------
1171
1172 \brief sme_Open() - Initialze all SME modules and put them at idle state
1173
1174 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1175 successfully return, all modules are at idle state ready to start.
1176
1177 smeOpen must be called before any other SME APIs can be involved.
1178 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001179 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 \param hHal - The handle returned by macOpen.
1181
1182 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1183
1184 Other status means SME is failed to be initialized
1185 \sa
1186
1187 --------------------------------------------------------------------------*/
1188eHalStatus sme_Open(tHalHandle hHal)
1189{
1190 eHalStatus status = eHAL_STATUS_FAILURE;
1191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1192
1193 do {
1194 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001195 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1197 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001198 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 status = eHAL_STATUS_FAILURE;
1200 break;
1201 }
1202
1203 status = ccmOpen(hHal);
1204 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1205 smsLog( pMac, LOGE,
1206 "ccmOpen failed during initialization with status=%d", status );
1207 break;
1208 }
1209
1210 status = csrOpen(pMac);
1211 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1212 smsLog( pMac, LOGE,
1213 "csrOpen failed during initialization with status=%d", status );
1214 break;
1215 }
1216
1217 status = pmcOpen(hHal);
1218 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1219 smsLog( pMac, LOGE,
1220 "pmcOpen failed during initialization with status=%d", status );
1221 break;
1222 }
1223
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001224#ifdef FEATURE_WLAN_TDLS
1225 pMac->isTdlsPowerSaveProhibited = 0;
1226#endif
1227
Jeff Johnson295189b2012-06-20 16:38:30 -07001228#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1229 status = sme_QosOpen(pMac);
1230 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1231 smsLog( pMac, LOGE,
1232 "Qos open failed during initialization with status=%d", status );
1233 break;
1234 }
1235
1236 status = btcOpen(pMac);
1237 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1238 smsLog( pMac, LOGE,
1239 "btcOpen open failed during initialization with status=%d", status );
1240 break;
1241 }
1242#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001243#ifdef FEATURE_OEM_DATA_SUPPORT
1244 status = oemData_OemDataReqOpen(pMac);
1245 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1246 smsLog(pMac, LOGE,
1247 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1248 break;
1249 }
1250#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001251
1252 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1253 break;
1254
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 {
1256 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1257 if ( NULL == pvosGCtx ){
1258 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1259 status = eHAL_STATUS_FAILURE;
1260 break;
1261 }
1262
1263 status = WLANSAP_Open( pvosGCtx );
1264 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1265 smsLog( pMac, LOGE,
1266 "WLANSAP_Open open failed during initialization with status=%d", status );
1267 break;
1268 }
1269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001270#if defined WLAN_FEATURE_VOWIFI
1271 status = rrmOpen(pMac);
1272 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1273 smsLog( pMac, LOGE,
1274 "rrmOpen open failed during initialization with status=%d", status );
1275 break;
1276 }
1277#endif
1278
1279#if defined WLAN_FEATURE_VOWIFI_11R
1280 sme_FTOpen(pMac);
1281#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001283 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001284
1285 }while (0);
1286
1287 return status;
1288}
1289
Jeff Johnson295189b2012-06-20 16:38:30 -07001290/*--------------------------------------------------------------------------
1291
1292 \brief sme_set11dinfo() - Set the 11d information about valid channels
1293 and there power using information from nvRAM
1294 This function is called only for AP.
1295
Srinivas Girigowdade697412013-02-14 16:31:48 -08001296 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
1298 \param hHal - The handle returned by macOpen.
1299 \Param pSmeConfigParams - a pointer to a caller allocated object of
1300 typedef struct _smeConfigParams.
1301
1302 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1303
1304 Other status means SME is failed to update the config parameters.
1305 \sa
1306--------------------------------------------------------------------------*/
1307
1308eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1309{
1310 eHalStatus status = eHAL_STATUS_FAILURE;
1311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1312
Katya Nigambcb705f2013-12-26 14:26:22 +05301313 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001314 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 if (NULL == pSmeConfigParams ) {
1316 smsLog( pMac, LOGE,
1317 "Empty config param structure for SME, nothing to update");
1318 return status;
1319 }
1320
1321 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1322 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001323 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 status );
1325 }
1326 return status;
1327}
1328
1329/*--------------------------------------------------------------------------
1330
1331 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1332
Srinivas Girigowdade697412013-02-14 16:31:48 -08001333 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001334
1335 \param hHal - The handle returned by HostapdAdapter.
1336 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1337
1338 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1339
1340 Other status means, failed to get the current regulatory domain.
1341 \sa
1342--------------------------------------------------------------------------*/
1343
1344eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1345{
1346 eHalStatus status = eHAL_STATUS_FAILURE;
1347 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1348
Katya Nigambcb705f2013-12-26 14:26:22 +05301349 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001350 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 if (NULL == domainIdSoftAp ) {
1352 smsLog( pMac, LOGE, "Uninitialized domain Id");
1353 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
1356 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1357 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001358
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 return status;
1360}
1361
1362
1363eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1364{
1365 eHalStatus status = eHAL_STATUS_FAILURE;
1366 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1367
Katya Nigambcb705f2013-12-26 14:26:22 +05301368 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001369 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 if (NULL == apCntryCode ) {
1371 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1372 return status;
1373 }
1374
1375 status = csrSetRegInfo(hHal, apCntryCode );
1376 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001377 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 status );
1379 }
1380 return status;
1381}
1382
Jeff Johnson295189b2012-06-20 16:38:30 -07001383#ifdef FEATURE_WLAN_SCAN_PNO
1384/*--------------------------------------------------------------------------
1385
1386 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001387
1388 It is used at driver start up to inform RIVA of the default channel
1389 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
Srinivas Girigowdade697412013-02-14 16:31:48 -08001391 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001392
1393 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001394
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1396
1397 Other status means SME is failed to update the channel config.
1398 \sa
1399
1400 --------------------------------------------------------------------------*/
1401eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1402{
1403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1404
Katya Nigambcb705f2013-12-26 14:26:22 +05301405 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001406 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1407 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 &pMac->scan.base20MHzChannels, FALSE);
1409 return eHAL_STATUS_SUCCESS;
1410}
1411#endif // FEATURE_WLAN_SCAN_PNLO
1412
Abhishek Singhf644b272014-08-21 02:59:39 +05301413eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1414{
1415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1416 eHalStatus status = eHAL_STATUS_SUCCESS;
1417
1418 status = csrUpdateChannelList(pMac);
1419
1420 if (eHAL_STATUS_SUCCESS != status)
1421 {
1422 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1423 "failed to update the supported channel list");
1424 }
1425 return status;
1426}
1427
Jeff Johnson295189b2012-06-20 16:38:30 -07001428/*--------------------------------------------------------------------------
1429
1430 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1431
1432 The function updates some configuration for modules in SME, CCM, CSR, etc
1433 during SMEs close open sequence.
1434
1435 Modules inside SME apply the new configuration at the next transaction.
1436
Srinivas Girigowdade697412013-02-14 16:31:48 -08001437 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001438
1439 \param hHal - The handle returned by macOpen.
1440 \Param pSmeConfigParams - a pointer to a caller allocated object of
1441 typedef struct _smeConfigParams.
1442
1443 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1444
1445 Other status means SME is failed to update the config parameters.
1446 \sa
1447
1448 --------------------------------------------------------------------------*/
1449eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1450{
1451 eHalStatus status = eHAL_STATUS_FAILURE;
1452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1453
Katya Nigambcb705f2013-12-26 14:26:22 +05301454 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001455 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 if (NULL == pSmeConfigParams ) {
1457 smsLog( pMac, LOGE,
1458 "Empty config param structure for SME, nothing to update");
1459 return status;
1460 }
1461
1462 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1463
1464 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001465 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 status );
1467 }
1468#if defined WLAN_FEATURE_P2P_INTERNAL
1469 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1470
1471 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001472 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 status );
1474 }
1475#endif
1476#if defined WLAN_FEATURE_VOWIFI
1477 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1478
1479 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001480 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 status );
1482 }
1483#endif
1484 //For SOC, CFG is set before start
1485 //We don't want to apply global CFG in connect state because that may cause some side affect
1486 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 csrIsAllSessionDisconnected( pMac) )
1488 {
1489 csrSetGlobalCfgs(pMac);
1490 }
1491
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301492 /* update the directed scan offload setting */
1493 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1494
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301495 if (pMac->fScanOffload)
1496 {
1497 /* If scan offload is enabled then lim has allow the sending of
1498 scan request to firmware even in powersave mode. The firmware has
1499 to take care of exiting from power save mode */
1500 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1501 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1502
1503 if (eHAL_STATUS_SUCCESS != status)
1504 {
1505 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1506 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1507 }
1508 }
krunal sonie9002db2013-11-25 14:24:17 -08001509 pMac->isCoalesingInIBSSAllowed =
1510 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001511 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301512 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301513 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301514
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 return status;
1516}
1517
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301518#ifdef WLAN_FEATURE_GTK_OFFLOAD
1519void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1520 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1521{
1522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1523
1524 if (NULL == pMac)
1525 {
1526 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1527 "%s: pMac is null", __func__);
1528 return ;
1529 }
1530 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1531 {
1532 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1533 "%s: HDD callback is null", __func__);
1534 return ;
1535 }
1536 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1537 pGtkOffloadGetInfoRsp);
1538}
1539#endif
1540
Jeff Johnson295189b2012-06-20 16:38:30 -07001541/* ---------------------------------------------------------------------------
1542 \fn sme_ChangeConfigParams
1543 \brief The SME API exposed for HDD to provide config params to SME during
1544 SMEs stop -> start sequence.
1545
1546 If HDD changed the domain that will cause a reset. This function will
1547 provide the new set of 11d information for the new domain. Currrently this
1548 API provides info regarding 11d only at reset but we can extend this for
1549 other params (PMC, QoS) which needs to be initialized again at reset.
1550
Srinivas Girigowdade697412013-02-14 16:31:48 -08001551 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
1553 \param hHal - The handle returned by macOpen.
1554
1555 \Param
1556 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1557 currently provides 11d related information like Country code,
1558 Regulatory domain, valid channel list, Tx power per channel, a
1559 list with active/passive scan allowed per valid channel.
1560
1561 \return eHalStatus
1562 ---------------------------------------------------------------------------*/
1563eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1564 tCsrUpdateConfigParam *pUpdateConfigParam)
1565{
1566 eHalStatus status = eHAL_STATUS_FAILURE;
1567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1568
1569 if (NULL == pUpdateConfigParam ) {
1570 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001571 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 return status;
1573 }
1574
1575 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1576
1577 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001578 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 status );
1580 }
1581
1582 return status;
1583
1584}
1585
1586/*--------------------------------------------------------------------------
1587
1588 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1589 that the NIC is ready tio run.
1590
1591 The function is called by HDD at the end of initialization stage so PE/HAL can
1592 enable the NIC to running state.
1593
Srinivas Girigowdade697412013-02-14 16:31:48 -08001594 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 \param hHal - The handle returned by macOpen.
1596
1597 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1598 successfully.
1599
1600 Other status means SME failed to send the message to PE.
1601 \sa
1602
1603 --------------------------------------------------------------------------*/
1604eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1605{
1606 tSirSmeReadyReq Msg;
1607 eHalStatus status = eHAL_STATUS_FAILURE;
1608 tPmcPowerState powerState;
1609 tPmcSwitchState hwWlanSwitchState;
1610 tPmcSwitchState swWlanSwitchState;
1611 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1612
Katya Nigambcb705f2013-12-26 14:26:22 +05301613 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001614 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 do
1616 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001617
1618 Msg.messageType = eWNI_SME_SYS_READY_IND;
1619 Msg.length = sizeof( tSirSmeReadyReq );
1620
1621 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1622 {
1623 status = eHAL_STATUS_SUCCESS;
1624 }
1625 else
1626 {
1627 smsLog( pMac, LOGE,
1628 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1629 break;
1630 }
1631
1632 status = pmcQueryPowerState( hHal, &powerState,
1633 &hwWlanSwitchState, &swWlanSwitchState );
1634 if ( ! HAL_STATUS_SUCCESS( status ) )
1635 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001636 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 status );
1638 break;
1639 }
1640
1641 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1642 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1643 {
1644 status = csrReady(pMac);
1645 if ( ! HAL_STATUS_SUCCESS( status ) )
1646 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001647 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 break;
1649 }
1650 status = pmcReady(hHal);
1651 if ( ! HAL_STATUS_SUCCESS( status ) )
1652 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001653 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 break;
1655 }
1656#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1657 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1658 {
1659 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001660 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 break;
1662 }
1663#endif
1664
1665#if defined WLAN_FEATURE_VOWIFI
1666 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1667 {
1668 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001669 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 break;
1671 }
1672#endif
1673 }
1674 pMac->sme.state = SME_STATE_READY;
1675 } while( 0 );
1676
1677 return status;
1678}
1679
1680/*--------------------------------------------------------------------------
1681
1682 \brief sme_Start() - Put all SME modules at ready state.
1683
1684 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1685 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001686 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 \param hHal - The handle returned by macOpen.
1688
1689 \return eHAL_STATUS_SUCCESS - SME is ready.
1690
1691 Other status means SME is failed to start
1692 \sa
1693
1694 --------------------------------------------------------------------------*/
1695eHalStatus sme_Start(tHalHandle hHal)
1696{
1697 eHalStatus status = eHAL_STATUS_FAILURE;
1698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1699
1700 do
1701 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 status = csrStart(pMac);
1703 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001704 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 status );
1706 break;
1707 }
1708
1709 status = pmcStart(hHal);
1710 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001711 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 status );
1713 break;
1714 }
1715
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1717 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001718 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 status );
1720 break;
1721 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 pMac->sme.state = SME_STATE_START;
1723 }while (0);
1724
1725 return status;
1726}
1727
1728
1729#ifdef WLAN_FEATURE_PACKET_FILTERING
1730/******************************************************************************
1731*
1732* Name: sme_PCFilterMatchCountResponseHandler
1733*
1734* Description:
1735* Invoke Packet Coalescing Filter Match Count callback routine
1736*
1737* Parameters:
1738* hHal - HAL handle for device
1739* pMsg - Pointer to tRcvFltPktMatchRsp structure
1740*
1741* Returns: eHalStatus
1742*
1743******************************************************************************/
1744eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1745{
1746 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1747 eHalStatus status = eHAL_STATUS_SUCCESS;
1748 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1749
1750 if (NULL == pMsg)
1751 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001752 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 status = eHAL_STATUS_FAILURE;
1754 }
1755 else
1756 {
1757 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001758 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001759
1760 /* Call Packet Coalescing Filter Match Count callback routine. */
1761 if (pMac->pmc.FilterMatchCountCB != NULL)
1762 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1763 pRcvFltPktMatchRsp);
1764
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001765 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 pRcvFltPktMatchRsp->status);
1767
1768 pMac->pmc.FilterMatchCountCB = NULL;
1769 pMac->pmc.FilterMatchCountCBContext = NULL;
1770 }
1771
1772 return(status);
1773}
1774#endif // WLAN_FEATURE_PACKET_FILTERING
1775
1776
Chet Lanctot186b5732013-03-18 10:26:30 -07001777#ifdef WLAN_FEATURE_11W
1778/*------------------------------------------------------------------
1779 *
1780 * Handle the unprotected management frame indication from LIM and
1781 * forward it to HDD.
1782 *
1783 *------------------------------------------------------------------*/
1784
1785eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1786 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1787{
1788 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1789 eHalStatus status = eHAL_STATUS_SUCCESS;
1790 tCsrRoamInfo pRoamInfo = {0};
1791 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1792
1793 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1794 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1795 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1796
1797 /* forward the mgmt frame to HDD */
1798 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1799
1800 return status;
1801}
1802#endif
1803
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001804#ifdef WLAN_FEATURE_AP_HT40_24G
1805/* ---------------------------------------------------------------------------
1806 \fn sme_HT2040CoexInfoInd
1807 \brief a Send 20/40 Coex info to SAP layer
1808
1809 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1810 \return eHalStatus
1811 ---------------------------------------------------------------------------*/
1812
1813eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1814 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1815{
1816 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1817 eHalStatus status = eHAL_STATUS_SUCCESS;
1818 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1819 tCsrRoamInfo roamInfo = {0};
1820
1821 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1822
1823 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1824 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1825 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1826
1827 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1828 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1829
1830 /* forward the 20/40 BSS Coex information to HDD */
1831 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1832 " to WLANSAP_RoamCallback "));
1833
1834 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1835 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1836 return status;
1837}
1838#endif
1839
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001840#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001841/*------------------------------------------------------------------
1842 *
1843 * Handle the tsm ie indication from LIM and forward it to HDD.
1844 *
1845 *------------------------------------------------------------------*/
1846
1847eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1848{
1849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1850 eHalStatus status = eHAL_STATUS_SUCCESS;
1851 tCsrRoamInfo pRoamInfo = {0};
1852 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1853
1854 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1855 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1856 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1857
1858 /* forward the tsm ie information to HDD */
1859 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1860
1861 return status;
1862}
1863
1864/* ---------------------------------------------------------------------------
1865 \fn sme_SetCCKMIe
1866 \brief function to store the CCKM IE passed from supplicant and use it while packing
1867 reassociation request
1868 \param hHal - HAL handle for device
1869 \param pCckmIe - pointer to CCKM IE data
1870 \param pCckmIeLen - length of the CCKM IE
1871 \- return Success or failure
1872 -------------------------------------------------------------------------*/
1873eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1874 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1875{
1876 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1877 eHalStatus status = eHAL_STATUS_SUCCESS;
1878
1879 status = sme_AcquireGlobalLock( &pMac->sme );
1880 if ( HAL_STATUS_SUCCESS( status ) )
1881 {
1882 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1883 sme_ReleaseGlobalLock( &pMac->sme );
1884 }
1885 return status;
1886}
1887
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001888/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001889 \fn sme_SetEseBeaconRequest
1890 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001891 \param hHal - HAL handle for device
1892 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001893 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001894 \- return Success or failure
1895 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001896eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1897 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001898{
1899 eHalStatus status = eSIR_SUCCESS;
1900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1901 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001902 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001903 tANI_U8 counter = 0;
1904 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1905 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1906
1907 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001908 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001909
1910 //Prepare the request to send to SME.
1911 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1912 if(NULL == pSmeBcnReportReq)
1913 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001914 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001915 return eSIR_FAILURE;
1916 }
1917
1918 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1919 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1920
1921 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1922 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1923 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1924 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001925 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1926 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001927
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001928 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001929 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001930 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001931 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1932 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1933 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1934 }
1935
1936 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1937 return status;
1938}
1939
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001940#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001941
Chet Lanctot186b5732013-03-18 10:26:30 -07001942
c_hpothu92367912014-05-01 15:18:17 +05301943/* ---------------------------------------------------------------------------
1944 \fn sme_getBcnMissRate
1945 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1946 \param hHal - HAL handle for device.
1947 \param sessionId - session ID.
1948 \- return Success or Failure.
1949 -------------------------------------------------------------------------*/
1950
1951eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1952{
1953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1954 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1955 vos_msg_t vosMessage;
1956 tSirBcnMissRateReq *pMsg;
1957 tCsrRoamSession *pSession;
1958
1959 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1960 {
1961 pSession = CSR_GET_SESSION( pMac, sessionId );
1962
1963 if (!pSession)
1964 {
1965 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1966 sme_ReleaseGlobalLock( &pMac->sme );
1967 return eHAL_STATUS_FAILURE;
1968 }
1969
c_hpothu402de812014-07-10 15:55:45 +05301970 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301971 if (NULL == pMsg)
1972 {
1973 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1974 sme_ReleaseGlobalLock( &pMac->sme );
1975 return eHAL_STATUS_FAILURE;
1976 }
1977
1978 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1979 sizeof(tSirMacAddr));
1980
1981 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1982 pMsg->callback = callback;
1983 pMsg->data = data;
1984
1985 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1986 vosMessage.bodyptr = pMsg;
1987 vosMessage.reserved = 0;
1988 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1989 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1990 {
1991 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1992 "%s: Post Set TM Level MSG fail", __func__);
1993 vos_mem_free(pMsg);
1994 sme_ReleaseGlobalLock( &pMac->sme );
1995 return eHAL_STATUS_FAILURE;
1996 }
1997 sme_ReleaseGlobalLock( &pMac->sme);
1998 return eHAL_STATUS_SUCCESS;
1999 }
2000 return eHAL_STATUS_FAILURE;
2001}
2002
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302003eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2004 tpSirEncryptedDataRspParams pEncRspParams)
2005{
2006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2007
2008 if (NULL == pMac)
2009 {
2010 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2011 "%s: pMac is null", __func__);
2012 return eHAL_STATUS_FAILURE;
2013 }
2014 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2015 {
2016 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2017 "%s: HDD callback is null", __func__);
2018 return eHAL_STATUS_FAILURE;
2019 }
2020 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2021 &pEncRspParams->encryptedDataRsp);
2022 return eHAL_STATUS_SUCCESS;
2023}
2024
Girish Gowlia95daca2015-02-04 20:31:31 +05302025eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2026 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2027{
2028 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2029 eHalStatus status = eHAL_STATUS_SUCCESS;
2030 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2031
2032 /* forward the information to HDD */
2033 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2034 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2035 pSmeUpdateMaxRateParams->maxRateFlag);
2036 return status;
2037}
2038
Jeff Johnson295189b2012-06-20 16:38:30 -07002039/*--------------------------------------------------------------------------
2040
2041 \brief sme_ProcessMsg() - The main message processor for SME.
2042
2043 The function is called by a message dispatcher when to process a message
2044 targeted for SME.
2045
Srinivas Girigowdade697412013-02-14 16:31:48 -08002046 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 \param hHal - The handle returned by macOpen.
2048 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2049
2050 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2051
2052 Other status means SME failed to process the message to HAL.
2053 \sa
2054
2055 --------------------------------------------------------------------------*/
2056eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2057{
2058 eHalStatus status = eHAL_STATUS_FAILURE;
2059 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2060
2061 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002062 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 return status;
2064 }
2065
2066 status = sme_AcquireGlobalLock( &pMac->sme );
2067 if ( HAL_STATUS_SUCCESS( status ) )
2068 {
2069 if( SME_IS_START(pMac) )
2070 {
2071 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2072 case eWNI_PMC_ENTER_BMPS_RSP:
2073 case eWNI_PMC_EXIT_BMPS_RSP:
2074 case eWNI_PMC_EXIT_BMPS_IND:
2075 case eWNI_PMC_ENTER_IMPS_RSP:
2076 case eWNI_PMC_EXIT_IMPS_RSP:
2077 case eWNI_PMC_SMPS_STATE_IND:
2078 case eWNI_PMC_ENTER_UAPSD_RSP:
2079 case eWNI_PMC_EXIT_UAPSD_RSP:
2080 case eWNI_PMC_ENTER_WOWL_RSP:
2081 case eWNI_PMC_EXIT_WOWL_RSP:
2082 //PMC
2083 if (pMsg->bodyptr)
2084 {
2085 pmcMessageProcessor(hHal, pMsg->bodyptr);
2086 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302087 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002089 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 }
2091 break;
2092
2093 case WNI_CFG_SET_CNF:
2094 case WNI_CFG_DNLD_CNF:
2095 case WNI_CFG_GET_RSP:
2096 case WNI_CFG_ADD_GRP_ADDR_CNF:
2097 case WNI_CFG_DEL_GRP_ADDR_CNF:
2098 //CCM
2099 if (pMsg->bodyptr)
2100 {
2101 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2102 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302103 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002105 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 }
2107 break;
2108
2109 case eWNI_SME_ADDTS_RSP:
2110 case eWNI_SME_DELTS_RSP:
2111 case eWNI_SME_DELTS_IND:
2112#ifdef WLAN_FEATURE_VOWIFI_11R
2113 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002114#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 //QoS
2116 if (pMsg->bodyptr)
2117 {
2118#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2119 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302120 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002121#endif
2122 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002123 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 }
2125 break;
2126#if defined WLAN_FEATURE_VOWIFI
2127 case eWNI_SME_NEIGHBOR_REPORT_IND:
2128 case eWNI_SME_BEACON_REPORT_REQ_IND:
2129#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002130 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002131#endif
2132 if ( pMsg->bodyptr )
2133 {
2134 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302135 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 }
2137 else
2138 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002139 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 }
2141 break;
2142#endif
2143
Jeff Johnsone7245742012-09-05 17:12:55 -07002144#ifdef FEATURE_OEM_DATA_SUPPORT
2145 //Handle the eWNI_SME_OEM_DATA_RSP:
2146 case eWNI_SME_OEM_DATA_RSP:
2147 if(pMsg->bodyptr)
2148 {
2149 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2150 vos_mem_free(pMsg->bodyptr);
2151 }
2152 else
2153 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002154 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002155 }
2156 smeProcessPendingQueue( pMac );
2157 break;
2158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002159
2160 case eWNI_SME_ADD_STA_SELF_RSP:
2161 if(pMsg->bodyptr)
2162 {
2163 status = csrProcessAddStaSessionRsp(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_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 }
2170 break;
2171 case eWNI_SME_DEL_STA_SELF_RSP:
2172 if(pMsg->bodyptr)
2173 {
2174 status = csrProcessDelStaSessionRsp(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_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 }
2181 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 case eWNI_SME_REMAIN_ON_CHN_RSP:
2183 if(pMsg->bodyptr)
2184 {
2185 status = sme_remainOnChnRsp(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_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192 break;
2193 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2194 if(pMsg->bodyptr)
2195 {
2196 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2197 vos_mem_free(pMsg->bodyptr);
2198 }
2199 else
2200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002201 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 -07002202 }
2203 break;
2204 case eWNI_SME_MGMT_FRM_IND:
2205 if(pMsg->bodyptr)
2206 {
2207 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2208 vos_mem_free(pMsg->bodyptr);
2209 }
2210 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002211 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002212 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002215#ifdef WLAN_FEATURE_AP_HT40_24G
2216 case eWNI_SME_2040_COEX_IND:
2217 if(pMsg->bodyptr)
2218 {
2219 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2220 vos_mem_free(pMsg->bodyptr);
2221 }
2222 else
2223 {
2224 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2225 }
2226 break;
2227#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2229 if(pMsg->bodyptr)
2230 {
2231 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2232 vos_mem_free(pMsg->bodyptr);
2233 }
2234 else
2235 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002236 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 }
2238 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 case eWNI_SME_COEX_IND:
2240 if(pMsg->bodyptr)
2241 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302242 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2243
2244 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2245 {
2246 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2247 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2248 pMac->isCoexScoIndSet = 1;
2249 }
2250 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2251 {
2252 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2253 pMac->isCoexScoIndSet = 0;
2254 sme_RequestBmps(hHal, NULL, NULL);
2255 }
2256
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2258 vos_mem_free(pMsg->bodyptr);
2259 }
2260 else
2261 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002262 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002264 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002265
2266#ifdef FEATURE_WLAN_SCAN_PNO
2267 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2268 if(pMsg->bodyptr)
2269 {
2270 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2271 vos_mem_free(pMsg->bodyptr);
2272 }
2273 else
2274 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002275 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 }
2277 break;
2278#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002279
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 case eWNI_SME_TX_PER_HIT_IND:
2281 if (pMac->sme.pTxPerHitCallback)
2282 {
2283 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2284 }
2285 break;
2286
2287 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002288 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 {
2290 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2291 vos_mem_free(pMsg->bodyptr);
2292 }
2293 else
2294 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002295 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2296 }
2297 break;
2298
2299 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2300 if (pMsg->bodyptr)
2301 {
2302 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2303 vos_mem_free(pMsg->bodyptr);
2304 }
2305 else
2306 {
2307 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 }
2309 break;
2310
2311#ifdef WLAN_FEATURE_PACKET_FILTERING
2312 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2313 if(pMsg->bodyptr)
2314 {
2315 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2316 vos_mem_free(pMsg->bodyptr);
2317 }
2318 else
2319 {
2320 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002321 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 }
2323 break;
2324#endif // WLAN_FEATURE_PACKET_FILTERING
2325 case eWNI_SME_PRE_SWITCH_CHL_IND:
2326 {
2327 status = sme_HandlePreChannelSwitchInd(pMac);
2328 break;
2329 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002330
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 case eWNI_SME_POST_SWITCH_CHL_IND:
2332 {
2333 status = sme_HandlePostChannelSwitchInd(pMac);
2334 break;
2335 }
2336
2337#ifdef WLAN_WAKEUP_EVENTS
2338 case eWNI_SME_WAKE_REASON_IND:
2339 if(pMsg->bodyptr)
2340 {
2341 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2342 vos_mem_free(pMsg->bodyptr);
2343 }
2344 else
2345 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002346 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 }
2348 break;
2349#endif // WLAN_WAKEUP_EVENTS
2350
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002351#ifdef FEATURE_WLAN_TDLS
2352 /*
2353 * command rescived from PE, SME tdls msg processor shall be called
2354 * to process commands recieved from PE
2355 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002356 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2357 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002358 case eWNI_SME_TDLS_DEL_STA_RSP:
2359 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002360 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002361 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302362 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302363 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002364#ifdef FEATURE_WLAN_TDLS_INTERNAL
2365 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2366 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2367 case eWNI_SME_TDLS_LINK_START_RSP:
2368 case eWNI_SME_TDLS_LINK_START_IND:
2369 case eWNI_SME_TDLS_TEARDOWN_RSP:
2370 case eWNI_SME_TDLS_TEARDOWN_IND:
2371 case eWNI_SME_ADD_TDLS_PEER_IND:
2372 case eWNI_SME_DELETE_TDLS_PEER_IND:
2373#endif
2374 {
2375 if (pMsg->bodyptr)
2376 {
2377 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302378 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002379 }
2380 else
2381 {
2382 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002383 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002384 }
2385 break;
2386 }
2387#endif
2388
Chet Lanctot186b5732013-03-18 10:26:30 -07002389#ifdef WLAN_FEATURE_11W
2390 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2391 if (pMsg->bodyptr)
2392 {
2393 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2394 vos_mem_free(pMsg->bodyptr);
2395 }
2396 else
2397 {
2398 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2399 }
2400 break;
2401#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002402#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002403 case eWNI_SME_TSM_IE_IND:
2404 {
2405 if (pMsg->bodyptr)
2406 {
2407 sme_TsmIeInd(pMac, pMsg->bodyptr);
2408 vos_mem_free(pMsg->bodyptr);
2409 }
2410 else
2411 {
2412 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2413 }
2414 break;
2415 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002416#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002417#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2418 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2419 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2420 break;
2421#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002422
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302423#ifdef WLAN_FEATURE_GTK_OFFLOAD
2424 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2425 if (pMsg->bodyptr)
2426 {
2427 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302428 vos_mem_zero(pMsg->bodyptr,
2429 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302430 vos_mem_free(pMsg->bodyptr);
2431 }
2432 else
2433 {
2434 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2435 }
2436 break ;
2437#endif
Leo Chang9056f462013-08-01 19:21:11 -07002438
2439#ifdef FEATURE_WLAN_LPHB
2440 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002441 case eWNI_SME_LPHB_IND:
2442 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002443 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002444 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002445 }
2446 vos_mem_free(pMsg->bodyptr);
2447
2448 break;
2449#endif /* FEATURE_WLAN_LPHB */
2450
Leo Chang0b0e45a2013-12-15 15:18:55 -08002451#ifdef FEATURE_WLAN_CH_AVOID
2452 /* LPHB timeout indication arrived, send IND to client */
2453 case eWNI_SME_CH_AVOID_IND:
2454 if (pMac->sme.pChAvoidNotificationCb)
2455 {
2456 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2457 "%s: CH avoid notification", __func__);
2458 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2459 }
2460 vos_mem_free(pMsg->bodyptr);
2461
2462 break;
2463#endif /* FEATURE_WLAN_CH_AVOID */
2464
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302465 case eWNI_SME_ENCRYPT_MSG_RSP:
2466 if (pMsg->bodyptr)
2467 {
2468 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2469 vos_mem_free(pMsg->bodyptr);
2470 }
2471 else
2472 {
2473 smsLog(pMac, LOGE,
2474 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2475 " nothing to process");
2476 }
2477 break ;
2478
Girish Gowlia95daca2015-02-04 20:31:31 +05302479 case eWNI_SME_UPDATE_MAX_RATE_IND:
2480 if (pMsg->bodyptr)
2481 {
2482 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2483 vos_mem_free(pMsg->bodyptr);
2484 }
2485 else
2486 {
2487 smsLog(pMac, LOGE,
2488 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2489 " nothing to process");
2490 }
2491 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302492
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 default:
2494
2495 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2496 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2497 {
2498 //CSR
2499 if (pMsg->bodyptr)
2500 {
2501 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302502 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 }
2504 else
2505 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002506 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 }
2508 }
2509 else
2510 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002511 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 pMsg->type);
2513 if (pMsg->bodyptr)
2514 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302515 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 }
2517 }
2518 }//switch
2519 } //SME_IS_START
2520 else
2521 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002522 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 if (pMsg->bodyptr)
2524 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302525 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 }
2527 }
2528 sme_ReleaseGlobalLock( &pMac->sme );
2529 }
2530 else
2531 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002532 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002533 if (pMsg->bodyptr)
2534 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302535 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 }
2537 }
2538
2539 return status;
2540}
2541
2542
2543//No need to hold the global lock here because this function can only be called
2544//after sme_Stop.
2545v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2546{
2547 if( pMsg )
2548 {
2549 if (pMsg->bodyptr)
2550 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302551 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 }
2553 }
2554
2555}
2556
2557
2558/*--------------------------------------------------------------------------
2559
2560 \brief sme_Stop() - Stop all SME modules and put them at idle state
2561
2562 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2563 return, all modules are at idle state ready to start.
2564
Srinivas Girigowdade697412013-02-14 16:31:48 -08002565 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002566 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302567 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002568
2569 \return eHAL_STATUS_SUCCESS - SME is stopped.
2570
2571 Other status means SME is failed to stop but caller should still
2572 consider SME is stopped.
2573 \sa
2574
2575 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302576eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002577{
2578 eHalStatus status = eHAL_STATUS_FAILURE;
2579 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2581
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2583 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002584 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 status );
2586 fail_status = status;
2587 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002588
2589 p2pStop(hHal);
2590
Kiet Lama72a2322013-11-15 11:18:11 +05302591 status = pmcStop(hHal);
2592 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2593 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2594 status );
2595 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 }
2597
Kiet Lama72a2322013-11-15 11:18:11 +05302598 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002600 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002601 status );
2602 fail_status = status;
2603 }
2604
2605 ccmStop(hHal);
2606
2607 purgeSmeCmdList(pMac);
2608
2609 if (!HAL_STATUS_SUCCESS( fail_status )) {
2610 status = fail_status;
2611 }
2612
2613 pMac->sme.state = SME_STATE_STOP;
2614
2615 return status;
2616}
2617
2618/*--------------------------------------------------------------------------
2619
2620 \brief sme_Close() - Release all SME modules and their resources.
2621
2622 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2623 return, all modules are at closed state.
2624
2625 No SME APIs can be involved after smeClose except smeOpen.
2626 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002627 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 \param hHal - The handle returned by macOpen
2629
2630 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2631
2632 Other status means SME is failed to be closed but caller still cannot
2633 call any other SME functions except smeOpen.
2634 \sa
2635
2636 --------------------------------------------------------------------------*/
2637eHalStatus sme_Close(tHalHandle hHal)
2638{
2639 eHalStatus status = eHAL_STATUS_FAILURE;
2640 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2642
2643 status = csrClose(pMac);
2644 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002645 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002646 status );
2647 fail_status = status;
2648 }
2649
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2651 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002652 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 status );
2654 fail_status = status;
2655 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002656
2657#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2658 status = btcClose(hHal);
2659 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002660 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 status );
2662 fail_status = status;
2663 }
2664
2665 status = sme_QosClose(pMac);
2666 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002667 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002668 status );
2669 fail_status = status;
2670 }
2671#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002672#ifdef FEATURE_OEM_DATA_SUPPORT
2673 status = oemData_OemDataReqClose(hHal);
2674 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002675 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002676 status );
2677 fail_status = status;
2678 }
2679#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002680
2681 status = ccmClose(hHal);
2682 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002683 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 status );
2685 fail_status = status;
2686 }
2687
2688 status = pmcClose(hHal);
2689 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002690 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 status );
2692 fail_status = status;
2693 }
2694#if defined WLAN_FEATURE_VOWIFI
2695 status = rrmClose(hHal);
2696 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002697 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 status );
2699 fail_status = status;
2700 }
2701#endif
2702
2703#if defined WLAN_FEATURE_VOWIFI_11R
2704 sme_FTClose(hHal);
2705#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002707
2708 freeSmeCmdList(pMac);
2709
2710 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2711 {
2712 fail_status = eHAL_STATUS_FAILURE;
2713 }
2714
2715 if (!HAL_STATUS_SUCCESS( fail_status )) {
2716 status = fail_status;
2717 }
2718
2719 pMac->sme.state = SME_STATE_STOP;
2720
2721 return status;
2722}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002723#ifdef FEATURE_WLAN_LFR
2724tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2725{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002726#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002727 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2728 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2729 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2730 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2731 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2732 return eANI_BOOLEAN_FALSE;
2733 default:
2734 return eANI_BOOLEAN_TRUE;
2735 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002736#else
2737 /*
2738 * TODO: always return TRUE for now until
2739 * we figure out why we could be stuck in
2740 * one of the roaming states forever.
2741 */
2742 return eANI_BOOLEAN_TRUE;
2743#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002744}
2745#endif
c_hpothu58901462014-11-01 16:44:34 +05302746
2747/* ---------------------------------------------------------------------------
2748 \fn sco_isScanAllowed
2749 \brief check for scan interface connection status
2750 \param pMac - Pointer to the global MAC parameter structure
2751 \param pScanReq - scan request structure.
2752
2753 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2754 ---------------------------------------------------------------------------*/
2755tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2756{
2757 tANI_BOOLEAN ret;
2758
2759 if (pscanReq->p2pSearch)
2760 ret = csrIsP2pSessionConnected(pMac);
2761 else
2762 ret = csrIsStaSessionConnected(pMac);
2763
2764 return !ret;
2765}
2766
Jeff Johnson295189b2012-06-20 16:38:30 -07002767/* ---------------------------------------------------------------------------
2768 \fn sme_ScanRequest
2769 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002770 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 \param pScanRequestID - pointer to an object to get back the request ID
2772 \param callback - a callback function that scan calls upon finish, will not
2773 be called if csrScanRequest returns error
2774 \param pContext - a pointer passed in for the callback
2775 \return eHalStatus
2776 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002777eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2778 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 csrScanCompleteCallback callback, void *pContext)
2780{
2781 eHalStatus status = eHAL_STATUS_FAILURE;
2782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302783 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002784 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 smsLog(pMac, LOG2, FL("enter"));
2786 do
2787 {
c_hpothu304c0522014-09-30 10:22:57 +05302788 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302789 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 {
2791 status = sme_AcquireGlobalLock( &pMac->sme );
2792 if ( HAL_STATUS_SUCCESS( status ) )
2793 {
2794 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002795#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002796 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002797 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002798#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002799 status = csrScanRequest( hHal, sessionId, pscanReq,
2800 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302801 if ( !HAL_STATUS_SUCCESS( status ) )
2802 {
2803 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2804 " SId=%d"), sessionId);
2805 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002806#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002807 }
2808 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002809 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302810 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302811 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302812 macTraceGetNeighbourRoamState(
2813 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302814 macTraceGetcsrRoamSubState(
2815 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002816 /*HandOff is in progress. So schedule this scan later*/
2817 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002818 }
2819#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002821
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 sme_ReleaseGlobalLock( &pMac->sme );
2823 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002824 else
2825 {
2826 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2827 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002828 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002829 else
2830 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302831 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2832 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05302833 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002834 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 } while( 0 );
2836
2837 return (status);
2838
2839
2840}
2841
2842/* ---------------------------------------------------------------------------
2843 \fn sme_ScanGetResult
2844 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002845 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 \param pFilter - If pFilter is NULL, all cached results are returned
2847 \param phResult - an object for the result.
2848 \return eHalStatus
2849 ---------------------------------------------------------------------------*/
2850eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2851 tScanResultHandle *phResult)
2852{
2853 eHalStatus status = eHAL_STATUS_FAILURE;
2854 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2855
Katya Nigambcb705f2013-12-26 14:26:22 +05302856 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002857 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 smsLog(pMac, LOG2, FL("enter"));
2859 status = sme_AcquireGlobalLock( &pMac->sme );
2860 if ( HAL_STATUS_SUCCESS( status ) )
2861 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002862 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002863 sme_ReleaseGlobalLock( &pMac->sme );
2864 }
2865 smsLog(pMac, LOG2, FL("exit status %d"), status);
2866
2867 return (status);
2868}
2869
2870
2871/* ---------------------------------------------------------------------------
2872 \fn sme_ScanFlushResult
2873 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002874 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 \return eHalStatus
2876 ---------------------------------------------------------------------------*/
2877eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2878{
2879 eHalStatus status = eHAL_STATUS_FAILURE;
2880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2881
Katya Nigambcb705f2013-12-26 14:26:22 +05302882 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002883 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 status = sme_AcquireGlobalLock( &pMac->sme );
2885 if ( HAL_STATUS_SUCCESS( status ) )
2886 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002887 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 sme_ReleaseGlobalLock( &pMac->sme );
2889 }
2890
2891 return (status);
2892}
2893
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302894/* ---------------------------------------------------------------------------
2895 \fn sme_FilterScanResults
2896 \brief a wrapper function to request CSR to clear scan results.
2897 This is a synchronous call
2898 \return eHalStatus
2899 ---------------------------------------------------------------------------*/
2900eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2901{
2902 eHalStatus status = eHAL_STATUS_SUCCESS;
2903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2904
2905 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2906 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2907 status = sme_AcquireGlobalLock( &pMac->sme );
2908 if ( HAL_STATUS_SUCCESS( status ) )
2909 {
2910 csrScanFilterResults(pMac);
2911 sme_ReleaseGlobalLock( &pMac->sme );
2912 }
2913
2914 return (status);
2915}
2916
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002917eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2918{
2919 eHalStatus status = eHAL_STATUS_FAILURE;
2920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2921
Katya Nigambcb705f2013-12-26 14:26:22 +05302922 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002923 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002924 status = sme_AcquireGlobalLock( &pMac->sme );
2925 if ( HAL_STATUS_SUCCESS( status ) )
2926 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302927 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002928 sme_ReleaseGlobalLock( &pMac->sme );
2929 }
2930
2931 return (status);
2932}
Jeff Johnson295189b2012-06-20 16:38:30 -07002933
2934/* ---------------------------------------------------------------------------
2935 \fn sme_ScanResultGetFirst
2936 \brief a wrapper function to request CSR to returns the first element of
2937 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002938 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 \param hScanResult - returned from csrScanGetResult
2940 \return tCsrScanResultInfo * - NULL if no result
2941 ---------------------------------------------------------------------------*/
2942tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2943 tScanResultHandle hScanResult)
2944{
2945 eHalStatus status = eHAL_STATUS_FAILURE;
2946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2947 tCsrScanResultInfo *pRet = NULL;
2948
Katya Nigambcb705f2013-12-26 14:26:22 +05302949 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002950 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002951 status = sme_AcquireGlobalLock( &pMac->sme );
2952 if ( HAL_STATUS_SUCCESS( status ) )
2953 {
2954 pRet = csrScanResultGetFirst( pMac, hScanResult );
2955 sme_ReleaseGlobalLock( &pMac->sme );
2956 }
2957
2958 return (pRet);
2959}
2960
2961
2962/* ---------------------------------------------------------------------------
2963 \fn sme_ScanResultGetNext
2964 \brief a wrapper function to request CSR to returns the next element of
2965 scan result. It can be called without calling csrScanResultGetFirst
2966 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002967 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002968 \param hScanResult - returned from csrScanGetResult
2969 \return Null if no result or reach the end
2970 ---------------------------------------------------------------------------*/
2971tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2972 tScanResultHandle hScanResult)
2973{
2974 eHalStatus status = eHAL_STATUS_FAILURE;
2975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2976 tCsrScanResultInfo *pRet = NULL;
2977
Katya Nigambcb705f2013-12-26 14:26:22 +05302978 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002979 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 status = sme_AcquireGlobalLock( &pMac->sme );
2981 if ( HAL_STATUS_SUCCESS( status ) )
2982 {
2983 pRet = csrScanResultGetNext( pMac, hScanResult );
2984 sme_ReleaseGlobalLock( &pMac->sme );
2985 }
2986
2987 return (pRet);
2988}
2989
2990
2991/* ---------------------------------------------------------------------------
2992 \fn sme_ScanSetBGScanparams
2993 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002994 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 \param pScanReq - BG scan request structure
2996 \return eHalStatus
2997 ---------------------------------------------------------------------------*/
2998eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2999{
3000 eHalStatus status = eHAL_STATUS_FAILURE;
3001 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3002
3003 if( NULL != pScanReq )
3004 {
3005 status = sme_AcquireGlobalLock( &pMac->sme );
3006 if ( HAL_STATUS_SUCCESS( status ) )
3007 {
3008 status = csrScanSetBGScanparams( hHal, pScanReq );
3009 sme_ReleaseGlobalLock( &pMac->sme );
3010 }
3011 }
3012
3013 return (status);
3014}
3015
3016
3017/* ---------------------------------------------------------------------------
3018 \fn sme_ScanResultPurge
3019 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3020 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003021 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 \param hScanResult - returned from csrScanGetResult. hScanResult is
3023 considered gone by
3024 calling this function and even before this function reutrns.
3025 \return eHalStatus
3026 ---------------------------------------------------------------------------*/
3027eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3028{
3029 eHalStatus status = eHAL_STATUS_FAILURE;
3030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3031
Katya Nigambcb705f2013-12-26 14:26:22 +05303032 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003033 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 status = sme_AcquireGlobalLock( &pMac->sme );
3035 if ( HAL_STATUS_SUCCESS( status ) )
3036 {
3037 status = csrScanResultPurge( hHal, hScanResult );
3038 sme_ReleaseGlobalLock( &pMac->sme );
3039 }
3040
3041 return (status);
3042}
3043
3044/* ---------------------------------------------------------------------------
3045 \fn sme_ScanGetPMKIDCandidateList
3046 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003047 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003048 \param pPmkidList - caller allocated buffer point to an array of
3049 tPmkidCandidateInfo
3050 \param pNumItems - pointer to a variable that has the number of
3051 tPmkidCandidateInfo allocated when retruning, this is
3052 either the number needed or number of items put into
3053 pPmkidList
3054 \return eHalStatus - when fail, it usually means the buffer allocated is not
3055 big enough and pNumItems
3056 has the number of tPmkidCandidateInfo.
3057 \Note: pNumItems is a number of tPmkidCandidateInfo,
3058 not sizeof(tPmkidCandidateInfo) * something
3059 ---------------------------------------------------------------------------*/
3060eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003061 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 tANI_U32 *pNumItems )
3063{
3064 eHalStatus status = eHAL_STATUS_FAILURE;
3065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3066
3067 status = sme_AcquireGlobalLock( &pMac->sme );
3068 if ( HAL_STATUS_SUCCESS( status ) )
3069 {
3070 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3071 sme_ReleaseGlobalLock( &pMac->sme );
3072 }
3073
3074 return (status);
3075}
3076
3077/*----------------------------------------------------------------------------
3078 \fn sme_RoamRegisterLinkQualityIndCallback
3079
3080 \brief
3081 a wrapper function to allow HDD to register a callback handler with CSR for
3082 link quality indications.
3083
3084 Only one callback may be registered at any time.
3085 In order to deregister the callback, a NULL cback may be provided.
3086
3087 Registration happens in the task context of the caller.
3088
3089 \param callback - Call back being registered
3090 \param pContext - user data
3091
3092 DEPENDENCIES: After CSR open
3093
3094 \return eHalStatus
3095-----------------------------------------------------------------------------*/
3096eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3097 csrRoamLinkQualityIndCallback callback,
3098 void *pContext)
3099{
3100 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3101}
3102
3103/* ---------------------------------------------------------------------------
3104 \fn sme_RoamRegisterCallback
3105 \brief a wrapper function to allow HDD to register a callback with CSR.
3106 Unlike scan, roam has one callback for all the roam requests
3107 \param callback - a callback function that roam calls upon when state changes
3108 \param pContext - a pointer passed in for the callback
3109 \return eHalStatus
3110 ---------------------------------------------------------------------------*/
3111eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3112 csrRoamCompleteCallback callback,
3113 void *pContext)
3114{
3115 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3116}
3117
3118eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3119{
3120 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3121 return pMac->roam.configParam.phyMode;
3122}
3123
3124/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303125 \fn sme_GetChannelBondingMode5G
3126 \brief get the channel bonding mode for 5G band
3127 \param hHal - HAL handle
3128 \return channel bonding mode for 5G
3129 ---------------------------------------------------------------------------*/
3130tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3131{
3132 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3133 tSmeConfigParams smeConfig;
3134
3135 sme_GetConfigParam(pMac, &smeConfig);
3136
3137 return smeConfig.csrConfig.channelBondingMode5GHz;
3138}
3139
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303140#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303141/* ---------------------------------------------------------------------------
3142 \fn sme_GetChannelBondingMode24G
3143 \brief get the channel bonding mode for 2.4G band
3144 \param hHal - HAL handle
3145 \return channel bonding mode for 2.4G
3146 ---------------------------------------------------------------------------*/
3147tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3148{
3149 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3150 tSmeConfigParams smeConfig;
3151
3152 sme_GetConfigParam(pMac, &smeConfig);
3153
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303154 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303155}
3156
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303157/* ---------------------------------------------------------------------------
3158 \fn sme_UpdateChannelBondingMode24G
3159 \brief update the channel bonding mode for 2.4G band
3160 \param hHal - HAL handle
3161 \param cbMode - channel bonding mode
3162 \return
3163 ---------------------------------------------------------------------------*/
3164void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3165{
3166 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3167 tSmeConfigParams smeConfig;
3168
3169 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3170 sme_GetConfigParam(pMac, &smeConfig);
3171 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3172 FL("Previous Channel Bonding : = %d"),
3173 smeConfig.csrConfig.channelBondingAPMode24GHz);
3174
3175 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3176 sme_UpdateConfig(hHal, &smeConfig);
3177 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3178 FL("New Channel Bonding : = %d"),
3179 sme_GetChannelBondingMode24G(hHal));
3180 return;
3181}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303182
3183/* ---------------------------------------------------------------------------
3184
3185 \fn sme_SetHT2040Mode
3186
3187 \brief To update HT Operation beacon IE & Channel Bonding.
3188
3189 \param
3190
3191 \return eHalStatus SUCCESS
3192 FAILURE or RESOURCES
3193 The API finished and failed.
3194
3195 -------------------------------------------------------------------------------*/
3196eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3197{
3198 eHalStatus status = eHAL_STATUS_FAILURE;
3199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3200
3201 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3202 FL("Channel Bonding =%d"),
3203 cbMode);
3204
3205 status = sme_AcquireGlobalLock(&pMac->sme);
3206 if (HAL_STATUS_SUCCESS(status))
3207 {
3208 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3209 sme_ReleaseGlobalLock(&pMac->sme );
3210 }
3211 return (status);
3212}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303213#endif
Peng Xu117eab42014-09-25 13:33:27 +05303214
3215/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 \fn sme_RoamConnect
3217 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003218 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 \param sessionId - the sessionId returned by sme_OpenSession.
3220 \param pProfile - description of the network to which to connect
3221 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3222 from csrScanGetResult
3223 \param pRoamId - to get back the request ID
3224 \return eHalStatus
3225 ---------------------------------------------------------------------------*/
3226eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3227 tANI_U32 *pRoamId)
3228{
3229 eHalStatus status = eHAL_STATUS_FAILURE;
3230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3231
Yue Mae36e3552014-03-05 17:06:20 -08003232 if (!pMac)
3233 {
3234 return eHAL_STATUS_FAILURE;
3235 }
3236
Katya Nigambcb705f2013-12-26 14:26:22 +05303237 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003238 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 smsLog(pMac, LOG2, FL("enter"));
3240 status = sme_AcquireGlobalLock( &pMac->sme );
3241 if ( HAL_STATUS_SUCCESS( status ) )
3242 {
3243 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3244 {
3245 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3246 }
3247 else
3248 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003249 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 status = eHAL_STATUS_INVALID_PARAMETER;
3251 }
3252 sme_ReleaseGlobalLock( &pMac->sme );
3253 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003254 else
3255 {
3256 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3257 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003258
3259 return (status);
3260}
3261
3262/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303263
3264 \fn sme_SetPhyMode
3265
3266 \brief Changes the PhyMode.
3267
3268 \param hHal - The handle returned by macOpen.
3269
3270 \param phyMode new phyMode which is to set
3271
3272 \return eHalStatus SUCCESS.
3273
3274 -------------------------------------------------------------------------------*/
3275eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3276{
3277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3278
3279 if (NULL == pMac)
3280 {
3281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3282 "%s: invalid context", __func__);
3283 return eHAL_STATUS_FAILURE;
3284 }
3285
3286 pMac->roam.configParam.phyMode = phyMode;
3287 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3288 pMac->roam.configParam.phyMode,
3289 pMac->roam.configParam.ProprietaryRatesEnabled);
3290
3291 return eHAL_STATUS_SUCCESS;
3292}
3293
3294/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 \fn sme_RoamReassoc
3296 \brief a wrapper function to request CSR to inititiate a re-association
3297 \param pProfile - can be NULL to join the currently connected AP. In that
3298 case modProfileFields should carry the modified field(s) which could trigger
3299 reassoc
3300 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3301 that might need modification dynamically once STA is up & running and this
3302 could trigger a reassoc
3303 \param pRoamId - to get back the request ID
3304 \return eHalStatus
3305 -------------------------------------------------------------------------------*/
3306eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3307 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003308 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003309{
3310 eHalStatus status = eHAL_STATUS_FAILURE;
3311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3312
Katya Nigambcb705f2013-12-26 14:26:22 +05303313 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003314 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 smsLog(pMac, LOG2, FL("enter"));
3316 status = sme_AcquireGlobalLock( &pMac->sme );
3317 if ( HAL_STATUS_SUCCESS( status ) )
3318 {
3319 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3320 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003321 if((NULL == pProfile) && (fForce == 1))
3322 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003323 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3324 /* to force the AP initiate fresh 802.1x authentication need to clear
3325 * the PMKID cache for that set the following boolean. this is needed
3326 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3327 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003328 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3329 }
3330 else
3331 {
3332 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003333 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 }
3335 else
3336 {
3337 status = eHAL_STATUS_INVALID_PARAMETER;
3338 }
3339 sme_ReleaseGlobalLock( &pMac->sme );
3340 }
3341
3342 return (status);
3343}
3344
3345/* ---------------------------------------------------------------------------
3346 \fn sme_RoamConnectToLastProfile
3347 \brief a wrapper function to request CSR to disconnect and reconnect with
3348 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003349 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 \return eHalStatus. It returns fail if currently connected
3351 ---------------------------------------------------------------------------*/
3352eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3353{
3354 eHalStatus status = eHAL_STATUS_FAILURE;
3355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3356
3357 status = sme_AcquireGlobalLock( &pMac->sme );
3358 if ( HAL_STATUS_SUCCESS( status ) )
3359 {
3360 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3361 {
3362 status = csrRoamConnectToLastProfile( pMac, sessionId );
3363 }
3364 else
3365 {
3366 status = eHAL_STATUS_INVALID_PARAMETER;
3367 }
3368 sme_ReleaseGlobalLock( &pMac->sme );
3369 }
3370
3371 return (status);
3372}
3373
3374/* ---------------------------------------------------------------------------
3375 \fn sme_RoamDisconnect
3376 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003377 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 \param reason -- To indicate the reason for disconnecting. Currently, only
3379 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3380 \return eHalStatus
3381 ---------------------------------------------------------------------------*/
3382eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3383{
3384 eHalStatus status = eHAL_STATUS_FAILURE;
3385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3386
Katya Nigambcb705f2013-12-26 14:26:22 +05303387 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003388 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 smsLog(pMac, LOG2, FL("enter"));
3390 status = sme_AcquireGlobalLock( &pMac->sme );
3391 if ( HAL_STATUS_SUCCESS( status ) )
3392 {
3393 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3394 {
3395 status = csrRoamDisconnect( pMac, sessionId, reason );
3396 }
3397 else
3398 {
3399 status = eHAL_STATUS_INVALID_PARAMETER;
3400 }
3401 sme_ReleaseGlobalLock( &pMac->sme );
3402 }
3403
3404 return (status);
3405}
3406
Jeff Johnson295189b2012-06-20 16:38:30 -07003407/* ---------------------------------------------------------------------------
3408 \fn sme_RoamStopBss
3409 \brief To stop BSS for Soft AP. This is an asynchronous API.
3410 \param hHal - Global structure
3411 \param sessionId - sessionId of SoftAP
3412 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3413 -------------------------------------------------------------------------------*/
3414eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3415{
3416 eHalStatus status = eHAL_STATUS_FAILURE;
3417 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3418
3419 smsLog(pMac, LOG2, FL("enter"));
3420 status = sme_AcquireGlobalLock( &pMac->sme );
3421 if ( HAL_STATUS_SUCCESS( status ) )
3422 {
3423 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3424 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303425 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 }
3427 else
3428 {
3429 status = eHAL_STATUS_INVALID_PARAMETER;
3430 }
3431 sme_ReleaseGlobalLock( &pMac->sme );
3432 }
3433
3434 return (status);
3435}
3436
3437/* ---------------------------------------------------------------------------
3438 \fn sme_RoamDisconnectSta
3439 \brief To disassociate a station. This is an asynchronous API.
3440 \param hHal - Global structure
3441 \param sessionId - sessionId of SoftAP
3442 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3443 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3444 -------------------------------------------------------------------------------*/
3445eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3446 tANI_U8 *pPeerMacAddr)
3447{
3448 eHalStatus status = eHAL_STATUS_FAILURE;
3449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3450
3451 if ( NULL == pMac )
3452 {
3453 VOS_ASSERT(0);
3454 return status;
3455 }
3456
3457 status = sme_AcquireGlobalLock( &pMac->sme );
3458 if ( HAL_STATUS_SUCCESS( status ) )
3459 {
3460 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3461 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003462 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303463 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 }
3465 else
3466 {
3467 status = eHAL_STATUS_INVALID_PARAMETER;
3468 }
3469 sme_ReleaseGlobalLock( &pMac->sme );
3470 }
3471
3472 return (status);
3473}
3474
3475/* ---------------------------------------------------------------------------
3476 \fn sme_RoamDeauthSta
3477 \brief To disassociate a station. This is an asynchronous API.
3478 \param hHal - Global structure
3479 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303480 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3482 -------------------------------------------------------------------------------*/
3483eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303484 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003485{
3486 eHalStatus status = eHAL_STATUS_FAILURE;
3487 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3488
3489 if ( NULL == pMac )
3490 {
3491 VOS_ASSERT(0);
3492 return status;
3493 }
3494
3495 status = sme_AcquireGlobalLock( &pMac->sme );
3496 if ( HAL_STATUS_SUCCESS( status ) )
3497 {
3498 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3499 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303500 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 }
3502 else
3503 {
3504 status = eHAL_STATUS_INVALID_PARAMETER;
3505 }
3506 sme_ReleaseGlobalLock( &pMac->sme );
3507 }
3508
3509 return (status);
3510}
3511
3512/* ---------------------------------------------------------------------------
3513 \fn sme_RoamTKIPCounterMeasures
3514 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3515 \param sessionId - sessionId of SoftAP
3516 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3517 \return eHalStatus
3518 -------------------------------------------------------------------------------*/
3519eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3520 tANI_BOOLEAN bEnable)
3521{
3522 eHalStatus status = eHAL_STATUS_FAILURE;
3523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3524
3525 if ( NULL == pMac )
3526 {
3527 VOS_ASSERT(0);
3528 return status;
3529 }
3530
3531 status = sme_AcquireGlobalLock( &pMac->sme );
3532 if ( HAL_STATUS_SUCCESS( status ) )
3533 {
3534 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3535 {
3536 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3537 }
3538 else
3539 {
3540 status = eHAL_STATUS_INVALID_PARAMETER;
3541 }
3542 sme_ReleaseGlobalLock( &pMac->sme );
3543 }
3544
3545 return (status);
3546}
3547
3548/* ---------------------------------------------------------------------------
3549 \fn sme_RoamGetAssociatedStas
3550 \brief To probe the list of associated stations from various modules of CORE stack.
3551 \This is an asynchronous API.
3552 \param sessionId - sessionId of SoftAP
3553 \param modId - Module from whom list of associtated stations is to be probed.
3554 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3555 \param pUsrContext - Opaque HDD context
3556 \param pfnSapEventCallback - Sap event callback in HDD
3557 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3558 \return eHalStatus
3559 -------------------------------------------------------------------------------*/
3560eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3561 VOS_MODULE_ID modId, void *pUsrContext,
3562 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3563{
3564 eHalStatus status = eHAL_STATUS_FAILURE;
3565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3566
3567 if ( NULL == pMac )
3568 {
3569 VOS_ASSERT(0);
3570 return status;
3571 }
3572
3573 status = sme_AcquireGlobalLock( &pMac->sme );
3574 if ( HAL_STATUS_SUCCESS( status ) )
3575 {
3576 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3577 {
3578 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3579 }
3580 else
3581 {
3582 status = eHAL_STATUS_INVALID_PARAMETER;
3583 }
3584 sme_ReleaseGlobalLock( &pMac->sme );
3585 }
3586
3587 return (status);
3588}
3589
3590/* ---------------------------------------------------------------------------
3591 \fn sme_RoamGetWpsSessionOverlap
3592 \brief To get the WPS PBC session overlap information.
3593 \This is an asynchronous API.
3594 \param sessionId - sessionId of SoftAP
3595 \param pUsrContext - Opaque HDD context
3596 \param pfnSapEventCallback - Sap event callback in HDD
3597 \pRemoveMac - pointer to Mac address which needs to be removed from session
3598 \return eHalStatus
3599 -------------------------------------------------------------------------------*/
3600eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003601 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003602 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3603{
3604 eHalStatus status = eHAL_STATUS_FAILURE;
3605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3606
3607 if ( NULL == pMac )
3608 {
3609 VOS_ASSERT(0);
3610 return status;
3611 }
3612
3613 status = sme_AcquireGlobalLock( &pMac->sme );
3614 if ( HAL_STATUS_SUCCESS( status ) )
3615 {
3616 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3617 {
3618 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3619 }
3620 else
3621 {
3622 status = eHAL_STATUS_INVALID_PARAMETER;
3623 }
3624 sme_ReleaseGlobalLock( &pMac->sme );
3625 }
3626
3627 return (status);
3628}
3629
Jeff Johnson295189b2012-06-20 16:38:30 -07003630
3631/* ---------------------------------------------------------------------------
3632 \fn sme_RoamGetConnectState
3633 \brief a wrapper function to request CSR to return the current connect state
3634 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003635 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003636 \return eHalStatus
3637 ---------------------------------------------------------------------------*/
3638eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3639{
3640 eHalStatus status = eHAL_STATUS_FAILURE;
3641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3642
3643 status = sme_AcquireGlobalLock( &pMac->sme );
3644 if ( HAL_STATUS_SUCCESS( status ) )
3645 {
3646 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3647 {
3648 status = csrRoamGetConnectState( pMac, sessionId, pState );
3649 }
3650 else
3651 {
3652 status = eHAL_STATUS_INVALID_PARAMETER;
3653 }
3654 sme_ReleaseGlobalLock( &pMac->sme );
3655 }
3656
3657 return (status);
3658}
3659
3660/* ---------------------------------------------------------------------------
3661 \fn sme_RoamGetConnectProfile
3662 \brief a wrapper function to request CSR to return the current connect
3663 profile. Caller must call csrRoamFreeConnectProfile after it is done
3664 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003665 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 \param pProfile - pointer to a caller allocated structure
3667 tCsrRoamConnectedProfile
3668 \return eHalStatus. Failure if not connected
3669 ---------------------------------------------------------------------------*/
3670eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3671 tCsrRoamConnectedProfile *pProfile)
3672{
3673 eHalStatus status = eHAL_STATUS_FAILURE;
3674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3675
Katya Nigambcb705f2013-12-26 14:26:22 +05303676 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003677 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 status = sme_AcquireGlobalLock( &pMac->sme );
3679 if ( HAL_STATUS_SUCCESS( status ) )
3680 {
3681 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3682 {
3683 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3684 }
3685 else
3686 {
3687 status = eHAL_STATUS_INVALID_PARAMETER;
3688 }
3689 sme_ReleaseGlobalLock( &pMac->sme );
3690 }
3691
3692 return (status);
3693}
3694
3695/* ---------------------------------------------------------------------------
3696 \fn sme_RoamFreeConnectProfile
3697 \brief a wrapper function to request CSR to free and reinitialize the
3698 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003699 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 \param pProfile - pointer to a caller allocated structure
3701 tCsrRoamConnectedProfile
3702 \return eHalStatus.
3703 ---------------------------------------------------------------------------*/
3704eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3705 tCsrRoamConnectedProfile *pProfile)
3706{
3707 eHalStatus status = eHAL_STATUS_FAILURE;
3708 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3709
Katya Nigambcb705f2013-12-26 14:26:22 +05303710 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003711 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 status = sme_AcquireGlobalLock( &pMac->sme );
3713 if ( HAL_STATUS_SUCCESS( status ) )
3714 {
3715 status = csrRoamFreeConnectProfile( pMac, pProfile );
3716 sme_ReleaseGlobalLock( &pMac->sme );
3717 }
3718
3719 return (status);
3720}
3721
3722/* ---------------------------------------------------------------------------
3723 \fn sme_RoamSetPMKIDCache
3724 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003725 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 \param pPMKIDCache - caller allocated buffer point to an array of
3727 tPmkidCacheInfo
3728 \param numItems - a variable that has the number of tPmkidCacheInfo
3729 allocated when retruning, this is either the number needed
3730 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303731 \param update_entire_cache - this bool value specifies if the entire pmkid
3732 cache should be overwritten or should it be
3733 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 \return eHalStatus - when fail, it usually means the buffer allocated is not
3735 big enough and pNumItems has the number of
3736 tPmkidCacheInfo.
3737 \Note: pNumItems is a number of tPmkidCacheInfo,
3738 not sizeof(tPmkidCacheInfo) * something
3739 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303740eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3741 tPmkidCacheInfo *pPMKIDCache,
3742 tANI_U32 numItems,
3743 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003744{
3745 eHalStatus status = eHAL_STATUS_FAILURE;
3746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3747
Katya Nigambcb705f2013-12-26 14:26:22 +05303748 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003749 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 status = sme_AcquireGlobalLock( &pMac->sme );
3751 if ( HAL_STATUS_SUCCESS( status ) )
3752 {
3753 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3754 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303755 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3756 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 }
3758 else
3759 {
3760 status = eHAL_STATUS_INVALID_PARAMETER;
3761 }
3762 sme_ReleaseGlobalLock( &pMac->sme );
3763 }
3764
3765 return (status);
3766}
3767
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303768eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3769 tANI_U8 *pBSSId,
3770 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003771{
3772 eHalStatus status = eHAL_STATUS_FAILURE;
3773 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3774 status = sme_AcquireGlobalLock( &pMac->sme );
3775 if ( HAL_STATUS_SUCCESS( status ) )
3776 {
3777 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3778 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303779 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3780 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003781 }
3782 else
3783 {
3784 status = eHAL_STATUS_INVALID_PARAMETER;
3785 }
3786 sme_ReleaseGlobalLock( &pMac->sme );
3787 }
3788 return (status);
3789}
Wilson Yang47b58192013-12-11 11:40:19 -08003790
Jeff Johnson295189b2012-06-20 16:38:30 -07003791/* ---------------------------------------------------------------------------
3792 \fn sme_RoamGetSecurityReqIE
3793 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3794 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003795 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 \param pLen - caller allocated memory that has the length of pBuf as input.
3797 Upon returned, *pLen has the needed or IE length in pBuf.
3798 \param pBuf - Caller allocated memory that contain the IE field, if any,
3799 upon return
3800 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3801 \return eHalStatus - when fail, it usually means the buffer allocated is not
3802 big enough
3803 ---------------------------------------------------------------------------*/
3804eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3805 tANI_U8 *pBuf, eCsrSecurityType secType)
3806{
3807 eHalStatus status = eHAL_STATUS_FAILURE;
3808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3809
3810 status = sme_AcquireGlobalLock( &pMac->sme );
3811 if ( HAL_STATUS_SUCCESS( status ) )
3812 {
3813 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3814 {
3815 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3816 }
3817 else
3818 {
3819 status = eHAL_STATUS_INVALID_PARAMETER;
3820 }
3821 sme_ReleaseGlobalLock( &pMac->sme );
3822 }
3823
3824 return (status);
3825}
3826
3827/* ---------------------------------------------------------------------------
3828 \fn sme_RoamGetSecurityRspIE
3829 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3830 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003831 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 \param pLen - caller allocated memory that has the length of pBuf as input.
3833 Upon returned, *pLen has the needed or IE length in pBuf.
3834 \param pBuf - Caller allocated memory that contain the IE field, if any,
3835 upon return
3836 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3837 \return eHalStatus - when fail, it usually means the buffer allocated is not
3838 big enough
3839 ---------------------------------------------------------------------------*/
3840eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3841 tANI_U8 *pBuf, eCsrSecurityType secType)
3842{
3843 eHalStatus status = eHAL_STATUS_FAILURE;
3844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3845
3846 status = sme_AcquireGlobalLock( &pMac->sme );
3847 if ( HAL_STATUS_SUCCESS( status ) )
3848 {
3849 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3850 {
3851 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3852 }
3853 else
3854 {
3855 status = eHAL_STATUS_INVALID_PARAMETER;
3856 }
3857 sme_ReleaseGlobalLock( &pMac->sme );
3858 }
3859
3860 return (status);
3861
3862}
3863
3864
3865/* ---------------------------------------------------------------------------
3866 \fn sme_RoamGetNumPMKIDCache
3867 \brief a wrapper function to request CSR to return number of PMKID cache
3868 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003869 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 \return tANI_U32 - the number of PMKID cache entries
3871 ---------------------------------------------------------------------------*/
3872tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3873{
3874 eHalStatus status = eHAL_STATUS_FAILURE;
3875 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3876 tANI_U32 numPmkidCache = 0;
3877
3878 status = sme_AcquireGlobalLock( &pMac->sme );
3879 if ( HAL_STATUS_SUCCESS( status ) )
3880 {
3881 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3882 {
3883 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3884 status = eHAL_STATUS_SUCCESS;
3885 }
3886 else
3887 {
3888 status = eHAL_STATUS_INVALID_PARAMETER;
3889 }
3890 sme_ReleaseGlobalLock( &pMac->sme );
3891 }
3892
3893 return (numPmkidCache);
3894}
3895
3896/* ---------------------------------------------------------------------------
3897 \fn sme_RoamGetPMKIDCache
3898 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003899 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 \param pNum - caller allocated memory that has the space of the number of
3901 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3902 needed or actually number in tPmkidCacheInfo.
3903 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3904 any, upon return
3905 \return eHalStatus - when fail, it usually means the buffer allocated is not
3906 big enough
3907 ---------------------------------------------------------------------------*/
3908eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3909 tPmkidCacheInfo *pPmkidCache)
3910{
3911 eHalStatus status = eHAL_STATUS_FAILURE;
3912 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3913
3914 status = sme_AcquireGlobalLock( &pMac->sme );
3915 if ( HAL_STATUS_SUCCESS( status ) )
3916 {
3917 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3918 {
3919 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3920 }
3921 else
3922 {
3923 status = eHAL_STATUS_INVALID_PARAMETER;
3924 }
3925 sme_ReleaseGlobalLock( &pMac->sme );
3926 }
3927
3928 return (status);
3929}
3930
3931
3932/* ---------------------------------------------------------------------------
3933 \fn sme_GetConfigParam
3934 \brief a wrapper function that HDD calls to get the global settings
3935 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003936 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003937 \param pParam - caller allocated memory
3938 \return eHalStatus
3939 ---------------------------------------------------------------------------*/
3940eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3941{
3942 eHalStatus status = eHAL_STATUS_FAILURE;
3943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3944
Katya Nigambcb705f2013-12-26 14:26:22 +05303945 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003946 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 status = sme_AcquireGlobalLock( &pMac->sme );
3948 if ( HAL_STATUS_SUCCESS( status ) )
3949 {
3950 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3951 if (status != eHAL_STATUS_SUCCESS)
3952 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003953 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 sme_ReleaseGlobalLock( &pMac->sme );
3955 return status;
3956 }
3957#if defined WLAN_FEATURE_P2P_INTERNAL
3958 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3959 if (status != eHAL_STATUS_SUCCESS)
3960 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003961 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003962 sme_ReleaseGlobalLock( &pMac->sme );
3963 return status;
3964 }
3965#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05303966 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 sme_ReleaseGlobalLock( &pMac->sme );
3968 }
3969
3970 return (status);
3971}
3972
3973/* ---------------------------------------------------------------------------
3974 \fn sme_CfgSetInt
3975 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003976 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 \param cfgId - Configuration Parameter ID (type) for STA.
3978 \param ccmValue - The information related to Configuration Parameter ID
3979 which needs to be saved in CFG
3980 \param callback - To be registered by CSR with CCM. Once the CFG done with
3981 saving the information in the database, it notifies CCM &
3982 then the callback will be invoked to notify.
3983 \param toBeSaved - To save the request for future reference
3984 \return eHalStatus
3985 ---------------------------------------------------------------------------*/
3986eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3987 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3988{
3989 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3990}
3991
3992/* ---------------------------------------------------------------------------
3993 \fn sme_CfgSetStr
3994 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003995 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 \param cfgId - Configuration Parameter ID (type) for STA.
3997 \param pStr - Pointer to the byte array which carries the information needs
3998 to be saved in CFG
3999 \param length - Length of the data to be saved
4000 \param callback - To be registered by CSR with CCM. Once the CFG done with
4001 saving the information in the database, it notifies CCM &
4002 then the callback will be invoked to notify.
4003 \param toBeSaved - To save the request for future reference
4004 \return eHalStatus
4005 ---------------------------------------------------------------------------*/
4006eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4007 tANI_U32 length, tCcmCfgSetCallback callback,
4008 eAniBoolean toBeSaved)
4009{
4010 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4011}
4012
4013/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304014 \fn sme_GetModifyProfileFields
4015 \brief HDD or SME - QOS calls this function to get the current values of
4016 connected profile fields, changing which can cause reassoc.
4017 This function must be called after CFG is downloaded and STA is in connected
4018 state. Also, make sure to call this function to get the current profile
4019 fields before calling the reassoc. So that pModifyProfileFields will have
4020 all the latest values plus the one(s) has been updated as part of reassoc
4021 request.
4022 \param pModifyProfileFields - pointer to the connected profile fields
4023 changing which can cause reassoc
4024
4025 \return eHalStatus
4026 -------------------------------------------------------------------------------*/
4027eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4028 tCsrRoamModifyProfileFields * pModifyProfileFields)
4029{
4030 eHalStatus status = eHAL_STATUS_FAILURE;
4031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4032
4033 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4034 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4035 status = sme_AcquireGlobalLock( &pMac->sme );
4036 if ( HAL_STATUS_SUCCESS( status ) )
4037 {
4038 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4039 {
4040 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4041 }
4042 else
4043 {
4044 status = eHAL_STATUS_INVALID_PARAMETER;
4045 }
4046 sme_ReleaseGlobalLock( &pMac->sme );
4047 }
4048
4049 return (status);
4050}
4051
4052/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304053 \fn sme_HT40StopOBSSScan
4054 \brief HDD or SME - Command to stop the OBSS scan
4055 THis is implemented only for debugging purpose.
4056 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4057 \param sessionId - sessionId
4058 changing which can cause reassoc
4059
4060 \return eHalStatus
4061 -------------------------------------------------------------------------------*/
4062eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4063{
4064 eHalStatus status = eHAL_STATUS_FAILURE;
4065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4066
4067 smsLog(pMac, LOG2, FL("enter"));
4068 status = sme_AcquireGlobalLock( &pMac->sme );
4069 if ( HAL_STATUS_SUCCESS( status ) )
4070 {
4071 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4072 {
4073 csrHT40StopOBSSScan( pMac, sessionId );
4074 }
4075 else
4076 {
4077 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4078 "%s: Invalid session sessionId %d", __func__,sessionId);
4079 status = eHAL_STATUS_INVALID_PARAMETER;
4080 }
4081 sme_ReleaseGlobalLock( &pMac->sme );
4082 }
4083 return (status);
4084}
4085
Jeff Johnson295189b2012-06-20 16:38:30 -07004086/*--------------------------------------------------------------------------
4087 \fn sme_SetConfigPowerSave
4088 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4089 For BMPS related configuration, this function also updates the CFG
4090 and sends a message to FW to pick up the new values. Note: Calling
4091 this function only updates the configuration and does not enable
4092 the specified power save mode.
4093 \param hHal - The handle returned by macOpen.
4094 \param psMode - Power Saving mode being modified
4095 \param pConfigParams - a pointer to a caller allocated object of type
4096 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4097 \return eHalStatus
4098 --------------------------------------------------------------------------*/
4099eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4100 void *pConfigParams)
4101{
4102 eHalStatus status = eHAL_STATUS_FAILURE;
4103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4104
Katya Nigambcb705f2013-12-26 14:26:22 +05304105 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004106 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 if (NULL == pConfigParams ) {
4108 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4109 "nothing to update");
4110 return eHAL_STATUS_FAILURE;
4111 }
4112
4113 status = sme_AcquireGlobalLock( &pMac->sme );
4114 if ( HAL_STATUS_SUCCESS( status ) )
4115 {
4116 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4117 sme_ReleaseGlobalLock( &pMac->sme );
4118 }
4119
4120 return (status);
4121}
4122
4123/*--------------------------------------------------------------------------
4124 \fn sme_GetConfigPowerSave
4125 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4126 \param hHal - The handle returned by macOpen.
4127 \param psMode - Power Saving mode
4128 \param pConfigParams - a pointer to a caller allocated object of type
4129 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4130 \return eHalStatus
4131 --------------------------------------------------------------------------*/
4132eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4133 void *pConfigParams)
4134{
4135 eHalStatus status = eHAL_STATUS_FAILURE;
4136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4137
Katya Nigambcb705f2013-12-26 14:26:22 +05304138 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004139 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 if (NULL == pConfigParams ) {
4141 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4142 "nothing to update");
4143 return eHAL_STATUS_FAILURE;
4144 }
4145
4146 status = sme_AcquireGlobalLock( &pMac->sme );
4147 if ( HAL_STATUS_SUCCESS( status ) )
4148 {
4149 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4150 sme_ReleaseGlobalLock( &pMac->sme );
4151 }
4152
4153 return (status);
4154}
4155
4156/* ---------------------------------------------------------------------------
4157 \fn sme_SignalPowerEvent
4158 \brief Signals to PMC that a power event has occurred. Used for putting
4159 the chip into deep sleep mode.
4160 \param hHal - The handle returned by macOpen.
4161 \param event - the event that has occurred
4162 \return eHalStatus
4163 ---------------------------------------------------------------------------*/
4164eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4165{
4166 eHalStatus status = eHAL_STATUS_FAILURE;
4167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4168
4169 status = sme_AcquireGlobalLock( &pMac->sme );
4170 if ( HAL_STATUS_SUCCESS( status ) )
4171 {
4172 status = pmcSignalPowerEvent(hHal, event);
4173 sme_ReleaseGlobalLock( &pMac->sme );
4174 }
4175
4176 return (status);
4177}
4178
4179/* ---------------------------------------------------------------------------
4180 \fn sme_EnablePowerSave
4181 \brief Enables one of the power saving modes.
4182 \param hHal - The handle returned by macOpen.
4183 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4184 while the chip is operating in Full Power, PMC will start
4185 a timer that will try to put the chip in BMPS mode after
4186 expiry.
4187 \return eHalStatus
4188 ---------------------------------------------------------------------------*/
4189eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4190{
4191 eHalStatus status = eHAL_STATUS_FAILURE;
4192 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4193
Katya Nigambcb705f2013-12-26 14:26:22 +05304194 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004195 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 status = sme_AcquireGlobalLock( &pMac->sme );
4197 if ( HAL_STATUS_SUCCESS( status ) )
4198 {
4199 status = pmcEnablePowerSave(hHal, psMode);
4200 sme_ReleaseGlobalLock( &pMac->sme );
4201 }
4202
4203 return (status);
4204}
4205
4206/* ---------------------------------------------------------------------------
4207 \fn sme_DisablePowerSave
4208 \brief Disables one of the power saving modes.
4209 \param hHal - The handle returned by macOpen.
4210 \param psMode - The power saving mode to disable. Disabling does not imply
4211 that device will be brought out of the current PS mode. This
4212 is purely a configuration API.
4213 \return eHalStatus
4214 ---------------------------------------------------------------------------*/
4215eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4216{
4217 eHalStatus status = eHAL_STATUS_FAILURE;
4218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4219
Katya Nigambcb705f2013-12-26 14:26:22 +05304220 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004221 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 status = sme_AcquireGlobalLock( &pMac->sme );
4223 if ( HAL_STATUS_SUCCESS( status ) )
4224 {
4225 status = pmcDisablePowerSave(hHal, psMode);
4226 sme_ReleaseGlobalLock( &pMac->sme );
4227 }
4228
4229 return (status);
4230 }
4231
4232/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304233+ \fn sme_SetHostPowerSave
4234+ \brief Enables BMPS logic to be controlled by User level apps
4235+ \param hHal - The handle returned by macOpen.
4236+ \param psMode - The power saving mode to disable. Disabling does not imply
4237+ that device will be brought out of the current PS mode. This
4238+ is purely a configuration API.
4239+ \return eHalStatus
4240+ ---------------------------------------------------------------------------*/
4241eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4242{
4243 eHalStatus status = eHAL_STATUS_FAILURE;
4244 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4245
4246 pMac->pmc.isHostPsEn = psMode;
4247
4248 return (status);
4249}
4250
4251/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 \fn sme_StartAutoBmpsTimer
4253 \brief Starts a timer that periodically polls all the registered
4254 module for entry into Bmps mode. This timer is started only if BMPS is
4255 enabled and whenever the device is in full power.
4256 \param hHal - The handle returned by macOpen.
4257 \return eHalStatus
4258 ---------------------------------------------------------------------------*/
4259eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4260{
4261 eHalStatus status = eHAL_STATUS_FAILURE;
4262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4263
Katya Nigambcb705f2013-12-26 14:26:22 +05304264 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004265 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 status = sme_AcquireGlobalLock( &pMac->sme );
4267 if ( HAL_STATUS_SUCCESS( status ) )
4268 {
4269 status = pmcStartAutoBmpsTimer(hHal);
4270 sme_ReleaseGlobalLock( &pMac->sme );
4271 }
4272
4273 return (status);
4274}
4275/* ---------------------------------------------------------------------------
4276 \fn sme_StopAutoBmpsTimer
4277 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4278 Stopping the timer does not cause a device state change. Only the timer
4279 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4280 \param hHal - The handle returned by macOpen.
4281 \return eHalStatus
4282 ---------------------------------------------------------------------------*/
4283eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4284{
4285 eHalStatus status = eHAL_STATUS_FAILURE;
4286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4287
Katya Nigambcb705f2013-12-26 14:26:22 +05304288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004289 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 status = sme_AcquireGlobalLock( &pMac->sme );
4291 if ( HAL_STATUS_SUCCESS( status ) )
4292 {
4293 status = pmcStopAutoBmpsTimer(hHal);
4294 sme_ReleaseGlobalLock( &pMac->sme );
4295 }
4296
4297 return (status);
4298}
4299/* ---------------------------------------------------------------------------
4300 \fn sme_QueryPowerState
4301 \brief Returns the current power state of the device.
4302 \param hHal - The handle returned by macOpen.
4303 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4304 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4305 \return eHalStatus
4306 ---------------------------------------------------------------------------*/
4307eHalStatus sme_QueryPowerState (
4308 tHalHandle hHal,
4309 tPmcPowerState *pPowerState,
4310 tPmcSwitchState *pSwWlanSwitchState)
4311{
4312 eHalStatus status = eHAL_STATUS_FAILURE;
4313 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4314
4315 status = sme_AcquireGlobalLock( &pMac->sme );
4316 if ( HAL_STATUS_SUCCESS( status ) )
4317 {
4318 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4319 sme_ReleaseGlobalLock( &pMac->sme );
4320 }
4321
4322 return (status);
4323}
4324
4325/* ---------------------------------------------------------------------------
4326 \fn sme_IsPowerSaveEnabled
4327 \brief Checks if the device is able to enter a particular power save mode
4328 This does not imply that the device is in a particular PS mode
4329 \param hHal - The handle returned by macOpen.
4330 \param psMode - the power saving mode
4331 \return eHalStatus
4332 ---------------------------------------------------------------------------*/
4333tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4334{
4335 eHalStatus status = eHAL_STATUS_FAILURE;
4336 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4337 tANI_BOOLEAN result = false;
4338
Katya Nigambcb705f2013-12-26 14:26:22 +05304339 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004340 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004341 status = sme_AcquireGlobalLock( &pMac->sme );
4342 if ( HAL_STATUS_SUCCESS( status ) )
4343 {
4344 result = pmcIsPowerSaveEnabled(hHal, psMode);
4345 sme_ReleaseGlobalLock( &pMac->sme );
4346 return result;
4347 }
4348
4349 return false;
4350}
4351
4352/* ---------------------------------------------------------------------------
4353 \fn sme_RequestFullPower
4354 \brief Request that the device be brought to full power state. When the
4355 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4356 is enabled. On timer expiry PMC will attempt to put the device in
4357 BMPS mode if following holds true:
4358 - BMPS mode is enabled
4359 - Polling of all modules through the Power Save Check routine passes
4360 - STA is associated to an access point
4361 \param hHal - The handle returned by macOpen.
4362 \param - callbackRoutine Callback routine invoked in case of success/failure
4363 \return eHalStatus - status
4364 eHAL_STATUS_SUCCESS - device brought to full power state
4365 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4366 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4367 ---------------------------------------------------------------------------*/
4368eHalStatus sme_RequestFullPower (
4369 tHalHandle hHal,
4370 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4371 void *callbackContext,
4372 tRequestFullPowerReason fullPowerReason)
4373{
4374 eHalStatus status = eHAL_STATUS_FAILURE;
4375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4376
Katya Nigambcb705f2013-12-26 14:26:22 +05304377 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004378 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 status = sme_AcquireGlobalLock( &pMac->sme );
4380 if ( HAL_STATUS_SUCCESS( status ) )
4381 {
4382 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4383 sme_ReleaseGlobalLock( &pMac->sme );
4384 }
4385
4386 return (status);
4387}
4388
4389/* ---------------------------------------------------------------------------
4390 \fn sme_RequestBmps
4391 \brief Request that the device be put in BMPS state. Request will be
4392 accepted only if BMPS mode is enabled and power save check routine
4393 passes.
4394 \param hHal - The handle returned by macOpen.
4395 \param - callbackRoutine Callback routine invoked in case of success/failure
4396 \return eHalStatus
4397 eHAL_STATUS_SUCCESS - device is in BMPS state
4398 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4399 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4400 ---------------------------------------------------------------------------*/
4401eHalStatus sme_RequestBmps (
4402 tHalHandle hHal,
4403 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4404 void *callbackContext)
4405{
4406 eHalStatus status = eHAL_STATUS_FAILURE;
4407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4408
Katya Nigambcb705f2013-12-26 14:26:22 +05304409 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004410 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 status = sme_AcquireGlobalLock( &pMac->sme );
4412 if ( HAL_STATUS_SUCCESS( status ) )
4413 {
4414 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4415 sme_ReleaseGlobalLock( &pMac->sme );
4416 }
4417
4418 return (status);
4419}
4420
4421
4422/* ---------------------------------------------------------------------------
4423 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004424 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4425 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 \param hHal - The handle returned by macOpen.
4427 ---------------------------------------------------------------------------*/
4428void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4429{
4430 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4431
Katya Nigambcb705f2013-12-26 14:26:22 +05304432 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004433 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4435 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4436}
4437
4438
4439/* ---------------------------------------------------------------------------
4440 \fn sme_StartUapsd
4441 \brief Request that the device be put in UAPSD state. If the device is in
4442 Full Power it will be put in BMPS mode first and then into UAPSD
4443 mode.
4444 \param hHal - The handle returned by macOpen.
4445 \param - callbackRoutine Callback routine invoked in case of success/failure
4446 eHAL_STATUS_SUCCESS - device is in UAPSD state
4447 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4448 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4449 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4450 \return eHalStatus
4451 ---------------------------------------------------------------------------*/
4452eHalStatus sme_StartUapsd (
4453 tHalHandle hHal,
4454 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4455 void *callbackContext)
4456{
4457 eHalStatus status = eHAL_STATUS_FAILURE;
4458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4459
4460 status = sme_AcquireGlobalLock( &pMac->sme );
4461 if ( HAL_STATUS_SUCCESS( status ) )
4462 {
4463 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4464 sme_ReleaseGlobalLock( &pMac->sme );
4465 }
4466
4467 return (status);
4468 }
4469
4470/* ---------------------------------------------------------------------------
4471 \fn sme_StopUapsd
4472 \brief Request that the device be put out of UAPSD state. Device will be
4473 put in in BMPS state after stop UAPSD completes.
4474 \param hHal - The handle returned by macOpen.
4475 \return eHalStatus
4476 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4477 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4478 ---------------------------------------------------------------------------*/
4479eHalStatus sme_StopUapsd (tHalHandle hHal)
4480{
4481 eHalStatus status = eHAL_STATUS_FAILURE;
4482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4483
4484 status = sme_AcquireGlobalLock( &pMac->sme );
4485 if ( HAL_STATUS_SUCCESS( status ) )
4486 {
4487 status = pmcStopUapsd(hHal);
4488 sme_ReleaseGlobalLock( &pMac->sme );
4489 }
4490
4491 return (status);
4492}
4493
4494/* ---------------------------------------------------------------------------
4495 \fn sme_RequestStandby
4496 \brief Request that the device be put in standby. It is HDD's responsibility
4497 to bring the chip to full power and do a disassoc before calling
4498 this API.
4499 \param hHal - The handle returned by macOpen.
4500 \param - callbackRoutine Callback routine invoked in case of success/failure
4501 \return eHalStatus
4502 eHAL_STATUS_SUCCESS - device is in Standby mode
4503 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4504 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4505 ---------------------------------------------------------------------------*/
4506eHalStatus sme_RequestStandby (
4507 tHalHandle hHal,
4508 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4509 void *callbackContext)
4510{
4511 eHalStatus status = eHAL_STATUS_FAILURE;
4512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4513
Katya Nigambcb705f2013-12-26 14:26:22 +05304514 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004515 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304516 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 status = sme_AcquireGlobalLock( &pMac->sme );
4518 if ( HAL_STATUS_SUCCESS( status ) )
4519 {
4520 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4521 sme_ReleaseGlobalLock( &pMac->sme );
4522 }
4523
4524 return (status);
4525}
4526
4527/* ---------------------------------------------------------------------------
4528 \fn sme_RegisterPowerSaveCheck
4529 \brief Register a power save check routine that is called whenever
4530 the device is about to enter one of the power save modes.
4531 \param hHal - The handle returned by macOpen.
4532 \param checkRoutine - Power save check routine to be registered
4533 \return eHalStatus
4534 eHAL_STATUS_SUCCESS - successfully registered
4535 eHAL_STATUS_FAILURE - not successfully registered
4536 ---------------------------------------------------------------------------*/
4537eHalStatus sme_RegisterPowerSaveCheck (
4538 tHalHandle hHal,
4539 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4540{
4541 eHalStatus status = eHAL_STATUS_FAILURE;
4542 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4543
4544 status = sme_AcquireGlobalLock( &pMac->sme );
4545 if ( HAL_STATUS_SUCCESS( status ) )
4546 {
4547 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4548 sme_ReleaseGlobalLock( &pMac->sme );
4549 }
4550
4551 return (status);
4552}
4553
4554/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304555 \fn sme_Register11dScanDoneCallback
4556 \brief Register a routine of type csrScanCompleteCallback which is
4557 called whenever an 11d scan is done
4558 \param hHal - The handle returned by macOpen.
4559 \param callback - 11d scan complete routine to be registered
4560 \return eHalStatus
4561 ---------------------------------------------------------------------------*/
4562eHalStatus sme_Register11dScanDoneCallback (
4563 tHalHandle hHal,
4564 csrScanCompleteCallback callback)
4565{
4566 eHalStatus status = eHAL_STATUS_SUCCESS;
4567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4568
4569 pMac->scan.callback11dScanDone = callback;
4570
4571 return (status);
4572}
4573
4574/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 \fn sme_DeregisterPowerSaveCheck
4576 \brief Deregister a power save check routine
4577 \param hHal - The handle returned by macOpen.
4578 \param checkRoutine - Power save check routine to be deregistered
4579 \return eHalStatus
4580 eHAL_STATUS_SUCCESS - successfully deregistered
4581 eHAL_STATUS_FAILURE - not successfully deregistered
4582 ---------------------------------------------------------------------------*/
4583eHalStatus sme_DeregisterPowerSaveCheck (
4584 tHalHandle hHal,
4585 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4586{
4587 eHalStatus status = eHAL_STATUS_FAILURE;
4588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4589
4590 status = sme_AcquireGlobalLock( &pMac->sme );
4591 if ( HAL_STATUS_SUCCESS( status ) )
4592 {
4593 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4594 sme_ReleaseGlobalLock( &pMac->sme );
4595 }
4596
4597 return (status);
4598}
4599
4600/* ---------------------------------------------------------------------------
4601 \fn sme_RegisterDeviceStateUpdateInd
4602 \brief Register a callback routine that is called whenever
4603 the device enters a new device state (Full Power, BMPS, UAPSD)
4604 \param hHal - The handle returned by macOpen.
4605 \param callbackRoutine - Callback routine to be registered
4606 \param callbackContext - Cookie to be passed back during callback
4607 \return eHalStatus
4608 eHAL_STATUS_SUCCESS - successfully registered
4609 eHAL_STATUS_FAILURE - not successfully registered
4610 ---------------------------------------------------------------------------*/
4611eHalStatus sme_RegisterDeviceStateUpdateInd (
4612 tHalHandle hHal,
4613 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4614 void *callbackContext)
4615{
4616 eHalStatus status = eHAL_STATUS_FAILURE;
4617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4618
4619 status = sme_AcquireGlobalLock( &pMac->sme );
4620 if ( HAL_STATUS_SUCCESS( status ) )
4621 {
4622 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4623 sme_ReleaseGlobalLock( &pMac->sme );
4624 }
4625
4626 return (status);
4627}
4628
4629/* ---------------------------------------------------------------------------
4630 \fn sme_DeregisterDeviceStateUpdateInd
4631 \brief Deregister a routine that was registered for device state changes
4632 \param hHal - The handle returned by macOpen.
4633 \param callbackRoutine - Callback routine to be deregistered
4634 \return eHalStatus
4635 eHAL_STATUS_SUCCESS - successfully deregistered
4636 eHAL_STATUS_FAILURE - not successfully deregistered
4637 ---------------------------------------------------------------------------*/
4638eHalStatus sme_DeregisterDeviceStateUpdateInd (
4639 tHalHandle hHal,
4640 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4641{
4642 eHalStatus status = eHAL_STATUS_FAILURE;
4643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4644
4645 status = sme_AcquireGlobalLock( &pMac->sme );
4646 if ( HAL_STATUS_SUCCESS( status ) )
4647 {
4648 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4649 sme_ReleaseGlobalLock( &pMac->sme );
4650 }
4651
4652 return (status);
4653}
4654
4655/* ---------------------------------------------------------------------------
4656 \fn sme_WowlAddBcastPattern
4657 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4658 do a pattern match on these patterns when Wowl is enabled during BMPS
4659 mode. Note that Firmware performs the pattern matching only on
4660 broadcast frames and while Libra is in BMPS mode.
4661 \param hHal - The handle returned by macOpen.
4662 \param pattern - Pattern to be added
4663 \return eHalStatus
4664 eHAL_STATUS_FAILURE Cannot add pattern
4665 eHAL_STATUS_SUCCESS Request accepted.
4666 ---------------------------------------------------------------------------*/
4667eHalStatus sme_WowlAddBcastPattern (
4668 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004669 tpSirWowlAddBcastPtrn pattern,
4670 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004671{
4672 eHalStatus status = eHAL_STATUS_FAILURE;
4673 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304674 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004675 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 status = sme_AcquireGlobalLock( &pMac->sme );
4677 if ( HAL_STATUS_SUCCESS( status ) )
4678 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004679 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 sme_ReleaseGlobalLock( &pMac->sme );
4681 }
4682
4683 return (status);
4684}
4685
4686/* ---------------------------------------------------------------------------
4687 \fn sme_WowlDelBcastPattern
4688 \brief Delete a pattern that was added for Pattern Byte Matching.
4689 \param hHal - The handle returned by macOpen.
4690 \param pattern - Pattern to be deleted
4691 \return eHalStatus
4692 eHAL_STATUS_FAILURE Cannot delete pattern
4693 eHAL_STATUS_SUCCESS Request accepted.
4694 ---------------------------------------------------------------------------*/
4695eHalStatus sme_WowlDelBcastPattern (
4696 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004697 tpSirWowlDelBcastPtrn pattern,
4698 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004699{
4700 eHalStatus status = eHAL_STATUS_FAILURE;
4701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304702 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004703 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004704 status = sme_AcquireGlobalLock( &pMac->sme );
4705 if ( HAL_STATUS_SUCCESS( status ) )
4706 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004707 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 sme_ReleaseGlobalLock( &pMac->sme );
4709 }
4710
4711 return (status);
4712}
4713
4714/* ---------------------------------------------------------------------------
4715 \fn sme_EnterWowl
4716 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4717 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4718 SME will will cache the information that WOWL has been enabled and
4719 attempt to put the device in BMPS. On entry into BMPS, SME will
4720 enable the WOWL mode.
4721 Note 1: If we exit BMPS mode (someone requests full power), we
4722 will NOT resume WOWL when we go back to BMPS again. Request for full
4723 power (while in WOWL mode) means disable WOWL and go to full power.
4724 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4725 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4726 are required. Currently there is no requirement or use case to support
4727 UAPSD and WOWL at the same time.
4728
4729 \param hHal - The handle returned by macOpen.
4730 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4731 Used for success/failure notification by SME
4732 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4733 at the time of callback.
4734 \param wakeReasonIndCB - Callback routine provided by HDD.
4735 Used for Wake Reason Indication by SME
4736 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4737 at the time of callback.
4738 \return eHalStatus
4739 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4740 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4741 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4742 BMPS mode is entered.
4743 ---------------------------------------------------------------------------*/
4744eHalStatus sme_EnterWowl (
4745 tHalHandle hHal,
4746 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4747 void *enterWowlCallbackContext,
4748#ifdef WLAN_WAKEUP_EVENTS
4749 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4750 void *wakeIndicationCBContext,
4751#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004752 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004753{
4754 eHalStatus status = eHAL_STATUS_FAILURE;
4755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304756 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004757 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004758 status = sme_AcquireGlobalLock( &pMac->sme );
4759 if ( HAL_STATUS_SUCCESS( status ) )
4760 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004761 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004762#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004763 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004764#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004765 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 sme_ReleaseGlobalLock( &pMac->sme );
4767 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004768 return (status);
4769}
4770/* ---------------------------------------------------------------------------
4771 \fn sme_ExitWowl
4772 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4773 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4774 mode.
4775 \param hHal - The handle returned by macOpen.
4776 \return eHalStatus
4777 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4778 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4779 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304780eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004781{
4782 eHalStatus status = eHAL_STATUS_FAILURE;
4783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304784 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004785 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 status = sme_AcquireGlobalLock( &pMac->sme );
4787 if ( HAL_STATUS_SUCCESS( status ) )
4788 {
c_hpothu01484c02014-05-16 14:05:15 +05304789 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 sme_ReleaseGlobalLock( &pMac->sme );
4791 }
4792
4793 return (status);
4794}
4795
4796/* ---------------------------------------------------------------------------
4797
4798 \fn sme_RoamSetKey
4799
4800 \brief To set encryption key. This function should be called only when connected
4801 This is an asynchronous API.
4802
4803 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4804
4805 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4806
4807 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4808
4809 FAILURE or RESOURCES The API finished and failed.
4810
4811 -------------------------------------------------------------------------------*/
4812eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4813{
4814 eHalStatus status = eHAL_STATUS_FAILURE;
4815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4816 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 tANI_U32 i;
4818 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004819
Katya Nigambcb705f2013-12-26 14:26:22 +05304820 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004821 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004822 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4823 {
4824 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4825 return eHAL_STATUS_FAILURE;
4826 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304827 /*Once Setkey is done, we can go in BMPS*/
4828 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304829 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304830 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304831 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4832 " to allow BMPS"));
4833 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004834
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 status = sme_AcquireGlobalLock( &pMac->sme );
4836 if ( HAL_STATUS_SUCCESS( status ) )
4837 {
4838 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4839 if(pRoamId)
4840 {
4841 *pRoamId = roamId;
4842 }
4843
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004844 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004845
4846 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004847 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004848
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004849 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004850
4851 pSession = CSR_GET_SESSION(pMac, sessionId);
4852
Jeff Johnson32d95a32012-09-10 13:15:23 -07004853 if(!pSession)
4854 {
4855 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004856 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004857 return eHAL_STATUS_FAILURE;
4858 }
4859
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4861 {
4862 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4863 {
4864 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4865 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4866 {
4867 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4868 }
4869 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4870 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4871 {
4872 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4873 }
4874 }
4875 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004876
4877 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4878 sme_ReleaseGlobalLock( &pMac->sme );
4879 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05304880 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304881 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05304882 //Store sent PTK key time
4883 if(pSetKey->keyDirection == eSIR_TX_RX)
4884 {
4885 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4886 }
4887 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4888 {
4889 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4890 }
4891 else
4892 {
4893 return (status);
4894 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304895 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004896
4897 return (status);
4898}
4899
4900
4901/* ---------------------------------------------------------------------------
4902
4903 \fn sme_RoamRemoveKey
4904
4905 \brief To set encryption key. This is an asynchronous API.
4906
4907 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4908
4909 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4910
4911 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4912
4913 FAILURE or RESOURCES The API finished and failed.
4914
4915 -------------------------------------------------------------------------------*/
4916eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4917 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4918{
4919 eHalStatus status = eHAL_STATUS_FAILURE;
4920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4921 tANI_U32 roamId;
4922
Katya Nigambcb705f2013-12-26 14:26:22 +05304923 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004924 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 status = sme_AcquireGlobalLock( &pMac->sme );
4926 if ( HAL_STATUS_SUCCESS( status ) )
4927 {
4928 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4929 if(pRoamId)
4930 {
4931 *pRoamId = roamId;
4932 }
4933 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4934 sme_ReleaseGlobalLock( &pMac->sme );
4935 }
4936
4937 return (status);
4938}
4939
4940/* ---------------------------------------------------------------------------
4941 \fn sme_GetRssi
4942 \brief a wrapper function that client calls to register a callback to get RSSI
4943
4944 \param callback - SME sends back the requested stats using the callback
4945 \param staId - The station ID for which the stats is requested for
4946 \param pContext - user context to be passed back along with the callback
4947 \param pVosContext - vos context
4948 \return eHalStatus
4949 ---------------------------------------------------------------------------*/
4950eHalStatus sme_GetRssi(tHalHandle hHal,
4951 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004952 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004953 void *pContext, void* pVosContext)
4954{
4955 eHalStatus status = eHAL_STATUS_FAILURE;
4956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4957
4958 status = sme_AcquireGlobalLock( &pMac->sme );
4959 if ( HAL_STATUS_SUCCESS( status ) )
4960 {
4961 status = csrGetRssi( pMac, callback,
4962 staId, bssId, pContext, pVosContext);
4963 sme_ReleaseGlobalLock( &pMac->sme );
4964 }
4965 return (status);
4966}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304967
4968/* ---------------------------------------------------------------------------
4969 \fn sme_GetSnr
4970 \brief a wrapper function that client calls to register a callback to
4971 get SNR
4972
4973 \param callback - SME sends back the requested stats using the callback
4974 \param staId - The station ID for which the stats is requested for
4975 \param pContext - user context to be passed back along with the callback
4976 \param pVosContext - vos context
4977 \return eHalStatus
4978 ---------------------------------------------------------------------------*/
4979eHalStatus sme_GetSnr(tHalHandle hHal,
4980 tCsrSnrCallback callback,
4981 tANI_U8 staId, tCsrBssid bssId,
4982 void *pContext)
4983{
4984 eHalStatus status = eHAL_STATUS_FAILURE;
4985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4986
4987 status = sme_AcquireGlobalLock( &pMac->sme );
4988 if ( HAL_STATUS_SUCCESS( status ) )
4989 {
4990 status = csrGetSnr(pMac, callback,
4991 staId, bssId, pContext);
4992 sme_ReleaseGlobalLock( &pMac->sme );
4993 }
4994 return status;
4995}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004996#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004997/* ---------------------------------------------------------------------------
4998 \fn sme_GetRoamRssi
4999 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5000
5001 \param callback - SME sends back the requested stats using the callback
5002 \param staId - The station ID for which the stats is requested for
5003 \param pContext - user context to be passed back along with the callback
5004 \param pVosContext - vos context
5005 \return eHalStatus
5006 ---------------------------------------------------------------------------*/
5007eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5008 tCsrRssiCallback callback,
5009 tANI_U8 staId, tCsrBssid bssId,
5010 void *pContext, void* pVosContext)
5011{
5012 eHalStatus status = eHAL_STATUS_FAILURE;
5013 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5014
5015 status = sme_AcquireGlobalLock( &pMac->sme );
5016 if ( HAL_STATUS_SUCCESS( status ) )
5017 {
5018 status = csrGetRoamRssi( pMac, callback,
5019 staId, bssId, pContext, pVosContext);
5020 sme_ReleaseGlobalLock( &pMac->sme );
5021 }
5022 return (status);
5023}
5024#endif
5025
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005026#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005027/* ---------------------------------------------------------------------------
5028 \fn sme_GetTsmStats
5029 \brief a wrapper function that client calls to register a callback to get TSM Stats
5030
5031 \param callback - SME sends back the requested stats using the callback
5032 \param staId - The station ID for which the stats is requested for
5033 \param pContext - user context to be passed back along with the callback
5034 \param pVosContext - vos context
5035 \return eHalStatus
5036 ---------------------------------------------------------------------------*/
5037eHalStatus sme_GetTsmStats(tHalHandle hHal,
5038 tCsrTsmStatsCallback callback,
5039 tANI_U8 staId, tCsrBssid bssId,
5040 void *pContext, void* pVosContext, tANI_U8 tid)
5041{
5042 eHalStatus status = eHAL_STATUS_FAILURE;
5043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5044
5045 status = sme_AcquireGlobalLock( &pMac->sme );
5046 if ( HAL_STATUS_SUCCESS( status ) )
5047 {
5048 status = csrGetTsmStats( pMac, callback,
5049 staId, bssId, pContext, pVosContext, tid);
5050 sme_ReleaseGlobalLock( &pMac->sme );
5051 }
5052 return (status);
5053}
5054#endif
5055
5056
Jeff Johnson295189b2012-06-20 16:38:30 -07005057/* ---------------------------------------------------------------------------
5058 \fn sme_GetStatistics
5059 \brief a wrapper function that client calls to register a callback to get
5060 different PHY level statistics from CSR.
5061
5062 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5063 \param statsMask - The different category/categories of stats requester is looking for
5064 \param callback - SME sends back the requested stats using the callback
5065 \param periodicity - If requester needs periodic update in millisec, 0 means
5066 it's an one time request
5067 \param cache - If requester is happy with cached stats
5068 \param staId - The station ID for which the stats is requested for
5069 \param pContext - user context to be passed back along with the callback
5070 \return eHalStatus
5071 ---------------------------------------------------------------------------*/
5072eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5073 tANI_U32 statsMask,
5074 tCsrStatsCallback callback,
5075 tANI_U32 periodicity, tANI_BOOLEAN cache,
5076 tANI_U8 staId, void *pContext)
5077{
5078 eHalStatus status = eHAL_STATUS_FAILURE;
5079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5080
Katya Nigambcb705f2013-12-26 14:26:22 +05305081 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005082 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005083 status = sme_AcquireGlobalLock( &pMac->sme );
5084 if ( HAL_STATUS_SUCCESS( status ) )
5085 {
5086 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5087 periodicity, cache, staId, pContext);
5088 sme_ReleaseGlobalLock( &pMac->sme );
5089 }
5090
5091 return (status);
5092
5093}
5094
Abhishek Singh08aa7762014-12-16 13:59:03 +05305095eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5096 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305097{
5098 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5099 vos_msg_t msg;
5100 tSirFWStatsGetReq *pGetFWStatsReq;
5101
5102 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5103
5104 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5105 {
5106 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5107 if ( NULL == pGetFWStatsReq)
5108 {
5109 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5110 "WDA_FW_STATS_GET_REQ"));
5111 sme_ReleaseGlobalLock( &pMac->sme );
5112 return eHAL_STATUS_FAILURE;
5113 }
5114 pGetFWStatsReq->stats = stats;
5115 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305116 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305117
5118 msg.type = WDA_FW_STATS_GET_REQ;
5119 msg.reserved = 0;
5120 msg.bodyptr = pGetFWStatsReq;
5121 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5122 {
5123 smsLog(pMac, LOGE,
5124 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5125 vos_mem_free(pGetFWStatsReq);
5126 sme_ReleaseGlobalLock( &pMac->sme );
5127 return eHAL_STATUS_FAILURE;
5128 }
5129 sme_ReleaseGlobalLock( &pMac->sme );
5130 return eHAL_STATUS_SUCCESS;
5131 }
5132 return eHAL_STATUS_FAILURE;
5133}
5134
Jeff Johnson295189b2012-06-20 16:38:30 -07005135/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305136 \fn smeGetTLSTAState
5137 \helper function to get the TL STA State whenever the function is called.
5138
5139 \param staId - The staID to be passed to the TL
5140 to get the relevant TL STA State
5141 \return the state as tANI_U16
5142 ---------------------------------------------------------------------------*/
5143tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5144{
5145 tANI_U16 tlSTAState = TL_INIT_STATE;
5146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5147 eHalStatus status = eHAL_STATUS_FAILURE;
5148
5149 status = sme_AcquireGlobalLock( &pMac->sme );
5150 if ( HAL_STATUS_SUCCESS( status ) )
5151 {
5152 tlSTAState = csrGetTLSTAState( pMac, staId);
5153 sme_ReleaseGlobalLock( &pMac->sme );
5154 }
5155
5156 return tlSTAState;
5157}
5158
5159/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005160
5161 \fn sme_GetCountryCode
5162
5163 \brief To return the current country code. If no country code is applied, default country code is
5164 used to fill the buffer.
5165 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5166 This is a synchronous API.
5167
5168 \param pBuf - pointer to a caller allocated buffer for returned country code.
5169
5170 \param pbLen For input, this parameter indicates how big is the buffer.
5171 Upon return, this parameter has the number of bytes for country. If pBuf
5172 doesn't have enough space, this function returns
5173 fail status and this parameter contains the number that is needed.
5174
5175 \return eHalStatus SUCCESS.
5176
5177 FAILURE or RESOURCES The API finished and failed.
5178
5179 -------------------------------------------------------------------------------*/
5180eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5181{
5182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5183
Katya Nigambcb705f2013-12-26 14:26:22 +05305184 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005185 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5186
Jeff Johnson295189b2012-06-20 16:38:30 -07005187 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5188}
5189
5190
5191/* ---------------------------------------------------------------------------
5192
5193 \fn sme_SetCountryCode
5194
5195 \brief To change the current/default country code.
5196 If 11d supported is turned off, an error is return.
5197 This is a synchronous API.
5198
5199 \param pCountry - pointer to a caller allocated buffer for the country code.
5200
5201 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5202 whether a reset is required.
5203
5204 \return eHalStatus SUCCESS.
5205
5206 FAILURE or RESOURCES The API finished and failed.
5207
5208 -------------------------------------------------------------------------------*/
5209eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5210{
5211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5212
Katya Nigambcb705f2013-12-26 14:26:22 +05305213 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005214 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005215 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5216}
5217
5218
5219/* ---------------------------------------------------------------------------
5220 \fn sme_ResetCountryCodeInformation
5221 \brief this function is to reset the country code current being used back to EEPROM default
5222 this includes channel list and power setting. This is a synchronous API.
5223 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5224 a restart is needed to apply the change
5225 \return eHalStatus
5226 -------------------------------------------------------------------------------*/
5227eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5228{
5229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5230
5231 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5232}
5233
5234
5235/* ---------------------------------------------------------------------------
5236 \fn sme_GetSupportedCountryCode
5237 \brief this function is to get a list of the country code current being supported
5238 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5239 this has the country code list. 3 bytes for each country code. This may be NULL if
5240 caller wants to know the needed byte count.
5241 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5242 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5243 \return eHalStatus
5244 -------------------------------------------------------------------------------*/
5245eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5246{
5247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5248
5249 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5250}
5251
5252
5253/* ---------------------------------------------------------------------------
5254 \fn sme_GetCurrentRegulatoryDomain
5255 \brief this function is to get the current regulatory domain. This is a synchronous API.
5256 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5257 SME. The function fails if 11d support is turned off.
5258 \param pDomain - Caller allocated buffer to return the current domain.
5259 \return eHalStatus SUCCESS.
5260
5261 FAILURE or RESOURCES The API finished and failed.
5262 -------------------------------------------------------------------------------*/
5263eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5264{
5265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5266 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5267
5268 if( pDomain )
5269 {
5270 if( csrIs11dSupported( pMac ) )
5271 {
5272 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5273 status = eHAL_STATUS_SUCCESS;
5274 }
5275 else
5276 {
5277 status = eHAL_STATUS_FAILURE;
5278 }
5279 }
5280
5281 return ( status );
5282}
5283
5284
5285/* ---------------------------------------------------------------------------
5286 \fn sme_SetRegulatoryDomain
5287 \brief this function is to set the current regulatory domain.
5288 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5289 SME. This is a synchronous API.
5290 \param domainId - indicate the domain (defined in the driver) needs to set to.
5291 See v_REGDOMAIN_t for definition
5292 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5293 a restart is needed to apply the change
5294 \return eHalStatus
5295 -------------------------------------------------------------------------------*/
5296eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5297{
5298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5299
5300 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5301}
5302
5303
5304/* ---------------------------------------------------------------------------
5305
5306 \fn sme_GetRegulatoryDomainForCountry
5307
5308 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5309
5310 \param pCountry - pointer to a caller allocated buffer for input country code.
5311
5312 \param pDomainId Upon successful return, it is the domain that country belongs to.
5313 If it is NULL, returning success means that the country code is known.
5314
5315 \return eHalStatus SUCCESS.
5316
5317 FAILURE or RESOURCES The API finished and failed.
5318
5319 -------------------------------------------------------------------------------*/
5320eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5321{
5322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5323
Kiet Lam6c583332013-10-14 05:37:09 +05305324 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5325 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005326}
5327
5328
5329
5330
5331/* ---------------------------------------------------------------------------
5332
5333 \fn sme_GetSupportedRegulatoryDomains
5334
5335 \brief To return a list of supported regulatory domains. This is a synchronous API.
5336
5337 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5338
5339 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5340 Upon return, this parameter has the number for supported domains. If pDomains
5341 doesn't have enough space for all the supported domains, this function returns
5342 fail status and this parameter contains the number that is needed.
5343
5344 \return eHalStatus SUCCESS.
5345
5346 FAILURE or RESOURCES The API finished and failed.
5347
5348 -------------------------------------------------------------------------------*/
5349eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5350{
5351 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5352
5353 //We support all domains for now
5354 if( pNumDomains )
5355 {
5356 if( NUM_REG_DOMAINS <= *pNumDomains )
5357 {
5358 status = eHAL_STATUS_SUCCESS;
5359 }
5360 *pNumDomains = NUM_REG_DOMAINS;
5361 }
5362 if( HAL_STATUS_SUCCESS( status ) )
5363 {
5364 if( pDomains )
5365 {
5366 pDomains[0] = REGDOMAIN_FCC;
5367 pDomains[1] = REGDOMAIN_ETSI;
5368 pDomains[2] = REGDOMAIN_JAPAN;
5369 pDomains[3] = REGDOMAIN_WORLD;
5370 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5371 pDomains[5] = REGDOMAIN_APAC;
5372 pDomains[6] = REGDOMAIN_KOREA;
5373 pDomains[7] = REGDOMAIN_HI_5GHZ;
5374 pDomains[8] = REGDOMAIN_NO_5GHZ;
5375 }
5376 else
5377 {
5378 status = eHAL_STATUS_INVALID_PARAMETER;
5379 }
5380 }
5381
5382 return ( status );
5383}
5384
5385
5386//some support functions
5387tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5388{
5389 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5390
5391 return ( csrIs11dSupported( pMac ) );
5392}
5393
5394
5395tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5396{
5397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5398
5399 return ( csrIs11hSupported( pMac ) );
5400}
5401
5402
5403tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5404{
5405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5406
5407 return ( csrIsWmmSupported( pMac ) );
5408}
5409
5410//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5411eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5412{
5413 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5414
5415 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5416}
5417
5418/* ---------------------------------------------------------------------------
5419
5420 \fn sme_ChangeCountryCode
5421
5422 \brief Change Country code from upperlayer during WLAN driver operation.
5423 This is a synchronous API.
5424
5425 \param hHal - The handle returned by macOpen.
5426
5427 \param pCountry New Country Code String
5428
Abhishek Singha306a442013-11-07 18:39:01 +05305429 \param sendRegHint If we want to send reg hint to nl80211
5430
Jeff Johnson295189b2012-06-20 16:38:30 -07005431 \return eHalStatus SUCCESS.
5432
5433 FAILURE or RESOURCES The API finished and failed.
5434
5435 -------------------------------------------------------------------------------*/
5436eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5437 tSmeChangeCountryCallback callback,
5438 tANI_U8 *pCountry,
5439 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305440 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305441 tAniBool countryFromUserSpace,
5442 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005443{
5444 eHalStatus status = eHAL_STATUS_FAILURE;
5445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5446 vos_msg_t msg;
5447 tAniChangeCountryCodeReq *pMsg;
5448
Katya Nigambcb705f2013-12-26 14:26:22 +05305449 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005450 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005451 status = sme_AcquireGlobalLock( &pMac->sme );
5452 if ( HAL_STATUS_SUCCESS( status ) )
5453 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005454 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005455
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305456 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005457 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5458 {
5459
5460 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5461
5462 sme_ReleaseGlobalLock( &pMac->sme );
5463 status = eHAL_STATUS_FAILURE;
5464 return status;
5465 }
5466
Kiet Lam64c1b492013-07-12 13:56:44 +05305467 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5468 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005470 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005471 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305472 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005473 }
5474
5475 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5476 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305477 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305478 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305479 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 pMsg->changeCCCallback = callback;
5481 pMsg->pDevContext = pContext;
5482 pMsg->pVosContext = pVosContext;
5483
5484 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5485 msg.bodyptr = pMsg;
5486 msg.reserved = 0;
5487
5488 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5489 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005490 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305491 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005492 status = eHAL_STATUS_FAILURE;
5493 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005494 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005495 sme_ReleaseGlobalLock( &pMac->sme );
5496 }
5497
5498 return (status);
5499}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005500
5501/*--------------------------------------------------------------------------
5502
5503 \fn sme_GenericChangeCountryCode
5504
5505 \brief Change Country code from upperlayer during WLAN driver operation.
5506 This is a synchronous API.
5507
5508 \param hHal - The handle returned by macOpen.
5509
5510 \param pCountry New Country Code String
5511
5512 \param reg_domain regulatory domain
5513
5514 \return eHalStatus SUCCESS.
5515
5516 FAILURE or RESOURCES The API finished and failed.
5517
5518-----------------------------------------------------------------------------*/
5519eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5520 tANI_U8 *pCountry,
5521 v_REGDOMAIN_t reg_domain)
5522{
5523 eHalStatus status = eHAL_STATUS_FAILURE;
5524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5525 vos_msg_t msg;
5526 tAniGenericChangeCountryCodeReq *pMsg;
5527
Kiet Lamcffc5862013-10-30 16:28:45 +05305528 if (NULL == pMac)
5529 {
5530 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5531 "%s: pMac is null", __func__);
5532 return status;
5533 }
5534
Amar Singhal0d15bd52013-10-12 23:13:13 -07005535 status = sme_AcquireGlobalLock( &pMac->sme );
5536 if ( HAL_STATUS_SUCCESS( status ) )
5537 {
5538 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305539 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5540 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005541 {
5542 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5543 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305544 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005545 }
5546
5547 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5548 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005549 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305550
5551 pMsg->countryCode[2] = ' '; /* For ASCII space */
5552
Amar Singhal0d15bd52013-10-12 23:13:13 -07005553 pMsg->domain_index = reg_domain;
5554
5555 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5556 msg.bodyptr = pMsg;
5557 msg.reserved = 0;
5558
5559 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5560 {
5561 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305562 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005563 status = eHAL_STATUS_FAILURE;
5564 }
5565 smsLog(pMac, LOG1, FL(" returned"));
5566 sme_ReleaseGlobalLock( &pMac->sme );
5567 }
5568
5569 return (status);
5570}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305571
5572/* ---------------------------------------------------------------------------
5573
5574 \fn sme_InitChannels
5575
5576 \brief Used to initialize CSR channel lists while driver loading
5577
5578 \param hHal - global pMac structure
5579
5580 \return eHalStatus SUCCESS.
5581
5582 FAILURE or RESOURCES The API finished and failed.
5583
5584 -------------------------------------------------------------------------------*/
5585eHalStatus sme_InitChannels(tHalHandle hHal)
5586{
5587 eHalStatus status = eHAL_STATUS_FAILURE;
5588 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5589
5590 if (NULL == pMac)
5591 {
5592 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5593 "%s: pMac is null", __func__);
5594 return status;
5595 }
5596
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305597 status = csrInitChannels(pMac);
5598
Mihir Shetee1093ba2014-01-21 20:13:32 +05305599 return status;
5600}
5601
Mihir Shete04206452014-11-20 17:50:58 +05305602#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305603/*-------------------------------------------------------------------------
5604 \fn sme_InitChannelsForCC
5605
5606 \brief Used to issue regulatory hint to user
5607
5608 \param hHal - global pMac structure
5609
5610 \return eHalStatus SUCCESS.
5611
5612 FAILURE or RESOURCES The API finished and failed.
5613--------------------------------------------------------------------------*/
5614
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305615eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305616{
5617 eHalStatus status = eHAL_STATUS_FAILURE;
5618 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5619
5620 if (NULL == pMac)
5621 {
5622 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5623 "%s: pMac is null", __func__);
5624 return status;
5625 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305626 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305627
5628 return status;
5629}
Mihir Shete04206452014-11-20 17:50:58 +05305630#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305631
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305632/* ---------------------------------------------------------------------------
5633
5634 \fn sme_DHCPStartInd
5635
5636 \brief API to signal the FW about the DHCP Start event.
5637
5638 \param hHal - HAL handle for device.
5639
5640 \param device_mode - mode(AP,SAP etc) of the device.
5641
5642 \param macAddr - MAC address of the device.
5643
5644 \return eHalStatus SUCCESS.
5645
5646 FAILURE or RESOURCES The API finished and failed.
5647 --------------------------------------------------------------------------*/
5648eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5649 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305650 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305651{
5652 eHalStatus status;
5653 VOS_STATUS vosStatus;
5654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5655 vos_msg_t vosMessage;
5656 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305657 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305658
5659 status = sme_AcquireGlobalLock(&pMac->sme);
5660 if ( eHAL_STATUS_SUCCESS == status)
5661 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305662 pSession = CSR_GET_SESSION( pMac, sessionId );
5663
5664 if (!pSession)
5665 {
5666 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5667 sme_ReleaseGlobalLock( &pMac->sme );
5668 return eHAL_STATUS_FAILURE;
5669 }
5670
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305671 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5672 if (NULL == pMsg)
5673 {
5674 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5675 "%s: Not able to allocate memory for dhcp start", __func__);
5676 sme_ReleaseGlobalLock( &pMac->sme );
5677 return eHAL_STATUS_FAILURE;
5678 }
5679 pMsg->msgType = WDA_DHCP_START_IND;
5680 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5681 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305682 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5683 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305684 vosMessage.type = WDA_DHCP_START_IND;
5685 vosMessage.bodyptr = pMsg;
5686 vosMessage.reserved = 0;
5687
5688 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5689 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5690 {
5691 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5692 "%s: Post DHCP Start MSG fail", __func__);
5693 vos_mem_free(pMsg);
5694 status = eHAL_STATUS_FAILURE;
5695 }
5696 sme_ReleaseGlobalLock( &pMac->sme );
5697 }
5698 return (status);
5699}
5700/* ---------------------------------------------------------------------------
5701 \fn sme_DHCPStopInd
5702
5703 \brief API to signal the FW about the DHCP complete event.
5704
5705 \param hHal - HAL handle for device.
5706
5707 \param device_mode - mode(AP, SAP etc) of the device.
5708
5709 \param macAddr - MAC address of the device.
5710
5711 \return eHalStatus SUCCESS.
5712 FAILURE or RESOURCES The API finished and failed.
5713 --------------------------------------------------------------------------*/
5714eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5715 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305716 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305717{
5718 eHalStatus status;
5719 VOS_STATUS vosStatus;
5720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5721 vos_msg_t vosMessage;
5722 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305723 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305724
5725 status = sme_AcquireGlobalLock(&pMac->sme);
5726 if ( eHAL_STATUS_SUCCESS == status)
5727 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305728 pSession = CSR_GET_SESSION( pMac, sessionId );
5729
5730 if (!pSession)
5731 {
5732 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5733 sme_ReleaseGlobalLock( &pMac->sme );
5734 return eHAL_STATUS_FAILURE;
5735 }
5736
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305737 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5738 if (NULL == pMsg)
5739 {
5740 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5741 "%s: Not able to allocate memory for dhcp stop", __func__);
5742 sme_ReleaseGlobalLock( &pMac->sme );
5743 return eHAL_STATUS_FAILURE;
5744 }
5745
5746 pMsg->msgType = WDA_DHCP_STOP_IND;
5747 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5748 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305749 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5750 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305751
5752 vosMessage.type = WDA_DHCP_STOP_IND;
5753 vosMessage.bodyptr = pMsg;
5754 vosMessage.reserved = 0;
5755
5756 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5757 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5758 {
5759 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5760 "%s: Post DHCP Stop MSG fail", __func__);
5761 vos_mem_free(pMsg);
5762 status = eHAL_STATUS_FAILURE;
5763 }
5764
5765 sme_ReleaseGlobalLock( &pMac->sme );
5766 }
5767 return (status);
5768}
5769
Jeff Johnson295189b2012-06-20 16:38:30 -07005770
5771/* ---------------------------------------------------------------------------
5772 \fn sme_BtcSignalBtEvent
5773 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5774 BT event type and the current operating mode of Libra (full power,
5775 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5776 would be employed.
5777 \param hHal - The handle returned by macOpen.
5778 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5779 Caller owns the memory and is responsible for freeing it.
5780 \return VOS_STATUS
5781 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5782 if BTC execution mode is set to BTC_WLAN_ONLY
5783 or BTC_PTA_ONLY.
5784 VOS_STATUS_SUCCESS BT Event passed to HAL
5785 ---------------------------------------------------------------------------*/
5786VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5787{
5788 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005789
Jeff Johnson295189b2012-06-20 16:38:30 -07005790#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5791 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5792
Katya Nigambcb705f2013-12-26 14:26:22 +05305793 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005794 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005795 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5796 {
5797 status = btcSignalBTEvent (hHal, pBtEvent);
5798 sme_ReleaseGlobalLock( &pMac->sme );
5799 }
5800#endif
5801 return (status);
5802}
5803
5804/* ---------------------------------------------------------------------------
5805 \fn sme_BtcSetConfig
5806 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5807 This function should be invoked only after CFG download has completed.
5808 Calling it after sme_HDDReadyInd is recommended.
5809 \param hHal - The handle returned by macOpen.
5810 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5811 Caller owns the memory and is responsible for freeing it.
5812 \return VOS_STATUS
5813 VOS_STATUS_E_FAILURE Config not passed to HAL.
5814 VOS_STATUS_SUCCESS Config passed to HAL
5815 ---------------------------------------------------------------------------*/
5816VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5817{
5818 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5819#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305821 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005822 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005823 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5824 {
5825 status = btcSetConfig (hHal, pSmeBtcConfig);
5826 sme_ReleaseGlobalLock( &pMac->sme );
5827 }
5828#endif
5829 return (status);
5830}
5831
5832/* ---------------------------------------------------------------------------
5833 \fn sme_BtcGetConfig
5834 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5835 \param hHal - The handle returned by macOpen.
5836 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5837 tSmeBtcConfig. Caller owns the memory and is responsible
5838 for freeing it.
5839 \return VOS_STATUS
5840 VOS_STATUS_E_FAILURE - failure
5841 VOS_STATUS_SUCCESS success
5842 ---------------------------------------------------------------------------*/
5843VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5844{
5845 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5846#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5847 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5848
Katya Nigambcb705f2013-12-26 14:26:22 +05305849 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005850 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5852 {
5853 status = btcGetConfig (hHal, pSmeBtcConfig);
5854 sme_ReleaseGlobalLock( &pMac->sme );
5855 }
5856#endif
5857 return (status);
5858}
5859/* ---------------------------------------------------------------------------
5860 \fn sme_SetCfgPrivacy
5861 \brief API to set configure privacy parameters
5862 \param hHal - The handle returned by macOpen.
5863 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005864 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005865
5866 \return void
5867 ---------------------------------------------------------------------------*/
5868void sme_SetCfgPrivacy( tHalHandle hHal,
5869 tCsrRoamProfile *pProfile,
5870 tANI_BOOLEAN fPrivacy
5871 )
5872{
5873 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305874 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005875 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5877 {
5878 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5879 sme_ReleaseGlobalLock( &pMac->sme );
5880 }
5881}
5882
5883#if defined WLAN_FEATURE_VOWIFI
5884/* ---------------------------------------------------------------------------
5885 \fn sme_NeighborReportRequest
5886 \brief API to request neighbor report.
5887 \param hHal - The handle returned by macOpen.
5888 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5889 tRrmNeighborReq. Caller owns the memory and is responsible
5890 for freeing it.
5891 \return VOS_STATUS
5892 VOS_STATUS_E_FAILURE - failure
5893 VOS_STATUS_SUCCESS success
5894 ---------------------------------------------------------------------------*/
5895VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5896 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5897{
5898 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305900 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005901 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005902
5903 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5904 {
5905 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5906 sme_ReleaseGlobalLock( &pMac->sme );
5907 }
5908
5909 return (status);
5910}
5911#endif
5912
5913//The following are debug APIs to support direct read/write register/memory
5914//They are placed in SME because HW cannot be access when in LOW_POWER state
5915//AND not connected. The knowledge and synchronization is done in SME
5916
5917//sme_DbgReadRegister
5918//Caller needs to validate the input values
5919VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5920{
5921 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5922 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 tPmcPowerState PowerState;
5924 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305925 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005926 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005927
5928 /* 1) To make Quarky work in FTM mode **************************************/
5929
5930 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5931 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005932 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005933 {
5934 return VOS_STATUS_SUCCESS;
5935 }
5936 return VOS_STATUS_E_FAILURE;
5937 }
5938
5939 /* 2) NON FTM mode driver *************************************************/
5940
5941 /* Acquire SME global lock */
5942 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5943 {
5944 return VOS_STATUS_E_FAILURE;
5945 }
5946
5947 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5948 {
5949 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5950 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5951 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005952 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 {
5954 status = VOS_STATUS_SUCCESS;
5955 }
5956 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005957 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005958 status = VOS_STATUS_E_FAILURE;
5959 }
5960 }
5961 else
5962 {
5963 status = VOS_STATUS_E_FAILURE;
5964 }
5965 }
5966
5967 /* This is a hack for Qualky/pttWniSocket
5968 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5969 if ( VOS_STATUS_SUCCESS != status )
5970 {
5971 *pRegValue = 0xDEADBEEF;
5972 status = VOS_STATUS_SUCCESS;
5973 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005974
Jeff Johnson295189b2012-06-20 16:38:30 -07005975 /* Release SME global lock */
5976 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005977
Jeff Johnson295189b2012-06-20 16:38:30 -07005978 return (status);
5979}
5980
5981
5982//sme_DbgWriteRegister
5983//Caller needs to validate the input values
5984VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5985{
5986 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5987 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005988 tPmcPowerState PowerState;
5989 tANI_U32 sessionId = 0;
5990
5991 /* 1) To make Quarky work in FTM mode **************************************/
5992
Katya Nigambcb705f2013-12-26 14:26:22 +05305993 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005994 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5996 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005997 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005998 {
5999 return VOS_STATUS_SUCCESS;
6000 }
6001 return VOS_STATUS_E_FAILURE;
6002 }
6003
6004 /* 2) NON FTM mode driver *************************************************/
6005
6006 /* Acquire SME global lock */
6007 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6008 {
6009 return VOS_STATUS_E_FAILURE;
6010 }
6011
6012 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6013 {
6014 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6015 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6016 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006017 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006018 {
6019 status = VOS_STATUS_SUCCESS;
6020 }
6021 else
6022 {
6023 status = VOS_STATUS_E_FAILURE;
6024 }
6025 }
6026 else
6027 {
6028 status = VOS_STATUS_E_FAILURE;
6029 }
6030 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006031
Jeff Johnson295189b2012-06-20 16:38:30 -07006032 /* Release SME global lock */
6033 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006034
Jeff Johnson295189b2012-06-20 16:38:30 -07006035 return (status);
6036}
6037
6038
6039
6040//sme_DbgReadMemory
6041//Caller needs to validate the input values
6042//pBuf caller allocated buffer has the length of nLen
6043VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6044{
6045 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006047 tPmcPowerState PowerState;
6048 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006049 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6050 tANI_U32 arg1 = memAddr;
6051 tANI_U32 arg2 = nLen/4;
6052 tANI_U32 arg3 = 4;
6053 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006054 /* 1) To make Quarky work in FTM mode **************************************/
6055
Katya Nigambcb705f2013-12-26 14:26:22 +05306056 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006057 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006058 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6059 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306060 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006061 {
6062 return VOS_STATUS_SUCCESS;
6063 }
6064 return VOS_STATUS_E_FAILURE;
6065 }
6066
6067 /* 2) NON FTM mode driver *************************************************/
6068
6069 /* Acquire SME global lock */
6070 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6071 {
6072 return VOS_STATUS_E_FAILURE;
6073 }
6074
6075 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6076 {
6077 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6078 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6079 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306080 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006081 {
6082 status = VOS_STATUS_SUCCESS;
6083 }
6084 else
6085 {
6086 status = VOS_STATUS_E_FAILURE;
6087 }
6088 }
6089 else
6090 {
6091 status = VOS_STATUS_E_FAILURE;
6092 }
6093 }
6094
6095 /* This is a hack for Qualky/pttWniSocket
6096 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6097 if (VOS_STATUS_SUCCESS != status)
6098 {
6099 vos_mem_set(pBuf, nLen, 0xCD);
6100 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006101 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006102 }
6103
6104 /* Release SME lock */
6105 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006106
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 return (status);
6108}
6109
6110
6111//sme_DbgWriteMemory
6112//Caller needs to validate the input values
6113VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6114{
6115 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6116 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006117 tPmcPowerState PowerState;
6118 tANI_U32 sessionId = 0;
6119
6120 /* 1) To make Quarky work in FTM mode **************************************/
6121
Katya Nigambcb705f2013-12-26 14:26:22 +05306122 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006123 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006124 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6125 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 {
6127 return VOS_STATUS_SUCCESS;
6128 }
6129 return VOS_STATUS_E_FAILURE;
6130 }
6131
6132 /* 2) NON FTM mode driver *************************************************/
6133
6134 /* Acquire SME global lock */
6135 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6136 {
6137 return VOS_STATUS_E_FAILURE;
6138 }
6139
6140 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6141 {
6142 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6143 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6144 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006145 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006146 {
6147 status = VOS_STATUS_SUCCESS;
6148 }
6149 else
6150 {
6151 status = VOS_STATUS_E_FAILURE;
6152 }
6153 }
6154 else
6155 {
6156 status = VOS_STATUS_E_FAILURE;
6157 }
6158 }
6159
6160 /* Release Global lock */
6161 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006162
Jeff Johnson295189b2012-06-20 16:38:30 -07006163 return (status);
6164}
6165
6166
Katya Nigam70d68332013-09-16 16:49:45 +05306167void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6168{
6169 VOS_TRACE_LEVEL vosDebugLevel;
6170 char logBuffer[LOG_SIZE];
6171 va_list marker;
6172
6173 /* getting proper Debug level */
6174 vosDebugLevel = getVosDebugLevel(loglevel);
6175
6176 /* extracting arguments from pstring */
6177 va_start( marker, pString );
6178 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6179
6180 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6181 va_end( marker );
6182}
6183
6184
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006185void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006186{
6187#ifdef WLAN_DEBUG
6188 // Verify against current log level
6189 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6190 return;
6191 else
6192 {
6193 va_list marker;
6194
6195 va_start( marker, pString ); /* Initialize variable arguments. */
6196
6197 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6198
6199 va_end( marker ); /* Reset variable arguments. */
6200 }
6201#endif
6202}
Jeff Johnson295189b2012-06-20 16:38:30 -07006203
Jeff Johnson295189b2012-06-20 16:38:30 -07006204/* ---------------------------------------------------------------------------
6205 \fn sme_GetWcnssWlanCompiledVersion
6206 \brief This API returns the version of the WCNSS WLAN API with
6207 which the HOST driver was built
6208 \param hHal - The handle returned by macOpen.
6209 \param pVersion - Points to the Version structure to be filled
6210 \return VOS_STATUS
6211 VOS_STATUS_E_INVAL - failure
6212 VOS_STATUS_SUCCESS success
6213 ---------------------------------------------------------------------------*/
6214VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6215 tSirVersionType *pVersion)
6216{
6217 VOS_STATUS status = VOS_STATUS_SUCCESS;
6218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6219 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6220
6221 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6222 {
6223 if( pVersion != NULL )
6224 {
6225 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6226 }
6227 else
6228 {
6229 status = VOS_STATUS_E_INVAL;
6230 }
6231 sme_ReleaseGlobalLock( &pMac->sme );
6232 }
6233
6234 return (status);
6235}
6236
6237
6238/* ---------------------------------------------------------------------------
6239 \fn sme_GetWcnssWlanReportedVersion
6240 \brief This API returns the version of the WCNSS WLAN API with
6241 which the WCNSS driver reports it was built
6242 \param hHal - The handle returned by macOpen.
6243 \param pVersion - Points to the Version structure to be filled
6244 \return VOS_STATUS
6245 VOS_STATUS_E_INVAL - failure
6246 VOS_STATUS_SUCCESS success
6247 ---------------------------------------------------------------------------*/
6248VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6249 tSirVersionType *pVersion)
6250{
6251 VOS_STATUS status = VOS_STATUS_SUCCESS;
6252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6253 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6254
6255 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6256 {
6257 if( pVersion != NULL )
6258 {
6259 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6260 }
6261 else
6262 {
6263 status = VOS_STATUS_E_INVAL;
6264 }
6265 sme_ReleaseGlobalLock( &pMac->sme );
6266 }
6267
6268 return (status);
6269}
6270
6271
6272/* ---------------------------------------------------------------------------
6273 \fn sme_GetWcnssSoftwareVersion
6274 \brief This API returns the version string of the WCNSS driver
6275 \param hHal - The handle returned by macOpen.
6276 \param pVersion - Points to the Version string buffer to be filled
6277 \param versionBufferSize - THe size of the Version string buffer
6278 \return VOS_STATUS
6279 VOS_STATUS_E_INVAL - failure
6280 VOS_STATUS_SUCCESS success
6281 ---------------------------------------------------------------------------*/
6282VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6283 tANI_U8 *pVersion,
6284 tANI_U32 versionBufferSize)
6285{
6286 VOS_STATUS status = VOS_STATUS_SUCCESS;
6287 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6288 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6289
6290 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6291 {
6292 if( pVersion != NULL )
6293 {
6294 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6295 versionBufferSize);
6296 }
6297 else
6298 {
6299 status = VOS_STATUS_E_INVAL;
6300 }
6301 sme_ReleaseGlobalLock( &pMac->sme );
6302 }
6303
6304 return (status);
6305}
6306
6307
6308/* ---------------------------------------------------------------------------
6309 \fn sme_GetWcnssHardwareVersion
6310 \brief This API returns the version string of the WCNSS hardware
6311 \param hHal - The handle returned by macOpen.
6312 \param pVersion - Points to the Version string buffer to be filled
6313 \param versionBufferSize - THe size of the Version string buffer
6314 \return VOS_STATUS
6315 VOS_STATUS_E_INVAL - failure
6316 VOS_STATUS_SUCCESS success
6317 ---------------------------------------------------------------------------*/
6318VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6319 tANI_U8 *pVersion,
6320 tANI_U32 versionBufferSize)
6321{
6322 VOS_STATUS status = VOS_STATUS_SUCCESS;
6323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6324 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6325
6326 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6327 {
6328 if( pVersion != NULL )
6329 {
6330 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6331 versionBufferSize);
6332 }
6333 else
6334 {
6335 status = VOS_STATUS_E_INVAL;
6336 }
6337 sme_ReleaseGlobalLock( &pMac->sme );
6338 }
6339
6340 return (status);
6341}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006342
Jeff Johnson295189b2012-06-20 16:38:30 -07006343
6344#ifdef FEATURE_WLAN_WAPI
6345/* ---------------------------------------------------------------------------
6346 \fn sme_RoamSetBKIDCache
6347 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6348 candidate list.
6349 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6350 it is opened (by calling halOpen).
6351 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6352 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6353 when retruning, this is the number of items put into pBKIDCache
6354 \return eHalStatus - when fail, it usually means the buffer allocated is not
6355 big enough and pNumItems has the number of tBkidCacheInfo.
6356 ---------------------------------------------------------------------------*/
6357eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6358 tANI_U32 numItems )
6359{
6360 eHalStatus status = eHAL_STATUS_FAILURE;
6361 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6362
6363 status = sme_AcquireGlobalLock( &pMac->sme );
6364 if ( HAL_STATUS_SUCCESS( status ) )
6365 {
6366 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6367 sme_ReleaseGlobalLock( &pMac->sme );
6368 }
6369
6370 return (status);
6371}
6372
6373/* ---------------------------------------------------------------------------
6374 \fn sme_RoamGetBKIDCache
6375 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6376 BKID cache.
6377 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6378 it is opened (by calling halOpen).
6379 \param pNum - caller allocated memory that has the space of the number of
6380 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6381 in SME cache.
6382 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6383 upon return
6384 \return eHalStatus - when fail, it usually means the buffer allocated is not
6385 big enough.
6386 ---------------------------------------------------------------------------*/
6387eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6388 tBkidCacheInfo *pBkidCache)
6389{
6390 eHalStatus status = eHAL_STATUS_FAILURE;
6391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6392
6393 status = sme_AcquireGlobalLock( &pMac->sme );
6394 if ( HAL_STATUS_SUCCESS( status ) )
6395 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006396 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006397 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6398 sme_ReleaseGlobalLock( &pMac->sme );
6399 }
6400
6401 return (status);
6402}
6403
6404/* ---------------------------------------------------------------------------
6405 \fn sme_RoamGetNumBKIDCache
6406 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6407 number of BKID cache entries.
6408 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6409 it is opened (by calling halOpen).
6410 \return tANI_U32 - the number of BKID cache entries.
6411 ---------------------------------------------------------------------------*/
6412tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6413{
6414 eHalStatus status = eHAL_STATUS_FAILURE;
6415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6416 tANI_U32 numBkidCache = 0;
6417
6418 status = sme_AcquireGlobalLock( &pMac->sme );
6419 if ( HAL_STATUS_SUCCESS( status ) )
6420 {
6421 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6422 sme_ReleaseGlobalLock( &pMac->sme );
6423 }
6424
6425 return (numBkidCache);
6426}
6427
6428/* ---------------------------------------------------------------------------
6429 \fn sme_ScanGetBKIDCandidateList
6430 \brief a wrapper function to return the BKID candidate list
6431 \param pBkidList - caller allocated buffer point to an array of
6432 tBkidCandidateInfo
6433 \param pNumItems - pointer to a variable that has the number of
6434 tBkidCandidateInfo allocated when retruning, this is
6435 either the number needed or number of items put into
6436 pPmkidList
6437 \return eHalStatus - when fail, it usually means the buffer allocated is not
6438 big enough and pNumItems
6439 has the number of tBkidCandidateInfo.
6440 \Note: pNumItems is a number of tBkidCandidateInfo,
6441 not sizeof(tBkidCandidateInfo) * something
6442 ---------------------------------------------------------------------------*/
6443eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6444 tBkidCandidateInfo *pBkidList,
6445 tANI_U32 *pNumItems )
6446{
6447 eHalStatus status = eHAL_STATUS_FAILURE;
6448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6449
6450 status = sme_AcquireGlobalLock( &pMac->sme );
6451 if ( HAL_STATUS_SUCCESS( status ) )
6452 {
6453 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6454 sme_ReleaseGlobalLock( &pMac->sme );
6455 }
6456
6457 return (status);
6458}
6459#endif /* FEATURE_WLAN_WAPI */
6460
Jeff Johnsone7245742012-09-05 17:12:55 -07006461#ifdef FEATURE_OEM_DATA_SUPPORT
6462
6463/*****************************************************************************
6464 OEM DATA related modifications and function additions
6465 *****************************************************************************/
6466
6467/* ---------------------------------------------------------------------------
6468 \fn sme_getOemDataRsp
6469 \brief a wrapper function to obtain the OEM DATA RSP
6470 \param pOemDataRsp - A pointer to the response object
6471 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006472 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006473 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006474eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006475 tOemDataRsp **pOemDataRsp)
6476{
6477 eHalStatus status = eHAL_STATUS_SUCCESS;
6478 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6479
6480 do
6481 {
6482 //acquire the lock for the sme object
6483 status = sme_AcquireGlobalLock(&pMac->sme);
6484
6485 if(!HAL_STATUS_SUCCESS(status))
6486 {
6487 break;
6488 }
6489
6490 if(pMac->oemData.pOemDataRsp != NULL)
6491 {
6492 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6493 }
6494 else
6495 {
6496 status = eHAL_STATUS_FAILURE;
6497 }
6498
6499 //release the lock for the sme object
6500 sme_ReleaseGlobalLock( &pMac->sme );
6501
6502 } while(0);
6503
6504 return status;
6505}
6506
6507/* ---------------------------------------------------------------------------
6508 \fn sme_OemDataReq
6509 \brief a wrapper function for OEM DATA REQ
6510 \param sessionId - session id to be used.
6511 \param pOemDataReqId - pointer to an object to get back the request ID
6512 \param callback - a callback function that is called upon finish
6513 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006514 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006515 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006516eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006517 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006518 tOemDataReqConfig *pOemDataReqConfig,
6519 tANI_U32 *pOemDataReqID,
6520 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006521 void *pContext)
6522{
6523 eHalStatus status = eHAL_STATUS_SUCCESS;
6524 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6525
6526 do
6527 {
6528 //acquire the lock for the sme object
6529 status = sme_AcquireGlobalLock(&pMac->sme);
6530 if(HAL_STATUS_SUCCESS(status))
6531 {
6532 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6533
6534 if(pOemDataReqID)
6535 {
6536 *pOemDataReqID = lOemDataReqId;
6537 }
6538 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006539 {
6540 sme_ReleaseGlobalLock( &pMac->sme );
6541 return eHAL_STATUS_FAILURE;
6542 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006543
6544 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6545
6546 //release the lock for the sme object
6547 sme_ReleaseGlobalLock( &pMac->sme );
6548 }
6549 } while(0);
6550
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006551 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006552
6553 return(status);
6554}
6555
6556#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006557
6558/*--------------------------------------------------------------------------
6559
6560 \brief sme_OpenSession() - Open a session for scan/roam operation.
6561
6562 This is a synchronous API.
6563
6564
6565 \param hHal - The handle returned by macOpen.
6566 \param callback - A pointer to the function caller specifies for roam/connect status indication
6567 \param pContext - The context passed with callback
6568 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6569 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6570
6571 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6572
6573 Other status means SME is failed to open the session.
6574 eHAL_STATUS_RESOURCES - no more session available.
6575 \sa
6576
6577 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006578eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6579 void *pContext, tANI_U8 *pSelfMacAddr,
6580 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006581{
6582 eHalStatus status;
6583 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6584
6585 if( NULL == pbSessionId )
6586 {
6587 status = eHAL_STATUS_INVALID_PARAMETER;
6588 }
6589 else
6590 {
6591 status = sme_AcquireGlobalLock( &pMac->sme );
6592 if ( HAL_STATUS_SUCCESS( status ) )
6593 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006594 status = csrRoamOpenSession(pMac, callback, pContext,
6595 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006596
6597 sme_ReleaseGlobalLock( &pMac->sme );
6598 }
6599 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006600 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306601 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006602 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006603
6604 return ( status );
6605}
6606
6607
6608/*--------------------------------------------------------------------------
6609
6610 \brief sme_CloseSession() - Open a session for scan/roam operation.
6611
6612 This is a synchronous API.
6613
6614
6615 \param hHal - The handle returned by macOpen.
6616
6617 \param sessionId - A previous opened session's ID.
6618
6619 \return eHAL_STATUS_SUCCESS - session is closed.
6620
6621 Other status means SME is failed to open the session.
6622 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6623 \sa
6624
6625 --------------------------------------------------------------------------*/
6626eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6627 csrRoamSessionCloseCallback callback, void *pContext)
6628{
6629 eHalStatus status;
6630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6631
Katya Nigambcb705f2013-12-26 14:26:22 +05306632 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006633 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 status = sme_AcquireGlobalLock( &pMac->sme );
6635 if ( HAL_STATUS_SUCCESS( status ) )
6636 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006637 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006638 callback, pContext );
6639
6640 sme_ReleaseGlobalLock( &pMac->sme );
6641 }
6642
6643 return ( status );
6644}
6645
Jeff Johnson295189b2012-06-20 16:38:30 -07006646/* ---------------------------------------------------------------------------
6647
6648 \fn sme_RoamUpdateAPWPSIE
6649
6650 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6651 This is an asynchronous API.
6652
6653 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6654
6655 \return eHalStatus – SUCCESS –
6656
6657 FAILURE or RESOURCES – The API finished and failed.
6658
6659 -------------------------------------------------------------------------------*/
6660eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6661{
6662
6663 eHalStatus status = eHAL_STATUS_FAILURE;
6664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6665
6666 status = sme_AcquireGlobalLock( &pMac->sme );
6667 if ( HAL_STATUS_SUCCESS( status ) )
6668 {
6669
6670 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6671
6672 sme_ReleaseGlobalLock( &pMac->sme );
6673 }
6674
6675 return (status);
6676}
6677/* ---------------------------------------------------------------------------
6678
6679 \fn sme_RoamUpdateAPWPARSNIEs
6680
6681 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6682 This is an asynchronous API.
6683
6684 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6685
6686 \return eHalStatus – SUCCESS –
6687
6688 FAILURE or RESOURCES – The API finished and failed.
6689
6690 -------------------------------------------------------------------------------*/
6691eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6692{
6693
6694 eHalStatus status = eHAL_STATUS_FAILURE;
6695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6696
6697 status = sme_AcquireGlobalLock( &pMac->sme );
6698 if ( HAL_STATUS_SUCCESS( status ) )
6699 {
6700
6701 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6702
6703 sme_ReleaseGlobalLock( &pMac->sme );
6704 }
6705
6706 return (status);
6707}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006708/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006709
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006710 \fn sme_ChangeMCCBeaconInterval
6711
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006712 \brief To update P2P-GO beaconInterval. This function should be called after
6713 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006714 This is an asynchronous API.
6715
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006716 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006717
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006718 \return eHalStatus SUCCESS
6719 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006720 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006721
6722 -------------------------------------------------------------------------------*/
6723eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6724{
6725 eHalStatus status = eHAL_STATUS_FAILURE;
6726 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6727
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006728 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006729 status = sme_AcquireGlobalLock( &pMac->sme );
6730 if ( HAL_STATUS_SUCCESS( status ) )
6731 {
6732 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6733 sme_ReleaseGlobalLock( &pMac->sme );
6734 }
6735 return (status);
6736}
Jeff Johnson295189b2012-06-20 16:38:30 -07006737
6738/*-------------------------------------------------------------------------------*
6739
6740 \fn sme_sendBTAmpEvent
6741
6742 \brief to receive the coex priorty request from BT-AMP PAL
6743 and send the BT_AMP link state to HAL
6744
6745 \param btAmpEvent - btAmpEvent
6746
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006747 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006748
6749 FAILURE: API failed
6750
6751-------------------------------------------------------------------------------*/
6752
6753eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6754{
6755 vos_msg_t msg;
6756 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6757 eHalStatus status = eHAL_STATUS_FAILURE;
6758
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006759 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 if (NULL == ptrSmeBtAmpEvent)
6761 {
6762 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006763 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006764 return status;
6765 }
6766
6767 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6768 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6769 msg.reserved = 0;
6770 msg.bodyptr = ptrSmeBtAmpEvent;
6771
6772 //status = halFW_SendBTAmpEventMesg(pMac, event);
6773
6774 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6775 {
6776 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006777 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006778 vos_mem_free(ptrSmeBtAmpEvent);
6779 return status;
6780 }
6781
6782 return eHAL_STATUS_SUCCESS;
6783
6784}
6785
6786/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306787 \fn smeIssueFastRoamNeighborAPEvent
6788 \brief API to trigger fast BSS roam independent of RSSI triggers
6789 \param hHal - The handle returned by macOpen.
6790 \param bssid - Pointer to the BSSID to roam to.
6791 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306792 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306793 \return eHalStatus
6794 ---------------------------------------------------------------------------*/
6795eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6796 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306797 tSmeFastRoamTrigger fastRoamTrig,
6798 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306799{
6800 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6801 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6802 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6803 eHalStatus status = eHAL_STATUS_SUCCESS;
6804
6805 status = sme_AcquireGlobalLock( &pMac->sme );
6806 if ( HAL_STATUS_SUCCESS( status ) )
6807 {
6808 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6809 "%s: invoked", __func__);
6810
6811 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6812 {
6813 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6814 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6815 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6816 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306817 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08006818 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306819 /*
6820 * As FastReassoc is based on assumption that roamable AP should be
6821 * present into the occupied channel list.We shd add i/p channel
6822 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
6823 * aged out prior to connection and there is no scan from aged out
6824 * to till connection indication.
6825 */
6826 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306827 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6828 if (VOS_STATUS_SUCCESS != vosStatus)
6829 {
6830 smsLog(pMac, LOGE,
6831 FL("CFG Channel list scan state failed with status %d "),
6832 vosStatus);
6833 }
6834 }
6835 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6836 {
6837 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6838 (void *)bssid, sizeof(tSirMacAddr));
6839 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006840 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6841 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306842
6843 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6844 0,
6845 pMac,
6846 0);
6847
6848 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6849 {
6850 smsLog(pMac,
6851 LOGE,
6852 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6853 vosStatus);
6854 }
6855 }
6856 sme_ReleaseGlobalLock( &pMac->sme );
6857 }
6858 return vosStatus;
6859}
6860/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006861 \fn sme_SetHostOffload
6862 \brief API to set the host offload feature.
6863 \param hHal - The handle returned by macOpen.
6864 \param pRequest - Pointer to the offload request.
6865 \return eHalStatus
6866 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006867eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006868 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006869{
6870 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006871 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006872
Katya Nigambcb705f2013-12-26 14:26:22 +05306873 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006874 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006875 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6876 {
6877#ifdef WLAN_NS_OFFLOAD
6878 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6879 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006880 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006881 }
6882 else
6883#endif //WLAN_NS_OFFLOAD
6884 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006885 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006886 }
6887 sme_ReleaseGlobalLock( &pMac->sme );
6888 }
6889
6890 return (status);
6891}
6892
6893#ifdef WLAN_FEATURE_GTK_OFFLOAD
6894/* ---------------------------------------------------------------------------
6895 \fn sme_SetGTKOffload
6896 \brief API to set GTK offload information.
6897 \param hHal - The handle returned by macOpen.
6898 \param pRequest - Pointer to the GTK offload request.
6899 \return eHalStatus
6900 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006901eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006902 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006903{
6904 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6905 eHalStatus status;
6906
Katya Nigambcb705f2013-12-26 14:26:22 +05306907 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006908 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006909 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6910 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006911 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006912 sme_ReleaseGlobalLock( &pMac->sme );
6913 }
6914
6915 return (status);
6916}
6917
6918/* ---------------------------------------------------------------------------
6919 \fn sme_GetGTKOffload
6920 \brief API to get GTK offload information.
6921 \param hHal - The handle returned by macOpen.
6922 \param pRequest - Pointer to the GTK offload response.
6923 \return eHalStatus
6924 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006925eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006926 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006927{
6928 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6929 eHalStatus status;
6930
Katya Nigambcb705f2013-12-26 14:26:22 +05306931 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006932 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006933 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6934 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006935 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006936 sme_ReleaseGlobalLock( &pMac->sme );
6937 }
6938
6939 return (status);
6940}
6941#endif // WLAN_FEATURE_GTK_OFFLOAD
6942
6943/* ---------------------------------------------------------------------------
6944 \fn sme_SetKeepAlive
6945 \brief API to set the Keep Alive feature.
6946 \param hHal - The handle returned by macOpen.
6947 \param pRequest - Pointer to the Keep Alive request.
6948 \return eHalStatus
6949 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006950eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006951 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006952{
6953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6954 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006955 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6956 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006957 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006958 sme_ReleaseGlobalLock( &pMac->sme );
6959 }
6960
6961 return (status);
6962}
6963
6964#ifdef FEATURE_WLAN_SCAN_PNO
6965/* ---------------------------------------------------------------------------
6966 \fn sme_SetPreferredNetworkList
6967 \brief API to set the Preferred Network List Offload feature.
6968 \param hHal - The handle returned by macOpen.
6969 \param pRequest - Pointer to the offload request.
6970 \return eHalStatus
6971 ---------------------------------------------------------------------------*/
6972eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6973{
6974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6975 eHalStatus status;
6976
6977 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6978 {
6979 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6980 sme_ReleaseGlobalLock( &pMac->sme );
6981 }
6982
6983 return (status);
6984}
6985
6986eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6987{
6988 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6989 eHalStatus status;
6990
6991 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6992 {
6993 pmcSetRssiFilter(hHal, rssiThreshold);
6994 sme_ReleaseGlobalLock( &pMac->sme );
6995 }
6996
6997 return (status);
6998}
6999
7000#endif // FEATURE_WLAN_SCAN_PNO
7001
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007002eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007003{
7004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7005 eHalStatus status;
7006
Katya Nigambcb705f2013-12-26 14:26:22 +05307007 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007008 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007009 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7010 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007011 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007012 sme_ReleaseGlobalLock( &pMac->sme );
7013 }
7014
7015 return (status);
7016}
7017
7018/* ---------------------------------------------------------------------------
7019 \fn sme_AbortMacScan
7020 \brief API to cancel MAC scan.
7021 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307022 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307023 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307024 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007025 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307026tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7027 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007028{
c_hpothua3d45d52015-01-05 14:11:17 +05307029 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 eHalStatus status;
7031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7032
Katya Nigambcb705f2013-12-26 14:26:22 +05307033 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007034 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007035 status = sme_AcquireGlobalLock( &pMac->sme );
7036 if ( HAL_STATUS_SUCCESS( status ) )
7037 {
c_hpothua3d45d52015-01-05 14:11:17 +05307038 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007039
Jeff Johnson295189b2012-06-20 16:38:30 -07007040 sme_ReleaseGlobalLock( &pMac->sme );
7041 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007042
c_hpothua3d45d52015-01-05 14:11:17 +05307043 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007044}
7045
7046/* ----------------------------------------------------------------------------
7047 \fn sme_GetOperationChannel
7048 \brief API to get current channel on which STA is parked
7049 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007050 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007051 \returns eHAL_STATUS_SUCCESS
7052 eHAL_STATUS_FAILURE
7053-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007054eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007055{
Jeff Johnson295189b2012-06-20 16:38:30 -07007056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7057 tCsrRoamSession *pSession;
7058
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007059 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007060 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007061 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007062
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007063 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007064 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007065 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007066 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7067 {
7068 *pChannel =pSession->connectedProfile.operationChannel;
7069 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007070 }
7071 }
7072 return eHAL_STATUS_FAILURE;
7073}// sme_GetOperationChannel ends here
7074
Jeff Johnson295189b2012-06-20 16:38:30 -07007075/* ---------------------------------------------------------------------------
7076
7077 \fn sme_RegisterMgtFrame
7078
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007079 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007080 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007081 \param matchData - data which needs to be matched before passing frame
7082 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007083 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007084 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007085 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007086eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007087 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7088{
7089 eHalStatus status = eHAL_STATUS_SUCCESS;
7090 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7091
Katya Nigambcb705f2013-12-26 14:26:22 +05307092 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007093 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007094 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7095 {
7096 tSirRegisterMgmtFrame *pMsg;
7097 tANI_U16 len;
7098 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007099
7100 if(!pSession)
7101 {
7102 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007103 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007104 return eHAL_STATUS_FAILURE;
7105 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007106
Jeff Johnson295189b2012-06-20 16:38:30 -07007107 if( !pSession->sessionActive )
7108 {
7109 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007110 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007111 sme_ReleaseGlobalLock( &pMac->sme );
7112 return eHAL_STATUS_FAILURE;
7113 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007114
Jeff Johnson295189b2012-06-20 16:38:30 -07007115 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7116
Kiet Lam64c1b492013-07-12 13:56:44 +05307117 pMsg = vos_mem_malloc(len);
7118 if ( NULL == pMsg )
7119 status = eHAL_STATUS_FAILURE;
7120 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007121 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307122 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007123 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7124 pMsg->length = len;
7125 pMsg->sessionId = sessionId;
7126 pMsg->registerFrame = VOS_TRUE;
7127 pMsg->frameType = frameType;
7128 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307129 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007130 status = palSendMBMessage(pMac->hHdd, pMsg);
7131 }
7132 sme_ReleaseGlobalLock( &pMac->sme );
7133 }
7134 return status;
7135}
7136
7137/* ---------------------------------------------------------------------------
7138
7139 \fn sme_DeregisterMgtFrame
7140
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007141 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007143 \param matchData - data which needs to be matched before passing frame
7144 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007146 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007147 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007148eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007149 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7150{
7151 eHalStatus status = eHAL_STATUS_SUCCESS;
7152 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7153
Katya Nigambcb705f2013-12-26 14:26:22 +05307154 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007155 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007156 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7157 {
7158 tSirRegisterMgmtFrame *pMsg;
7159 tANI_U16 len;
7160 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007161
7162 if(!pSession)
7163 {
7164 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007165 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007166 return eHAL_STATUS_FAILURE;
7167 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007168
7169 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007170 {
7171 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007172 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007173 sme_ReleaseGlobalLock( &pMac->sme );
7174 return eHAL_STATUS_FAILURE;
7175 }
7176
7177 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7178
Kiet Lam64c1b492013-07-12 13:56:44 +05307179 pMsg = vos_mem_malloc(len);
7180 if ( NULL == pMsg )
7181 status = eHAL_STATUS_FAILURE;
7182 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007183 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307184 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007185 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007186 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007187 pMsg->registerFrame = VOS_FALSE;
7188 pMsg->frameType = frameType;
7189 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307190 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007191 status = palSendMBMessage(pMac->hHdd, pMsg);
7192 }
7193 sme_ReleaseGlobalLock( &pMac->sme );
7194 }
7195 return status;
7196}
7197
7198/* ---------------------------------------------------------------------------
7199 \fn sme_RemainOnChannel
7200 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7201 \param hHal - The handle returned by macOpen.
7202 \param pRequest - channel
7203 \param duration - duration in ms
7204 \param callback - HDD registered callback to process reaminOnChannelRsp
7205 \param context - HDD Callback param
7206 \return eHalStatus
7207 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007208eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7209 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307210 remainOnChanCallback callback,
7211 void *pContext,
7212 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007213{
7214 eHalStatus status = eHAL_STATUS_SUCCESS;
7215 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7216
Katya Nigambcb705f2013-12-26 14:26:22 +05307217 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007218 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007219 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7220 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307221 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7222 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007223#ifdef WLAN_FEATURE_P2P_INTERNAL
7224 , eP2PRemainOnChnReasonUnknown
7225#endif
7226 );
7227 sme_ReleaseGlobalLock( &pMac->sme );
7228 }
7229 return(status);
7230}
7231
7232/* ---------------------------------------------------------------------------
7233 \fn sme_ReportProbeReq
7234 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7235 \param hHal - The handle returned by macOpen.
7236 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7237 \return eHalStatus
7238 ---------------------------------------------------------------------------*/
7239
7240#ifndef WLAN_FEATURE_CONCURRENT_P2P
7241eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7242{
7243 eHalStatus status = eHAL_STATUS_SUCCESS;
7244 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7245
7246 do
7247 {
7248 //acquire the lock for the sme object
7249 status = sme_AcquireGlobalLock(&pMac->sme);
7250 if(HAL_STATUS_SUCCESS(status))
7251 {
7252 /* call set in context */
7253 pMac->p2pContext.probeReqForwarding = flag;
7254 //release the lock for the sme object
7255 sme_ReleaseGlobalLock( &pMac->sme );
7256 }
7257 } while(0);
7258
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007259 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007260
7261 return(status);
7262}
7263
7264/* ---------------------------------------------------------------------------
7265 \fn sme_updateP2pIe
7266 \brief API to set the P2p Ie in p2p context
7267 \param hHal - The handle returned by macOpen.
7268 \param p2pIe - Ptr to p2pIe from HDD.
7269 \param p2pIeLength: length of p2pIe
7270 \return eHalStatus
7271 ---------------------------------------------------------------------------*/
7272
7273eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7274{
7275 eHalStatus status = eHAL_STATUS_SUCCESS;
7276 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7277
7278 //acquire the lock for the sme object
7279 status = sme_AcquireGlobalLock(&pMac->sme);
7280 if(HAL_STATUS_SUCCESS(status))
7281 {
7282 if(NULL != pMac->p2pContext.probeRspIe){
7283 vos_mem_free(pMac->p2pContext.probeRspIe);
7284 pMac->p2pContext.probeRspIeLength = 0;
7285 }
7286
7287 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7288 if (NULL == pMac->p2pContext.probeRspIe)
7289 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007290 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007291 pMac->p2pContext.probeRspIeLength = 0;
7292 status = eHAL_STATUS_FAILURE;
7293 }
7294 else
7295 {
7296 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7297
7298 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7299 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007300 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007301 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7302 p2pIeLength);
7303 }
7304
7305 //release the lock for the sme object
7306 sme_ReleaseGlobalLock( &pMac->sme );
7307 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007308
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007309 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007310
7311 return(status);
7312}
7313#endif
7314
7315/* ---------------------------------------------------------------------------
7316 \fn sme_sendAction
7317 \brief API to send action frame from supplicant.
7318 \param hHal - The handle returned by macOpen.
7319 \return eHalStatus
7320 ---------------------------------------------------------------------------*/
7321
7322eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007323 const tANI_U8 *pBuf, tANI_U32 len,
7324 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007325{
7326 eHalStatus status = eHAL_STATUS_SUCCESS;
7327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7328
Katya Nigambcb705f2013-12-26 14:26:22 +05307329 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007330 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007331 //acquire the lock for the sme object
7332 status = sme_AcquireGlobalLock(&pMac->sme);
7333 if(HAL_STATUS_SUCCESS(status))
7334 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007335 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007336 //release the lock for the sme object
7337 sme_ReleaseGlobalLock( &pMac->sme );
7338 }
7339
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007340 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007341
7342 return(status);
7343}
7344
7345eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7346{
7347 eHalStatus status = eHAL_STATUS_SUCCESS;
7348 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7349
Katya Nigambcb705f2013-12-26 14:26:22 +05307350 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007351 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007352 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7353 {
7354 status = p2pCancelRemainOnChannel (hHal, sessionId);
7355 sme_ReleaseGlobalLock( &pMac->sme );
7356 }
7357 return(status);
7358}
7359
7360//Power Save Related
7361eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7362{
7363 eHalStatus status = eHAL_STATUS_SUCCESS;
7364 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7365
7366 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7367 {
7368 status = p2pSetPs (hHal, data);
7369 sme_ReleaseGlobalLock( &pMac->sme );
7370 }
7371 return(status);
7372}
7373
Jeff Johnson295189b2012-06-20 16:38:30 -07007374
7375/* ---------------------------------------------------------------------------
7376
7377 \fn sme_ConfigureRxpFilter
7378
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007379 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007380 SME will pass this request to lower mac to set/reset the filter on RXP for
7381 multicast & broadcast traffic.
7382
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007383 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007384
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007385 hHal - The handle returned by macOpen.
7386
Jeff Johnson295189b2012-06-20 16:38:30 -07007387 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7388 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7389 on this param. In future we can use this as a mask to set various types of
7390 filters as suggested below:
7391 FILTER_ALL_MULTICAST:
7392 FILTER_ALL_BROADCAST:
7393 FILTER_ALL_MULTICAST_BROADCAST:
7394
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007395
7396 \return eHalStatus
7397
7398
Jeff Johnson295189b2012-06-20 16:38:30 -07007399--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007400eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007401 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7402{
7403 eHalStatus status = eHAL_STATUS_SUCCESS;
7404 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7405 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7406 vos_msg_t vosMessage;
7407
Katya Nigambcb705f2013-12-26 14:26:22 +05307408 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007409 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007410 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7411 {
7412 /* serialize the req through MC thread */
7413 vosMessage.bodyptr = wlanRxpFilterParam;
7414 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7415 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7416 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7417 {
7418 status = eHAL_STATUS_FAILURE;
7419 }
7420 sme_ReleaseGlobalLock( &pMac->sme );
7421 }
7422 return(status);
7423}
7424
Jeff Johnson295189b2012-06-20 16:38:30 -07007425/* ---------------------------------------------------------------------------
7426
7427 \fn sme_ConfigureSuspendInd
7428
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007429 \brief
7430 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007431 be suspended
7432
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007433 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007434
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007435 hHal - The handle returned by macOpen.
7436
Jeff Johnson295189b2012-06-20 16:38:30 -07007437 wlanSuspendParam- Depicts the wlan suspend params
7438
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007439
7440 \return eHalStatus
7441
7442
Jeff Johnson295189b2012-06-20 16:38:30 -07007443--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007444eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007445 tpSirWlanSuspendParam wlanSuspendParam)
7446{
7447 eHalStatus status = eHAL_STATUS_SUCCESS;
7448 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7449 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7450 vos_msg_t vosMessage;
7451
Katya Nigambcb705f2013-12-26 14:26:22 +05307452 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007453 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007454 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7455 {
7456 /* serialize the req through MC thread */
7457 vosMessage.bodyptr = wlanSuspendParam;
7458 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7459 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7460 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7461 {
7462 status = eHAL_STATUS_FAILURE;
7463 }
7464 sme_ReleaseGlobalLock( &pMac->sme );
7465 }
7466 return(status);
7467}
7468
7469/* ---------------------------------------------------------------------------
7470
7471 \fn sme_ConfigureResumeReq
7472
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007473 \brief
7474 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007475 be Resumed
7476
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007477 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007478
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007479 hHal - The handle returned by macOpen.
7480
Jeff Johnson295189b2012-06-20 16:38:30 -07007481 wlanResumeParam- Depicts the wlan resume params
7482
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007483
7484 \return eHalStatus
7485
7486
Jeff Johnson295189b2012-06-20 16:38:30 -07007487--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007488eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007489 tpSirWlanResumeParam wlanResumeParam)
7490{
7491 eHalStatus status = eHAL_STATUS_SUCCESS;
7492 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7493 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7494 vos_msg_t vosMessage;
7495
Katya Nigambcb705f2013-12-26 14:26:22 +05307496 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007497 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007498 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7499 {
7500 /* serialize the req through MC thread */
7501 vosMessage.bodyptr = wlanResumeParam;
7502 vosMessage.type = WDA_WLAN_RESUME_REQ;
7503 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7504 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7505 {
7506 status = eHAL_STATUS_FAILURE;
7507 }
7508 sme_ReleaseGlobalLock( &pMac->sme );
7509 }
7510 return(status);
7511}
7512
Jeff Johnson295189b2012-06-20 16:38:30 -07007513/* ---------------------------------------------------------------------------
7514
7515 \fn sme_GetInfraSessionId
7516
7517 \brief To get the session ID for infra session, if connected
7518 This is a synchronous API.
7519
7520 \param hHal - The handle returned by macOpen.
7521
7522 \return sessionid, -1 if infra session is not connected
7523
7524 -------------------------------------------------------------------------------*/
7525tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7526{
7527 eHalStatus status = eHAL_STATUS_FAILURE;
7528 tANI_S8 sessionid = -1;
7529 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007530
Jeff Johnson295189b2012-06-20 16:38:30 -07007531 status = sme_AcquireGlobalLock( &pMac->sme );
7532 if ( HAL_STATUS_SUCCESS( status ) )
7533 {
7534
7535 sessionid = csrGetInfraSessionId( pMac);
7536
7537 sme_ReleaseGlobalLock( &pMac->sme );
7538 }
7539
7540 return (sessionid);
7541}
7542
7543/* ---------------------------------------------------------------------------
7544
7545 \fn sme_GetInfraOperationChannel
7546
7547 \brief To get the operating channel for infra session, if connected
7548 This is a synchronous API.
7549
7550 \param hHal - The handle returned by macOpen.
7551 \param sessionId - the sessionId returned by sme_OpenSession.
7552
7553 \return operating channel, 0 if infra session is not connected
7554
7555 -------------------------------------------------------------------------------*/
7556tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7557{
7558 eHalStatus status = eHAL_STATUS_FAILURE;
7559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7560 tANI_U8 channel = 0;
7561 status = sme_AcquireGlobalLock( &pMac->sme );
7562 if ( HAL_STATUS_SUCCESS( status ) )
7563 {
7564
7565 channel = csrGetInfraOperationChannel( pMac, sessionId);
7566
7567 sme_ReleaseGlobalLock( &pMac->sme );
7568 }
7569
7570 return (channel);
7571}
7572
7573//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 -07007574//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007575tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7576{
7577 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007579 tANI_U8 channel = 0;
7580 status = sme_AcquireGlobalLock( &pMac->sme );
7581 if ( HAL_STATUS_SUCCESS( status ) )
7582 {
7583
7584 channel = csrGetConcurrentOperationChannel( pMac );
7585 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007586 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007587 sme_ReleaseGlobalLock( &pMac->sme );
7588 }
7589
7590 return (channel);
7591}
7592
7593#ifdef FEATURE_WLAN_SCAN_PNO
7594/******************************************************************************
7595*
7596* Name: sme_PreferredNetworkFoundInd
7597*
7598* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007599* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007600*
7601* Parameters:
7602* hHal - HAL handle for device
7603* pMsg - found network description
7604*
7605* Returns: eHalStatus
7606*
7607******************************************************************************/
7608eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7609{
7610 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7611 eHalStatus status = eHAL_STATUS_SUCCESS;
7612 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007613 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7614 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007615
7616 if (NULL == pMsg)
7617 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007618 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007619 status = eHAL_STATUS_FAILURE;
7620 }
7621 else
7622 {
7623 if (pPrefNetworkFoundInd->ssId.length > 0)
7624 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007625 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7626 pPrefNetworkFoundInd->ssId.length);
7627 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7628 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307629 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7630 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007631
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307632 /* Flush scan results, So as to avoid indication/updation of
7633 * stale entries, which may not have aged out during APPS collapse
7634 */
7635 sme_ScanFlushResult(hHal,0);
7636
Srikant Kuppa066904f2013-05-07 13:56:02 -07007637 //Save the frame to scan result
7638 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7639 {
7640 //we may have a frame
7641 status = csrScanSavePreferredNetworkFound(pMac,
7642 pPrefNetworkFoundInd);
7643 if (!HAL_STATUS_SUCCESS(status))
7644 {
7645 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7646 }
7647 }
7648 else
7649 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007650 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007651 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 }
7653
Srikant Kuppa066904f2013-05-07 13:56:02 -07007654 /* Call Preferred Netowrk Found Indication callback routine. */
7655 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7656 {
7657 pMac->pmc.prefNetwFoundCB(
7658 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7659 pPrefNetworkFoundInd);
7660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007661 }
7662 else
7663 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007664 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007665 status = eHAL_STATUS_FAILURE;
7666 }
7667 }
7668
7669
7670 return(status);
7671}
7672
7673#endif // FEATURE_WLAN_SCAN_PNO
7674
7675
7676eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7677{
7678 eHalStatus status = eHAL_STATUS_FAILURE;
7679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007680
Jeff Johnson295189b2012-06-20 16:38:30 -07007681 status = sme_AcquireGlobalLock( &pMac->sme );
7682 if ( HAL_STATUS_SUCCESS( status ) )
7683 {
7684 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7685 sme_ReleaseGlobalLock( &pMac->sme );
7686 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007687
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 return (status);
7689}
7690
7691
7692/* ---------------------------------------------------------------------------
7693
7694 \fn sme_SetTxPerTracking
7695
7696 \brief Set Tx PER tracking configuration parameters
7697
7698 \param hHal - The handle returned by macOpen.
7699 \param pTxPerTrackingConf - Tx PER configuration parameters
7700
7701 \return eHalStatus
7702
7703 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007704eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7705 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007706 void *pCallbackContext,
7707 tpSirTxPerTrackingParam pTxPerTrackingParam)
7708{
7709 vos_msg_t msg;
7710 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7712
7713 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7714 {
7715 pMac->sme.pTxPerHitCallback = pCallbackfn;
7716 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7717 sme_ReleaseGlobalLock( &pMac->sme );
7718 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007719
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 // free this memory in failure case or WDA request callback function
7721 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7722 if (NULL == pTxPerTrackingParamReq)
7723 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007724 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 -07007725 return eHAL_STATUS_FAILURE;
7726 }
7727
Kiet Lam64c1b492013-07-12 13:56:44 +05307728 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7729 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007730 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7731 msg.reserved = 0;
7732 msg.bodyptr = pTxPerTrackingParamReq;
7733
7734 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7735 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007736 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 -07007737 vos_mem_free(pTxPerTrackingParamReq);
7738 return eHAL_STATUS_FAILURE;
7739 }
7740
7741 return eHAL_STATUS_SUCCESS;
7742}
7743
7744/* ---------------------------------------------------------------------------
7745
7746 \fn sme_HandleChangeCountryCode
7747
7748 \brief Change Country code, Reg Domain and channel list
7749
7750 \details Country Code Priority
7751 0 = 11D > Configured Country > NV
7752 1 = Configured Country > 11D > NV
7753 If Supplicant country code is priority than 11d is disabled.
7754 If 11D is enabled, we update the country code after every scan.
7755 Hence when Supplicant country code is priority, we don't need 11D info.
7756 Country code from Supplicant is set as current courtry code.
7757 User can send reset command XX (instead of country code) to reset the
7758 country code to default values which is read from NV.
7759 In case of reset, 11D is enabled and default NV code is Set as current country code
7760 If 11D is priority,
7761 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7762
7763 \param pMac - The handle returned by macOpen.
7764 \param pMsgBuf - MSG Buffer
7765
7766 \return eHalStatus
7767
7768 -------------------------------------------------------------------------------*/
7769eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7770{
7771 eHalStatus status = eHAL_STATUS_SUCCESS;
7772 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007773 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007774 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7775 static uNvTables nvTables;
7776 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7777
7778
7779 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7780 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7781 {
7782 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7783
7784 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7785
7786 /* read the country code from NV and use it */
7787 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7788 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307789 vos_mem_copy(pMsg->countryCode,
7790 nvTables.defaultCountryTable.countryCode,
7791 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007792 }
7793 else
7794 {
7795 status = eHAL_STATUS_FAILURE;
7796 return status;
7797 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307798 /* Update the 11d country to default country from NV bin so that when
7799 * callback is received for this default country, driver will not
7800 * disable the 11d taking it as valid country by user.
7801 */
7802 smsLog(pMac, LOG1,
7803 FL("Set default country code (%c%c) from NV as invalid country received"),
7804 pMsg->countryCode[0],pMsg->countryCode[1]);
7805 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7806 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007807 }
7808 else
7809 {
7810 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307811 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7812 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007813 {
7814 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7815 }
7816 }
7817
7818 /* WEXT set country code means
7819 * 11D should be supported?
7820 * 11D Channel should be enforced?
7821 * 11D Country code should be matched?
7822 * 11D Reg Domian should be matched?
7823 * Country string changed */
7824 if(pMac->roam.configParam.Is11dSupportEnabled &&
7825 pMac->roam.configParam.fEnforce11dChannels &&
7826 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7827 pMac->roam.configParam.fEnforceDefaultDomain &&
7828 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7829 {
7830 /* All 11D related options are already enabled
7831 * Country string is not changed
7832 * Do not need do anything for country code change request */
7833 return eHAL_STATUS_SUCCESS;
7834 }
7835
7836 /* Set Current Country code and Current Regulatory domain */
7837 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7838 if(eHAL_STATUS_SUCCESS != status)
7839 {
7840 /* Supplicant country code failed. So give 11D priority */
7841 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7842 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007843 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007844 }
7845
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307847 vos_mem_copy(pMac->scan.countryCodeDefault,
7848 pMac->scan.countryCodeCurrent,
7849 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007850
7851 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307852 status = csrGetRegulatoryDomainForCountry(pMac,
7853 pMac->scan.countryCodeCurrent,
7854 (v_REGDOMAIN_t *) &domainIdIoctl,
7855 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007856 if ( status != eHAL_STATUS_SUCCESS )
7857 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007858 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007859 return status;
7860 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007861 else if (REGDOMAIN_WORLD == domainIdIoctl)
7862 {
7863 /* Supplicant country code is invalid, so we are on world mode now. So
7864 give 11D chance to update */
7865 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7866 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7867 }
7868
Jeff Johnson295189b2012-06-20 16:38:30 -07007869
Abhishek Singha306a442013-11-07 18:39:01 +05307870 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007871
7872 if ( status != eHAL_STATUS_SUCCESS )
7873 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007874 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007875 return status;
7876 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007877 else
7878 {
7879 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7880 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307881 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
7882 if (status != eHAL_STATUS_SUCCESS)
7883 {
7884 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7885 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007886 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7887 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007888 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007889 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7890 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7891 }
7892 }
Kiet Lam6c583332013-10-14 05:37:09 +05307893#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007894 /* set to default domain ID */
7895 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7896
7897 /* get the channels based on new cc */
7898 status = csrInitGetChannels( pMac );
7899
7900 if ( status != eHAL_STATUS_SUCCESS )
7901 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007902 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007903 return status;
7904 }
7905
7906 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007907 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307908 /* Country code Changed, Purge Only scan result
7909 * which does not have channel number belong to 11d
7910 * channel list
7911 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307912 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307913
Kiet Lam6c583332013-10-14 05:37:09 +05307914#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007915 if( pMsg->changeCCCallback )
7916 {
7917 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7918 }
7919
7920 return eHAL_STATUS_SUCCESS;
7921}
7922
Amar Singhal0d15bd52013-10-12 23:13:13 -07007923/* ---------------------------------------------------------------------------
7924
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007925 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007926
7927 \brief Change Country code, Reg Domain and channel list
7928
7929 If Supplicant country code is priority than 11d is disabled.
7930 If 11D is enabled, we update the country code after every scan.
7931 Hence when Supplicant country code is priority, we don't need 11D info.
7932 Country code from Supplicant is set as current country code.
7933
7934 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007935 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007936
7937 \return eHalStatus
7938
7939 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007940eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7941 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007942{
7943 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007944 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307945 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007946
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007947 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007948 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7949
Kiet Lam6c583332013-10-14 05:37:09 +05307950 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7951 VOS_COUNTRY_CODE_LEN) == 0)
7952 {
7953 is11dCountry = VOS_TRUE;
7954 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007955
Sachin Ahuja120bf632015-02-24 18:06:34 +05307956 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
7957 "pMac->scan.countryCode11d : %c%c\n"),
7958 pMsg->countryCode[0], pMsg->countryCode[1],
7959 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307960 /* Set the country code given by userspace when 11dOriginal is FALSE
7961 * when 11doriginal is True,is11dCountry =0 and
7962 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7963 * and return failure
7964 */
7965 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007966 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307967 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7968 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307969 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007970
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307971 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007972
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307973 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007974 pMac->scan.countryCode11d,
7975 (v_REGDOMAIN_t *) &reg_domain_id,
7976 COUNTRY_IE);
7977
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307978 return eHAL_STATUS_FAILURE;
7979 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007980 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007981 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05307982 if ((!is11dCountry) &&
7983 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7984 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07007985 {
7986 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307987 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007988 }
7989
Sachin Ahuja120bf632015-02-24 18:06:34 +05307990 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05307991 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007992 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05307993 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7994 WNI_CFG_COUNTRY_CODE_LEN);
7995
Amar Singhal0d15bd52013-10-12 23:13:13 -07007996
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307997 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
7998 if (status != eHAL_STATUS_SUCCESS)
7999 {
8000 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8001 }
Abhishek Singha306a442013-11-07 18:39:01 +05308002 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07008003
Kiet Lam6c583332013-10-14 05:37:09 +05308004 if (VOS_FALSE == is11dCountry )
8005 {
8006 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05308007 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05308008 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
8009 /* set to default domain ID */
8010 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8011 }
8012
Amar Singhal0d15bd52013-10-12 23:13:13 -07008013 if ( status != eHAL_STATUS_SUCCESS )
8014 {
8015 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05308016 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008017 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008018 else
8019 {
8020 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8021 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008022 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8023 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008024 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008025 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008026 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8027 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8028 }
8029 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008030
Amar Singhal0d15bd52013-10-12 23:13:13 -07008031 /* get the channels based on new cc */
8032 status = csrInitGetChannels(pMac);
8033
8034 if ( status != eHAL_STATUS_SUCCESS )
8035 {
8036 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8037 return status;
8038 }
8039
8040 /* reset info based on new cc, and we are done */
8041 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308042 if (VOS_TRUE == is11dCountry)
8043 {
Kiet Lam6c583332013-10-14 05:37:09 +05308044 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8045 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8046 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308047 /* Country code Changed, Purge Only scan result
8048 * which does not have channel number belong to 11d
8049 * channel list
8050 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308051 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308052 // Do active scans after the country is set by User hints or Country IE
8053 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308054 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008055 smsLog(pMac, LOG1, FL(" returned"));
8056 return eHAL_STATUS_SUCCESS;
8057}
8058
8059/* ---------------------------------------------------------------------------
8060
Kiet Lamcffc5862013-10-30 16:28:45 +05308061 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008062
8063 \brief Update Country code in the driver if set by kernel as world
8064
8065 If 11D is enabled, we update the country code after every scan & notify kernel.
8066 This is to make sure kernel & driver are in sync in case of CC found in
8067 driver but not in kernel database
8068
8069 \param pMac - The handle returned by macOpen.
8070 \param pMsg - Carrying new CC set in kernel
8071
8072 \return eHalStatus
8073
8074 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308075eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008076{
Kiet Lamcffc5862013-10-30 16:28:45 +05308077 eHalStatus status;
8078
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008079 smsLog(pMac, LOG1, FL(" called"));
8080
8081 //this is to make sure kernel & driver are in sync in case of CC found in
8082 //driver but not in kernel database
8083 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8084 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008085 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308086 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008087 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308088 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008089 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008090 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308091
Abhishek Singha306a442013-11-07 18:39:01 +05308092 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308093
8094 if ( status != eHAL_STATUS_SUCCESS )
8095 {
8096 smsLog( pMac, LOGE, FL(" fail to set regId") );
8097 return status;
8098 }
8099 else
8100 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308101 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8102 if (status != eHAL_STATUS_SUCCESS)
8103 {
8104 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8105 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308106 status = csrInitGetChannels(pMac);
8107 if ( status != eHAL_STATUS_SUCCESS )
8108 {
8109 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8110 }
8111 else
8112 {
8113 csrInitChannelList(pMac);
8114 }
8115 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308116 /* Country code Changed, Purge Only scan result
8117 * which does not have channel number belong to 11d
8118 * channel list
8119 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308120 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008121 smsLog(pMac, LOG1, FL(" returned"));
8122 return eHAL_STATUS_SUCCESS;
8123}
8124
8125/* ---------------------------------------------------------------------------
8126
Sushant Kaushik1d732562014-05-21 14:15:37 +05308127 \fn sme_DisconnectConnectedSessions
8128
8129 \brief Disconnect STA and P2P client session if channel is not supported
8130
8131 If new country code does not support the channel on which STA/P2P client
8132 is connetced, it sends the disconnect to the AP/P2P GO
8133
8134 \param pMac - The handle returned by macOpen
8135
8136 \return eHalStatus
8137
8138 -------------------------------------------------------------------------------*/
8139
8140void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8141{
8142 v_U8_t i, sessionId, isChanFound = false;
8143 tANI_U8 currChannel;
8144
8145 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8146 {
8147 if (csrIsSessionClientAndConnected(pMac, sessionId))
8148 {
8149 isChanFound = false;
8150 //Session is connected.Check the channel
8151 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8152 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8153 currChannel, sessionId);
8154 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8155 {
8156 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8157 {
8158 isChanFound = true;
8159 break;
8160 }
8161 }
8162
8163 if (!isChanFound)
8164 {
8165 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8166 {
8167 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8168 {
8169 isChanFound = true;
8170 break;
8171 }
8172 }
8173 }
8174 if (!isChanFound)
8175 {
8176 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8177 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8178 }
8179 }
8180 }
8181}
8182/* ---------------------------------------------------------------------------
8183
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008184 \fn sme_HandleGenericChangeCountryCode
8185
8186 \brief Change Country code, Reg Domain and channel list
8187
8188 If Supplicant country code is priority than 11d is disabled.
8189 If 11D is enabled, we update the country code after every scan.
8190 Hence when Supplicant country code is priority, we don't need 11D info.
8191 Country code from kernel is set as current country code.
8192
8193 \param pMac - The handle returned by macOpen.
8194 \param pMsgBuf - message buffer
8195
8196 \return eHalStatus
8197
8198 -------------------------------------------------------------------------------*/
8199eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8200{
8201 tAniGenericChangeCountryCodeReq *pMsg;
8202 v_REGDOMAIN_t reg_domain_id;
8203
8204 smsLog(pMac, LOG1, FL(" called"));
8205 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8206 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8207
8208 if (REGDOMAIN_COUNT == reg_domain_id)
8209 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308210 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008211 }
8212 else
8213 {
8214 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8215 }
8216 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008217 return eHAL_STATUS_SUCCESS;
8218}
8219
Jeff Johnson295189b2012-06-20 16:38:30 -07008220#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008221eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008222{
8223 tpSirRcvFltMcAddrList pRequestBuf;
8224 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008225 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008226 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008227
8228 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308229 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008230 pMulticastAddrs->ulMulticastAddrCnt,
8231 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008232
8233 /*
8234 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008235 */
8236 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8237 csrIsConnStateInfra(pMac, sessionId))
8238 {
8239 pSession = CSR_GET_SESSION( pMac, sessionId );
8240 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008241
8242 if(pSession == NULL )
8243 {
8244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008245 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008246 return eHAL_STATUS_FAILURE;
8247 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008248
Jeff Johnson295189b2012-06-20 16:38:30 -07008249 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8250 if (NULL == pRequestBuf)
8251 {
8252 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008253 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008254 return eHAL_STATUS_FAILED_ALLOC;
8255 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008256
8257 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8258 {
8259 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8260 "indication as we are not connected", __func__);
8261 vos_mem_free(pRequestBuf);
8262 return eHAL_STATUS_FAILURE;
8263 }
8264
Jeff Johnson295189b2012-06-20 16:38:30 -07008265 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8266
Kiet Lam64c1b492013-07-12 13:56:44 +05308267 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8268 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008269 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8270 sizeof(tSirMacAddr));
8271
Jeff Johnson295189b2012-06-20 16:38:30 -07008272 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8273 msg.reserved = 0;
8274 msg.bodyptr = pRequestBuf;
8275 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8276 {
8277 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008278 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008279 vos_mem_free(pRequestBuf);
8280 return eHAL_STATUS_FAILURE;
8281 }
8282
8283 return eHAL_STATUS_SUCCESS;
8284}
8285
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008286eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008287 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008288{
8289 tpSirRcvPktFilterCfgType pRequestBuf;
8290 v_SINT_t allocSize;
8291 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008292 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8293 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008294 v_U8_t idx=0;
8295
8296 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008297 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008298 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008299
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008300 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008301
Jeff Johnson295189b2012-06-20 16:38:30 -07008302 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008303
8304 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008305 {
8306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008307 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008308 return eHAL_STATUS_FAILED_ALLOC;
8309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008310
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008311 if( NULL == pSession )
8312 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008313 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008314 vos_mem_free(pRequestBuf);
8315 return eHAL_STATUS_FAILURE;
8316 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008317
Kiet Lam64c1b492013-07-12 13:56:44 +05308318 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8319 sizeof(tSirMacAddr));
8320 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8321 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008322 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8323
Jeff Johnson295189b2012-06-20 16:38:30 -07008324 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8325 msg.reserved = 0;
8326 msg.bodyptr = pRequestBuf;
8327
8328 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008329 "FT %d FID %d ",
8330 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008331
8332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008333 "params %d CT %d",
8334 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008335
8336 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8337 {
8338
8339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008340 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008341 pRequestBuf->paramsData[idx].protocolLayer,
8342 pRequestBuf->paramsData[idx].cmpFlag);
8343
8344 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008345 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008346 pRequestBuf->paramsData[idx].dataOffset,
8347 pRequestBuf->paramsData[idx].dataLength);
8348
8349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008350 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008351 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008352 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008353 pRequestBuf->paramsData[idx].compareData[2],
8354 pRequestBuf->paramsData[idx].compareData[3],
8355 pRequestBuf->paramsData[idx].compareData[4],
8356 pRequestBuf->paramsData[idx].compareData[5]);
8357
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008358 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008359 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008360 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008361 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008362 pRequestBuf->paramsData[idx].dataMask[2],
8363 pRequestBuf->paramsData[idx].dataMask[3],
8364 pRequestBuf->paramsData[idx].dataMask[4],
8365 pRequestBuf->paramsData[idx].dataMask[5]);
8366
8367 }
8368
8369 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8370 {
8371 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008372 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008373 vos_mem_free(pRequestBuf);
8374 return eHAL_STATUS_FAILURE;
8375 }
8376
8377 return eHAL_STATUS_SUCCESS;
8378}
8379
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008380eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008381 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008382 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008383 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008384{
8385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8386 eHalStatus status;
8387
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008388 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008389
8390 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8391 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008392 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008393 sme_ReleaseGlobalLock( &pMac->sme );
8394 }
8395
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008396 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008397
8398 return (status);
8399}
8400
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008401eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008402 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008403{
8404 tpSirRcvFltPktClearParam pRequestBuf;
8405 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008406 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8407 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008408
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008409 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008410 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008411
Jeff Johnson295189b2012-06-20 16:38:30 -07008412 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008413 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008414 {
8415 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8416 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008417 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008418 return eHAL_STATUS_FAILED_ALLOC;
8419 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008420 if( NULL == pSession )
8421 {
8422 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008423 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008424 vos_mem_free(pRequestBuf);
8425 return eHAL_STATUS_FAILURE;
8426 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008427
Kiet Lam64c1b492013-07-12 13:56:44 +05308428 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8429 sizeof(tSirMacAddr));
8430 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8431 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008432
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008433 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8434
Jeff Johnson295189b2012-06-20 16:38:30 -07008435 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8436 msg.reserved = 0;
8437 msg.bodyptr = pRequestBuf;
8438 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8439 {
8440 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008441 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008442 vos_mem_free(pRequestBuf);
8443 return eHAL_STATUS_FAILURE;
8444 }
8445
8446 return eHAL_STATUS_SUCCESS;
8447}
8448#endif // WLAN_FEATURE_PACKET_FILTERING
8449
8450/* ---------------------------------------------------------------------------
8451 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008452 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008453 channel switch.
8454 \param callbackContext
8455 \param status
8456 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008457void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008458 eHalStatus status)
8459{
8460 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8461 tSirMbMsg *pMsg;
8462 tANI_U16 msgLen;
8463
8464 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308465 pMsg = vos_mem_malloc(msgLen);
8466 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008467 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308468 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008469 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8470 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8471 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008472 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008473
8474 return;
8475}
8476
8477/* ---------------------------------------------------------------------------
8478 \fn sme_HandlePreChannelSwitchInd
8479 \brief Processes the indcation from PE for pre-channel switch.
8480 \param hHal
8481 \- The handle returned by macOpen. return eHalStatus
8482 ---------------------------------------------------------------------------*/
8483eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8484{
8485 eHalStatus status = eHAL_STATUS_FAILURE;
8486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8487 status = sme_AcquireGlobalLock( &pMac->sme );
8488 if ( HAL_STATUS_SUCCESS( status ) )
8489 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008490 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8491 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008492 sme_ReleaseGlobalLock( &pMac->sme );
8493 }
8494
8495 return (status);
8496}
8497
8498/* ---------------------------------------------------------------------------
8499 \fn sme_HandlePostChannelSwitchInd
8500 \brief Processes the indcation from PE for post-channel switch.
8501 \param hHal
8502 \- The handle returned by macOpen. return eHalStatus
8503 ---------------------------------------------------------------------------*/
8504eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8505{
8506 eHalStatus status = eHAL_STATUS_FAILURE;
8507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8508
8509 status = sme_AcquireGlobalLock( &pMac->sme );
8510 if ( HAL_STATUS_SUCCESS( status ) )
8511 {
8512 status = pmcRequestBmps(hHal, NULL, NULL);
8513 sme_ReleaseGlobalLock( &pMac->sme );
8514 }
8515
8516 return (status);
8517}
8518
8519/* ---------------------------------------------------------------------------
8520
8521 \fn sme_IsChannelValid
8522
8523 \brief To check if the channel is valid for currently established domain
8524 This is a synchronous API.
8525
8526 \param hHal - The handle returned by macOpen.
8527 \param channel - channel to verify
8528
8529 \return TRUE/FALSE, TRUE if channel is valid
8530
8531 -------------------------------------------------------------------------------*/
8532tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8533{
8534 eHalStatus status = eHAL_STATUS_FAILURE;
8535 tANI_BOOLEAN valid = FALSE;
8536 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008537
Jeff Johnson295189b2012-06-20 16:38:30 -07008538 status = sme_AcquireGlobalLock( &pMac->sme );
8539 if ( HAL_STATUS_SUCCESS( status ) )
8540 {
8541
8542 valid = csrRoamIsChannelValid( pMac, channel);
8543
8544 sme_ReleaseGlobalLock( &pMac->sme );
8545 }
8546
8547 return (valid);
8548}
8549
8550/* ---------------------------------------------------------------------------
8551 \fn sme_SetFreqBand
8552 \brief Used to set frequency band.
8553 \param hHal
8554 \eBand band value to be configured
8555 \- return eHalStatus
8556 -------------------------------------------------------------------------*/
8557eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8558{
8559 eHalStatus status = eHAL_STATUS_FAILURE;
8560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8561
8562 status = sme_AcquireGlobalLock( &pMac->sme );
8563 if ( HAL_STATUS_SUCCESS( status ) )
8564 {
8565 status = csrSetBand(hHal, eBand);
8566 sme_ReleaseGlobalLock( &pMac->sme );
8567 }
8568 return status;
8569}
8570
8571/* ---------------------------------------------------------------------------
8572 \fn sme_GetFreqBand
8573 \brief Used to get the current band settings.
8574 \param hHal
8575 \pBand pointer to hold band value
8576 \- return eHalStatus
8577 -------------------------------------------------------------------------*/
8578eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8579{
8580 eHalStatus status = eHAL_STATUS_FAILURE;
8581 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8582
8583 status = sme_AcquireGlobalLock( &pMac->sme );
8584 if ( HAL_STATUS_SUCCESS( status ) )
8585 {
8586 *pBand = csrGetCurrentBand( hHal );
8587 sme_ReleaseGlobalLock( &pMac->sme );
8588 }
8589 return status;
8590}
8591
8592#ifdef WLAN_WAKEUP_EVENTS
8593/******************************************************************************
8594 \fn sme_WakeReasonIndCallback
8595
8596 \brief
8597 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8598
8599 \param hHal - HAL handle for device
8600 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8601
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008602 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008603******************************************************************************/
8604eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8605{
8606 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8607 eHalStatus status = eHAL_STATUS_SUCCESS;
8608 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8609
8610 if (NULL == pMsg)
8611 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008612 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008613 status = eHAL_STATUS_FAILURE;
8614 }
8615 else
8616 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008617 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008618
8619 /* Call Wake Reason Indication callback routine. */
8620 if (pMac->pmc.wakeReasonIndCB != NULL)
8621 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008622
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008623 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008624 }
8625
8626 return(status);
8627}
8628#endif // WLAN_WAKEUP_EVENTS
8629
8630
8631/* ---------------------------------------------------------------------------
8632
8633 \fn sme_SetMaxTxPower
8634
8635 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8636 not persist over reboots.
8637
8638 \param hHal
8639 \param pBssid BSSID to set the power cap for
8640 \param pBssid pSelfMacAddress self MAC Address
8641 \param pBssid power to set in dB
8642 \- return eHalStatus
8643
8644 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008645eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008646 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8647{
8648 vos_msg_t msg;
8649 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308650 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008651 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008652 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8653 if (NULL == pMaxTxParams)
8654 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008655 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 -07008656 return eHAL_STATUS_FAILURE;
8657 }
8658
8659 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308660 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008661 SIR_MAC_ADDR_LENGTH);
8662 pMaxTxParams->power = dB;
8663
8664 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8665 msg.reserved = 0;
8666 msg.bodyptr = pMaxTxParams;
8667
8668 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8669 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008670 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 -07008671 vos_mem_free(pMaxTxParams);
8672 return eHAL_STATUS_FAILURE;
8673 }
8674
8675 return eHAL_STATUS_SUCCESS;
8676}
8677
Jeff Johnson295189b2012-06-20 16:38:30 -07008678/* ---------------------------------------------------------------------------
8679
Arif Hussaina5ebce02013-08-09 15:09:58 -07008680 \fn sme_SetMaxTxPowerPerBand
8681
8682 \brief Set the Maximum Transmit Power specific to band dynamically.
8683 Note: this setting will not persist over reboots.
8684
8685 \param band
8686 \param power to set in dB
8687 \- return eHalStatus
8688
8689 ----------------------------------------------------------------------------*/
8690eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8691{
8692 vos_msg_t msg;
8693 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8694
8695 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8696 if (NULL == pMaxTxPowerPerBandParams)
8697 {
8698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8699 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8700 __func__);
8701 return eHAL_STATUS_FAILURE;
8702 }
8703
8704 pMaxTxPowerPerBandParams->power = dB;
8705 pMaxTxPowerPerBandParams->bandInfo = band;
8706
8707 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8708 msg.reserved = 0;
8709 msg.bodyptr = pMaxTxPowerPerBandParams;
8710
8711 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8712 {
8713 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8714 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8715 __func__);
8716 vos_mem_free(pMaxTxPowerPerBandParams);
8717 return eHAL_STATUS_FAILURE;
8718 }
8719
8720 return eHAL_STATUS_SUCCESS;
8721}
8722
8723/* ---------------------------------------------------------------------------
8724
schang86c22c42013-03-13 18:41:24 -07008725 \fn sme_SetTxPower
8726
8727 \brief Set Transmit Power dynamically. Note: this setting will
8728 not persist over reboots.
8729
8730 \param hHal
8731 \param sessionId Target Session ID
8732 \param mW power to set in mW
8733 \- return eHalStatus
8734
8735 -------------------------------------------------------------------------------*/
8736eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8737{
8738
8739 eHalStatus status = eHAL_STATUS_FAILURE;
8740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8741
Katya Nigambcb705f2013-12-26 14:26:22 +05308742 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008743 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008744 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8745 status = sme_AcquireGlobalLock(&pMac->sme);
8746 if (HAL_STATUS_SUCCESS(status))
8747 {
8748 status = csrSetTxPower(pMac, sessionId, mW);
8749 sme_ReleaseGlobalLock(&pMac->sme);
8750 }
8751 return status;
8752}
8753
8754/* ---------------------------------------------------------------------------
8755
Jeff Johnson295189b2012-06-20 16:38:30 -07008756 \fn sme_HideSSID
8757
8758 \brief hide/show SSID dynamically. Note: this setting will
8759 not persist over reboots.
8760
8761 \param hHal
8762 \param sessionId
8763 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8764 \- return eHalStatus
8765
8766 -------------------------------------------------------------------------------*/
8767eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8768{
8769 eHalStatus status = eHAL_STATUS_SUCCESS;
8770 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8771 tANI_U16 len;
8772
8773 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8774 {
8775 tpSirUpdateParams pMsg;
8776 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008777
8778 if(!pSession)
8779 {
8780 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008781 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008782 return eHAL_STATUS_FAILURE;
8783 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008784
8785 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008786 VOS_ASSERT(0);
8787
8788 /* Create the message and send to lim */
8789 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308790 pMsg = vos_mem_malloc(len);
8791 if ( NULL == pMsg )
8792 status = eHAL_STATUS_FAILURE;
8793 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008794 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308795 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008796 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8797 pMsg->length = len;
8798 /* Data starts from here */
8799 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008800 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008801 status = palSendMBMessage(pMac->hHdd, pMsg);
8802 }
8803 sme_ReleaseGlobalLock( &pMac->sme );
8804 }
8805 return status;
8806}
Jeff Johnson295189b2012-06-20 16:38:30 -07008807
8808/* ---------------------------------------------------------------------------
8809
8810 \fn sme_SetTmLevel
8811 \brief Set Thermal Mitigation Level to RIVA
8812 \param hHal - The handle returned by macOpen.
8813 \param newTMLevel - new Thermal Mitigation Level
8814 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008815 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008816 ---------------------------------------------------------------------------*/
8817eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8818{
8819 eHalStatus status = eHAL_STATUS_SUCCESS;
8820 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8821 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8822 vos_msg_t vosMessage;
8823 tAniSetTmLevelReq *setTmLevelReq = NULL;
8824
Katya Nigambcb705f2013-12-26 14:26:22 +05308825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008826 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008827 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8828 {
8829 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308830 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008831 {
8832 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008833 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008834 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008835 return eHAL_STATUS_FAILURE;
8836 }
8837
8838 setTmLevelReq->tmMode = tmMode;
8839 setTmLevelReq->newTmLevel = newTMLevel;
8840
8841 /* serialize the req through MC thread */
8842 vosMessage.bodyptr = setTmLevelReq;
8843 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8844 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8845 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8846 {
8847 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008848 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008849 vos_mem_free(setTmLevelReq);
8850 status = eHAL_STATUS_FAILURE;
8851 }
8852 sme_ReleaseGlobalLock( &pMac->sme );
8853 }
8854 return(status);
8855}
8856
8857/*---------------------------------------------------------------------------
8858
8859 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8860 Host and FW.
8861
8862 \param hHal - HAL handle for device
8863
8864 \return NONE
8865
8866---------------------------------------------------------------------------*/
8867void sme_featureCapsExchange( tHalHandle hHal)
8868{
8869 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308870 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008871 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008872 WDA_featureCapsExchange(vosContext);
8873}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008874
Yathish9f22e662012-12-10 14:21:35 -08008875/*---------------------------------------------------------------------------
8876
8877 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8878 in Host.
8879
8880 \param hHal - HAL handle for device
8881
8882 \return NONE
8883
8884---------------------------------------------------------------------------*/
8885void sme_disableFeatureCapablity(tANI_U8 feature_index)
8886{
8887 WDA_disableCapablityFeature(feature_index);
8888}
8889
Jeff Johnsond13512a2012-07-17 11:42:19 -07008890/* ---------------------------------------------------------------------------
8891
8892 \fn sme_GetDefaultCountryCode
8893
8894 \brief Get the default country code from NV
8895
8896 \param hHal
8897 \param pCountry
8898 \- return eHalStatus
8899
8900 -------------------------------------------------------------------------------*/
8901eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8902{
8903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308904 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008905 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008906 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8907}
8908
8909/* ---------------------------------------------------------------------------
8910
8911 \fn sme_GetCurrentCountryCode
8912
8913 \brief Get the current country code
8914
8915 \param hHal
8916 \param pCountry
8917 \- return eHalStatus
8918
8919 -------------------------------------------------------------------------------*/
8920eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8921{
8922 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308923 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008924 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008925 return csrGetCurrentCountryCode(pMac, pCountry);
8926}
8927
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008928/* ---------------------------------------------------------------------------
8929 \fn sme_transportDebug
8930 \brief Dynamically monitoring Transport channels
8931 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008932 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008933 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008934 \param toggleStallDetect Enable stall detect feature
8935 This feature will take effect to data performance
8936 Not integrate till fully verification
8937 \- return NONE
8938 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008939void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008940{
schang6295e542013-03-12 15:31:23 -07008941 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8942
8943 if (NULL == pMac)
8944 {
8945 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8946 "%s: invalid context", __func__);
8947 return;
8948 }
8949 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008950}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008951
Kiran4a17ebe2013-01-31 10:43:43 -08008952/* ---------------------------------------------------------------------------
8953 \fn sme_ResetPowerValuesFor5G
8954 \brief Reset the power values for 5G band with NV power values.
8955 \param hHal - HAL handle for device
8956 \- return NONE
8957 -------------------------------------------------------------------------*/
8958void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8959{
8960 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
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_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008963 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8964 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8965}
8966
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008967#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008968/* ---------------------------------------------------------------------------
8969 \fn sme_UpdateRoamPrefer5GHz
8970 \brief enable/disable Roam prefer 5G runtime option
8971 This function is called through dynamic setConfig callback function
8972 to configure the Roam prefer 5G runtime option
8973 \param hHal - HAL handle for device
8974 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8975 \- return Success or failure
8976 -------------------------------------------------------------------------*/
8977
8978eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8979{
8980 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008981 eHalStatus status = eHAL_STATUS_SUCCESS;
8982
Katya Nigambcb705f2013-12-26 14:26:22 +05308983 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008984 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008985 status = sme_AcquireGlobalLock( &pMac->sme );
8986 if ( HAL_STATUS_SUCCESS( status ) )
8987 {
8988 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8989 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8990 pMac->roam.configParam.nRoamPrefer5GHz,
8991 nRoamPrefer5GHz);
8992 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8993 sme_ReleaseGlobalLock( &pMac->sme );
8994 }
8995
8996 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008997}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008998
8999/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009000 \fn sme_setRoamIntraBand
9001 \brief enable/disable Intra band roaming
9002 This function is called through dynamic setConfig callback function
9003 to configure the intra band roaming
9004 \param hHal - HAL handle for device
9005 \param nRoamIntraBand Enable/Disable Intra band roaming
9006 \- return Success or failure
9007 -------------------------------------------------------------------------*/
9008eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
9009{
9010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9011 eHalStatus status = eHAL_STATUS_SUCCESS;
9012
Katya Nigambcb705f2013-12-26 14:26:22 +05309013 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009014 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009015 status = sme_AcquireGlobalLock( &pMac->sme );
9016 if ( HAL_STATUS_SUCCESS( status ) )
9017 {
9018 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9019 "%s: gRoamIntraBand is changed from %d to %d", __func__,
9020 pMac->roam.configParam.nRoamIntraBand,
9021 nRoamIntraBand);
9022 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
9023 sme_ReleaseGlobalLock( &pMac->sme );
9024 }
9025
9026 return status ;
9027}
9028
9029/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009030 \fn sme_UpdateRoamScanNProbes
9031 \brief function to update roam scan N probes
9032 This function is called through dynamic setConfig callback function
9033 to update roam scan N probes
9034 \param hHal - HAL handle for device
9035 \param nProbes number of probe requests to be sent out
9036 \- return Success or failure
9037 -------------------------------------------------------------------------*/
9038eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9039{
9040 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9041 eHalStatus status = eHAL_STATUS_SUCCESS;
9042
9043 status = sme_AcquireGlobalLock( &pMac->sme );
9044 if ( HAL_STATUS_SUCCESS( status ) )
9045 {
9046 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9047 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9048 pMac->roam.configParam.nProbes,
9049 nProbes);
9050 pMac->roam.configParam.nProbes = nProbes;
9051 sme_ReleaseGlobalLock( &pMac->sme );
9052 }
9053#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9054 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9055 {
9056 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9057 REASON_NPROBES_CHANGED);
9058 }
9059#endif
9060 return status ;
9061}
9062
9063/* ---------------------------------------------------------------------------
9064 \fn sme_UpdateRoamScanHomeAwayTime
9065 \brief function to update roam scan Home away time
9066 This function is called through dynamic setConfig callback function
9067 to update roam scan home away time
9068 \param hHal - HAL handle for device
9069 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009070 \param bSendOffloadCmd If TRUE then send offload command to firmware
9071 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009072 \- return Success or failure
9073 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009074eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9075 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009076{
9077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9078 eHalStatus status = eHAL_STATUS_SUCCESS;
9079
9080 status = sme_AcquireGlobalLock( &pMac->sme );
9081 if ( HAL_STATUS_SUCCESS( status ) )
9082 {
9083 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9084 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9085 pMac->roam.configParam.nRoamScanHomeAwayTime,
9086 nRoamScanHomeAwayTime);
9087 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9088 sme_ReleaseGlobalLock( &pMac->sme );
9089 }
9090
9091#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009092 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009093 {
9094 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9095 REASON_HOME_AWAY_TIME_CHANGED);
9096 }
9097#endif
9098 return status;
9099}
9100
9101
9102/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009103 \fn sme_getRoamIntraBand
9104 \brief get Intra band roaming
9105 \param hHal - HAL handle for device
9106 \- return Success or failure
9107 -------------------------------------------------------------------------*/
9108v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9109{
9110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309111 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009112 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009113 return pMac->roam.configParam.nRoamIntraBand;
9114}
9115
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009116/* ---------------------------------------------------------------------------
9117 \fn sme_getRoamScanNProbes
9118 \brief get N Probes
9119 \param hHal - HAL handle for device
9120 \- return Success or failure
9121 -------------------------------------------------------------------------*/
9122v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9123{
9124 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9125 return pMac->roam.configParam.nProbes;
9126}
9127
9128/* ---------------------------------------------------------------------------
9129 \fn sme_getRoamScanHomeAwayTime
9130 \brief get Roam scan home away time
9131 \param hHal - HAL handle for device
9132 \- return Success or failure
9133 -------------------------------------------------------------------------*/
9134v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9135{
9136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9137 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9138}
9139
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009140
9141/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009142 \fn sme_UpdateImmediateRoamRssiDiff
9143 \brief Update nImmediateRoamRssiDiff
9144 This function is called through dynamic setConfig callback function
9145 to configure nImmediateRoamRssiDiff
9146 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9147 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009148 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009149 candidate and current AP.
9150 \- return Success or failure
9151 -------------------------------------------------------------------------*/
9152
9153eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9154{
9155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009156 eHalStatus status = eHAL_STATUS_SUCCESS;
9157
Katya Nigambcb705f2013-12-26 14:26:22 +05309158 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009159 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009160 status = sme_AcquireGlobalLock( &pMac->sme );
9161 if ( HAL_STATUS_SUCCESS( status ) )
9162 {
9163 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309164 "LFR runtime successfully set immediate roam rssi diff to"
9165 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009166 nImmediateRoamRssiDiff,
9167 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309168 macTraceGetNeighbourRoamState(
9169 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009170 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9171 sme_ReleaseGlobalLock( &pMac->sme );
9172 }
9173
9174 return status ;
9175}
9176
9177/* ---------------------------------------------------------------------------
9178 \fn sme_UpdateRoamRssiDiff
9179 \brief Update RoamRssiDiff
9180 This function is called through dynamic setConfig callback function
9181 to configure RoamRssiDiff
9182 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9183 \param hHal - HAL handle for device
9184 \param RoamRssiDiff - minimum rssi difference between potential
9185 candidate and current AP.
9186 \- return Success or failure
9187 -------------------------------------------------------------------------*/
9188
9189eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9190{
9191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9192 eHalStatus status = eHAL_STATUS_SUCCESS;
9193
9194 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309195 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009196 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009197 if ( HAL_STATUS_SUCCESS( status ) )
9198 {
9199 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309200 "LFR runtime successfully set roam rssi diff to %d"
9201 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009202 RoamRssiDiff,
9203 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309204 macTraceGetNeighbourRoamState(
9205 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009206 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9207 sme_ReleaseGlobalLock( &pMac->sme );
9208 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009209#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9210 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9211 {
9212 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9213 }
9214#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009215 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009216}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009217
9218/*--------------------------------------------------------------------------
9219 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009220 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009221 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009222 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009223 \param hHal - The handle returned by macOpen.
9224 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9225 Other status means SME is failed to update isFastTransitionEnabled.
9226 \sa
9227 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009228eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009229 v_BOOL_t isFastTransitionEnabled)
9230{
9231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009232 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009233
Katya Nigambcb705f2013-12-26 14:26:22 +05309234 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009235 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009236 status = sme_AcquireGlobalLock( &pMac->sme );
9237 if ( HAL_STATUS_SUCCESS( status ) )
9238 {
9239 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9240 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9241 pMac->roam.configParam.isFastTransitionEnabled,
9242 isFastTransitionEnabled);
9243 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9244 sme_ReleaseGlobalLock( &pMac->sme );
9245 }
9246
9247 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009248}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009249
9250/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009251 \fn sme_UpdateWESMode
9252 \brief Update WES Mode
9253 This function is called through dynamic setConfig callback function
9254 to configure isWESModeEnabled
9255 \param hHal - HAL handle for device
9256 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9257 Other status means SME is failed to update isWESModeEnabled.
9258 -------------------------------------------------------------------------*/
9259
9260eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9261{
9262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9263 eHalStatus status = eHAL_STATUS_SUCCESS;
9264
9265 status = sme_AcquireGlobalLock( &pMac->sme );
9266 if ( HAL_STATUS_SUCCESS( status ) )
9267 {
9268 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309269 "LFR runtime successfully set WES Mode to %d"
9270 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009271 isWESModeEnabled,
9272 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309273 macTraceGetNeighbourRoamState(
9274 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009275 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9276 sme_ReleaseGlobalLock( &pMac->sme );
9277 }
9278
9279 return status ;
9280}
9281
9282/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009283 \fn sme_SetRoamScanControl
9284 \brief Set roam scan control
9285 This function is called to set roam scan control
9286 if roam scan control is set to 0, roaming scan cache is cleared
9287 any value other than 0 is treated as invalid value
9288 \param hHal - HAL handle for device
9289 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9290 Other status means SME failure to update
9291 -------------------------------------------------------------------------*/
9292eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9293{
9294 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9295 eHalStatus status = eHAL_STATUS_SUCCESS;
9296
Katya Nigambcb705f2013-12-26 14:26:22 +05309297 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009298 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009299 status = sme_AcquireGlobalLock( &pMac->sme );
9300 if ( HAL_STATUS_SUCCESS( status ) )
9301 {
9302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309303 "LFR runtime successfully set roam scan control to %d"
9304 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009305 roamScanControl,
9306 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309307 macTraceGetNeighbourRoamState(
9308 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009309 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9310 if ( 0 == roamScanControl)
9311 {
9312 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9313 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009314 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009315#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9316 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9317 {
9318 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9319 }
9320#endif
9321 }
9322 sme_ReleaseGlobalLock( &pMac->sme );
9323 }
9324 return status ;
9325}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009326#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009327
9328#ifdef FEATURE_WLAN_LFR
9329/*--------------------------------------------------------------------------
9330 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009331 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009332 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009333 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009334 \param hHal - The handle returned by macOpen.
9335 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9336 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9337 \sa
9338 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009339eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009340 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009341{
9342 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9343
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009344 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9345 {
9346 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9347 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9348 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9349 isFastRoamIniFeatureEnabled);
9350 return eHAL_STATUS_SUCCESS;
9351 }
9352
Srinivas Girigowdade697412013-02-14 16:31:48 -08009353 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9354 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9355 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9356 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009357 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009358 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009359
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009360 return eHAL_STATUS_SUCCESS;
9361}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009362
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009363/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309364 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9365 When Supplicant issue enabled / disable fwr based roaming on the basis
9366 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9367
9368 This is a synchronous call
9369 \param hHal - The handle returned by macOpen.
9370 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9371 Other status means SME is failed to (enabled/disabled) offload scan.
9372 \sa
9373 --------------------------------------------------------------------------*/
9374
9375eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9376 const v_BOOL_t isFastRoamEnabled)
9377{
9378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9379 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9380 {
9381 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9382 "%s: FastRoam is disabled through ini", __func__);
9383 return eHAL_STATUS_FAILURE;
9384 }
9385 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9386 return eHAL_STATUS_SUCCESS;
9387}
9388
9389/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009390 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9391 Enable/disable LFR MAWC support at runtime
9392 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9393 isMAWCIniFeatureEnabled.
9394 This is a synchronous call
9395 \param hHal - The handle returned by macOpen.
9396 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9397 Other status means SME is failed to update MAWCEnabled.
9398 \sa
9399 --------------------------------------------------------------------------*/
9400eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9401 const v_BOOL_t MAWCEnabled)
9402{
9403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9404 eHalStatus status = eHAL_STATUS_SUCCESS;
9405
9406 status = sme_AcquireGlobalLock( &pMac->sme );
9407 if ( HAL_STATUS_SUCCESS( status ) )
9408 {
9409 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9410 "%s: MAWCEnabled is changed from %d to %d", __func__,
9411 pMac->roam.configParam.MAWCEnabled,
9412 MAWCEnabled);
9413 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9414 sme_ReleaseGlobalLock( &pMac->sme );
9415 }
9416
9417 return status ;
9418
9419}
9420
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009421#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9422/*--------------------------------------------------------------------------
9423 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9424 This is a synchronuous call
9425 \param hHal - The handle returned by macOpen.
9426 \return eHAL_STATUS_SUCCESS
9427 Other status means SME is failed
9428 \sa
9429 --------------------------------------------------------------------------*/
9430
9431eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9432 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9433{
9434
9435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9436 eHalStatus status = eHAL_STATUS_SUCCESS;
9437
9438 status = sme_AcquireGlobalLock( &pMac->sme );
9439 if ( HAL_STATUS_SUCCESS( status ) )
9440 {
9441 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9442 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9443 {
9444 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9445 }
9446 sme_ReleaseGlobalLock( &pMac->sme );
9447 }
9448
9449 return status;
9450}
9451#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009452#endif /* FEATURE_WLAN_LFR */
9453
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009454#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009455/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009456 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009457 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009458 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009459 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009460 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009461 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9462 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009463 \sa
9464 --------------------------------------------------------------------------*/
9465
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009466eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9467 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009468{
9469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9470
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009471 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009472 {
9473 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009474 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9475 pMac->roam.configParam.isEseIniFeatureEnabled,
9476 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009477 return eHAL_STATUS_SUCCESS;
9478 }
9479
Srinivas Girigowdade697412013-02-14 16:31:48 -08009480 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009481 "%s: EseEnabled is changed from %d to %d", __func__,
9482 pMac->roam.configParam.isEseIniFeatureEnabled,
9483 isEseIniFeatureEnabled);
9484 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9485 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009486
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009487 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009488 {
9489 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009490 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009491
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009492#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9493 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9494 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009495 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009496 }
9497#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009498 return eHAL_STATUS_SUCCESS;
9499}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009500#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009501
9502/*--------------------------------------------------------------------------
9503 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9504 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9505 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009506 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009507 \param hHal - The handle returned by macOpen.
9508 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9509 Other status means SME is failed to update fEnableFwRssiMonitoring.
9510 \sa
9511 --------------------------------------------------------------------------*/
9512
9513eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9514 v_BOOL_t fEnableFwRssiMonitoring)
9515{
9516 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9517
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009518 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9519 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9520 {
9521 halStatus = eHAL_STATUS_FAILURE;
9522 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009523 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009524 }
9525
9526 return (halStatus);
9527}
9528
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009529#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009530/*--------------------------------------------------------------------------
9531 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9532 This is a synchronous call
9533 \param hHal - The handle returned by macOpen.
9534 \return eHAL_STATUS_SUCCESS - SME update config successful.
9535 Other status means SME is failed to update
9536 \sa
9537 --------------------------------------------------------------------------*/
9538eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9539 v_U8_t neighborLookupRssiThreshold)
9540{
9541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9542 eHalStatus status = eHAL_STATUS_SUCCESS;
9543
9544 status = sme_AcquireGlobalLock( &pMac->sme );
9545 if ( HAL_STATUS_SUCCESS( status ) )
9546 {
9547 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9548 if (HAL_STATUS_SUCCESS(status))
9549 {
9550 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309551 "LFR runtime successfully set Lookup threshold to %d"
9552 " - old value is %d - roam state is %s",
9553 neighborLookupRssiThreshold,
9554 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9555 macTraceGetNeighbourRoamState(
9556 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009557 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9558 neighborLookupRssiThreshold;
9559 }
9560 sme_ReleaseGlobalLock( &pMac->sme );
9561 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009562 return status;
9563}
9564
9565/*--------------------------------------------------------------------------
9566 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9567 This is a synchronous call
9568 \param hHal - The handle returned by macOpen.
9569 \return eHAL_STATUS_SUCCESS - SME update config successful.
9570 Other status means SME is failed to update
9571 \sa
9572 --------------------------------------------------------------------------*/
9573eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9574 v_U8_t neighborReassocRssiThreshold)
9575{
9576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9577 eHalStatus status = eHAL_STATUS_SUCCESS;
9578
9579 status = sme_AcquireGlobalLock( &pMac->sme );
9580 if ( HAL_STATUS_SUCCESS( status ) )
9581 {
9582 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309583 "LFR runtime successfully set Reassoc threshold to %d"
9584 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009585 neighborReassocRssiThreshold,
9586 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309587 macTraceGetNeighbourRoamState(
9588 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009589 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9590 neighborReassocRssiThreshold;
9591 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9592 neighborReassocRssiThreshold;
9593 sme_ReleaseGlobalLock( &pMac->sme );
9594 }
9595
9596 return status ;
9597}
9598
9599
9600/*--------------------------------------------------------------------------
9601 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9602 This is a synchronous call
9603 \param hHal - The handle returned by macOpen.
9604 \return eHAL_STATUS_SUCCESS - SME update config successful.
9605 Other status means SME is failed to update
9606 \sa
9607 --------------------------------------------------------------------------*/
9608v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9609{
9610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9611 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9612}
9613
9614/*--------------------------------------------------------------------------
9615 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9616 This is a synchronous call
9617 \param hHal - The handle returned by macOpen.
9618 \return eHAL_STATUS_SUCCESS - SME update config successful.
9619 Other status means SME is failed to update
9620 \sa
9621 --------------------------------------------------------------------------*/
9622eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9623 v_U16_t neighborScanResultsRefreshPeriod)
9624{
9625 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9626 eHalStatus status = eHAL_STATUS_SUCCESS;
9627
9628 status = sme_AcquireGlobalLock( &pMac->sme );
9629 if ( HAL_STATUS_SUCCESS( status ) )
9630 {
9631 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309632 "LFR runtime successfully set roam scan refresh period to %d"
9633 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009634 neighborScanResultsRefreshPeriod,
9635 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309636 macTraceGetNeighbourRoamState(
9637 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009638 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9639 neighborScanResultsRefreshPeriod;
9640 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9641 neighborScanResultsRefreshPeriod;
9642
9643 sme_ReleaseGlobalLock( &pMac->sme );
9644 }
9645
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009646#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9647 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9648 {
9649 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9650 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9651 }
9652#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009653 return status ;
9654}
9655
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009656#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9657/*--------------------------------------------------------------------------
9658 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9659 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9660 gRoamScanOffloadEnabled.
9661 This is a synchronous call
9662 \param hHal - The handle returned by macOpen.
9663 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9664 Other status means SME is failed to update.
9665 \sa
9666 --------------------------------------------------------------------------*/
9667
9668eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9669 v_BOOL_t nRoamScanOffloadEnabled)
9670{
9671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9672 eHalStatus status = eHAL_STATUS_SUCCESS;
9673
9674 status = sme_AcquireGlobalLock( &pMac->sme );
9675 if ( HAL_STATUS_SUCCESS( status ) )
9676 {
9677 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9678 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9679 pMac->roam.configParam.isRoamOffloadScanEnabled,
9680 nRoamScanOffloadEnabled);
9681 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9682 sme_ReleaseGlobalLock( &pMac->sme );
9683 }
9684
9685 return status ;
9686}
9687#endif
9688
Srinivas Girigowdade697412013-02-14 16:31:48 -08009689/*--------------------------------------------------------------------------
9690 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9691 This is a synchronous call
9692 \param hHal - The handle returned by macOpen.
9693 \return v_U16_t - Neighbor scan results refresh period value
9694 \sa
9695 --------------------------------------------------------------------------*/
9696v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9697{
9698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9699 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9700}
9701
9702/*--------------------------------------------------------------------------
9703 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9704 This is a synchronuous call
9705 \param hHal - The handle returned by macOpen.
9706 \return eHAL_STATUS_SUCCESS - SME update config successful.
9707 Other status means SME is failed to update
9708 \sa
9709 --------------------------------------------------------------------------*/
9710v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9711{
9712 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9713 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9714}
9715
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009716/* ---------------------------------------------------------------------------
9717 \fn sme_UpdateEmptyScanRefreshPeriod
9718 \brief Update nEmptyScanRefreshPeriod
9719 This function is called through dynamic setConfig callback function
9720 to configure nEmptyScanRefreshPeriod
9721 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9722 \param hHal - HAL handle for device
9723 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9724 \- return Success or failure
9725 -------------------------------------------------------------------------*/
9726
9727eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9728{
9729 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9730 eHalStatus status = eHAL_STATUS_SUCCESS;
9731
9732 status = sme_AcquireGlobalLock( &pMac->sme );
9733 if ( HAL_STATUS_SUCCESS( status ) )
9734 {
9735 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309736 "LFR runtime successfully set roam scan period to %d -"
9737 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009738 nEmptyScanRefreshPeriod,
9739 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309740 macTraceGetNeighbourRoamState(
9741 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009742 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9743 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9744 sme_ReleaseGlobalLock( &pMac->sme );
9745 }
9746
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009747#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9748 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9749 {
9750 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9751 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9752 }
9753#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009754 return status ;
9755}
9756
9757/* ---------------------------------------------------------------------------
9758 \fn sme_setNeighborScanMinChanTime
9759 \brief Update nNeighborScanMinChanTime
9760 This function is called through dynamic setConfig callback function
9761 to configure gNeighborScanChannelMinTime
9762 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9763 \param hHal - HAL handle for device
9764 \param nNeighborScanMinChanTime - Channel minimum dwell time
9765 \- return Success or failure
9766 -------------------------------------------------------------------------*/
9767eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9768{
9769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9770 eHalStatus status = eHAL_STATUS_SUCCESS;
9771
9772 status = sme_AcquireGlobalLock( &pMac->sme );
9773 if ( HAL_STATUS_SUCCESS( status ) )
9774 {
9775 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309776 "LFR runtime successfully set channel min dwell time to %d"
9777 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009778 nNeighborScanMinChanTime,
9779 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309780 macTraceGetNeighbourRoamState(
9781 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009782 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9783 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9784 sme_ReleaseGlobalLock( &pMac->sme );
9785 }
9786
9787 return status ;
9788}
9789
9790/* ---------------------------------------------------------------------------
9791 \fn sme_setNeighborScanMaxChanTime
9792 \brief Update nNeighborScanMaxChanTime
9793 This function is called through dynamic setConfig callback function
9794 to configure gNeighborScanChannelMaxTime
9795 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9796 \param hHal - HAL handle for device
9797 \param nNeighborScanMinChanTime - Channel maximum dwell time
9798 \- return Success or failure
9799 -------------------------------------------------------------------------*/
9800eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9801{
9802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9803 eHalStatus status = eHAL_STATUS_SUCCESS;
9804
9805 status = sme_AcquireGlobalLock( &pMac->sme );
9806 if ( HAL_STATUS_SUCCESS( status ) )
9807 {
9808 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309809 "LFR runtime successfully set channel max dwell time to %d"
9810 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009811 nNeighborScanMaxChanTime,
9812 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309813 macTraceGetNeighbourRoamState(
9814 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009815 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9816 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9817 sme_ReleaseGlobalLock( &pMac->sme );
9818 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009819#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9820 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9821 {
9822 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9823 REASON_SCAN_CH_TIME_CHANGED);
9824 }
9825#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009826
9827 return status ;
9828}
9829
9830/* ---------------------------------------------------------------------------
9831 \fn sme_getNeighborScanMinChanTime
9832 \brief get neighbor scan min channel time
9833 \param hHal - The handle returned by macOpen.
9834 \return v_U16_t - channel min time value
9835 -------------------------------------------------------------------------*/
9836v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9837{
9838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9839 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9840}
9841
9842/* ---------------------------------------------------------------------------
9843 \fn sme_getNeighborScanMaxChanTime
9844 \brief get neighbor scan max channel time
9845 \param hHal - The handle returned by macOpen.
9846 \return v_U16_t - channel max time value
9847 -------------------------------------------------------------------------*/
9848v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9849{
9850 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9851 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9852}
9853
9854/* ---------------------------------------------------------------------------
9855 \fn sme_setNeighborScanPeriod
9856 \brief Update nNeighborScanPeriod
9857 This function is called through dynamic setConfig callback function
9858 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009859 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009860 \param hHal - HAL handle for device
9861 \param nNeighborScanPeriod - neighbor scan period
9862 \- return Success or failure
9863 -------------------------------------------------------------------------*/
9864eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9865{
9866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9867 eHalStatus status = eHAL_STATUS_SUCCESS;
9868
9869 status = sme_AcquireGlobalLock( &pMac->sme );
9870 if ( HAL_STATUS_SUCCESS( status ) )
9871 {
9872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309873 "LFR runtime successfully set neighbor scan period to %d"
9874 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009875 nNeighborScanPeriod,
9876 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309877 macTraceGetNeighbourRoamState(
9878 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009879 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9880 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9881 sme_ReleaseGlobalLock( &pMac->sme );
9882 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009883#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9884 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9885 {
9886 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9887 REASON_SCAN_HOME_TIME_CHANGED);
9888 }
9889#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009890
9891 return status ;
9892}
9893
9894/* ---------------------------------------------------------------------------
9895 \fn sme_getNeighborScanPeriod
9896 \brief get neighbor scan period
9897 \param hHal - The handle returned by macOpen.
9898 \return v_U16_t - neighbor scan period
9899 -------------------------------------------------------------------------*/
9900v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9901{
9902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9903 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9904}
9905
9906#endif
9907
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009908#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009909
Srinivas Girigowdade697412013-02-14 16:31:48 -08009910/*--------------------------------------------------------------------------
9911 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9912 This is a synchronous call
9913 \param hHal - The handle returned by macOpen.
9914 \return v_U16_t - Rssi diff value
9915 \sa
9916 --------------------------------------------------------------------------*/
9917v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9918{
9919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9920 return pMac->roam.configParam.RoamRssiDiff;
9921}
9922
9923/*--------------------------------------------------------------------------
9924 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9925 This is a synchronous call
9926 \param hHal - The handle returned by macOpen.
9927 \return eHAL_STATUS_SUCCESS - SME update config successful.
9928 Other status means SME is failed to update
9929 \sa
9930 --------------------------------------------------------------------------*/
9931eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9932 tANI_U8 numChannels)
9933{
9934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9935 eHalStatus status = eHAL_STATUS_SUCCESS;
9936 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009937 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309938 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009939 tANI_U8 i = 0, j = 0;
9940
9941 status = sme_AcquireGlobalLock( &pMac->sme );
9942 if ( HAL_STATUS_SUCCESS( status ) )
9943 {
9944 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9945 {
9946 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9947 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309948 if (j < sizeof(oldChannelList))
9949 {
9950 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9951 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9952 }
9953 else
9954 {
9955 break;
9956 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009957 }
9958 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009959 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009960 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009961 sme_SetRoamScanControl(hHal, 1);
9962 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009963 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009964 j = 0;
9965 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009966 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309967 if (j < sizeof(oldChannelList))
9968 {
9969 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9970 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9971 }
9972 else
9973 {
9974 break;
9975 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009976 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009977 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009978
9979 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309980 "LFR runtime successfully set roam scan channels to %s"
9981 "- old value is %s - roam state is %s",
9982 newChannelList, oldChannelList,
9983 macTraceGetNeighbourRoamState(
9984 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009985 sme_ReleaseGlobalLock( &pMac->sme );
9986 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009987#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9988 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9989 {
9990 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9991 }
9992#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009993
9994 return status ;
9995}
9996
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009997
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009998#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009999/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010000 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010001 This is a synchronuous call
10002 \param hHal - The handle returned by macOpen.
10003 \return eHAL_STATUS_SUCCESS - SME update config successful.
10004 Other status means SME is failed to update
10005 \sa
10006 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010007eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010008 tANI_U8 *pChannelList,
10009 tANI_U8 numChannels)
10010{
10011 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10012 eHalStatus status = eHAL_STATUS_SUCCESS;
10013 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10014 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
10015 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
10016 tANI_U8 newChannelList[128] = {0};
10017 tANI_U8 i = 0, j = 0;
10018
10019 status = sme_AcquireGlobalLock( &pMac->sme );
10020 if ( HAL_STATUS_SUCCESS( status ) )
10021 {
10022 if (NULL != currChannelListInfo->ChannelList)
10023 {
10024 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10025 {
10026 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10027 currChannelListInfo->ChannelList[i]);
10028 }
10029 }
10030 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
10031
10032 if ( HAL_STATUS_SUCCESS( status ))
10033 {
10034 if (NULL != currChannelListInfo->ChannelList)
10035 {
10036 j = 0;
10037 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10038 {
10039 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10040 currChannelListInfo->ChannelList[i]);
10041 }
10042 }
10043
10044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010045 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10046 newChannelList, oldChannelList,
10047 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010048 }
10049 sme_ReleaseGlobalLock( &pMac->sme );
10050 }
10051#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10052 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10053 {
10054 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10055 }
10056#endif
10057
10058 return status ;
10059}
10060#endif
10061
Srinivas Girigowdade697412013-02-14 16:31:48 -080010062/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010063 \brief sme_getRoamScanChannelList() - get roam scan channel list
10064 This is a synchronous call
10065 \param hHal - The handle returned by macOpen.
10066 \return eHAL_STATUS_SUCCESS - SME update config successful.
10067 Other status means SME is failed to update
10068 \sa
10069 --------------------------------------------------------------------------*/
10070eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10071 tANI_U8 *pNumChannels)
10072{
10073 int i = 0;
10074 tANI_U8 *pOutPtr = pChannelList;
10075 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10076 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10077 eHalStatus status = eHAL_STATUS_SUCCESS;
10078
10079 status = sme_AcquireGlobalLock( &pMac->sme );
10080 if ( HAL_STATUS_SUCCESS( status ) )
10081 {
10082 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10083 {
10084 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10085 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010086 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010087 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010088 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010089 }
10090
10091 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10092 for (i = 0; i < (*pNumChannels); i++)
10093 {
10094 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10095 }
10096 pOutPtr[i] = '\0';
10097 sme_ReleaseGlobalLock( &pMac->sme );
10098 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010099 return status ;
10100}
10101
10102/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010103 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010104 This is a synchronuous call
10105 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010106 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010107 FALSE (0) - if feature is disabled (compile or runtime)
10108 \sa
10109 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010110tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010111{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010112#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010113 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010114 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010115#else
10116 return eANI_BOOLEAN_FALSE;
10117#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010118}
10119
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010120/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010121 \brief sme_GetWESMode() - get WES Mode
10122 This is a synchronous call
10123 \param hHal - The handle returned by macOpen
10124 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10125 \sa
10126 --------------------------------------------------------------------------*/
10127v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10128{
10129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10130 return pMac->roam.configParam.isWESModeEnabled;
10131}
10132
10133/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010134 \brief sme_GetRoamScanControl() - get scan control
10135 This is a synchronous call
10136 \param hHal - The handle returned by macOpen.
10137 \return v_BOOL_t - Enabled(1)/Disabled(0)
10138 \sa
10139 --------------------------------------------------------------------------*/
10140v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10141{
10142 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10143 return pMac->roam.configParam.nRoamScanControl;
10144}
10145#endif
10146
10147/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010148 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10149 This is a synchronuous call
10150 \param hHal - The handle returned by macOpen.
10151 \return TRUE (1) - if the feature is enabled
10152 FALSE (0) - if feature is disabled (compile or runtime)
10153 \sa
10154 --------------------------------------------------------------------------*/
10155tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10156{
10157#ifdef FEATURE_WLAN_LFR
10158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10159 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10160#else
10161 return eANI_BOOLEAN_FALSE;
10162#endif
10163}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010164
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010165/*--------------------------------------------------------------------------
10166 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10167 This is a synchronuous call
10168 \param hHal - The handle returned by macOpen.
10169 \return TRUE (1) - if the feature is enabled
10170 FALSE (0) - if feature is disabled (compile or runtime)
10171 \sa
10172 --------------------------------------------------------------------------*/
10173tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10174{
10175#ifdef WLAN_FEATURE_VOWIFI_11R
10176 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10177 return pMac->roam.configParam.isFastTransitionEnabled;
10178#else
10179 return eANI_BOOLEAN_FALSE;
10180#endif
10181}
10182
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010183/* ---------------------------------------------------------------------------
10184 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010185
Kiet Lam0f320422013-11-21 19:29:17 +053010186 \brief Check if a feature is enabled by FW
10187
10188 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010189
Kiet Lam0f320422013-11-21 19:29:17 +053010190 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010191 -------------------------------------------------------------------------*/
10192tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10193{
10194 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10195}
Kiet Lam0f320422013-11-21 19:29:17 +053010196
10197/* ---------------------------------------------------------------------------
10198 \fn sme_IsFeatureSupportedByDriver
10199 \brief Check if a feature is enabled by Driver
10200
10201 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10202 \- return 1/0 (TRUE/FALSE)
10203 -------------------------------------------------------------------------*/
10204
10205tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10206{
10207 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10208}
10209
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010210#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010211
10212/* ---------------------------------------------------------------------------
10213 \fn sme_SendTdlsMgmtFrame
10214 \brief API to send TDLS management frames.
10215
10216 \param peerMac - peer's Mac Adress.
10217 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10218 \- return VOS_STATUS_SUCCES
10219 -------------------------------------------------------------------------*/
10220VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10221 tANI_U8 sessionId,
10222 tSirMacAddr peerMac,
10223 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10224{
10225 eHalStatus status = eHAL_STATUS_SUCCESS;
10226 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10227
10228 status = sme_AcquireGlobalLock( &pMac->sme );
10229
10230 if ( HAL_STATUS_SUCCESS( status ) )
10231 {
10232 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10233 sme_ReleaseGlobalLock( &pMac->sme );
10234 }
10235 return status ;
10236}
10237
Atul Mittalc0f739f2014-07-31 13:47:47 +053010238// tdlsoffchan
10239
10240/* ---------------------------------------------------------------------------
10241 \fn sme_SendTdlsChanSwitchReq
10242 \brief API to send TDLS management frames.
10243
10244 \param peerMac - peer's Mac Adress.
10245 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10246 \- return VOS_STATUS_SUCCES
10247 -------------------------------------------------------------------------*/
10248VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10249 tANI_U8 sessionId,
10250 tSirMacAddr peerMac,
10251 tANI_S32 tdlsOffCh,
10252 tANI_S32 tdlsOffChBwOffset,
10253 tANI_U8 tdlsSwMode)
10254{
10255 eHalStatus status = eHAL_STATUS_SUCCESS;
10256 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10257
10258 status = sme_AcquireGlobalLock( &pMac->sme );
10259
10260 if ( HAL_STATUS_SUCCESS( status ) )
10261 {
10262 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10263 tdlsOffCh, tdlsOffChBwOffset,
10264 tdlsSwMode);
10265 }
10266 sme_ReleaseGlobalLock( &pMac->sme );
10267 return status ;
10268}
10269
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010270/* ---------------------------------------------------------------------------
10271 \fn sme_SendTdlsMgmtFrame
10272 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010273
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010274 \param peerMac - peer's Mac Adress.
10275 \param frame_type - Type of TDLS mgmt frame to be sent.
10276 \param dialog - dialog token used in the frame.
10277 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010278 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010279 \param buf - additional IEs to be included
10280 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010281 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010282 \- return VOS_STATUS_SUCCES
10283 -------------------------------------------------------------------------*/
10284VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010285 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 -080010286{
10287 eHalStatus status = eHAL_STATUS_SUCCESS;
10288 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10289 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10290
10291 status = sme_AcquireGlobalLock( &pMac->sme );
10292 if ( HAL_STATUS_SUCCESS( status ) )
10293 {
10294 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10295 sendTdlsReq.frameType = frame_type;
10296 sendTdlsReq.buf = buf;
10297 sendTdlsReq.len = len;
10298 sendTdlsReq.dialog = dialog;
10299 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010300 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010301 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010302
10303 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10304
10305 sme_ReleaseGlobalLock( &pMac->sme );
10306 }
10307
10308 return status ;
10309
10310}
10311/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010312 \fn sme_ChangeTdlsPeerSta
10313 \brief API to Update TDLS peer sta parameters.
10314
10315 \param peerMac - peer's Mac Adress.
10316 \param staParams - Peer Station Parameters
10317 \- return VOS_STATUS_SUCCES
10318 -------------------------------------------------------------------------*/
10319VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10320 tCsrStaParams *pstaParams)
10321{
10322 eHalStatus status = eHAL_STATUS_SUCCESS;
10323 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10324
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010325 if (NULL == pstaParams)
10326 {
10327 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10328 "%s :pstaParams is NULL",__func__);
10329 return eHAL_STATUS_FAILURE;
10330 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010331 status = sme_AcquireGlobalLock( &pMac->sme );
10332 if ( HAL_STATUS_SUCCESS( status ) )
10333 {
10334 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10335
10336 sme_ReleaseGlobalLock( &pMac->sme );
10337 }
10338
10339 return status ;
10340
10341}
10342
10343/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010344 \fn sme_AddTdlsPeerSta
10345 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010346
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010347 \param peerMac - peer's Mac Adress.
10348 \- return VOS_STATUS_SUCCES
10349 -------------------------------------------------------------------------*/
10350VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10351{
10352 eHalStatus status = eHAL_STATUS_SUCCESS;
10353 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10354
10355 status = sme_AcquireGlobalLock( &pMac->sme );
10356 if ( HAL_STATUS_SUCCESS( status ) )
10357 {
10358 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10359
10360 sme_ReleaseGlobalLock( &pMac->sme );
10361 }
10362
10363 return status ;
10364
10365}
10366/* ---------------------------------------------------------------------------
10367 \fn sme_DeleteTdlsPeerSta
10368 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010369
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010370 \param peerMac - peer's Mac Adress.
10371 \- return VOS_STATUS_SUCCES
10372 -------------------------------------------------------------------------*/
10373VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10374{
10375 eHalStatus status = eHAL_STATUS_SUCCESS;
10376 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10377
10378 status = sme_AcquireGlobalLock( &pMac->sme );
10379 if ( HAL_STATUS_SUCCESS( status ) )
10380 {
10381 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10382
10383 sme_ReleaseGlobalLock( &pMac->sme );
10384 }
10385
10386 return status ;
10387
10388}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010389/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010390 \fn sme_SetTdlsPowerSaveProhibited
10391 \API to set/reset the isTdlsPowerSaveProhibited.
10392
10393 \- return void
10394 -------------------------------------------------------------------------*/
10395void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10396{
10397 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10398
10399 pMac->isTdlsPowerSaveProhibited = val;
10400 return;
10401}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010402#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010403/* ---------------------------------------------------------------------------
10404 \fn sme_IsPmcBmps
10405 \API to Check if PMC state is BMPS.
10406
10407 \- return v_BOOL_t
10408 -------------------------------------------------------------------------*/
10409v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10410{
10411 return (BMPS == pmcGetPmcState(hHal));
10412}
10413
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010414#ifdef FEATURE_WLAN_TDLS_INTERNAL
10415/*
10416 * SME API to start TDLS discovery Procedure
10417 */
10418VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10419{
10420 VOS_STATUS status = VOS_STATUS_SUCCESS;
10421 tCsrTdlsDisRequest disReq = {{0}} ;
10422 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10423 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10424
10425 return status ;
10426
10427}
10428
10429/*
10430 * Process TDLS discovery results
10431 */
10432v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10433 tSmeTdlsDisResult *disResult, v_U8_t listType)
10434{
10435 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10436 tSirTdlsPeerInfo *peerInfo = NULL ;
10437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10438 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10439 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10440 tListElem *pEntry = NULL ;
10441 v_U8_t peerCnt = 0 ;
10442
10443 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010444 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010445 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10446 while(pEntry)
10447 {
10448 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10449 tdlsPeerStaLink) ;
10450 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10451
10452 switch(listType)
10453 {
10454 case TDLS_SETUP_LIST:
10455 {
10456 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10457 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010458 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10459 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010460 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10461 peerCnt++ ;
10462 }
10463 break ;
10464 }
10465 case TDLS_DIS_LIST:
10466 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010467 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10468 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010469 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10470 peerCnt++ ;
10471 break ;
10472 }
10473 default:
10474 {
10475 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010476 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010477 break ;
10478 }
10479 }
10480
10481 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10482 }
10483
10484 return peerCnt ;
10485
10486}
10487
10488/*
10489 * SME API to start TDLS link setup Procedure.
10490 */
10491VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10492{
10493 VOS_STATUS status = VOS_STATUS_SUCCESS;
10494 tCsrTdlsSetupRequest setupReq = {{0}} ;
10495 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10496 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10497 return status ;
10498
10499}
10500
10501/*
10502 * SME API to start TDLS link Teardown Procedure.
10503 */
10504VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10505{
10506 VOS_STATUS status = VOS_STATUS_SUCCESS;
10507 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10508 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10509 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10510 return status ;
10511
10512}
10513
10514#endif /* FEATURE_WLAN_TDLS */
10515
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010516eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10517{
10518 eHalStatus status = eHAL_STATUS_FAILURE;
10519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10520
10521 smsLog(pMac, LOG2, FL("enter"));
10522 status = sme_AcquireGlobalLock( &pMac->sme );
10523 if ( HAL_STATUS_SUCCESS( status ) )
10524 {
10525 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10526 sme_ReleaseGlobalLock( &pMac->sme );
10527 }
10528 smsLog(pMac, LOG2, FL("exit status %d"), status);
10529
10530 return (status);
10531}
10532
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010533/*
10534 * SME API to enable/disable WLAN driver initiated SSR
10535 */
10536void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10537{
10538 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10539 eHalStatus status = eHAL_STATUS_SUCCESS;
10540
10541 status = sme_AcquireGlobalLock(&pMac->sme);
10542 if (HAL_STATUS_SUCCESS(status))
10543 {
10544 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10545 "SSR level is changed %d", enableSSR);
10546 /* not serializing this messsage, as this is only going
10547 * to set a variable in WDA/WDI
10548 */
10549 WDA_SetEnableSSR(enableSSR);
10550 sme_ReleaseGlobalLock(&pMac->sme);
10551 }
10552 return;
10553}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010554
10555/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010556 * SME API to stringify bonding mode. (hostapd convention)
10557 */
10558
10559static const char* sme_CBMode2String( tANI_U32 mode)
10560{
10561 switch (mode)
10562 {
10563 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10564 return "HT20";
10565 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10566 return "HT40-"; /* lower secondary channel */
10567 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10568 return "HT40+"; /* upper secondary channel */
10569#ifdef WLAN_FEATURE_11AC
10570 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10571 return "VHT80+40+"; /* upper secondary channels */
10572 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10573 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10574 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10575 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10576 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10577 return "VHT80-40-"; /* lower secondary channels */
10578#endif
10579 default:
10580 VOS_ASSERT(0);
10581 return "Unknown";
10582 }
10583}
10584
10585/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010586 * SME API to determine the channel bonding mode
10587 */
10588VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10589{
10590 tSmeConfigParams smeConfig;
10591 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10592
10593 if (
10594#ifdef WLAN_FEATURE_11AC
10595 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10596 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10597#endif
10598 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010599 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10600
10601 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10602 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10603
10604 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010605 )
10606 {
10607 return VOS_STATUS_SUCCESS;
10608 }
10609
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053010610 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010611 sme_GetConfigParam(pMac, &smeConfig);
10612
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010613 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010614#ifdef WLAN_FEATURE_AP_HT40_24G
10615 if ( !pMac->roam.configParam.channelBondingMode5GHz
10616 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10617#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010618 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010619#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010620 return VOS_STATUS_SUCCESS;
10621 }
10622
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010623
10624#ifdef WLAN_FEATURE_11AC
10625 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10626 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10627 {
10628 if ( channel== 36 || channel == 52 || channel == 100 ||
10629 channel == 116 || channel == 149 )
10630 {
10631 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010632 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010633 }
10634 else if ( channel == 40 || channel == 56 || channel == 104 ||
10635 channel == 120 || channel == 153 )
10636 {
10637 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010638 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010639 }
10640 else if ( channel == 44 || channel == 60 || channel == 108 ||
10641 channel == 124 || channel == 157 )
10642 {
10643 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010644 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010645 }
10646 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010647 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010648 {
10649 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010650 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010651 }
10652 else if ( channel == 165 )
10653 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010654 smeConfig.csrConfig.channelBondingMode5GHz =
10655 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010656 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010657
10658#ifdef WLAN_FEATURE_AP_HT40_24G
10659 if (smeConfig.csrConfig.apHT40_24GEnabled)
10660 {
10661 if (channel >= 1 && channel <= 7)
10662 smeConfig.csrConfig.channelBondingAPMode24GHz =
10663 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10664 else if (channel >= 8 && channel <= 13)
10665 smeConfig.csrConfig.channelBondingAPMode24GHz =
10666 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10667 else if (channel ==14)
10668 smeConfig.csrConfig.channelBondingAPMode24GHz =
10669 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10670 }
10671#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010672 }
10673#endif
10674
10675 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10676 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10677 {
10678 if ( channel== 40 || channel == 48 || channel == 56 ||
10679 channel == 64 || channel == 104 || channel == 112 ||
10680 channel == 120 || channel == 128 || channel == 136 ||
10681 channel == 144 || channel == 153 || channel == 161 )
10682 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010683 smeConfig.csrConfig.channelBondingMode5GHz =
10684 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010685 }
10686 else if ( channel== 36 || channel == 44 || channel == 52 ||
10687 channel == 60 || channel == 100 || channel == 108 ||
10688 channel == 116 || channel == 124 || channel == 132 ||
10689 channel == 140 || channel == 149 || channel == 157 )
10690 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010691 smeConfig.csrConfig.channelBondingMode5GHz =
10692 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010693 }
10694 else if ( channel == 165 )
10695 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010696 smeConfig.csrConfig.channelBondingMode5GHz =
10697 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010698 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010699
10700#ifdef WLAN_FEATURE_AP_HT40_24G
10701 if (smeConfig.csrConfig.apHT40_24GEnabled)
10702 {
10703 if (channel >= 1 && channel <= 7)
10704 smeConfig.csrConfig.channelBondingAPMode24GHz =
10705 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10706 else if (channel >= 8 && channel <= 13)
10707 smeConfig.csrConfig.channelBondingAPMode24GHz =
10708 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10709 else if (channel ==14)
10710 smeConfig.csrConfig.channelBondingAPMode24GHz =
10711 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10712 }
10713#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010714 }
krunal soni634aba32014-03-06 17:46:50 -080010715
10716 /*
10717 for 802.11a phy mode, channel bonding should be zero.
10718 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10719 through csrChangeDefaultConfigParam function. We will override this
10720 value here.
10721 */
10722 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10723 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10724 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10725 {
10726 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010727#ifdef WLAN_FEATURE_AP_HT40_24G
10728 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10729 smeConfig.csrConfig.channelBondingAPMode24GHz =
10730 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10731#else
krunal soni634aba32014-03-06 17:46:50 -080010732 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010733#endif
krunal soni634aba32014-03-06 17:46:50 -080010734
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010735#ifdef WLAN_FEATURE_AP_HT40_24G
10736 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10737 FL("%s cbmode selected=%d bonding mode:%s"),
10738 (channel <= 14) ? "2G" : "5G",
10739 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10740 smeConfig.csrConfig.channelBondingMode5GHz,
10741 (channel <= 14) ?
10742 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10743 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10744#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010745 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010746 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10747#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010748
10749 sme_UpdateConfig (pMac, &smeConfig);
10750 return VOS_STATUS_SUCCESS;
10751}
10752
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010753/*--------------------------------------------------------------------------
10754
10755 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10756 \param hHal - The handle returned by macOpen.
10757 \param currDeviceMode - Current operating device mode.
10758 --------------------------------------------------------------------------*/
10759
10760void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10761{
10762 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10763 pMac->sme.currDeviceMode = currDeviceMode;
10764 return;
10765}
10766
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010767#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10768/*--------------------------------------------------------------------------
10769 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10770 from CSR.
10771 This is a synchronous call
10772 \param hHal - The handle returned by macOpen
10773 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10774 BSSID, channel etc.)
10775 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10776 Other status means SME is failed to send the request.
10777 \sa
10778 --------------------------------------------------------------------------*/
10779
10780eHalStatus sme_HandoffRequest(tHalHandle hHal,
10781 tCsrHandoffRequest *pHandoffInfo)
10782{
10783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10784 eHalStatus status = eHAL_STATUS_SUCCESS;
10785
10786 status = sme_AcquireGlobalLock( &pMac->sme );
10787 if ( HAL_STATUS_SUCCESS( status ) )
10788 {
10789 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10790 "%s: invoked", __func__);
10791 status = csrHandoffRequest(pMac, pHandoffInfo);
10792 sme_ReleaseGlobalLock( &pMac->sme );
10793 }
10794
10795 return status ;
10796}
10797#endif
10798
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010799/*
10800 * SME API to check if there is any infra station or
10801 * P2P client is connected
10802 */
10803VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10804{
10805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10806 if(csrIsInfraConnected(pMac))
10807 {
10808 return VOS_STATUS_SUCCESS;
10809 }
10810 return VOS_STATUS_E_FAILURE;
10811}
10812
Agarwal Ashish57e84372014-12-05 18:26:53 +053010813/*
10814 * SME API to check if any sessoion connected.
10815 */
10816VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
10817{
10818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10819 if(csrIsAnySessionConnected(pMac))
10820 {
10821
10822 return VOS_STATUS_SUCCESS;
10823 }
10824 return VOS_STATUS_E_FAILURE;
10825}
10826
Leo Chang9056f462013-08-01 19:21:11 -070010827
10828#ifdef FEATURE_WLAN_LPHB
10829/* ---------------------------------------------------------------------------
10830 \fn sme_LPHBConfigReq
10831 \API to make configuration LPHB within FW.
10832 \param hHal - The handle returned by macOpen
10833 \param lphdReq - LPHB request argument by client
10834 \param pCallbackfn - LPHB timeout notification callback function pointer
10835 \- return Configuration message posting status, SUCCESS or Fail
10836 -------------------------------------------------------------------------*/
10837eHalStatus sme_LPHBConfigReq
10838(
10839 tHalHandle hHal,
10840 tSirLPHBReq *lphdReq,
10841 void (*pCallbackfn)(void *pAdapter, void *indParam)
10842)
10843{
10844 eHalStatus status = eHAL_STATUS_SUCCESS;
10845 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10846 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10847 vos_msg_t vosMessage;
10848
10849 status = sme_AcquireGlobalLock(&pMac->sme);
10850 if (eHAL_STATUS_SUCCESS == status)
10851 {
10852 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10853 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010854 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010855 {
10856 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10857 "%s: Indication Call back did not registered", __func__);
10858 sme_ReleaseGlobalLock(&pMac->sme);
10859 return eHAL_STATUS_FAILURE;
10860 }
10861 else if (NULL != pCallbackfn)
10862 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010863 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010864 }
10865
10866 /* serialize the req through MC thread */
10867 vosMessage.bodyptr = lphdReq;
10868 vosMessage.type = WDA_LPHB_CONF_REQ;
10869 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10870 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10871 {
10872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10873 "%s: Post Config LPHB MSG fail", __func__);
10874 status = eHAL_STATUS_FAILURE;
10875 }
10876 sme_ReleaseGlobalLock(&pMac->sme);
10877 }
10878
10879 return(status);
10880}
10881#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010882/*--------------------------------------------------------------------------
10883 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10884 scan parameter.
10885 This is a synchronous call
10886 \param hHal - The handle returned by macOpen
10887 \return NONE.
10888 \sa
10889 --------------------------------------------------------------------------*/
10890void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10891 tANI_U8 nNumP2PChan)
10892{
10893 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10894
10895 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10896 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10897
10898 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10899 "%s: SCAN nNumStaChanCombinedConc : %d,"
10900 "nNumP2PChanCombinedConc : %d ",
10901 __func__, nNumStaChan, nNumP2PChan);
10902
10903 return;
10904
10905}
Leo Chang9056f462013-08-01 19:21:11 -070010906
Yue Mab9c86f42013-08-14 15:59:08 -070010907/* ---------------------------------------------------------------------------
10908 \fn sme_AddPeriodicTxPtrn
10909 \brief API to Periodic TX Pattern Offload feature
10910 \param hHal - The handle returned by macOpen
10911 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10912 \return eHalStatus
10913 ---------------------------------------------------------------------------*/
10914eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10915 *addPeriodicTxPtrnParams)
10916{
10917 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10918 eHalStatus status;
10919 vos_msg_t msg;
10920
10921 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10922 {
10923 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10924 msg.bodyptr = addPeriodicTxPtrnParams;
10925
10926 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10927 {
10928 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10929 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10930 __func__);
10931
10932 sme_ReleaseGlobalLock(&pMac->sme);
10933 return eHAL_STATUS_FAILURE;
10934 }
10935
10936 sme_ReleaseGlobalLock(&pMac->sme);
10937 return eHAL_STATUS_SUCCESS;
10938 }
10939
10940 return status;
10941}
10942
10943/* ---------------------------------------------------------------------------
10944 \fn sme_DelPeriodicTxPtrn
10945 \brief API to Periodic TX Pattern Offload feature
10946 \param hHal - The handle returned by macOpen
10947 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10948 \return eHalStatus
10949 ---------------------------------------------------------------------------*/
10950eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10951 *delPeriodicTxPtrnParams)
10952{
10953 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10954 eHalStatus status;
10955 vos_msg_t msg;
10956
10957 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10958 {
10959 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10960 msg.bodyptr = delPeriodicTxPtrnParams;
10961
10962 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10963 {
10964 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10965 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10966 __func__);
10967
10968 sme_ReleaseGlobalLock(&pMac->sme);
10969 return eHAL_STATUS_FAILURE;
10970 }
10971
10972 sme_ReleaseGlobalLock(&pMac->sme);
10973 return eHAL_STATUS_SUCCESS;
10974 }
10975
10976 return status;
10977}
10978
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010979void smeGetCommandQStatus( tHalHandle hHal )
10980{
10981 tSmeCmd *pTempCmd = NULL;
10982 tListElem *pEntry;
10983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10984
10985 if (NULL == pMac)
10986 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10988 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010989 return;
10990 }
10991
10992 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10993 if( pEntry )
10994 {
10995 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10996 }
10997 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10998 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10999 if(pTempCmd)
11000 {
11001 if( eSmeCsrCommandMask & pTempCmd->command )
11002 {
11003 //CSR command is stuck. See what the reason code is for that command
11004 dumpCsrCommandInfo(pMac, pTempCmd);
11005 }
11006 } //if(pTempCmd)
11007
11008 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
11009 csrLLCount(&pMac->sme.smeCmdPendingList));
11010
11011 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
11012 csrLLCount(&pMac->roam.roamCmdPendingList));
11013
11014 return;
11015}
Rajeev79dbe4c2013-10-05 11:03:42 +053011016
11017#ifdef FEATURE_WLAN_BATCH_SCAN
11018/* ---------------------------------------------------------------------------
11019 \fn sme_SetBatchScanReq
11020 \brief API to set batch scan request in FW
11021 \param hHal - The handle returned by macOpen.
11022 \param pRequest - Pointer to the batch request.
11023 \param sessionId - session ID
11024 \param callbackRoutine - HDD callback which needs to be invoked after
11025 getting set batch scan response from FW
11026 \param callbackContext - pAdapter context
11027 \return eHalStatus
11028 ---------------------------------------------------------------------------*/
11029eHalStatus sme_SetBatchScanReq
11030(
11031 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
11032 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11033 void *callbackContext
11034)
11035{
11036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11037 eHalStatus status;
11038
Yue Mae36e3552014-03-05 17:06:20 -080011039 if (!pMac)
11040 {
11041 return eHAL_STATUS_FAILURE;
11042 }
11043
Rajeev79dbe4c2013-10-05 11:03:42 +053011044 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11045 {
11046 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11047 callbackContext);
11048 sme_ReleaseGlobalLock( &pMac->sme );
11049 }
11050
11051 return status;
11052}
11053
11054/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011055 \fn sme_SendRateUpdateInd
11056 \brief API to Update rate
11057 \param hHal - The handle returned by macOpen
11058 \param rateUpdateParams - Pointer to rate update params
11059 \return eHalStatus
11060 ---------------------------------------------------------------------------*/
11061eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11062{
11063 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11064 eHalStatus status;
11065 vos_msg_t msg;
11066
11067 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11068 {
11069 msg.type = WDA_RATE_UPDATE_IND;
11070 msg.bodyptr = rateUpdateParams;
11071
11072 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11073 {
11074 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11075 "to post WDA_SET_RMC_RATE_IND to WDA!",
11076 __func__);
11077
11078 sme_ReleaseGlobalLock(&pMac->sme);
11079 return eHAL_STATUS_FAILURE;
11080 }
11081
11082 sme_ReleaseGlobalLock(&pMac->sme);
11083 return eHAL_STATUS_SUCCESS;
11084 }
11085
11086 return status;
11087}
11088
11089/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011090 \fn sme_TriggerBatchScanResultInd
11091 \brief API to trigger batch scan result indications from FW
11092 \param hHal - The handle returned by macOpen.
11093 \param pRequest - Pointer to get batch request.
11094 \param sessionId - session ID
11095 \param callbackRoutine - HDD callback which needs to be invoked after
11096 getting batch scan result indication from FW
11097 \param callbackContext - pAdapter context
11098 \return eHalStatus
11099 ---------------------------------------------------------------------------*/
11100eHalStatus sme_TriggerBatchScanResultInd
11101(
11102 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
11103 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
11104 void *callbackContext
11105)
11106{
11107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11108 eHalStatus status;
11109
11110 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11111 {
11112 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
11113 callbackRoutine, callbackContext);
11114 sme_ReleaseGlobalLock( &pMac->sme );
11115 }
11116
11117 return status;
11118}
11119
11120
11121/* ---------------------------------------------------------------------------
11122 \fn sme_StopBatchScanInd
11123 \brief API to stop batch scan request in FW
11124 \param hHal - The handle returned by macOpen.
11125 \param pRequest - Pointer to the batch request.
11126 \param sessionId - session ID
11127 \return eHalStatus
11128 ---------------------------------------------------------------------------*/
11129eHalStatus sme_StopBatchScanInd
11130(
11131 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
11132)
11133{
11134 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11135 eHalStatus status;
11136
11137 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11138 {
11139 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
11140 sme_ReleaseGlobalLock( &pMac->sme );
11141 }
11142
11143 return status;
11144}
11145
11146#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080011147
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011148
Leo Chang0b0e45a2013-12-15 15:18:55 -080011149#ifdef FEATURE_WLAN_CH_AVOID
11150/* ---------------------------------------------------------------------------
11151 \fn sme_AddChAvoidCallback
11152 \brief Used to plug in callback function
11153 Which notify channel may not be used with SAP or P2PGO mode.
11154 Notification come from FW.
11155 \param hHal
11156 \param pCallbackfn : callback function pointer should be plugged in
11157 \- return eHalStatus
11158 -------------------------------------------------------------------------*/
11159eHalStatus sme_AddChAvoidCallback
11160(
11161 tHalHandle hHal,
11162 void (*pCallbackfn)(void *pAdapter, void *indParam)
11163)
11164{
11165 eHalStatus status = eHAL_STATUS_SUCCESS;
11166 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11167
11168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11169 "%s: Plug in CH AVOID CB", __func__);
11170
11171 status = sme_AcquireGlobalLock(&pMac->sme);
11172 if (eHAL_STATUS_SUCCESS == status)
11173 {
11174 if (NULL != pCallbackfn)
11175 {
11176 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
11177 }
11178 sme_ReleaseGlobalLock(&pMac->sme);
11179 }
11180
11181 return(status);
11182}
11183#endif /* FEATURE_WLAN_CH_AVOID */
11184
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011185void activeListCmdTimeoutHandle(void *userData)
11186{
11187 if (NULL == userData)
11188 return;
11189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11190 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011191 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011192 smeGetCommandQStatus((tHalHandle) userData);
11193}
11194
Sunil Duttc69bccb2014-05-26 21:30:20 +053011195#ifdef WLAN_FEATURE_LINK_LAYER_STATS
11196
11197/* ---------------------------------------------------------------------------
11198 \fn sme_LLStatsSetReq
11199 \brief API to set link layer stats request to FW
11200 \param hHal - The handle returned by macOpen.
11201
11202 \Param pStatsReq - a pointer to a caller allocated object of
11203 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
11204 stats set.
11205
11206 \return eHalStatus
11207 ---------------------------------------------------------------------------*/
11208eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11209 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11210{
11211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11212 vos_msg_t msg;
11213 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011214 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011215
Dino Mycledf0a5d92014-07-04 09:41:55 +053011216 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11217 if ( !plinkLayerSetReq)
11218 {
11219 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11220 "%s: Not able to allocate memory for "
11221 "WDA_LINK_LAYER_STATS_SET_REQ",
11222 __func__);
11223 return eHAL_STATUS_FAILURE;
11224 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011225
Dino Mycledf0a5d92014-07-04 09:41:55 +053011226 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11227
Sunil Duttc69bccb2014-05-26 21:30:20 +053011228
11229 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11230 {
11231 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11232 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011233 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011234
11235 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11236 {
11237 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11238 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11239 status = eHAL_STATUS_FAILURE;
11240 }
11241 sme_ReleaseGlobalLock( &pMac->sme );
11242 }
11243 else
11244 {
11245 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11246 "sme_AcquireGlobalLock error", __func__);
11247 }
11248 return status;
11249}
11250
11251/* ---------------------------------------------------------------------------
11252 \fn sme_LLStatsGetReq
11253 \brief API to get link layer stats request to FW
11254 \param hHal - The handle returned by macOpen.
11255
11256 \Param pStatsReq - a pointer to a caller allocated object of
11257 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11258 stats get.
11259
11260 \return eHalStatus
11261 ---------------------------------------------------------------------------*/
11262eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11263 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11264{
11265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11266 vos_msg_t msg;
11267 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011268 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011269
Dino Mycledf0a5d92014-07-04 09:41:55 +053011270 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11271 if ( !pGetStatsReq)
11272 {
11273 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11274 "%s: Not able to allocate memory for "
11275 "WDA_LINK_LAYER_STATS_GET_REQ",
11276 __func__);
11277 return eHAL_STATUS_FAILURE;
11278 }
11279 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011280
11281 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11282 {
11283 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11284 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011285 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011286 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11287 {
11288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11289 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11290 status = eHAL_STATUS_FAILURE;
11291 }
11292 sme_ReleaseGlobalLock( &pMac->sme );
11293 }
11294 else
11295 {
11296 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11297 "sme_AcquireGlobalLock error", __func__);
11298 }
11299 return status;
11300}
11301
11302/* ---------------------------------------------------------------------------
11303 \fn sme_LLStatsClearReq
11304 \brief API to clear link layer stats request to FW
11305 \param hHal - The handle returned by macOpen.
11306
11307 \Param pStatsReq - a pointer to a caller allocated object of
11308 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11309 stats clear.
11310
11311 \return eHalStatus
11312 ---------------------------------------------------------------------------*/
11313eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11314 tSirLLStatsClearReq *pLinkLayerStatsClear)
11315{
11316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11317 vos_msg_t msg;
11318 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011319 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011320
11321
Sunil Duttc69bccb2014-05-26 21:30:20 +053011322
Dino Mycledf0a5d92014-07-04 09:41:55 +053011323 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11324 if ( !pClearStatsReq)
11325 {
11326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11327 "%s: Not able to allocate memory for "
11328 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11329 __func__);
11330 return eHAL_STATUS_FAILURE;
11331 }
11332
11333 *pClearStatsReq = *pLinkLayerStatsClear;
11334
Sunil Duttc69bccb2014-05-26 21:30:20 +053011335 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11336 {
11337 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11338 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011339 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011340
11341 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11342 {
11343 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11344 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11345 status = eHAL_STATUS_FAILURE;
11346 }
11347 sme_ReleaseGlobalLock( &pMac->sme );
11348 }
11349 else
11350 {
11351 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11352 "sme_AcquireGlobalLock error", __func__);
11353 }
11354
11355 return status;
11356}
11357
11358/* ---------------------------------------------------------------------------
11359 \fn sme_SetLinkLayerStatsIndCB
11360 \brief API to trigger Link Layer Statistic indications from FW
11361 \param hHal - The handle returned by macOpen.
11362 \param sessionId - session ID
11363 \param callbackRoutine - HDD callback which needs to be invoked after
11364 getting Link Layer Statistics from FW
11365 \param callbackContext - pAdapter context
11366 \return eHalStatus
11367 ---------------------------------------------------------------------------*/
11368eHalStatus sme_SetLinkLayerStatsIndCB
11369(
Dino Mycled3d50022014-07-07 12:58:25 +053011370 tHalHandle hHal,
11371 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11372 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011373)
11374{
11375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11376 eHalStatus status;
11377
11378 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11379 {
11380 if (NULL != callbackRoutine)
11381 {
11382 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011383 }
11384 sme_ReleaseGlobalLock( &pMac->sme );
11385 }
11386
11387 return status;
11388}
11389#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11390
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011391eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11392{
11393 eHalStatus status = eHAL_STATUS_SUCCESS;
11394 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11395 pMac->fEnableDebugLog = set_value;
11396 return (status);
11397}
11398
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011399VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011400 sme_QosWmmUpType *dscpmapping,
11401 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011402{
11403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011404 eHalStatus status = eHAL_STATUS_SUCCESS;
11405 v_U8_t i, j, peSessionId;
11406 tCsrRoamSession *pCsrSession = NULL;
11407 tpPESession pSession = NULL;
11408
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011409 status = sme_AcquireGlobalLock( &pMac->sme );
11410 if ( HAL_STATUS_SUCCESS( status ) )
11411 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011412 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11413 {
11414 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11415 "%s: Invalid session Id %u", __func__, sessionId);
11416 sme_ReleaseGlobalLock( &pMac->sme);
11417 return eHAL_STATUS_FAILURE;
11418 }
11419 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11420
11421 if (pCsrSession == NULL)
11422 {
11423 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11424 "%s: CSR Session lookup fails %u", __func__, sessionId);
11425 sme_ReleaseGlobalLock( &pMac->sme);
11426 return eHAL_STATUS_FAILURE;
11427 }
11428
11429 pSession = peFindSessionByBssid( pMac,
11430 pCsrSession->connectedProfile.bssid, &peSessionId );
11431
11432 if (pSession == NULL)
11433 {
11434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11435 "%s: Session lookup fails for BSSID", __func__);
11436 sme_ReleaseGlobalLock( &pMac->sme);
11437 return eHAL_STATUS_FAILURE;
11438 }
11439
11440 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011441 {
11442 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11443 "%s: QOS Mapping IE not present", __func__);
11444 sme_ReleaseGlobalLock( &pMac->sme);
11445 return eHAL_STATUS_FAILURE;
11446 }
11447 else
11448 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011449 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011450 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011451 for (j = pSession->QosMapSet.dscp_range[i][0];
11452 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011453 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011454 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11455 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011456 {
11457 dscpmapping[j]= 0;
11458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11459 "%s: User Priority %d is not used in mapping",
11460 __func__, i);
11461 break;
11462 }
11463 else
11464 {
11465 dscpmapping[j]= i;
11466 }
11467 }
11468 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011469 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011470 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011471 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011472 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011473 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11474 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011475 }
11476 }
11477 }
11478 }
11479 sme_ReleaseGlobalLock( &pMac->sme);
11480 return status;
11481}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011482
Agarwal Ashish5e414792014-06-08 15:25:23 +053011483tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11484{
11485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11486
11487 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11488 pMac->scan.countryCode11d, 2))
11489 {
11490 return eANI_BOOLEAN_TRUE;
11491 }
11492 else
11493 {
11494 return eANI_BOOLEAN_FALSE;
11495 }
11496}
Dino Mycle2c198072014-06-10 10:15:52 +053011497
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011498eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011499{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011500 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11501 eHalStatus status = eHAL_STATUS_SUCCESS;
11502 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011503
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011504 pMacSpoofCmd = csrGetCommandBuffer(pMac);
11505 if (pMacSpoofCmd)
11506 {
11507 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
11508 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
11509 sizeof(tSirSpoofMacAddrReq), 0);
11510 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
11511 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011512
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011513 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, eANI_BOOLEAN_TRUE);
11514 if ( !HAL_STATUS_SUCCESS( status ) )
11515 {
11516 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
11517 csrReleaseCommandScan(pMac, pMacSpoofCmd);
11518 }
11519 }
11520 else
11521 {
11522 //log error
11523 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
11524 status = eHAL_STATUS_RESOURCES;
11525 }
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011526
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011527 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011528}
11529
Dino Mycle2c198072014-06-10 10:15:52 +053011530#ifdef WLAN_FEATURE_EXTSCAN
11531/* ---------------------------------------------------------------------------
11532 \fn sme_GetValidChannelsByBand
11533 \brief SME API to fetch all valid channel filtered by band
11534 \param hHal
11535 \param wifiBand: RF band information
11536 \param aValidChannels: Array to store channel info
11537 \param len: number of channels
11538 \- return eHalStatus
11539 -------------------------------------------------------------------------*/
11540eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11541 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11542{
11543 eHalStatus status = eHAL_STATUS_SUCCESS;
11544 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11546 tANI_U8 numChannels = 0;
11547 tANI_U8 i = 0;
11548 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11549
11550 if (!aValidChannels || !pNumChannels) {
11551 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11552 FL("Output channel list/NumChannels is NULL"));
11553 return eHAL_STATUS_INVALID_PARAMETER;
11554 }
11555
11556 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11557 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11558 FL("Invalid wifiBand (%d)"), wifiBand);
11559 return eHAL_STATUS_INVALID_PARAMETER;
11560 }
11561
11562 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11563 &totValidChannels);
11564 if (!HAL_STATUS_SUCCESS(status)) {
11565 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11566 FL("Failed to get valid channel list (err=%d)"), status);
11567 return status;
11568 }
11569
11570 switch (wifiBand) {
11571 case WIFI_BAND_UNSPECIFIED:
11572 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11573 "return all (%d) valid channels"), totValidChannels);
11574 numChannels = totValidChannels;
11575 for (i = 0; i < numChannels; i++)
11576 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11577 break;
11578
11579 case WIFI_BAND_BG:
11580 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11581 for (i = 0; i < totValidChannels; i++)
11582 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11583 aValidChannels[numChannels++] =
11584 vos_chan_to_freq(chanList[i]);
11585 break;
11586
11587 case WIFI_BAND_A:
11588 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11589 FL("WIFI_BAND_A (5 GHz without DFS)"));
11590 for (i = 0; i < totValidChannels; i++)
11591 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11592 !CSR_IS_CHANNEL_DFS(chanList[i]))
11593 aValidChannels[numChannels++] =
11594 vos_chan_to_freq(chanList[i]);
11595 break;
11596
11597 case WIFI_BAND_ABG:
11598 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11599 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11600 for (i = 0; i < totValidChannels; i++)
11601 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11602 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11603 !CSR_IS_CHANNEL_DFS(chanList[i]))
11604 aValidChannels[numChannels++] =
11605 vos_chan_to_freq(chanList[i]);
11606 break;
11607
11608 case WIFI_BAND_A_DFS_ONLY:
11609 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11610 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11611 for (i = 0; i < totValidChannels; i++)
11612 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11613 CSR_IS_CHANNEL_DFS(chanList[i]))
11614 aValidChannels[numChannels++] =
11615 vos_chan_to_freq(chanList[i]);
11616 break;
11617
11618 case WIFI_BAND_A_WITH_DFS:
11619 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11620 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11621 for (i = 0; i < totValidChannels; i++)
11622 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11623 aValidChannels[numChannels++] =
11624 vos_chan_to_freq(chanList[i]);
11625 break;
11626
11627 case WIFI_BAND_ABG_WITH_DFS:
11628 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11629 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11630 for (i = 0; i < totValidChannels; i++)
11631 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11632 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11633 aValidChannels[numChannels++] =
11634 vos_chan_to_freq(chanList[i]);
11635 break;
11636
11637 default:
11638 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11639 FL("Unknown wifiBand (%d))"), wifiBand);
11640 return eHAL_STATUS_INVALID_PARAMETER;
11641 break;
11642 }
11643 *pNumChannels = numChannels;
11644
11645 return status;
11646}
11647/* ---------------------------------------------------------------------------
11648 \fn sme_EXTScanGetCapabilities
11649 \brief SME API to fetch Extended Scan capabilities
11650 \param hHal
11651 \param pReq: Extended Scan capabilities structure
11652 \- return eHalStatus
11653 -------------------------------------------------------------------------*/
11654eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11655 tSirGetEXTScanCapabilitiesReqParams *pReq)
11656{
11657 eHalStatus status = eHAL_STATUS_SUCCESS;
11658 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11659 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11660 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011661 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11662
11663 pGetEXTScanCapabilitiesReq =
11664 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11665 if ( !pGetEXTScanCapabilitiesReq)
11666 {
11667 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11668 "%s: Not able to allocate memory for "
11669 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11670 __func__);
11671 return eHAL_STATUS_FAILURE;
11672 }
11673
11674 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011675
11676 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11677 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11678 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11679 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011680 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011681 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11682 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11683 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11684 status = eHAL_STATUS_FAILURE;
11685
11686 sme_ReleaseGlobalLock(&pMac->sme);
11687 }
11688 return(status);
11689}
11690
11691/* ---------------------------------------------------------------------------
11692 \fn sme_EXTScanStart
11693 \brief SME API to issue Extended Scan start
11694 \param hHal
11695 \param pStartCmd: Extended Scan start structure
11696 \- return eHalStatus
11697 -------------------------------------------------------------------------*/
11698eHalStatus sme_EXTScanStart (tHalHandle hHal,
11699 tSirEXTScanStartReqParams *pStartCmd)
11700{
11701 eHalStatus status = eHAL_STATUS_SUCCESS;
11702 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11703 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11704 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011705 tSirEXTScanStartReqParams *pextScanStartReq;
11706
11707 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11708 if ( !pextScanStartReq)
11709 {
11710 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11711 "%s: Not able to allocate memory for "
11712 "WDA_EXTSCAN_START_REQ",
11713 __func__);
11714 return eHAL_STATUS_FAILURE;
11715 }
11716
11717 *pextScanStartReq = *pStartCmd;
11718
Dino Mycle2c198072014-06-10 10:15:52 +053011719
11720 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11721 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11722 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11723 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011724 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011725 vosMessage.type = WDA_EXTSCAN_START_REQ;
11726 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11727 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11728 status = eHAL_STATUS_FAILURE;
11729
11730 sme_ReleaseGlobalLock(&pMac->sme);
11731 }
11732 return(status);
11733}
11734
11735/* ---------------------------------------------------------------------------
11736 \fn sme_EXTScanStop
11737 \brief SME API to issue Extended Scan stop
11738 \param hHal
11739 \param pStopReq: Extended Scan stop structure
11740 \- return eHalStatus
11741 -------------------------------------------------------------------------*/
11742eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11743{
11744 eHalStatus status = eHAL_STATUS_SUCCESS;
11745 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11746 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11747 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011748 tSirEXTScanStopReqParams *pEXTScanStopReq;
11749
11750 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11751 if ( !pEXTScanStopReq)
11752 {
11753 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11754 "%s: Not able to allocate memory for "
11755 "WDA_EXTSCAN_STOP_REQ",
11756 __func__);
11757 return eHAL_STATUS_FAILURE;
11758 }
11759
11760 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011761
11762 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11763 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11764 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11765 {
11766 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011767 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011768 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11769 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11770 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11771 {
11772 status = eHAL_STATUS_FAILURE;
11773 }
11774 sme_ReleaseGlobalLock(&pMac->sme);
11775 }
11776 return(status);
11777}
11778
11779/* ---------------------------------------------------------------------------
11780 \fn sme_SetBssHotlist
11781 \brief SME API to set BSSID hotlist
11782 \param hHal
11783 \param pSetHotListReq: Extended Scan set hotlist structure
11784 \- return eHalStatus
11785 -------------------------------------------------------------------------*/
11786eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11787 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11788{
11789 eHalStatus status = eHAL_STATUS_SUCCESS;
11790 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11791 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11792 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011793 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11794
11795 pEXTScanSetBssidHotlistReq =
11796 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11797 if ( !pEXTScanSetBssidHotlistReq)
11798 {
11799 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11800 "%s: Not able to allocate memory for "
11801 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11802 __func__);
11803 return eHAL_STATUS_FAILURE;
11804 }
11805
11806 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011807
11808 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11809 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11810 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11811 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011812 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011813 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11814 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11815 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11816 status = eHAL_STATUS_FAILURE;
11817
11818 sme_ReleaseGlobalLock(&pMac->sme);
11819 }
11820
11821 return(status);
11822}
11823
11824/* ---------------------------------------------------------------------------
11825 \fn sme_ResetBssHotlist
11826 \brief SME API to reset BSSID hotlist
11827 \param hHal
11828 \param pSetHotListReq: Extended Scan set hotlist structure
11829 \- return eHalStatus
11830 -------------------------------------------------------------------------*/
11831eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11832 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11833{
11834 eHalStatus status = eHAL_STATUS_SUCCESS;
11835 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11836 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11837 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011838 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11839
11840 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11841 if ( !pEXTScanHotlistResetReq)
11842 {
11843 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11844 "%s: Not able to allocate memory for "
11845 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11846 __func__);
11847 return eHAL_STATUS_FAILURE;
11848 }
11849
11850 *pEXTScanHotlistResetReq = *pResetReq;
11851
Dino Mycle2c198072014-06-10 10:15:52 +053011852
11853 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11854 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11855 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11856 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011857 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011858 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11859 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11860 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11861 status = eHAL_STATUS_FAILURE;
11862
11863 sme_ReleaseGlobalLock(&pMac->sme);
11864 }
11865 return(status);
11866}
11867
11868/* ---------------------------------------------------------------------------
11869 \fn sme_SetSignificantChange
11870 \brief SME API to set significant change
11871 \param hHal
11872 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11873 \- return eHalStatus
11874 -------------------------------------------------------------------------*/
11875eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11876 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11877{
11878 eHalStatus status = eHAL_STATUS_SUCCESS;
11879 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11880 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11881 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011882 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11883
11884 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11885 if ( !pEXTScanSetSignificantReq)
11886 {
11887 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11888 "%s: Not able to allocate memory for "
11889 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11890 __func__);
11891 return eHAL_STATUS_FAILURE;
11892 }
11893
11894 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11895
11896
Dino Mycle2c198072014-06-10 10:15:52 +053011897
11898 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11899 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11900 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11901 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011902 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011903 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11904 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11905 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11906 status = eHAL_STATUS_FAILURE;
11907
11908 sme_ReleaseGlobalLock(&pMac->sme);
11909 }
11910 return(status);
11911}
11912
11913/* ---------------------------------------------------------------------------
11914 \fn sme_ResetSignificantChange
11915 \brief SME API to reset significant change
11916 \param hHal
11917 \param pResetReq: Extended Scan reset significant change structure
11918 \- return eHalStatus
11919 -------------------------------------------------------------------------*/
11920eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11921 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11922{
11923 eHalStatus status = eHAL_STATUS_SUCCESS;
11924 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11925 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11926 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011927 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11928
11929 pEXTScanResetSignificantReq =
11930 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11931 if ( !pEXTScanResetSignificantReq)
11932 {
11933 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11934 "%s: Not able to allocate memory for "
11935 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11936 __func__);
11937 return eHAL_STATUS_FAILURE;
11938 }
11939
11940 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011941
11942 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11943 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11944 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11945 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011946 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011947 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11948 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11949 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11950 status = eHAL_STATUS_FAILURE;
11951
11952 sme_ReleaseGlobalLock(&pMac->sme);
11953 }
11954 return(status);
11955}
11956
11957/* ---------------------------------------------------------------------------
11958 \fn sme_getCachedResults
11959 \brief SME API to get cached results
11960 \param hHal
11961 \param pCachedResultsReq: Extended Scan get cached results structure
11962 \- return eHalStatus
11963 -------------------------------------------------------------------------*/
11964eHalStatus sme_getCachedResults (tHalHandle hHal,
11965 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11966{
11967 eHalStatus status = eHAL_STATUS_SUCCESS;
11968 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11969 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11970 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011971 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11972
11973 pEXTScanCachedResultsReq =
11974 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11975 if ( !pEXTScanCachedResultsReq)
11976 {
11977 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11978 "%s: Not able to allocate memory for "
11979 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11980 __func__);
11981 return eHAL_STATUS_FAILURE;
11982 }
11983
11984 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11985
Dino Mycle2c198072014-06-10 10:15:52 +053011986
11987 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11988 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11989 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11990 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011991 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011992 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11993 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11994 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11995 status = eHAL_STATUS_FAILURE;
11996
11997 sme_ReleaseGlobalLock(&pMac->sme);
11998 }
11999 return(status);
12000}
12001
12002eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
12003 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
12004 void *callbackContext)
12005{
12006 eHalStatus status = eHAL_STATUS_SUCCESS;
12007 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12008
12009 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12010 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
12011 pMac->sme.pEXTScanCallbackContext = callbackContext;
12012 sme_ReleaseGlobalLock(&pMac->sme);
12013 }
12014 return(status);
12015}
12016
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053012017void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
12018{
12019 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12020
12021 pMac->miracast_mode = mode;
12022}
Dino Mycle2c198072014-06-10 10:15:52 +053012023#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053012024
12025void sme_resetCoexEevent(tHalHandle hHal)
12026{
12027 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12028
12029 if (pMac == NULL)
12030 {
12031 printk("btc: %s pMac is NULL \n",__func__);
12032 return;
12033 }
12034
12035 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12036 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
12037
12038 if (pMac->isCoexScoIndSet)
12039 {
12040 pMac->isCoexScoIndSet = 0;
12041 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
12042 NULL, eANI_BOOLEAN_FALSE);
12043 }
12044
12045 return;
12046}
Agarwal Ashish738843c2014-09-25 12:27:56 +053012047
12048void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
12049{
12050 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12051 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
12052 csrDisableDfsChannel(pMac);
12053
12054}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053012055
12056/* ---------------------------------------------------------------------------
12057 \fn sme_Encryptmsgsend
12058 \brief SME API to issue encrypt message request
12059 \param hHal
12060 \param pCmd: Data to be encrypted
12061 \- return eHalStatus
12062 -------------------------------------------------------------------------*/
12063eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
12064 u8 *pCmd,
12065 int length,
12066 pEncryptMsgRSPCb encMsgCbk)
12067{
12068 eHalStatus status = eHAL_STATUS_SUCCESS;
12069 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12070 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12071 vos_msg_t vosMessage;
12072 u8 *pEncryptMsg;
12073
12074 pEncryptMsg = vos_mem_malloc(length);
12075 if ( !pEncryptMsg)
12076 {
12077 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12078 "%s: Not able to allocate memory for "
12079 "SIR_HAL_ENCRYPT_MSG_REQ",
12080 __func__);
12081 return eHAL_STATUS_FAILURE;
12082 }
12083
12084 vos_mem_copy(pEncryptMsg, pCmd, length);
12085
12086 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12087
12088 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
12089 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
12090 /* Serialize the req through MC thread */
12091 vosMessage.bodyptr = pEncryptMsg;
12092 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
12093 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12094 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12095 status = eHAL_STATUS_FAILURE;
12096
12097 sme_ReleaseGlobalLock(&pMac->sme);
12098 }
12099 return(status);
12100}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053012101
12102/* ---------------------------------------------------------------------------
12103 \fn sme_RegisterBtCoexTDLSCallback
12104 \brief Used to plug in callback function
12105 Which notify btcoex on or off.
12106 Notification come from FW.
12107 \param hHal
12108 \param pCallbackfn : callback function pointer should be plugged in
12109 \- return eHalStatus
12110 -------------------------------------------------------------------------*/
12111eHalStatus sme_RegisterBtCoexTDLSCallback
12112(
12113 tHalHandle hHal,
12114 void (*pCallbackfn)(void *pAdapter, int )
12115)
12116{
12117 eHalStatus status = eHAL_STATUS_SUCCESS;
12118 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12119
12120 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12121 "%s: Plug in BtCoex TDLS CB", __func__);
12122
12123 status = sme_AcquireGlobalLock(&pMac->sme);
12124 if (eHAL_STATUS_SUCCESS == status)
12125 {
12126 if (NULL != pCallbackfn)
12127 {
12128 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
12129 }
12130 sme_ReleaseGlobalLock(&pMac->sme);
12131 }
12132 return(status);
12133}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012134
12135/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012136 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012137
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012138 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012139
12140 \param hHal - The handle returned by macOpen.
12141
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012142 \return eANI_BOOLEAN_TRUE if reassoc in progress,
12143 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012144---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012145
12146tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012147{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012148 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012149}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012150
12151/* ---------------------------------------------------------------------------
12152
12153 \fn sme_IsTdlsOffChannelValid
12154
12155 \brief To check if the channel is valid for currently established domain
12156 This is a synchronous API.
12157
12158 \param hHal - The handle returned by macOpen.
12159 \param channel - channel to verify
12160
12161 \return TRUE/FALSE, TRUE if channel is valid
12162
12163 -------------------------------------------------------------------------------*/
12164tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
12165{
12166 eHalStatus status = eHAL_STATUS_FAILURE;
12167 tANI_BOOLEAN valid = FALSE;
12168 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12169
12170 status = sme_AcquireGlobalLock( &pMac->sme );
12171 if ( HAL_STATUS_SUCCESS( status ) )
12172 {
12173 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012174 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012175 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012176 if (!CSR_IS_CHANNEL_DFS(channel))
12177 valid = TRUE;
12178 else {
12179 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12180 "%s: configured channel is DFS", __func__);
12181 }
12182 }
12183 else {
12184 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12185 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012186 }
12187 sme_ReleaseGlobalLock( &pMac->sme );
12188 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12190 "%s: current country code %c%c channel %d valid %d",
12191 __func__, pMac->scan.countryCodeCurrent[0],
12192 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012193 return (valid);
12194}
Mukul Sharma4be88422015-03-09 20:29:07 +053012195
12196tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
12197{
12198 eHalStatus status = eHAL_STATUS_FAILURE;
12199 tANI_BOOLEAN valid = FALSE;
12200 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12201
12202 status = sme_AcquireGlobalLock( &pMac->sme );
12203 if ( HAL_STATUS_SUCCESS( status ) )
12204 {
12205 valid = pMac->isCoexScoIndSet;
12206 }
12207 sme_ReleaseGlobalLock( &pMac->sme );
12208 return (valid);
12209}
Abhishek Singh01c73d12015-03-12 15:13:44 +053012210eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
12211 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
12212{
12213 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12214 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
12215 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
12216
12217 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
12218 != eHAL_STATUS_SUCCESS)
12219 {
12220 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12221 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
12222 return eHAL_STATUS_FAILURE;
12223 }
12224
12225 if (set_value)
12226 {
12227 if (pMac->miracastVendorConfig)
12228 {
12229 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12230 FL(" Miracast tuning already enabled!!"));
12231 return eHAL_STATUS_SUCCESS;
12232 }
12233
12234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12235 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
12236
12237 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
12238 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12239 {
12240 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12241 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
12242 return eHAL_STATUS_FAILURE;
12243 }
12244 /* Disable 64QAM rates ie (MCS 5,6 and 7)
12245 */
12246 mcsSet[0]=0x1F;
12247 }
12248 else
12249 {
12250 if (!pMac->miracastVendorConfig)
12251 {
12252 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12253 FL(" Miracast tuning already disabled!!"));
12254 return eHAL_STATUS_SUCCESS;
12255 }
12256
12257 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12258 FL("Disable Miracast tuning by enabling all MCS rates, setting %d blocks for aggregation and enabling probe response for broadcast probe in P2P-GO mode"),
12259 iniNumBuffAdvert);
12260
12261 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
12262 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12263 {
12264 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12265 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
12266 return eHAL_STATUS_FAILURE;
12267 }
12268 /* Enable all MCS rates)
12269 */
12270 mcsSet[0]=0xFF;
12271 }
12272
12273 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
12274 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12275 {
12276 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12277 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
12278 return eHAL_STATUS_FAILURE;
12279 }
12280
12281 pMac->miracastVendorConfig = set_value;
12282 return eHAL_STATUS_SUCCESS;
12283}
Mukul Sharma4be88422015-03-09 20:29:07 +053012284