blob: e8171b1782c74630f7d38e5286f0b9ae8fb7ade3 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Agrawal Ashish9d126602016-09-29 14:22:16 +05302 * Copyright (c) 2012-2016 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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/*===========================================================================
29
30 s a p M o d u l e . C
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070031
Jeff Johnson295189b2012-06-20 16:38:30 -070032 OVERVIEW:
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070033
Jeff Johnson295189b2012-06-20 16:38:30 -070034 This software unit holds the implementation of the WLAN SAP modules
35 functions providing EXTERNAL APIs. It is also where the global SAP module
36 context gets initialised
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070037
38 DEPENDENCIES:
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40 Are listed for each API below.
Jeff Johnson295189b2012-06-20 16:38:30 -070041===========================================================================*/
42
43/*===========================================================================
44
45 EDIT HISTORY FOR FILE
46
47
48 This section contains comments describing changes made to the module.
49 Notice that changes are listed in reverse chronological order.
50
51
52
53 when who what, where, why
54---------- --- --------------------------------------------------------
5503/15/10 SOFTAP team Created module
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07005606/03/10 js Added support to hostapd driven
Jeff Johnson295189b2012-06-20 16:38:30 -070057 * deauth/disassoc/mic failure
58
59===========================================================================*/
60
61/* $Header$ */
62
63/*----------------------------------------------------------------------------
64 * Include Files
65 * -------------------------------------------------------------------------*/
66#include "wlan_qct_tl.h"
67#include "vos_trace.h"
68
69// Pick up the sme callback registration API
70#include "sme_Api.h"
71
72// SAP API header file
73
74#include "sapInternal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075#include "smeInside.h"
76
77/*----------------------------------------------------------------------------
78 * Preprocessor Definitions and Constants
79 * -------------------------------------------------------------------------*/
80#define SAP_DEBUG
81
82/*----------------------------------------------------------------------------
83 * Type Declarations
84 * -------------------------------------------------------------------------*/
85
86
87/*----------------------------------------------------------------------------
88 * Global Data Definitions
89 * -------------------------------------------------------------------------*/
90
91/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070092 * External declarations for global context
Jeff Johnson295189b2012-06-20 16:38:30 -070093 * -------------------------------------------------------------------------*/
94// No! Get this from VOS.
95// The main per-Physical Link (per WLAN association) context.
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -070096ptSapContext gpSapCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -070097
98/*----------------------------------------------------------------------------
99 * Static Variable Definitions
100 * -------------------------------------------------------------------------*/
101
102/*----------------------------------------------------------------------------
103 * Static Function Declarations and Definitions
104 * -------------------------------------------------------------------------*/
105
106/*----------------------------------------------------------------------------
107 * Externalized Function Definitions
108* -------------------------------------------------------------------------*/
109
110/*----------------------------------------------------------------------------
111 * Function Declarations and Documentation
112 * -------------------------------------------------------------------------*/
113
114/*==========================================================================
115 FUNCTION WLANSAP_Open
116
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700117 DESCRIPTION
118 Called at driver initialization (vos_open). SAP will initialize
119 all its internal resources and will wait for the call to start to
120 register with the other modules.
121
122 DEPENDENCIES
123
124 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700125
126 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700127 pvosGCtx : Pointer to the global vos context; a handle to SAP's
128 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700129
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700130 RETURN VALUE
131 The result code associated with performing the operation
132
133 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
134 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700135 VOS_STATUS_SUCCESS: Success
136
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700137 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700138============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700139VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700140WLANSAP_Open
141(
142 v_PVOID_t pvosGCtx
143)
144{
145
146 ptSapContext pSapCtx = NULL;
147 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
148 VOS_ASSERT(pvosGCtx);
149 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700150 Allocate (and sanity check?!) SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 ------------------------------------------------------------------------*/
152 vos_alloc_context(pvosGCtx, VOS_MODULE_ID_SAP, (v_VOID_t **)&pSapCtx, sizeof(tSapContext));
153
154 if (NULL == pSapCtx)
155 {
156 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700157 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700158 return VOS_STATUS_E_FAULT;
159 }
160
Jeff Johnson295189b2012-06-20 16:38:30 -0700161 /*------------------------------------------------------------------------
162 Clean up SAP control block, initialize all values
163 ------------------------------------------------------------------------*/
164 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Open");
165
166 WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/);
167
Hanumantha Reddy Pothulaf30a2982015-05-15 15:02:30 +0530168 if (!VOS_IS_STATUS_SUCCESS(vos_spin_lock_init(&pSapCtx->staInfo_lock)))
169 {
170 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
171 "WLANSAP_Start failed init staInfo_lock");
172 vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
173 return VOS_STATUS_E_FAULT;
174 }
175
Jeff Johnson295189b2012-06-20 16:38:30 -0700176 // Setup the "link back" to the VOSS context
177 pSapCtx->pvosGCtx = pvosGCtx;
178
179 // Store a pointer to the SAP context provided by VOSS
180 gpSapCtx = pSapCtx;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700181
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 /*------------------------------------------------------------------------
183 Allocate internal resources
184 ------------------------------------------------------------------------*/
185
186 return VOS_STATUS_SUCCESS;
187}// WLANSAP_Open
188
189/*==========================================================================
190 FUNCTION WLANSAP_Start
191
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700192 DESCRIPTION
193 Called as part of the overall start procedure (vos_start). SAP will
194 use this call to register with TL as the SAP entity for
195 SAP RSN frames.
Jeff Johnson295189b2012-06-20 16:38:30 -0700196
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700197 DEPENDENCIES
198
199 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700200
201 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700202 pvosGCtx : Pointer to the global vos context; a handle to SAP's
203 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700204
205 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700206 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700207
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700208 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
209 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 VOS_STATUS_SUCCESS: Success
211
212 SIDE EFFECTS
213============================================================================*/
214
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700215VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700216WLANSAP_Start
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700217(
218 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700219)
220{
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 ptSapContext pSapCtx = NULL;
222
223 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
224
225 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
226 "WLANSAP_Start invoked successfully\n");
227 /*------------------------------------------------------------------------
228 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700229 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 ------------------------------------------------------------------------*/
231 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700232 if ( NULL == pSapCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 {
234 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700235 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 return VOS_STATUS_E_FAULT;
237 }
238
239 /*------------------------------------------------------------------------
240 For now, presume security is not enabled.
241 -----------------------------------------------------------------------*/
242 pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE;
243
244
245 /*------------------------------------------------------------------------
246 Now configure the roaming profile links. To SSID and bssid.
247 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700248 // We have room for two SSIDs.
249 pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.
250 pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList; //Array of two
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0;
252 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE;
253 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = pSapCtx->SSIDList[0].ssidHidden;
254
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700255 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.
256 pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid;
Jeff Johnson295189b2012-06-20 16:38:30 -0700257
258 // Now configure the auth type in the roaming profile. To open.
259 pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700260
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock)))
262 {
263 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700264 "WLANSAP_Start failed init lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 return VOS_STATUS_E_FAULT;
266 }
267
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 return VOS_STATUS_SUCCESS;
269}/* WLANSAP_Start */
270
271/*==========================================================================
272
273 FUNCTION WLANSAP_Stop
274
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700275 DESCRIPTION
276 Called by vos_stop to stop operation in SAP, before close. SAP will suspend all
277 BT-AMP Protocol Adaption Layer operation and will wait for the close
278 request to clean up its resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700280 DEPENDENCIES
281
282 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700283
284 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700285 pvosGCtx : Pointer to the global vos context; a handle to SAP's
286 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700287
288 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700289 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700290
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700291 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
292 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 VOS_STATUS_SUCCESS: Success
294
295 SIDE EFFECTS
296============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700297VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700298WLANSAP_Stop
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700299(
300 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700301)
302{
303
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 ptSapContext pSapCtx = NULL;
305
306 /*------------------------------------------------------------------------
307 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700308 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 ------------------------------------------------------------------------*/
310 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
311 "WLANSAP_Stop invoked successfully ");
312
313 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
314 if (NULL == pSapCtx)
315 {
316 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700317 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 return VOS_STATUS_E_FAULT;
319 }
320
321 sapFreeRoamProfile(&pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700322
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pSapCtx->SapGlobalLock ) ) )
324 {
325 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700326 "WLANSAP_Stop failed destroy lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 return VOS_STATUS_E_FAULT;
328 }
329 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700330 Stop SAP (de-register RSN handler!?)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333 return VOS_STATUS_SUCCESS;
334}/* WLANSAP_Stop */
335
336/*==========================================================================
337 FUNCTION WLANSAP_Close
338
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700339 DESCRIPTION
340 Called by vos_close during general driver close procedure. SAP will clean up
341 all the internal resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700342
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700343 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700344
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700345 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700346
347 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700348 pvosGCtx : Pointer to the global vos context; a handle to SAP's
349 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700350
351 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700352 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700354 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
355 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 VOS_STATUS_SUCCESS: Success
357
358 SIDE EFFECTS
359============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700360VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700361WLANSAP_Close
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700362(
363 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700364)
365{
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 ptSapContext pSapCtx = NULL;
367 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
368
369 /*------------------------------------------------------------------------
370 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700371 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 ------------------------------------------------------------------------*/
373 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
374 "WLANSAP_Close invoked");
375
376 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
377 if (NULL == pSapCtx)
378 {
379 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700380 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 return VOS_STATUS_E_FAULT;
382 }
383
384 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700385 Cleanup SAP control block.
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 ------------------------------------------------------------------------*/
387 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Close");
388 WLANSAP_CleanCB(pSapCtx, VOS_TRUE /* empty queues/lists/pkts if any*/);
389
390 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700391 Free SAP context from VOSS global
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 ------------------------------------------------------------------------*/
393 vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
394
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 return VOS_STATUS_SUCCESS;
396}/* WLANSAP_Close */
397
398/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700399 * Utility Function implementations
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 * -------------------------------------------------------------------------*/
401
402/*==========================================================================
403
404 FUNCTION WLANSAP_CleanCB
405
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700406 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 Clear out all fields in the SAP context.
408
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700409 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700411 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700412
413 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700414 pvosGCtx : Pointer to the global vos context; a handle to SAP's
415 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700416
417 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700418 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700419
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700420 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
421 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700422 VOS_STATUS_SUCCESS: Success
423
424 SIDE EFFECTS
425============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700426VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700427WLANSAP_CleanCB
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700428(
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 ptSapContext pSapCtx,
430 v_U32_t freeFlag // 0 /*do not empty*/);
431)
432{
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700434 Sanity check SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 ------------------------------------------------------------------------*/
436
437 if (NULL == pSapCtx)
438 {
439 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700440 "%s: Invalid SAP pointer", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 return VOS_STATUS_E_FAULT;
442 }
443
444 /*------------------------------------------------------------------------
445 Clean up SAP control block, initialize all values
446 ------------------------------------------------------------------------*/
447 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB");
448
449 vos_mem_zero( pSapCtx, sizeof(tSapContext));
450
451 pSapCtx->pvosGCtx = NULL;
452
453 pSapCtx->sapsMachine= eSAP_DISCONNECTED;
454
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +0530455 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d, sapContext value = %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700456 __func__, pSapCtx->sapsMachine, pSapCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 pSapCtx->sessionId = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700458 pSapCtx->channel = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700459
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 return VOS_STATUS_SUCCESS;
461}// WLANSAP_CleanCB
462
463/*==========================================================================
464 FUNCTION WLANSAP_pmcFullPwrReqCB
465
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700466 DESCRIPTION
467 Callback provide to PMC in the pmcRequestFullPower API.
Jeff Johnson295189b2012-06-20 16:38:30 -0700468
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700469 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700471 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700472
473 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700474 callbackContext: The user passed in a context to identify
475 status: The halStatus
Jeff Johnson295189b2012-06-20 16:38:30 -0700476
477 RETURN VALUE
478 None
479
480 SIDE EFFECTS
481============================================================================*/
482void
483WLANSAP_pmcFullPwrReqCB
484(
485 void *callbackContext,
486 eHalStatus status
487)
488{
489 if(HAL_STATUS_SUCCESS(status))
490 {
491 //If success what else to be handled???
492 }
493 else
494 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700495 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n");
497
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 }
499
500}// WLANSAP_pmcFullPwrReqCB
501/*==========================================================================
502 FUNCTION WLANSAP_getState
503
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700504 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 This api returns the current SAP state to the caller.
506
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700507 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700508
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700509 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700510
511 IN
512 pContext : Pointer to Sap Context structure
513
514 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700515 Returns the SAP FSM state.
Jeff Johnson295189b2012-06-20 16:38:30 -0700516============================================================================*/
517
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700518v_U8_t WLANSAP_getState
Jeff Johnson295189b2012-06-20 16:38:30 -0700519(
520 v_PVOID_t pvosGCtx
521)
522{
523 ptSapContext pSapCtx = NULL;
524
525 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
526
527 if ( NULL == pSapCtx )
528 {
529 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700530 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 return VOS_STATUS_E_FAULT;
532 }
533 return pSapCtx->sapsMachine;
534}
Nishank Aggarwalc11826c2016-12-15 18:54:10 +0530535/*==========================================================================
536 FUNCTION WLANSAP_get_sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -0700537
Nishank Aggarwalc11826c2016-12-15 18:54:10 +0530538 DESCRIPTION
539 This api returns the current SAP sessionId to the caller.
540
541 DEPENDENCIES
542
543 PARAMETERS
544
545 IN
546 pContext : Pointer to Sap Context structure
547 v_U8_t : Pointer to sessionID
548
549 RETURN VALUE
550 VOS_STATUS_SUCCESS on success.
551
552 VOS_STATUS_E_INVAL: Pointer to SAP cb is NULL ; access would cause a page
553 fault
554============================================================================*/
555VOS_STATUS WLANSAP_get_sessionId
556(
557 v_PVOID_t pvosGCtx, v_U8_t *sessionId
558)
559{
560 ptSapContext pSapCtx = NULL;
561 VOS_STATUS status = VOS_STATUS_SUCCESS;
562
563 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
564
565 if ( NULL == pSapCtx )
566 {
567 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
568 "%s: Invalid SAP pointer from pvosGCtx", __func__);
569 status = VOS_STATUS_E_INVAL;
570 }
571
572 if (pSapCtx->sapsMachine == eSAP_STARTED) {
573 *sessionId = pSapCtx->sessionId;
574 status = VOS_STATUS_SUCCESS;
575 }
576 else
577 status = VOS_STATUS_E_FAILURE;
578
579 return status;
580}
Jeff Johnson295189b2012-06-20 16:38:30 -0700581/*==========================================================================
582 FUNCTION WLANSAP_StartBss
583
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700584 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 This api function provides SAP FSM event eWLAN_SAP_PHYSICAL_LINK_CREATE for
586 starting AP BSS
587
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700588 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700589
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700590 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
592 IN
593 pContext : Pointer to Sap Context structure
594 pQctCommitConfig : Pointer to configuration structure passed down from HDD(HostApd for Android)
595 hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results
596 pUsrContext : Parameter that will be passed back in all the SAP callback events.
597
598 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700599 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700600
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700601 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
602 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 VOS_STATUS_SUCCESS: Success
604
605 SIDE EFFECTS
606============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700607VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700608WLANSAP_StartBss
609(
610 v_PVOID_t pvosGCtx,//pwextCtx
611 tpWLAN_SAPEventCB pSapEventCallback,
612 tsap_Config_t *pConfig,
613 v_PVOID_t pUsrContext
614)
615{
616 tWLAN_SAPEvent sapEvent; /* State machine event*/
617 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
618 ptSapContext pSapCtx = NULL;
619 tANI_BOOLEAN restartNeeded;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700620 tHalHandle hHal;
621
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
623
624 /*------------------------------------------------------------------------
625 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700626 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 ------------------------------------------------------------------------*/
628 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
629 "WLANSAP_StartBss");
630
631 if (VOS_STA_SAP_MODE == vos_get_conparam ())
632 {
633 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
634 if ( NULL == pSapCtx )
635 {
636 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700637 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 return VOS_STATUS_E_FAULT;
639 }
640 pSapCtx->sapsMachine = eSAP_DISCONNECTED;
641
642 /* Channel selection is auto or configured */
643 pSapCtx->channel = pConfig->channel;
Peng Xu2446a892014-09-05 17:21:18 +0530644 pSapCtx->scanBandPreference = pConfig->scanBandPreference;
Peng Xuafc34e32014-09-25 13:23:55 +0530645 pSapCtx->acsBandSwitchThreshold = pConfig->acsBandSwitchThreshold;
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 pSapCtx->pUsrContext = pUsrContext;
647
648 //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
649 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700650
651 //Save a copy to SAP context
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700652 vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
654 vos_mem_copy(pSapCtx->self_mac_addr,
655 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
656
657 //copy the configuration items to csrProfile
658 sapconvertToCsrProfile( pConfig, eCSR_BSS_TYPE_INFRA_AP, &pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700659 hHal = (tHalHandle)VOS_GET_HAL_CB(pvosGCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 if (NULL == hHal)
661 {
662 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700663 "%s: Invalid MAC context from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 }
665 else
666 {
667 //If concurrent session is running that is already associated
668 //then we just follow that sessions country info (whether
669 //present or not doesn't maater as we have to follow whatever
670 //STA session does)
Rajkumar Manoharaned6fd542013-11-26 22:55:16 +0530671 if ((0 == sme_GetConcurrentOperationChannel(hHal)) &&
672 pConfig->ieee80211d)
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 {
674 /* Setting the region/country information */
675 sme_setRegInfo(hHal, pConfig->countryCode);
676 sme_ResetCountryCodeInformation(hHal, &restartNeeded);
677 }
678 }
679
680 // Copy MAC filtering settings to sap context
681 pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl;
682 vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, sizeof(pConfig->accept_mac));
683 pSapCtx->nAcceptMac = pConfig->num_accept_mac;
684 sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
685 vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, sizeof(pConfig->deny_mac));
686 pSapCtx->nDenyMac = pConfig->num_deny_mac;
687 sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac);
688
689 /* Fill in the event structure for FSM */
690 sapEvent.event = eSAP_HDD_START_INFRA_BSS;
691 sapEvent.params = 0;//pSapPhysLinkCreate
692
693 /* Store the HDD callback in SAP context */
694 pSapCtx->pfnSapEventCallback = pSapEventCallback;
695
696 /* Handle event*/
697 vosStatus = sapFsm(pSapCtx, &sapEvent);
698 }
699 else
700 {
701 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
702 "SoftAp role has not been enabled");
703 }
704
705 return vosStatus;
706}// WLANSAP_StartBss
707
708/*==========================================================================
Gopichand Nakkalacb9f2192013-06-25 16:10:38 -0700709 FUNCTION WLANSAP_SetMacACL
710
711 DESCRIPTION
712 This api function provides SAP to set mac list entry in accept list as well
713 as deny list
714
715 DEPENDENCIES
716
717 PARAMETERS
718
719 IN
720 pContext : Pointer to Sap Context structure
721 pQctCommitConfig : Pointer to configuration structure passed down from
722 HDD(HostApd for Android)
723
724 RETURN VALUE
725 The result code associated with performing the operation
726
727 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
728 fault
729 VOS_STATUS_SUCCESS: Success
730
731 SIDE EFFECTS
732============================================================================*/
733VOS_STATUS
734WLANSAP_SetMacACL
735(
736 v_PVOID_t pvosGCtx, //pwextCtx
737 tsap_Config_t *pConfig
738)
739{
740 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
741 ptSapContext pSapCtx = NULL;
742
743 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
744 "WLANSAP_SetMacACL");
745
746 if (VOS_STA_SAP_MODE == vos_get_conparam ())
747 {
748 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
749 if ( NULL == pSapCtx )
750 {
751 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
752 "%s: Invalid SAP pointer from pvosGCtx", __func__);
753 return VOS_STATUS_E_FAULT;
754 }
755
756 // Copy MAC filtering settings to sap context
757 pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl;
758
759 if (eSAP_DENY_UNLESS_ACCEPTED == pSapCtx->eSapMacAddrAclMode)
760 {
761 vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac,
762 sizeof(pConfig->accept_mac));
763 pSapCtx->nAcceptMac = pConfig->num_accept_mac;
764 sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
765 }
766 else if (eSAP_ACCEPT_UNLESS_DENIED == pSapCtx->eSapMacAddrAclMode)
767 {
768 vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac,
769 sizeof(pConfig->deny_mac));
770 pSapCtx->nDenyMac = pConfig->num_deny_mac;
771 sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac);
772 }
773 }
774 else
775 {
776 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
777 "%s : SoftAp role has not been enabled", __func__);
778 return VOS_STATUS_E_FAULT;
779 }
780
781 return vosStatus;
782}//WLANSAP_SetMacACL
783
784/*==========================================================================
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 FUNCTION WLANSAP_StopBss
786
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700787 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 This api function provides SAP FSM event eSAP_HDD_STOP_INFRA_BSS for
789 stopping AP BSS
790
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700791 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700792
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700793 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700794
795 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700796 pvosGCtx : Pointer to the global vos context; a handle to SAP's
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 control block can be extracted from its contexe
798
799 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700800 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700801
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700802 VOS_STATUS_E_FAULT: Pointer to VOSS GC is NULL ; access would cause a page
803 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 VOS_STATUS_SUCCESS: Success
805
806 SIDE EFFECTS
807============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700808VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700809WLANSAP_StopBss
810(
811 v_PVOID_t pvosGCtx
812)
813{
814 tWLAN_SAPEvent sapEvent; /* State machine event*/
815 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
816 ptSapContext pSapCtx = NULL;
817 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
818
819 /*------------------------------------------------------------------------
820 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700821 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 ------------------------------------------------------------------------*/
823 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
824 "WLANSAP_StopBss");
825
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700826 if ( NULL == pvosGCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 {
828 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700829 "%s: Invalid Global VOSS handle", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 return VOS_STATUS_E_FAULT;
831 }
832
833 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
834
835 if (NULL == pSapCtx )
836 {
837 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700838 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 return VOS_STATUS_E_FAULT;
840 }
841
842 /* Fill in the event structure for FSM */
843 sapEvent.event = eSAP_HDD_STOP_INFRA_BSS;
844 sapEvent.params = 0;
845
846 /* Handle event*/
847 vosStatus = sapFsm(pSapCtx, &sapEvent);
848
849 return vosStatus;
850}
851
852/*==========================================================================
853 FUNCTION WLANSAP_GetAssocStations
854
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700855 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 This api function is used to probe the list of associated stations from various modules of CORE stack
857
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700858 DEPENDENCIES
859 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700860
861 PARAMETERS
862
863 IN
864 pvosGCtx : Pointer to vos global context structure
865 modId : Module from whom list of associtated stations is supposed to be probed. If an invalid module is passed
866 then by default VOS_MODULE_ID_PE will be probed
867 IN/OUT
868 pAssocStas : Pointer to list of associated stations that are known to the module specified in mod parameter
869
870 NOTE: The memory for this list will be allocated by the caller of this API
871
872 RETURN VALUE
873 The VOS_STATUS code associated with performing the operation
874
875 VOS_STATUS_SUCCESS: Success
876
877 SIDE EFFECTS
878============================================================================*/
879VOS_STATUS
880WLANSAP_GetAssocStations
881(
882 v_PVOID_t pvosGCtx,
883 VOS_MODULE_ID modId,
884 tpSap_AssocMacAddr pAssocStas
885)
886{
887 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
888
889 /*------------------------------------------------------------------------
890 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700891 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 ------------------------------------------------------------------------*/
893 if (NULL == pSapCtx)
894 {
895 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700896 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 return VOS_STATUS_E_FAULT;
898 }
899
900 sme_RoamGetAssociatedStas( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
901 modId,
902 pSapCtx->pUsrContext,
903 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
904 (v_U8_t *)pAssocStas );
905
906 return VOS_STATUS_SUCCESS;
907}
908
909
910/*==========================================================================
911 FUNCTION WLANSAP_RemoveWpsSessionOverlap
912
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700913 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 This api function provides for Ap App/HDD to remove an entry from session session overlap info.
915
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700916 DEPENDENCIES
917 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700918
919 PARAMETERS
920
921 IN
922 pvosGCtx: Pointer to vos global context structure
923 pRemoveMac: pointer to v_MACADDR_t for session MAC address
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700924
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700926 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928 VOS_STATUS_SUCCESS: Success
929 VOS_STATUS_E_FAULT: Session is not dectected. The parameter is function not valid.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700930
931 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700932============================================================================*/
933VOS_STATUS
934WLANSAP_RemoveWpsSessionOverlap
935
936(
937 v_PVOID_t pvosGCtx,
938 v_MACADDR_t pRemoveMac
939)
940{
941 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
942
943 /*------------------------------------------------------------------------
944 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700945 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 ------------------------------------------------------------------------*/
947 if (NULL == pSapCtx)
948 {
949 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700950 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 return VOS_STATUS_E_FAULT;
952 }
953
954 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
955 pSapCtx->pUsrContext,
956 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
957 pRemoveMac);
958
959 return VOS_STATUS_SUCCESS;
960}
961
962/*==========================================================================
963 FUNCTION WLANSAP_getWpsSessionOverlap
964
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700965 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 This api function provides for Ap App/HDD to get WPS session overlap info.
967
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700968 DEPENDENCIES
969 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700970
971 PARAMETERS
972
973 IN
974 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700975
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700977 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700978
979 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700980
981 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700982============================================================================*/
983VOS_STATUS
984WLANSAP_getWpsSessionOverlap
985(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700986 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700987)
988{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700989 v_MACADDR_t pRemoveMac = VOS_MAC_ADDR_ZERO_INITIALIZER;
Jeff Johnson295189b2012-06-20 16:38:30 -0700990
991 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
992
993 /*------------------------------------------------------------------------
994 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700995 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 ------------------------------------------------------------------------*/
997 if (NULL == pSapCtx)
998 {
999 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001000 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 return VOS_STATUS_E_FAULT;
1002 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001003
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
1005 pSapCtx->pUsrContext,
1006 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
1007 pRemoveMac);
1008
1009 return VOS_STATUS_SUCCESS;
1010}
1011
1012
1013/* This routine will set the mode of operation for ACL dynamically*/
1014VOS_STATUS
1015WLANSAP_SetMode ( v_PVOID_t pvosGCtx, v_U32_t mode)
1016{
1017 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1018
1019 if (NULL == pSapCtx)
1020 {
1021 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001022 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 return VOS_STATUS_E_FAULT;
1024 }
1025
1026 pSapCtx->eSapMacAddrAclMode = (eSapMacAddrACL)mode;
1027 return VOS_STATUS_SUCCESS;
1028}
1029
1030/* This routine will clear all the entries in accept list as well as deny list */
1031
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001032VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001033WLANSAP_ClearACL( v_PVOID_t pvosGCtx)
1034{
1035 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1036 v_U8_t i;
1037
1038 if (NULL == pSapCtx)
1039 {
1040 return VOS_STATUS_E_RESOURCES;
1041 }
1042
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001043 if (pSapCtx->denyMacList != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 {
1045 for (i = 0; i < (pSapCtx->nDenyMac-1); i++)
1046 {
1047 vos_mem_zero((pSapCtx->denyMacList+i)->bytes, sizeof(v_MACADDR_t));
1048
1049 }
1050 }
1051 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
1052 pSapCtx->nDenyMac = 0;
1053
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001054 if (pSapCtx->acceptMacList!=NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 {
1056 for (i = 0; i < (pSapCtx->nAcceptMac-1); i++)
1057 {
1058 vos_mem_zero((pSapCtx->acceptMacList+i)->bytes, sizeof(v_MACADDR_t));
1059
1060 }
1061 }
1062 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
1063 pSapCtx->nAcceptMac = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001064
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 return VOS_STATUS_SUCCESS;
1066}
1067
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001068VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001069WLANSAP_ModifyACL
1070(
1071 v_PVOID_t pvosGCtx,
1072 v_U8_t *pPeerStaMac,
1073 eSapACLType listType,
1074 eSapACLCmdType cmd
1075)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001076{
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 eSapBool staInWhiteList=eSAP_FALSE, staInBlackList=eSAP_FALSE;
1078 v_U8_t staWLIndex, staBLIndex;
1079 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1080
1081 if (NULL == pSapCtx)
1082 {
1083 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001084 "%s: Invalid SAP Context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 return VOS_STATUS_E_FAULT;
1086 }
1087
1088 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"Modify ACL entered\n"
1089 "Before modification of ACL\n"
1090 "size of accept and deny lists %d %d",
1091 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1092 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
1093 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
1094 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
1095 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
1096
1097 /* the expectation is a mac addr will not be in both the lists at the same time.
1098 It is the responsiblity of userspace to ensure this */
1099 staInWhiteList = sapSearchMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac, pPeerStaMac, &staWLIndex);
1100 staInBlackList = sapSearchMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac, pPeerStaMac, &staBLIndex);
1101
1102 if (staInWhiteList && staInBlackList)
1103 {
1104 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Arif Hussain24bafea2013-11-15 15:10:03 -08001105 "Peer mac "MAC_ADDRESS_STR" found in white and black lists."
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001106 "Initial lists passed incorrect. Cannot execute this command.",
Arif Hussain24bafea2013-11-15 15:10:03 -08001107 MAC_ADDR_ARRAY(pPeerStaMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 return VOS_STATUS_E_FAILURE;
1109
1110 }
1111
1112 switch(listType)
1113 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001114 case eSAP_WHITE_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "cmd %d", cmd);
1116 if (cmd == ADD_STA_TO_ACL)
1117 {
1118 //error check
1119 // if list is already at max, return failure
Gopichand Nakkalacb9f2192013-06-25 16:10:38 -07001120 if (pSapCtx->nAcceptMac == MAX_ACL_MAC_ADDRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 {
1122 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Arif Hussain24bafea2013-11-15 15:10:03 -08001123 "White list is already maxed out. Cannot accept "MAC_ADDRESS_STR,
1124 MAC_ADDR_ARRAY(pPeerStaMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 return VOS_STATUS_E_FAILURE;
1126 }
1127 if (staInWhiteList)
1128 {
1129 //Do nothing if already present in white list. Just print a warning
1130 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08001131 "MAC address already present in white list "MAC_ADDRESS_STR,
1132 MAC_ADDR_ARRAY(pPeerStaMac));
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001133 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 {
1135 if (staInBlackList)
1136 {
1137 //remove it from black list before adding to the white list
1138 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1139 "STA present in black list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001140 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 }
1142 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001143 "... Now add to the white list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 sapAddMacToACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, pPeerStaMac);
1145 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1146 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001147 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 }
1149 else if (cmd == DELETE_STA_FROM_ACL)
1150 {
1151 if (staInWhiteList)
1152 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001153 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from white list");
1154 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1156 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1157 }
1158 else
1159 {
1160 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08001161 "MAC address to be deleted is not present in the white list "MAC_ADDRESS_STR,
1162 MAC_ADDR_ARRAY(pPeerStaMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 return VOS_STATUS_E_FAILURE;
1164 }
1165 }
1166 else
1167 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001168 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 return VOS_STATUS_E_FAILURE;
1170 }
1171 break;
1172
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001173 case eSAP_BLACK_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,
1175 "cmd %d", cmd);
1176 if (cmd == ADD_STA_TO_ACL)
1177 {
1178 //error check
1179 // if list is already at max, return failure
Gopichand Nakkalacb9f2192013-06-25 16:10:38 -07001180 if (pSapCtx->nDenyMac == MAX_ACL_MAC_ADDRESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 {
1182 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Arif Hussain24bafea2013-11-15 15:10:03 -08001183 "Black list is already maxed out. Cannot accept "MAC_ADDRESS_STR,
1184 MAC_ADDR_ARRAY(pPeerStaMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 return VOS_STATUS_E_FAILURE;
1186 }
1187 if (staInBlackList)
1188 {
1189 //Do nothing if already present in white list
1190 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08001191 "MAC address already present in black list "MAC_ADDRESS_STR,
1192 MAC_ADDR_ARRAY(pPeerStaMac));
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001193 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001194 {
1195 if (staInWhiteList)
1196 {
1197 //remove it from white list before adding to the white list
1198 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1199 "Present in white list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001200 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 }
1202 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001203 "... Now add to black list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 sapAddMacToACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, pPeerStaMac);
1205 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"size of accept and deny lists %d %d",
1206 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 }
1209 else if (cmd == DELETE_STA_FROM_ACL)
1210 {
1211 if (staInBlackList)
1212 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001213 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from black list");
1214 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"no accept and deny mac %d %d",
1216 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1217 }
1218 else
1219 {
1220 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
Arif Hussain24bafea2013-11-15 15:10:03 -08001221 "MAC address to be deleted is not present in the black list "MAC_ADDRESS_STR,
1222 MAC_ADDR_ARRAY(pPeerStaMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 return VOS_STATUS_E_FAILURE;
1224 }
1225 }
1226 else
1227 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001228 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 return VOS_STATUS_E_FAILURE;
1230 }
1231 break;
1232
1233 default:
1234 {
1235 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1236 "Invalid list type passed %d",listType);
1237 return VOS_STATUS_E_FAILURE;
1238 }
1239 }
1240 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"After modification of ACL");
1241 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
1242 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
1243 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
1244 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
1245 return VOS_STATUS_SUCCESS;
1246}
1247
1248/*==========================================================================
1249 FUNCTION WLANSAP_DisassocSta
1250
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001251 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 This api function provides for Ap App/HDD initiated disassociation of station
1253
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001254 DEPENDENCIES
1255 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001256
1257 PARAMETERS
1258
1259 IN
1260 pvosGCtx : Pointer to vos global context structure
1261 pPeerStaMac : Mac address of the station to disassociate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001262
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001264 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001265
1266 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001267
1268 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001269============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001270VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001271WLANSAP_DisassocSta
1272(
1273 v_PVOID_t pvosGCtx,
Anand N Sunkadc205d952015-07-30 15:36:03 +05301274#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
1275 const v_U8_t *pPeerStaMac
1276#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 v_U8_t *pPeerStaMac
Anand N Sunkadc205d952015-07-30 15:36:03 +05301278#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001279)
1280{
1281 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1282
1283 /*------------------------------------------------------------------------
1284 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001285 Extract SAP control block
1286 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 if (NULL == pSapCtx)
1288 {
1289 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001290 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 return VOS_STATUS_E_FAULT;
1292 }
1293
1294 sme_RoamDisconnectSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
1295 pPeerStaMac);
1296
1297 return VOS_STATUS_SUCCESS;
1298}
1299
Jeff Johnson295189b2012-06-20 16:38:30 -07001300/*==========================================================================
1301 FUNCTION WLANSAP_DeauthSta
1302
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001303 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 This api function provides for Ap App/HDD initiated deauthentication of station
1305
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001306 DEPENDENCIES
1307 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001308
1309 PARAMETERS
1310
1311 IN
1312 pvosGCtx : Pointer to vos global context structure
Hanumantha Reddy Pothulabfd06f72014-10-31 14:03:37 +05301313 pDelStaParams : Pointer to parameters of the station to
1314 deauthenticate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001315
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001317 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001318
1319 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001320
1321 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001322============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001323VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001324WLANSAP_DeauthSta
1325(
1326 v_PVOID_t pvosGCtx,
Hanumantha Reddy Pothulabfd06f72014-10-31 14:03:37 +05301327 struct tagCsrDelStaParams *pDelStaParams
Jeff Johnson295189b2012-06-20 16:38:30 -07001328)
1329{
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001330 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1331 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1333
1334 /*------------------------------------------------------------------------
1335 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001336 Extract SAP control block
1337 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 if (NULL == pSapCtx)
1339 {
1340 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001341 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001342 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 }
1344
Hanumantha Reddy Pothulabfd06f72014-10-31 14:03:37 +05301345 halStatus = sme_RoamDeauthSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx),
1346 pSapCtx->sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07001347
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001348 if (halStatus == eHAL_STATUS_SUCCESS)
1349 {
1350 vosStatus = VOS_STATUS_SUCCESS;
1351 }
1352 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001353}
1354/*==========================================================================
1355 FUNCTION WLANSAP_SetChannelRange
1356
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001357 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 This api function sets the range of channels for AP.
1359
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001360 DEPENDENCIES
1361 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001362
1363 PARAMETERS
1364
1365 IN
1366 startChannel : start channel
1367 endChannel : End channel
1368 operatingBand : Operating band (2.4GHz/5GHz)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001369
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001371 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001372
1373 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001374
1375 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001376============================================================================*/
1377VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001378WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel,
Leela Venkata Kiran Kumar Reddy Chirala9f6566c2014-09-05 19:06:58 +05301379 eSapOperatingBand operatingBand)
Jeff Johnson295189b2012-06-20 16:38:30 -07001380{
1381
1382 v_U8_t validChannelFlag =0;
1383 v_U8_t loopStartCount =0;
1384 v_U8_t loopEndCount =0;
1385 v_U8_t bandStartChannel =0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001386 v_U8_t bandEndChannel =0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001387
1388 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1389 "WLANSAP_SetChannelRange:startChannel %d,EndChannel %d,Operatingband:%d",
1390 startChannel,endChannel,operatingBand);
1391
1392 /*------------------------------------------------------------------------
1393 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001394 ------------------------------------------------------------------------*/
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001395 if (( WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN > operatingBand) ||
1396 (WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX < operatingBand))
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 {
1398 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1399 "Invalid operatingBand on WLANSAP_SetChannelRange");
1400 return VOS_STATUS_E_FAULT;
1401 }
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001402 if (( WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN > startChannel) ||
1403 (WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX < startChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001404 {
1405 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1406 "Invalid startChannel value on WLANSAP_SetChannelRange");
1407 return VOS_STATUS_E_FAULT;
1408 }
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001409 if (( WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN > endChannel) ||
1410 (WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX < endChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 {
1412 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1413 "Invalid endChannel value on WLANSAP_SetChannelRange");
1414 return VOS_STATUS_E_FAULT;
1415 }
1416 switch(operatingBand)
1417 {
Deepthi Gowri7db41f32014-10-13 17:02:29 +05301418 case eSAP_RF_SUBBAND_2_4_GHZ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 bandStartChannel = RF_CHAN_1;
1420 bandEndChannel = RF_CHAN_14;
1421 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001422
Deepthi Gowri7db41f32014-10-13 17:02:29 +05301423 case eSAP_RF_SUBBAND_5_LOW_GHZ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 bandStartChannel = RF_CHAN_36;
1425 bandEndChannel = RF_CHAN_64;
1426 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001427
Deepthi Gowri7db41f32014-10-13 17:02:29 +05301428 case eSAP_RF_SUBBAND_5_MID_GHZ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 bandStartChannel = RF_CHAN_100;
Leo Chang80de3c22013-11-26 10:52:12 -08001430#ifndef FEATURE_WLAN_CH144
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 bandEndChannel = RF_CHAN_140;
Leo Chang80de3c22013-11-26 10:52:12 -08001432#else
1433 bandEndChannel = RF_CHAN_144;
1434#endif /* FEATURE_WLAN_CH144 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001436
Deepthi Gowri7db41f32014-10-13 17:02:29 +05301437 case eSAP_RF_SUBBAND_5_HIGH_GHZ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 bandStartChannel = RF_CHAN_149;
1439 bandEndChannel = RF_CHAN_165;
1440 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001441
Deepthi Gowri7db41f32014-10-13 17:02:29 +05301442 case eSAP_RF_SUBBAND_5_ALL_GHZ:
1443 bandStartChannel = RF_CHAN_36;
1444 bandEndChannel = RF_CHAN_165;
1445 break;
1446
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 default:
1448 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1449 "Invalid operatingBand value on WLANSAP_SetChannelRange");
1450 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001451 }
1452
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 /* Validating the start channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001454 for(loopStartCount = bandStartChannel ; loopStartCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 loopStartCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001456 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 if(rfChannels[loopStartCount].channelNum == startChannel )
1458 {
1459 /* start channel is in the range */
1460 break;
1461 }
1462 }
1463 /* Validating the End channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001464 for(loopEndCount = bandStartChannel ; loopEndCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 loopEndCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001466 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 if(rfChannels[loopEndCount].channelNum == endChannel )
1468 {
1469 /* End channel is in the range */
1470 break;
1471 }
1472 }
1473 if((loopStartCount > bandEndChannel)||(loopEndCount > bandEndChannel))
1474 {
1475 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1476 "%s: Invalid startChannel-%d or EndChannel-%d for band -%d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001477 __func__,startChannel,endChannel,operatingBand);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001478 /* Supplied channels are nt in the operating band so set the default
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 channels for the given operating band */
1480 startChannel = rfChannels[bandStartChannel].channelNum;
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07001481 endChannel = rfChannels[bandEndChannel].channelNum;
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001483
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 /*Search for the Active channels in the given range */
1485 for( loopStartCount = bandStartChannel; loopStartCount <= bandEndChannel; loopStartCount++ )
1486 {
1487 if((startChannel <= rfChannels[loopStartCount].channelNum)&&
1488 (endChannel >= rfChannels[loopStartCount].channelNum ))
1489 {
1490 if( regChannels[loopStartCount].enabled )
1491 {
1492 validChannelFlag = 1;
1493 break;
1494 }
1495 }
1496 }
1497 if(0 == validChannelFlag)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001498 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1500 "%s-No active channels present in the given range for the current region",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001501 __func__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001502 /* There is no active channel in the supplied range.Updating the config
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 with the default channels in the given band so that we can select the best channel in the sub-band*/
1504 startChannel = rfChannels[bandStartChannel].channelNum;
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07001505 endChannel = rfChannels[bandEndChannel].channelNum;
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001507
1508 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 operatingBand, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1510 {
1511 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1512 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND to CCn");
1513 return VOS_STATUS_E_FAULT;
1514 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001515 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 startChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1517 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001518
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1520 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1521 return VOS_STATUS_E_FAULT;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001522
1523 }
1524 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001525 endChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1526 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001527
Jeff Johnson295189b2012-06-20 16:38:30 -07001528 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1529 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1530 return VOS_STATUS_E_FAULT;
1531 }
1532 return VOS_STATUS_SUCCESS;
1533}
Jeff Johnson295189b2012-06-20 16:38:30 -07001534
1535/*==========================================================================
1536 FUNCTION WLANSAP_SetCounterMeasure
1537
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001538 DESCRIPTION
1539 This api function is used to disassociate all the stations and prevent
1540 association for any other station.Whenever Authenticator receives 2 mic failures
1541 within 60 seconds, Authenticator will enable counter measure at SAP Layer.
1542 Authenticator will start the 60 seconds timer. Core stack will not allow any
1543 STA to associate till HDD disables counter meassure. Core stack shall kick out all the
1544 STA which are currently associated and DIASSOC Event will be propogated to HDD for
1545 each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 will disable the counter meassure at core stack. Now core stack can allow STAs to associate.
1547
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001548 DEPENDENCIES
1549 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001550
1551 PARAMETERS
1552
1553 IN
1554pvosGCtx: Pointer to vos global context structure
1555bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE
1556will come out of this state.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001557
Jeff Johnson295189b2012-06-20 16:38:30 -07001558 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001559 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001560
1561 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001562
1563 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001564============================================================================*/
1565VOS_STATUS
1566WLANSAP_SetCounterMeasure
1567(
1568 v_PVOID_t pvosGCtx,
1569 v_BOOL_t bEnable
1570)
1571{
1572 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1573
1574 /*------------------------------------------------------------------------
1575 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001576 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 ------------------------------------------------------------------------*/
1578 if (NULL == pSapCtx)
1579 {
1580 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001581 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 return VOS_STATUS_E_FAULT;
1583 }
1584
1585 sme_RoamTKIPCounterMeasures(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, bEnable);
1586
1587 return VOS_STATUS_SUCCESS;
1588}
1589
1590/*==========================================================================
1591
1592 FUNCTION WLANSAP_SetKeysSta
1593
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001594 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 This api function provides for Ap App/HDD to set key for a station.
1596
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001597 DEPENDENCIES
1598 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001599
1600 PARAMETERS
1601
1602 IN
1603pvosGCtx: Pointer to vos global context structure
1604pSetKeyInfo: tCsrRoamSetKey structure for the station
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001605
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001607 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001608
1609 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001610
1611 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001612============================================================================*/
1613VOS_STATUS
1614WLANSAP_SetKeySta
1615(
1616 v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo
1617)
1618{
1619 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1620 ptSapContext pSapCtx = NULL;
1621 v_PVOID_t hHal = NULL;
1622 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1623 v_U32_t roamId=0xFF;
1624
1625 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1626 {
1627 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1628 if (NULL == pSapCtx)
1629 {
1630 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001631 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 return VOS_STATUS_E_FAULT;
1633 }
1634 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1635 if (NULL == hHal)
1636 {
1637 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001638 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 return VOS_STATUS_E_FAULT;
1640 }
1641 halStatus = sme_RoamSetKey(hHal, pSapCtx->sessionId, pSetKeyInfo, &roamId);
1642
1643 if (halStatus == eHAL_STATUS_SUCCESS)
1644 {
1645 vosStatus = VOS_STATUS_SUCCESS;
1646 } else
1647 {
1648 vosStatus = VOS_STATUS_E_FAULT;
1649 }
1650 }
1651 else
1652 vosStatus = VOS_STATUS_E_FAULT;
1653
1654 return vosStatus;
1655}
1656
1657/*==========================================================================
1658 FUNCTION WLANSAP_DelKeySta
1659
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001660 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 This api function provides for Ap App/HDD to delete key for a station.
1662
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001663 DEPENDENCIES
1664 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001665
1666 PARAMETERS
1667
1668 IN
1669pvosGCtx: Pointer to vos global context structure
1670pSetKeyInfo: tCsrRoamRemoveKey structure for the station
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001671
Jeff Johnson295189b2012-06-20 16:38:30 -07001672 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001673 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001674
1675 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001676
1677 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001678============================================================================*/
1679VOS_STATUS
1680WLANSAP_DelKeySta
1681(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001682 v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 tCsrRoamRemoveKey *pRemoveKeyInfo
1684)
1685{
1686 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1687 ptSapContext pSapCtx = NULL;
1688 v_PVOID_t hHal = NULL;
1689 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1690 v_U32_t roamId=0xFF;
1691 tCsrRoamRemoveKey RemoveKeyInfo;
1692
1693 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1694 {
1695 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1696 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001697 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001699 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 return VOS_STATUS_E_FAULT;
1701 }
1702
1703 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1704 if (NULL == hHal)
1705 {
1706 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001707 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 return VOS_STATUS_E_FAULT;
1709 }
1710
1711 vos_mem_zero(&RemoveKeyInfo, sizeof(RemoveKeyInfo));
1712 RemoveKeyInfo.encType = pRemoveKeyInfo->encType;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001713 vos_mem_copy(RemoveKeyInfo.peerMac, pRemoveKeyInfo->peerMac, WNI_CFG_BSSID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 RemoveKeyInfo.keyId = pRemoveKeyInfo->keyId;
1715
1716 halStatus = sme_RoamRemoveKey(hHal, pSapCtx->sessionId, &RemoveKeyInfo, &roamId);
1717
1718 if (HAL_STATUS_SUCCESS(halStatus))
1719 {
1720 vosStatus = VOS_STATUS_SUCCESS;
1721 }
1722 else
1723 {
1724 vosStatus = VOS_STATUS_E_FAULT;
1725 }
1726 }
1727 else
1728 vosStatus = VOS_STATUS_E_FAULT;
1729
1730 return vosStatus;
1731}
1732
1733VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001734WLANSap_getstationIE_information(v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 v_U32_t *pLen,
1736 v_U8_t *pBuf)
1737{
1738 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1739 ptSapContext pSapCtx = NULL;
1740 v_U32_t len = 0;
1741
1742 if (VOS_STA_SAP_MODE == vos_get_conparam ( )){
1743 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1744 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001745 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001747 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 return VOS_STATUS_E_FAULT;
1749 }
1750 if (pLen)
1751 {
1752 len = *pLen;
1753 *pLen = pSapCtx->nStaWPARSnReqIeLength;
1754 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001755 "%s: WPAIE len : %x", __func__, *pLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 if(pBuf)
1757 {
1758 if(len >= pSapCtx->nStaWPARSnReqIeLength)
1759 {
1760 vos_mem_copy( pBuf, pSapCtx->pStaWpaRsnReqIE, pSapCtx->nStaWPARSnReqIeLength);
1761 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1762 "%s: WPAIE: %02x:%02x:%02x:%02x:%02x:%02x",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001763 __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 pBuf[0], pBuf[1], pBuf[2],
1765 pBuf[3], pBuf[4], pBuf[5]);
1766 vosStatus = VOS_STATUS_SUCCESS;
1767 }
1768 }
1769 }
1770 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001771
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 if( VOS_STATUS_E_FAILURE == vosStatus)
1773 {
1774 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1775 "%s: Error unable to populate the RSNWPAIE",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001776 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 }
1778
1779 return vosStatus;
1780
1781}
1782
1783/*==========================================================================
1784 FUNCTION WLANSAP_Set_WpsIe
1785
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001786 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001787 This api function provides for Ap App/HDD to set WPS IE.
1788
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001789 DEPENDENCIES
1790 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001791
1792 PARAMETERS
1793
1794 IN
1795pvosGCtx: Pointer to vos global context structure
1796pWPSIE: tSap_WPSIE structure that include WPS IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001797
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001799 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001800
1801 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001802
1803 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001804============================================================================*/
1805VOS_STATUS
1806WLANSAP_Set_WpsIe
1807(
1808 v_PVOID_t pvosGCtx, tSap_WPSIE *pSap_WPSIe
1809)
1810{
1811 ptSapContext pSapCtx = NULL;
1812 v_PVOID_t hHal = NULL;
1813
1814 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001815 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001816
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 if(VOS_STA_SAP_MODE == vos_get_conparam ( )) {
1818 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1819 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001820 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001822 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 return VOS_STATUS_E_FAULT;
1824 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001825
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1827 if ( NULL == hHal ){
1828 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001829 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 return VOS_STATUS_E_FAULT;
1831 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001832
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 if ( sap_AcquireGlobalLock( pSapCtx ) == VOS_STATUS_SUCCESS )
1834 {
1835 if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_BEACON_IE)
1836 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001837 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSBeaconIE, &pSap_WPSIe->sapwpsie.sapWPSBeaconIE, sizeof(tSap_WPSBeaconIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001839 else if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_PROBE_RSP_IE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 {
1841 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSProbeRspIE, &pSap_WPSIe->sapwpsie.sapWPSProbeRspIE, sizeof(tSap_WPSProbeRspIE));
1842 }
1843 else
1844 {
1845 sap_ReleaseGlobalLock( pSapCtx );
1846 return VOS_STATUS_E_FAULT;
1847 }
1848 sap_ReleaseGlobalLock( pSapCtx );
1849 return VOS_STATUS_SUCCESS;
1850 }
1851 else
1852 return VOS_STATUS_E_FAULT;
1853 }
1854 else
1855 return VOS_STATUS_E_FAULT;
1856}
1857
1858/*==========================================================================
1859 FUNCTION WLANSAP_Update_WpsIe
1860
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001861 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 This api function provides for Ap App/HDD to update WPS IEs.
1863
1864 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001865 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001866
1867 PARAMETERS
1868
1869 IN
1870pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001871
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001873 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001874
1875 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001876
1877 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001878============================================================================*/
1879VOS_STATUS
1880WLANSAP_Update_WpsIe
1881(
1882 v_PVOID_t pvosGCtx
1883)
1884{
1885 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1886 ptSapContext pSapCtx = NULL;
1887 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1888 v_PVOID_t hHal = NULL;
1889
1890 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001891 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001892
Jeff Johnson295189b2012-06-20 16:38:30 -07001893 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
1894 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1895 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001896 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001898 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 return VOS_STATUS_E_FAULT;
1900 }
1901
1902 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1903 if ( NULL == hHal ){
1904 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001905 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 return VOS_STATUS_E_FAULT;
1907 }
1908
1909 halStatus = sme_RoamUpdateAPWPSIE( hHal, pSapCtx->sessionId, &pSapCtx->APWPSIEs);
1910
1911 if(halStatus == eHAL_STATUS_SUCCESS) {
1912 vosStatus = VOS_STATUS_SUCCESS;
1913 } else
1914 {
1915 vosStatus = VOS_STATUS_E_FAULT;
1916 }
1917
1918 }
1919
1920 return vosStatus;
1921}
1922
1923/*==========================================================================
1924 FUNCTION WLANSAP_Get_WPS_State
1925
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001926 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 This api function provides for Ap App/HDD to check if WPS session in process.
1928
1929 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001930 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001931
1932 PARAMETERS
1933
1934 IN
1935pvosGCtx: Pointer to vos global context structure
1936
1937 OUT
1938pbWPSState: Pointer to variable to indicate if it is in WPS Registration state
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001939
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001941 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001942
1943 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001944
1945 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001946============================================================================*/
1947VOS_STATUS
1948WLANSAP_Get_WPS_State
1949(
1950 v_PVOID_t pvosGCtx, v_BOOL_t *bWPSState
1951)
1952{
1953 ptSapContext pSapCtx = NULL;
1954 v_PVOID_t hHal = NULL;
1955
1956 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001957 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001958
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001960
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1962 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001963 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001965 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 return VOS_STATUS_E_FAULT;
1967 }
1968
1969 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1970 if ( NULL == hHal ){
1971 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001972 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 return VOS_STATUS_E_FAULT;
1974 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001975
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 if ( sap_AcquireGlobalLock(pSapCtx ) == VOS_STATUS_SUCCESS )
1977 {
1978 if(pSapCtx->APWPSIEs.SirWPSProbeRspIE.FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
1979 *bWPSState = eANI_BOOLEAN_TRUE;
1980 else
1981 *bWPSState = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001982
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 sap_ReleaseGlobalLock( pSapCtx );
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001984
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 return VOS_STATUS_SUCCESS;
1986 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001987 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 return VOS_STATUS_E_FAULT;
1989 }
1990 else
1991 return VOS_STATUS_E_FAULT;
1992
1993}
1994
1995VOS_STATUS
1996sap_AcquireGlobalLock
1997(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001998 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07001999)
2000{
2001 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
2002
2003 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &pSapCtx->SapGlobalLock) ) )
2004 {
2005 vosStatus = VOS_STATUS_SUCCESS;
2006 }
2007
2008 return (vosStatus);
2009}
2010
2011VOS_STATUS
2012sap_ReleaseGlobalLock
2013(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002014 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07002015)
2016{
2017 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
2018
2019 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &pSapCtx->SapGlobalLock) ) )
2020 {
2021 vosStatus = VOS_STATUS_SUCCESS;
2022 }
2023
2024 return (vosStatus);
2025}
2026
2027/*==========================================================================
2028 FUNCTION WLANSAP_Set_WPARSNIes
2029
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002030 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response.
2032
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002033 DEPENDENCIES
2034 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002035
2036 PARAMETERS
2037
2038 IN
2039 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002040 pWPARSNIEs: buffer to the WPA/RSN IEs
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 WPARSNIEsLen: length of WPA/RSN IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002042
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002044 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002045
2046 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002047
2048 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002049============================================================================*/
2050VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen)
2051{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002052
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 ptSapContext pSapCtx = NULL;
2054 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2055 v_PVOID_t hHal = NULL;
2056
2057 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
2058 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
2059 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002060 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002062 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 return VOS_STATUS_E_FAULT;
2064 }
2065
2066 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2067 if ( NULL == hHal ){
2068 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002069 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 return VOS_STATUS_E_FAULT;
2071 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002072
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 pSapCtx->APWPARSNIEs.length = (tANI_U16)WPARSNIEsLen;
2074 vos_mem_copy(pSapCtx->APWPARSNIEs.rsnIEdata, pWPARSNIEs, WPARSNIEsLen);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002075
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 halStatus = sme_RoamUpdateAPWPARSNIEs( hHal, pSapCtx->sessionId, &pSapCtx->APWPARSNIEs);
2077
2078 if(halStatus == eHAL_STATUS_SUCCESS) {
2079 return VOS_STATUS_SUCCESS;
2080 } else
2081 {
2082 return VOS_STATUS_E_FAULT;
2083 }
2084 }
2085
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002086 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002087}
2088
2089VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset)
2090{
2091 if (NULL == pvosGCtx)
2092 {
2093 return VOS_STATUS_E_FAULT;
2094 }
2095
2096 return (WLANTL_GetSoftAPStatistics(pvosGCtx, statBuf, bReset));
2097}
2098
Jeff Johnson295189b2012-06-20 16:38:30 -07002099/*==========================================================================
2100
2101 FUNCTION WLANSAP_SendAction
2102
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002103 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 This api function provides to send action frame sent by upper layer.
2105
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002106 DEPENDENCIES
2107 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002108
2109 PARAMETERS
2110
2111 IN
2112 pvosGCtx: Pointer to vos global context structure
2113 pBuf: Pointer of the action frame to be transmitted
2114 len: Length of the action frame
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002115
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002117 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002118
2119 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002120
2121 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002122============================================================================*/
2123VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf,
Jeff Johnsone7245742012-09-05 17:12:55 -07002124 tANI_U32 len, tANI_U16 wait )
Jeff Johnson295189b2012-06-20 16:38:30 -07002125{
2126 ptSapContext pSapCtx = NULL;
2127 v_PVOID_t hHal = NULL;
2128 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2129
2130 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2131 {
2132 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2133 if (NULL == pSapCtx)
2134 {
2135 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002136 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 return VOS_STATUS_E_FAULT;
2138 }
2139 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2140 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2141 {
2142 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2143 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002144 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 return VOS_STATUS_E_FAULT;
2146 }
2147
Jeff Johnsone7245742012-09-05 17:12:55 -07002148 halStatus = sme_sendAction( hHal, pSapCtx->sessionId, pBuf, len, 0 , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002149
2150 if ( eHAL_STATUS_SUCCESS == halStatus )
2151 {
2152 return VOS_STATUS_SUCCESS;
2153 }
2154 }
2155
2156 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2157 "Failed to Send Action Frame");
2158
2159 return VOS_STATUS_E_FAULT;
2160}
2161
2162/*==========================================================================
2163
2164 FUNCTION WLANSAP_RemainOnChannel
2165
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002166 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 This api function provides to set Remain On channel on specified channel
2168 for specified duration.
2169
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002170 DEPENDENCIES
2171 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002172
2173 PARAMETERS
2174
2175 IN
2176 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002177 channel: Channel on which driver has to listen
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 duration: Duration for which driver has to listen on specified channel
2179 callback: Callback function to be called once Listen is done.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002180 pContext: Context needs to be called in callback function.
2181
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002183 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002186
2187 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002188============================================================================*/
2189VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx,
2190 tANI_U8 channel, tANI_U32 duration,
2191 remainOnChanCallback callback,
2192 void *pContext )
2193{
2194 ptSapContext pSapCtx = NULL;
2195 v_PVOID_t hHal = NULL;
2196 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2197
2198 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2199 {
2200 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2201 if (NULL == pSapCtx)
2202 {
2203 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002204 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 return VOS_STATUS_E_FAULT;
2206 }
2207 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2208 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2209 {
2210 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2211 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002212 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 return VOS_STATUS_E_FAULT;
2214 }
2215
2216 halStatus = sme_RemainOnChannel( hHal, pSapCtx->sessionId,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05302217 channel, duration, callback, pContext, TRUE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002218
2219 if( eHAL_STATUS_SUCCESS == halStatus )
2220 {
2221 return VOS_STATUS_SUCCESS;
2222 }
2223 }
2224
2225 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2226 "Failed to Set Remain on Channel");
2227
2228 return VOS_STATUS_E_FAULT;
2229}
2230
2231/*==========================================================================
2232
2233 FUNCTION WLANSAP_CancelRemainOnChannel
2234
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002235 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 This api cancel previous remain on channel request.
2237
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002238 DEPENDENCIES
2239 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002240
2241 PARAMETERS
2242
2243 IN
2244 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002245
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002247 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002250
2251 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002252============================================================================*/
2253VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx )
2254{
2255 ptSapContext pSapCtx = NULL;
2256 v_PVOID_t hHal = NULL;
2257 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2258
Agrawal Ashish9d126602016-09-29 14:22:16 +05302259 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
2260 if (NULL == pSapCtx)
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
Agrawal Ashish9d126602016-09-29 14:22:16 +05302262 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2263 "%s: Invalid SAP pointer from pvosGCtx", __func__);
2264 return VOS_STATUS_E_FAULT;
2265 }
2266 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2267 if ((NULL == hHal) || (eSAP_TRUE != pSapCtx->isSapSessionOpen))
2268 {
2269 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2270 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2271 __func__, hHal, pSapCtx->isSapSessionOpen );
2272 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274
Agrawal Ashish9d126602016-09-29 14:22:16 +05302275 halStatus = sme_CancelRemainOnChannel(hHal, pSapCtx->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
Agrawal Ashish9d126602016-09-29 14:22:16 +05302277 if (eHAL_STATUS_SUCCESS != halStatus)
2278 {
2279 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2280 "Failed to Cancel Remain on Channel");
2281 return VOS_STATUS_E_FAULT;
2282 }
2283 return VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002284}
2285
2286/*==========================================================================
2287
2288 FUNCTION WLANSAP_RegisterMgmtFrame
2289
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002290 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 HDD use this API to register specified type of frame with CORE stack.
2292 On receiving such kind of frame CORE stack should pass this frame to HDD
2293
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002294 DEPENDENCIES
2295 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 PARAMETERS
2298
2299 IN
2300 pvosGCtx: Pointer to vos global context structure
2301 frameType: frameType that needs to be registered with PE.
2302 matchData: Data pointer which should be matched after frame type is matched.
2303 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002304
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002306 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002307
2308 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002309
2310 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002311============================================================================*/
2312VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2313 tANI_U8* matchData, tANI_U16 matchLen )
2314{
2315 ptSapContext pSapCtx = NULL;
2316 v_PVOID_t hHal = NULL;
2317 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2318
2319 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2320 {
2321 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2322 if (NULL == pSapCtx)
2323 {
2324 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002325 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 return VOS_STATUS_E_FAULT;
2327 }
2328 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2329 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2330 {
2331 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2332 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002333 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 return VOS_STATUS_E_FAULT;
2335 }
2336
2337 halStatus = sme_RegisterMgmtFrame(hHal, pSapCtx->sessionId,
2338 frameType, matchData, matchLen);
2339
2340 if( eHAL_STATUS_SUCCESS == halStatus )
2341 {
2342 return VOS_STATUS_SUCCESS;
2343 }
2344 }
2345
2346 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2347 "Failed to Register MGMT frame");
2348
2349 return VOS_STATUS_E_FAULT;
2350}
2351
2352/*==========================================================================
2353
2354 FUNCTION WLANSAP_DeRegisterMgmtFrame
2355
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002356 DESCRIPTION
2357 This API is used to deregister previously registered frame.
Jeff Johnson295189b2012-06-20 16:38:30 -07002358
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002359 DEPENDENCIES
2360 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002361
2362 PARAMETERS
2363
2364 IN
2365 pvosGCtx: Pointer to vos global context structure
2366 frameType: frameType that needs to be De-registered with PE.
2367 matchData: Data pointer which should be matched after frame type is matched.
2368 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002369
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002371 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002372
2373 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002374
2375 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002376============================================================================*/
2377VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2378 tANI_U8* matchData, tANI_U16 matchLen )
2379{
2380 ptSapContext pSapCtx = NULL;
2381 v_PVOID_t hHal = NULL;
2382 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2383
2384 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2385 {
2386 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2387 if (NULL == pSapCtx)
2388 {
2389 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002390 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 return VOS_STATUS_E_FAULT;
2392 }
2393 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2394 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2395 {
2396 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2397 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002398 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 return VOS_STATUS_E_FAULT;
2400 }
2401
2402 halStatus = sme_DeregisterMgmtFrame( hHal, pSapCtx->sessionId,
2403 frameType, matchData, matchLen );
2404
2405 if( eHAL_STATUS_SUCCESS == halStatus )
2406 {
2407 return VOS_STATUS_SUCCESS;
2408 }
2409 }
2410
2411 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2412 "Failed to Deregister MGMT frame");
2413
2414 return VOS_STATUS_E_FAULT;
2415}
Hanumantha Reddy Pothulabfd06f72014-10-31 14:03:37 +05302416
2417/*==========================================================================
2418 FUNCTION WLANSAP_PopulateDelStaParams
2419
2420 DESCRIPTION
2421 This API is used to populate del station parameters
2422 DEPENDENCIES
2423 NA.
2424
2425 PARAMETERS
2426 IN
2427 mac: pointer to peer mac address.
2428 reason_code: Reason code for the disassoc/deauth.
2429 subtype: subtype points to either disassoc/deauth frame.
2430 pDelStaParams: address where parameters to be populated.
2431
2432 RETURN VALUE NONE
2433
2434 SIDE EFFECTS
2435============================================================================*/
2436void WLANSAP_PopulateDelStaParams(const v_U8_t *mac,
2437 v_U16_t reason_code,
2438 v_U8_t subtype,
2439 struct tagCsrDelStaParams *pDelStaParams)
2440{
2441 if (NULL == mac)
2442 memset(pDelStaParams->peerMacAddr, 0xff, VOS_MAC_ADDR_SIZE);
2443 else
2444 vos_mem_copy(pDelStaParams->peerMacAddr, mac, VOS_MAC_ADDR_SIZE);
2445
2446 if (reason_code == 0)
Sushant Kaushik4cd28f62014-12-26 14:23:50 +05302447 pDelStaParams->reason_code = eSIR_MAC_DEAUTH_LEAVING_BSS_REASON;
Hanumantha Reddy Pothulabfd06f72014-10-31 14:03:37 +05302448 else
2449 pDelStaParams->reason_code = reason_code;
2450
2451 if (subtype == (SIR_MAC_MGMT_DEAUTH >> 4) ||
2452 subtype == (SIR_MAC_MGMT_DISASSOC >> 4))
2453 pDelStaParams->subtype = subtype;
2454 else
2455 pDelStaParams->subtype = (SIR_MAC_MGMT_DEAUTH >> 4);
2456
2457 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
2458 FL("Delete STA with RC:%hu subtype:%hhu MAC::" MAC_ADDRESS_STR),
2459 pDelStaParams->reason_code, pDelStaParams->subtype,
2460 MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr));
2461}