blob: a7d4cdb86de1c1e432a925fa93728e26484b4280 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*===========================================================================
43
44 s a p M o d u l e . C
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070045
Jeff Johnson295189b2012-06-20 16:38:30 -070046 OVERVIEW:
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070047
Jeff Johnson295189b2012-06-20 16:38:30 -070048 This software unit holds the implementation of the WLAN SAP modules
49 functions providing EXTERNAL APIs. It is also where the global SAP module
50 context gets initialised
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070051
52 DEPENDENCIES:
Jeff Johnson295189b2012-06-20 16:38:30 -070053
54 Are listed for each API below.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070055
Jeff Johnson295189b2012-06-20 16:38:30 -070056 Copyright (c) 2010 QUALCOMM Incorporated.
57 All Rights Reserved.
58 Qualcomm Confidential and Proprietary
59===========================================================================*/
60
61/*===========================================================================
62
63 EDIT HISTORY FOR FILE
64
65
66 This section contains comments describing changes made to the module.
67 Notice that changes are listed in reverse chronological order.
68
69
70
71 when who what, where, why
72---------- --- --------------------------------------------------------
7303/15/10 SOFTAP team Created module
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07007406/03/10 js Added support to hostapd driven
Jeff Johnson295189b2012-06-20 16:38:30 -070075 * deauth/disassoc/mic failure
76
77===========================================================================*/
78
79/* $Header$ */
80
81/*----------------------------------------------------------------------------
82 * Include Files
83 * -------------------------------------------------------------------------*/
84#include "wlan_qct_tl.h"
85#include "vos_trace.h"
86
87// Pick up the sme callback registration API
88#include "sme_Api.h"
89
90// SAP API header file
91
92#include "sapInternal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070093#include "smeInside.h"
94
95/*----------------------------------------------------------------------------
96 * Preprocessor Definitions and Constants
97 * -------------------------------------------------------------------------*/
98#define SAP_DEBUG
99
100/*----------------------------------------------------------------------------
101 * Type Declarations
102 * -------------------------------------------------------------------------*/
103
104
105/*----------------------------------------------------------------------------
106 * Global Data Definitions
107 * -------------------------------------------------------------------------*/
108
109/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700110 * External declarations for global context
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 * -------------------------------------------------------------------------*/
112// No! Get this from VOS.
113// The main per-Physical Link (per WLAN association) context.
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700114ptSapContext gpSapCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700115
116/*----------------------------------------------------------------------------
117 * Static Variable Definitions
118 * -------------------------------------------------------------------------*/
119
120/*----------------------------------------------------------------------------
121 * Static Function Declarations and Definitions
122 * -------------------------------------------------------------------------*/
123
124/*----------------------------------------------------------------------------
125 * Externalized Function Definitions
126* -------------------------------------------------------------------------*/
127
128/*----------------------------------------------------------------------------
129 * Function Declarations and Documentation
130 * -------------------------------------------------------------------------*/
131
132/*==========================================================================
133 FUNCTION WLANSAP_Open
134
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700135 DESCRIPTION
136 Called at driver initialization (vos_open). SAP will initialize
137 all its internal resources and will wait for the call to start to
138 register with the other modules.
139
140 DEPENDENCIES
141
142 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700143
144 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700145 pvosGCtx : Pointer to the global vos context; a handle to SAP's
146 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700148 RETURN VALUE
149 The result code associated with performing the operation
150
151 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
152 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 VOS_STATUS_SUCCESS: Success
154
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700155 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700156============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700157VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700158WLANSAP_Open
159(
160 v_PVOID_t pvosGCtx
161)
162{
163
164 ptSapContext pSapCtx = NULL;
165 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
166 VOS_ASSERT(pvosGCtx);
167 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700168 Allocate (and sanity check?!) SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700169 ------------------------------------------------------------------------*/
170 vos_alloc_context(pvosGCtx, VOS_MODULE_ID_SAP, (v_VOID_t **)&pSapCtx, sizeof(tSapContext));
171
172 if (NULL == pSapCtx)
173 {
174 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700176 return VOS_STATUS_E_FAULT;
177 }
178
179 vos_mem_zero(pSapCtx, sizeof(tSapContext));
180
181 /*------------------------------------------------------------------------
182 Clean up SAP control block, initialize all values
183 ------------------------------------------------------------------------*/
184 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Open");
185
186 WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/);
187
188 // Setup the "link back" to the VOSS context
189 pSapCtx->pvosGCtx = pvosGCtx;
190
191 // Store a pointer to the SAP context provided by VOSS
192 gpSapCtx = pSapCtx;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700193
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 /*------------------------------------------------------------------------
195 Allocate internal resources
196 ------------------------------------------------------------------------*/
197
198 return VOS_STATUS_SUCCESS;
199}// WLANSAP_Open
200
201/*==========================================================================
202 FUNCTION WLANSAP_Start
203
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700204 DESCRIPTION
205 Called as part of the overall start procedure (vos_start). SAP will
206 use this call to register with TL as the SAP entity for
207 SAP RSN frames.
Jeff Johnson295189b2012-06-20 16:38:30 -0700208
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700209 DEPENDENCIES
210
211 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700212
213 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700214 pvosGCtx : Pointer to the global vos context; a handle to SAP's
215 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700216
217 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700218 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700219
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700220 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
221 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 VOS_STATUS_SUCCESS: Success
223
224 SIDE EFFECTS
225============================================================================*/
226
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700227VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700228WLANSAP_Start
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700229(
230 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700231)
232{
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 ptSapContext pSapCtx = NULL;
234
235 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
236
237 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
238 "WLANSAP_Start invoked successfully\n");
239 /*------------------------------------------------------------------------
240 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700241 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 ------------------------------------------------------------------------*/
243 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700244 if ( NULL == pSapCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 {
246 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700247 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700248 return VOS_STATUS_E_FAULT;
249 }
250
251 /*------------------------------------------------------------------------
252 For now, presume security is not enabled.
253 -----------------------------------------------------------------------*/
254 pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE;
255
256
257 /*------------------------------------------------------------------------
258 Now configure the roaming profile links. To SSID and bssid.
259 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700260 // We have room for two SSIDs.
261 pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.
262 pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList; //Array of two
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0;
264 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE;
265 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = pSapCtx->SSIDList[0].ssidHidden;
266
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700267 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.
268 pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid;
Jeff Johnson295189b2012-06-20 16:38:30 -0700269
270 // Now configure the auth type in the roaming profile. To open.
271 pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700272
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock)))
274 {
275 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700276 "WLANSAP_Start failed init lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 return VOS_STATUS_E_FAULT;
278 }
279
280
Jeff Johnson295189b2012-06-20 16:38:30 -0700281
282 return VOS_STATUS_SUCCESS;
283}/* WLANSAP_Start */
284
285/*==========================================================================
286
287 FUNCTION WLANSAP_Stop
288
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700289 DESCRIPTION
290 Called by vos_stop to stop operation in SAP, before close. SAP will suspend all
291 BT-AMP Protocol Adaption Layer operation and will wait for the close
292 request to clean up its resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700293
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700294 DEPENDENCIES
295
296 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700297
298 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700299 pvosGCtx : Pointer to the global vos context; a handle to SAP's
300 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700301
302 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700303 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700304
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700305 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
306 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 VOS_STATUS_SUCCESS: Success
308
309 SIDE EFFECTS
310============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700311VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700312WLANSAP_Stop
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700313(
314 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700315)
316{
317
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 ptSapContext pSapCtx = NULL;
319
320 /*------------------------------------------------------------------------
321 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700322 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 ------------------------------------------------------------------------*/
324 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
325 "WLANSAP_Stop invoked successfully ");
326
327 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
328 if (NULL == pSapCtx)
329 {
330 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700331 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 return VOS_STATUS_E_FAULT;
333 }
334
335 sapFreeRoamProfile(&pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700336
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pSapCtx->SapGlobalLock ) ) )
338 {
339 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700340 "WLANSAP_Stop failed destroy lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 return VOS_STATUS_E_FAULT;
342 }
343 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700344 Stop SAP (de-register RSN handler!?)
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -0700346
347 return VOS_STATUS_SUCCESS;
348}/* WLANSAP_Stop */
349
350/*==========================================================================
351 FUNCTION WLANSAP_Close
352
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700353 DESCRIPTION
354 Called by vos_close during general driver close procedure. SAP will clean up
355 all the internal resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700357 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700359 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700360
361 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700362 pvosGCtx : Pointer to the global vos context; a handle to SAP's
363 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700366 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700367
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700368 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
369 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 VOS_STATUS_SUCCESS: Success
371
372 SIDE EFFECTS
373============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700374VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700375WLANSAP_Close
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700376(
377 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700378)
379{
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 ptSapContext pSapCtx = NULL;
381 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
382
383 /*------------------------------------------------------------------------
384 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700385 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 ------------------------------------------------------------------------*/
387 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
388 "WLANSAP_Close invoked");
389
390 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
391 if (NULL == pSapCtx)
392 {
393 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700394 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 return VOS_STATUS_E_FAULT;
396 }
397
398 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700399 Cleanup SAP control block.
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 ------------------------------------------------------------------------*/
401 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Close");
402 WLANSAP_CleanCB(pSapCtx, VOS_TRUE /* empty queues/lists/pkts if any*/);
403
404 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700405 Free SAP context from VOSS global
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 ------------------------------------------------------------------------*/
407 vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
408
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 return VOS_STATUS_SUCCESS;
410}/* WLANSAP_Close */
411
412/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700413 * Utility Function implementations
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 * -------------------------------------------------------------------------*/
415
416/*==========================================================================
417
418 FUNCTION WLANSAP_CleanCB
419
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700420 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 Clear out all fields in the SAP context.
422
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700423 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700424
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700425 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700426
427 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700428 pvosGCtx : Pointer to the global vos context; a handle to SAP's
429 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
431 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700432 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700433
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700434 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
435 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 VOS_STATUS_SUCCESS: Success
437
438 SIDE EFFECTS
439============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700440VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700441WLANSAP_CleanCB
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700442(
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 ptSapContext pSapCtx,
444 v_U32_t freeFlag // 0 /*do not empty*/);
445)
446{
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700448 Sanity check SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 ------------------------------------------------------------------------*/
450
451 if (NULL == pSapCtx)
452 {
453 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700454 "%s: Invalid SAP pointer", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 return VOS_STATUS_E_FAULT;
456 }
457
458 /*------------------------------------------------------------------------
459 Clean up SAP control block, initialize all values
460 ------------------------------------------------------------------------*/
461 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB");
462
463 vos_mem_zero( pSapCtx, sizeof(tSapContext));
464
465 pSapCtx->pvosGCtx = NULL;
466
467 pSapCtx->sapsMachine= eSAP_DISCONNECTED;
468
469 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d, sapContext value = %x",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700470 __func__, pSapCtx->sapsMachine, pSapCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 pSapCtx->sessionId = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700472 pSapCtx->channel = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 return VOS_STATUS_SUCCESS;
475}// WLANSAP_CleanCB
476
477/*==========================================================================
478 FUNCTION WLANSAP_pmcFullPwrReqCB
479
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700480 DESCRIPTION
481 Callback provide to PMC in the pmcRequestFullPower API.
Jeff Johnson295189b2012-06-20 16:38:30 -0700482
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700483 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700484
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700485 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700486
487 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700488 callbackContext: The user passed in a context to identify
489 status: The halStatus
Jeff Johnson295189b2012-06-20 16:38:30 -0700490
491 RETURN VALUE
492 None
493
494 SIDE EFFECTS
495============================================================================*/
496void
497WLANSAP_pmcFullPwrReqCB
498(
499 void *callbackContext,
500 eHalStatus status
501)
502{
503 if(HAL_STATUS_SUCCESS(status))
504 {
505 //If success what else to be handled???
506 }
507 else
508 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700509 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n");
511
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 }
513
514}// WLANSAP_pmcFullPwrReqCB
515/*==========================================================================
516 FUNCTION WLANSAP_getState
517
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700518 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 This api returns the current SAP state to the caller.
520
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700521 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700522
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700523 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700524
525 IN
526 pContext : Pointer to Sap Context structure
527
528 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700529 Returns the SAP FSM state.
Jeff Johnson295189b2012-06-20 16:38:30 -0700530============================================================================*/
531
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700532v_U8_t WLANSAP_getState
Jeff Johnson295189b2012-06-20 16:38:30 -0700533(
534 v_PVOID_t pvosGCtx
535)
536{
537 ptSapContext pSapCtx = NULL;
538
539 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
540
541 if ( NULL == pSapCtx )
542 {
543 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700544 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 return VOS_STATUS_E_FAULT;
546 }
547 return pSapCtx->sapsMachine;
548}
549
550/*==========================================================================
551 FUNCTION WLANSAP_StartBss
552
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700553 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 This api function provides SAP FSM event eWLAN_SAP_PHYSICAL_LINK_CREATE for
555 starting AP BSS
556
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700557 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700558
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700559 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700560
561 IN
562 pContext : Pointer to Sap Context structure
563 pQctCommitConfig : Pointer to configuration structure passed down from HDD(HostApd for Android)
564 hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results
565 pUsrContext : Parameter that will be passed back in all the SAP callback events.
566
567 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700568 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700569
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700570 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
571 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 VOS_STATUS_SUCCESS: Success
573
574 SIDE EFFECTS
575============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700576VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700577WLANSAP_StartBss
578(
579 v_PVOID_t pvosGCtx,//pwextCtx
580 tpWLAN_SAPEventCB pSapEventCallback,
581 tsap_Config_t *pConfig,
582 v_PVOID_t pUsrContext
583)
584{
585 tWLAN_SAPEvent sapEvent; /* State machine event*/
586 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
587 ptSapContext pSapCtx = NULL;
588 tANI_BOOLEAN restartNeeded;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700589 tHalHandle hHal;
590
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
592
593 /*------------------------------------------------------------------------
594 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700595 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 ------------------------------------------------------------------------*/
597 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
598 "WLANSAP_StartBss");
599
600 if (VOS_STA_SAP_MODE == vos_get_conparam ())
601 {
602 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
603 if ( NULL == pSapCtx )
604 {
605 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700606 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 return VOS_STATUS_E_FAULT;
608 }
609 pSapCtx->sapsMachine = eSAP_DISCONNECTED;
610
611 /* Channel selection is auto or configured */
612 pSapCtx->channel = pConfig->channel;
613 pSapCtx->pUsrContext = pUsrContext;
614
615 //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
616 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700617 vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 pSapCtx->self_mac_addr,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700619 sizeof( tCsrBssid ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700620
621 //Save a copy to SAP context
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700622 vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
624 vos_mem_copy(pSapCtx->self_mac_addr,
625 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
626
627 //copy the configuration items to csrProfile
628 sapconvertToCsrProfile( pConfig, eCSR_BSS_TYPE_INFRA_AP, &pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700629 hHal = (tHalHandle)VOS_GET_HAL_CB(pvosGCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 if (NULL == hHal)
631 {
632 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700633 "%s: Invalid MAC context from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 }
635 else
636 {
637 //If concurrent session is running that is already associated
638 //then we just follow that sessions country info (whether
639 //present or not doesn't maater as we have to follow whatever
640 //STA session does)
641 if (0 == sme_GetConcurrentOperationChannel(hHal))
642 {
643 /* Setting the region/country information */
644 sme_setRegInfo(hHal, pConfig->countryCode);
645 sme_ResetCountryCodeInformation(hHal, &restartNeeded);
646 }
647 }
648
649 // Copy MAC filtering settings to sap context
650 pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl;
651 vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, sizeof(pConfig->accept_mac));
652 pSapCtx->nAcceptMac = pConfig->num_accept_mac;
653 sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
654 vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, sizeof(pConfig->deny_mac));
655 pSapCtx->nDenyMac = pConfig->num_deny_mac;
656 sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac);
657
658 /* Fill in the event structure for FSM */
659 sapEvent.event = eSAP_HDD_START_INFRA_BSS;
660 sapEvent.params = 0;//pSapPhysLinkCreate
661
662 /* Store the HDD callback in SAP context */
663 pSapCtx->pfnSapEventCallback = pSapEventCallback;
664
665 /* Handle event*/
666 vosStatus = sapFsm(pSapCtx, &sapEvent);
667 }
668 else
669 {
670 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
671 "SoftAp role has not been enabled");
672 }
673
674 return vosStatus;
675}// WLANSAP_StartBss
676
677/*==========================================================================
678 FUNCTION WLANSAP_StopBss
679
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700680 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 This api function provides SAP FSM event eSAP_HDD_STOP_INFRA_BSS for
682 stopping AP BSS
683
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700684 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700685
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700686 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700687
688 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700689 pvosGCtx : Pointer to the global vos context; a handle to SAP's
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 control block can be extracted from its contexe
691
692 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700693 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700694
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700695 VOS_STATUS_E_FAULT: Pointer to VOSS GC is NULL ; access would cause a page
696 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 VOS_STATUS_SUCCESS: Success
698
699 SIDE EFFECTS
700============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700701VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700702WLANSAP_StopBss
703(
704 v_PVOID_t pvosGCtx
705)
706{
707 tWLAN_SAPEvent sapEvent; /* State machine event*/
708 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
709 ptSapContext pSapCtx = NULL;
710 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
711
712 /*------------------------------------------------------------------------
713 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700714 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 ------------------------------------------------------------------------*/
716 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
717 "WLANSAP_StopBss");
718
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700719 if ( NULL == pvosGCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 {
721 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700722 "%s: Invalid Global VOSS handle", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 return VOS_STATUS_E_FAULT;
724 }
725
726 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
727
728 if (NULL == pSapCtx )
729 {
730 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700731 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 return VOS_STATUS_E_FAULT;
733 }
734
735 /* Fill in the event structure for FSM */
736 sapEvent.event = eSAP_HDD_STOP_INFRA_BSS;
737 sapEvent.params = 0;
738
739 /* Handle event*/
740 vosStatus = sapFsm(pSapCtx, &sapEvent);
741
742 return vosStatus;
743}
744
745/*==========================================================================
746 FUNCTION WLANSAP_GetAssocStations
747
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700748 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 This api function is used to probe the list of associated stations from various modules of CORE stack
750
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700751 DEPENDENCIES
752 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700753
754 PARAMETERS
755
756 IN
757 pvosGCtx : Pointer to vos global context structure
758 modId : Module from whom list of associtated stations is supposed to be probed. If an invalid module is passed
759 then by default VOS_MODULE_ID_PE will be probed
760 IN/OUT
761 pAssocStas : Pointer to list of associated stations that are known to the module specified in mod parameter
762
763 NOTE: The memory for this list will be allocated by the caller of this API
764
765 RETURN VALUE
766 The VOS_STATUS code associated with performing the operation
767
768 VOS_STATUS_SUCCESS: Success
769
770 SIDE EFFECTS
771============================================================================*/
772VOS_STATUS
773WLANSAP_GetAssocStations
774(
775 v_PVOID_t pvosGCtx,
776 VOS_MODULE_ID modId,
777 tpSap_AssocMacAddr pAssocStas
778)
779{
780 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
781
782 /*------------------------------------------------------------------------
783 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700784 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 ------------------------------------------------------------------------*/
786 if (NULL == pSapCtx)
787 {
788 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700789 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 return VOS_STATUS_E_FAULT;
791 }
792
793 sme_RoamGetAssociatedStas( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
794 modId,
795 pSapCtx->pUsrContext,
796 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
797 (v_U8_t *)pAssocStas );
798
799 return VOS_STATUS_SUCCESS;
800}
801
802
803/*==========================================================================
804 FUNCTION WLANSAP_RemoveWpsSessionOverlap
805
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700806 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 This api function provides for Ap App/HDD to remove an entry from session session overlap info.
808
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700809 DEPENDENCIES
810 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812 PARAMETERS
813
814 IN
815 pvosGCtx: Pointer to vos global context structure
816 pRemoveMac: pointer to v_MACADDR_t for session MAC address
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700817
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700819 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700820
821 VOS_STATUS_SUCCESS: Success
822 VOS_STATUS_E_FAULT: Session is not dectected. The parameter is function not valid.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700823
824 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700825============================================================================*/
826VOS_STATUS
827WLANSAP_RemoveWpsSessionOverlap
828
829(
830 v_PVOID_t pvosGCtx,
831 v_MACADDR_t pRemoveMac
832)
833{
834 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
835
836 /*------------------------------------------------------------------------
837 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700838 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 ------------------------------------------------------------------------*/
840 if (NULL == pSapCtx)
841 {
842 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700843 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 return VOS_STATUS_E_FAULT;
845 }
846
847 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
848 pSapCtx->pUsrContext,
849 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
850 pRemoveMac);
851
852 return VOS_STATUS_SUCCESS;
853}
854
855/*==========================================================================
856 FUNCTION WLANSAP_getWpsSessionOverlap
857
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700858 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 This api function provides for Ap App/HDD to get WPS session overlap info.
860
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700861 DEPENDENCIES
862 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700863
864 PARAMETERS
865
866 IN
867 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700868
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700870 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700871
872 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700873
874 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700875============================================================================*/
876VOS_STATUS
877WLANSAP_getWpsSessionOverlap
878(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700879 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700880)
881{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700882 v_MACADDR_t pRemoveMac = VOS_MAC_ADDR_ZERO_INITIALIZER;
Jeff Johnson295189b2012-06-20 16:38:30 -0700883
884 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
885
886 /*------------------------------------------------------------------------
887 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700888 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 ------------------------------------------------------------------------*/
890 if (NULL == pSapCtx)
891 {
892 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700893 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 return VOS_STATUS_E_FAULT;
895 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700896
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
898 pSapCtx->pUsrContext,
899 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
900 pRemoveMac);
901
902 return VOS_STATUS_SUCCESS;
903}
904
905
906/* This routine will set the mode of operation for ACL dynamically*/
907VOS_STATUS
908WLANSAP_SetMode ( v_PVOID_t pvosGCtx, v_U32_t mode)
909{
910 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
911
912 if (NULL == pSapCtx)
913 {
914 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700915 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 return VOS_STATUS_E_FAULT;
917 }
918
919 pSapCtx->eSapMacAddrAclMode = (eSapMacAddrACL)mode;
920 return VOS_STATUS_SUCCESS;
921}
922
923/* This routine will clear all the entries in accept list as well as deny list */
924
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700925VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700926WLANSAP_ClearACL( v_PVOID_t pvosGCtx)
927{
928 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
929 v_U8_t i;
930
931 if (NULL == pSapCtx)
932 {
933 return VOS_STATUS_E_RESOURCES;
934 }
935
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700936 if (pSapCtx->denyMacList != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 {
938 for (i = 0; i < (pSapCtx->nDenyMac-1); i++)
939 {
940 vos_mem_zero((pSapCtx->denyMacList+i)->bytes, sizeof(v_MACADDR_t));
941
942 }
943 }
944 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
945 pSapCtx->nDenyMac = 0;
946
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700947 if (pSapCtx->acceptMacList!=NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 {
949 for (i = 0; i < (pSapCtx->nAcceptMac-1); i++)
950 {
951 vos_mem_zero((pSapCtx->acceptMacList+i)->bytes, sizeof(v_MACADDR_t));
952
953 }
954 }
955 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
956 pSapCtx->nAcceptMac = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700957
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 return VOS_STATUS_SUCCESS;
959}
960
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700961VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700962WLANSAP_ModifyACL
963(
964 v_PVOID_t pvosGCtx,
965 v_U8_t *pPeerStaMac,
966 eSapACLType listType,
967 eSapACLCmdType cmd
968)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700969{
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 eSapBool staInWhiteList=eSAP_FALSE, staInBlackList=eSAP_FALSE;
971 v_U8_t staWLIndex, staBLIndex;
972 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
973
974 if (NULL == pSapCtx)
975 {
976 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700977 "%s: Invalid SAP Context", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 return VOS_STATUS_E_FAULT;
979 }
980
981 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"Modify ACL entered\n"
982 "Before modification of ACL\n"
983 "size of accept and deny lists %d %d",
984 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
985 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
986 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
987 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
988 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
989
990 /* the expectation is a mac addr will not be in both the lists at the same time.
991 It is the responsiblity of userspace to ensure this */
992 staInWhiteList = sapSearchMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac, pPeerStaMac, &staWLIndex);
993 staInBlackList = sapSearchMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac, pPeerStaMac, &staBLIndex);
994
995 if (staInWhiteList && staInBlackList)
996 {
997 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
998 "Peer mac %02x:%02x:%02x:%02x:%02x:%02x found in white and black lists."
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700999 "Initial lists passed incorrect. Cannot execute this command.",
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1001 pPeerStaMac[4], pPeerStaMac[5]);
1002 return VOS_STATUS_E_FAILURE;
1003
1004 }
1005
1006 switch(listType)
1007 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001008 case eSAP_WHITE_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "cmd %d", cmd);
1010 if (cmd == ADD_STA_TO_ACL)
1011 {
1012 //error check
1013 // if list is already at max, return failure
1014 if (pSapCtx->nAcceptMac == MAX_MAC_ADDRESS_ACCEPTED)
1015 {
1016 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001017 "White list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x",
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1019 pPeerStaMac[4], pPeerStaMac[5]);
1020 return VOS_STATUS_E_FAILURE;
1021 }
1022 if (staInWhiteList)
1023 {
1024 //Do nothing if already present in white list. Just print a warning
1025 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1026 "MAC address already present in white list %02x:%02x:%02x:%02x:%02x:%02x",
1027 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1028 pPeerStaMac[4], pPeerStaMac[5]);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001029 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 {
1031 if (staInBlackList)
1032 {
1033 //remove it from black list before adding to the white list
1034 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1035 "STA present in black list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001036 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 }
1038 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001039 "... Now add to the white list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 sapAddMacToACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, pPeerStaMac);
1041 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1042 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 }
1045 else if (cmd == DELETE_STA_FROM_ACL)
1046 {
1047 if (staInWhiteList)
1048 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001049 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from white list");
1050 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1052 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1053 }
1054 else
1055 {
1056 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1057 "MAC address to be deleted is not present in the white list %02x:%02x:%02x:%02x:%02x:%02x",
1058 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1059 pPeerStaMac[4], pPeerStaMac[5]);
1060 return VOS_STATUS_E_FAILURE;
1061 }
1062 }
1063 else
1064 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001065 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 return VOS_STATUS_E_FAILURE;
1067 }
1068 break;
1069
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001070 case eSAP_BLACK_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,
1072 "cmd %d", cmd);
1073 if (cmd == ADD_STA_TO_ACL)
1074 {
1075 //error check
1076 // if list is already at max, return failure
1077 if (pSapCtx->nDenyMac == MAX_MAC_ADDRESS_ACCEPTED)
1078 {
1079 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1080 "Black list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x",
1081 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1082 pPeerStaMac[4], pPeerStaMac[5]);
1083 return VOS_STATUS_E_FAILURE;
1084 }
1085 if (staInBlackList)
1086 {
1087 //Do nothing if already present in white list
1088 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1089 "MAC address already present in black list %02x:%02x:%02x:%02x:%02x:%02x",
1090 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1091 pPeerStaMac[4], pPeerStaMac[5]);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001092 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 {
1094 if (staInWhiteList)
1095 {
1096 //remove it from white list before adding to the white list
1097 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1098 "Present in white list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001099 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 }
1101 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001102 "... Now add to black list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 sapAddMacToACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, pPeerStaMac);
1104 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"size of accept and deny lists %d %d",
1105 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001106 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 }
1108 else if (cmd == DELETE_STA_FROM_ACL)
1109 {
1110 if (staInBlackList)
1111 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001112 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from black list");
1113 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"no accept and deny mac %d %d",
1115 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1116 }
1117 else
1118 {
1119 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1120 "MAC address to be deleted is not present in the black list %02x:%02x:%02x:%02x:%02x:%02x",
1121 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1122 pPeerStaMac[4], pPeerStaMac[5]);
1123 return VOS_STATUS_E_FAILURE;
1124 }
1125 }
1126 else
1127 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001128 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 return VOS_STATUS_E_FAILURE;
1130 }
1131 break;
1132
1133 default:
1134 {
1135 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1136 "Invalid list type passed %d",listType);
1137 return VOS_STATUS_E_FAILURE;
1138 }
1139 }
1140 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"After modification of ACL");
1141 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
1142 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
1143 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
1144 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
1145 return VOS_STATUS_SUCCESS;
1146}
1147
1148/*==========================================================================
1149 FUNCTION WLANSAP_DisassocSta
1150
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001151 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001152 This api function provides for Ap App/HDD initiated disassociation of station
1153
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001154 DEPENDENCIES
1155 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001156
1157 PARAMETERS
1158
1159 IN
1160 pvosGCtx : Pointer to vos global context structure
1161 pPeerStaMac : Mac address of the station to disassociate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001162
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001164 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001165
1166 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001167
1168 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001169============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001170VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001171WLANSAP_DisassocSta
1172(
1173 v_PVOID_t pvosGCtx,
1174 v_U8_t *pPeerStaMac
1175)
1176{
1177 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1178
1179 /*------------------------------------------------------------------------
1180 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001181 Extract SAP control block
1182 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 if (NULL == pSapCtx)
1184 {
1185 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001186 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 return VOS_STATUS_E_FAULT;
1188 }
1189
1190 sme_RoamDisconnectSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
1191 pPeerStaMac);
1192
1193 return VOS_STATUS_SUCCESS;
1194}
1195
Jeff Johnson295189b2012-06-20 16:38:30 -07001196/*==========================================================================
1197 FUNCTION WLANSAP_DeauthSta
1198
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001199 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 This api function provides for Ap App/HDD initiated deauthentication of station
1201
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001202 DEPENDENCIES
1203 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001204
1205 PARAMETERS
1206
1207 IN
1208 pvosGCtx : Pointer to vos global context structure
1209 pPeerStaMac : Mac address of the station to deauthenticate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001210
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001212 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001213
1214 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001215
1216 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001217============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001218VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001219WLANSAP_DeauthSta
1220(
1221 v_PVOID_t pvosGCtx,
1222 v_U8_t *pPeerStaMac
1223)
1224{
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001225 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1226 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1228
1229 /*------------------------------------------------------------------------
1230 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001231 Extract SAP control block
1232 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 if (NULL == pSapCtx)
1234 {
1235 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001236 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001237 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 }
1239
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001240 halStatus = sme_RoamDeauthSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001241 pPeerStaMac);
1242
Madan Mohan Koyyalamudicd784992013-01-11 15:30:36 -08001243 if (halStatus == eHAL_STATUS_SUCCESS)
1244 {
1245 vosStatus = VOS_STATUS_SUCCESS;
1246 }
1247 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001248}
1249/*==========================================================================
1250 FUNCTION WLANSAP_SetChannelRange
1251
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001252 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 This api function sets the range of channels for AP.
1254
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001255 DEPENDENCIES
1256 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001257
1258 PARAMETERS
1259
1260 IN
1261 startChannel : start channel
1262 endChannel : End channel
1263 operatingBand : Operating band (2.4GHz/5GHz)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001264
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001266 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001267
1268 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001269
1270 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001271============================================================================*/
1272VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001273WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel,
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 v_U8_t operatingBand)
1275{
1276
1277 v_U8_t validChannelFlag =0;
1278 v_U8_t loopStartCount =0;
1279 v_U8_t loopEndCount =0;
1280 v_U8_t bandStartChannel =0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001281 v_U8_t bandEndChannel =0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001282
1283 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1284 "WLANSAP_SetChannelRange:startChannel %d,EndChannel %d,Operatingband:%d",
1285 startChannel,endChannel,operatingBand);
1286
1287 /*------------------------------------------------------------------------
1288 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001289 ------------------------------------------------------------------------*/
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001290 if (( WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMIN > operatingBand) ||
1291 (WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_STAMAX < operatingBand))
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 {
1293 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1294 "Invalid operatingBand on WLANSAP_SetChannelRange");
1295 return VOS_STATUS_E_FAULT;
1296 }
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001297 if (( WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMIN > startChannel) ||
1298 (WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_STAMAX < startChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001299 {
1300 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1301 "Invalid startChannel value on WLANSAP_SetChannelRange");
1302 return VOS_STATUS_E_FAULT;
1303 }
Jeff Johnsonbacdbcc2013-02-26 21:23:41 -08001304 if (( WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMIN > endChannel) ||
1305 (WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_STAMAX < endChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 {
1307 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1308 "Invalid endChannel value on WLANSAP_SetChannelRange");
1309 return VOS_STATUS_E_FAULT;
1310 }
1311 switch(operatingBand)
1312 {
1313 case RF_SUBBAND_2_4_GHZ:
1314 bandStartChannel = RF_CHAN_1;
1315 bandEndChannel = RF_CHAN_14;
1316 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001317
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 case RF_SUBBAND_5_LOW_GHZ:
1319 bandStartChannel = RF_CHAN_36;
1320 bandEndChannel = RF_CHAN_64;
1321 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001322
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 case RF_SUBBAND_5_MID_GHZ:
1324 bandStartChannel = RF_CHAN_100;
1325 bandEndChannel = RF_CHAN_140;
1326 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001327
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 case RF_SUBBAND_5_HIGH_GHZ:
1329 bandStartChannel = RF_CHAN_149;
1330 bandEndChannel = RF_CHAN_165;
1331 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001332
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 default:
1334 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1335 "Invalid operatingBand value on WLANSAP_SetChannelRange");
1336 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001337 }
1338
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 /* Validating the start channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001340 for(loopStartCount = bandStartChannel ; loopStartCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 loopStartCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001342 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 if(rfChannels[loopStartCount].channelNum == startChannel )
1344 {
1345 /* start channel is in the range */
1346 break;
1347 }
1348 }
1349 /* Validating the End channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001350 for(loopEndCount = bandStartChannel ; loopEndCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 loopEndCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001352 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 if(rfChannels[loopEndCount].channelNum == endChannel )
1354 {
1355 /* End channel is in the range */
1356 break;
1357 }
1358 }
1359 if((loopStartCount > bandEndChannel)||(loopEndCount > bandEndChannel))
1360 {
1361 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1362 "%s: Invalid startChannel-%d or EndChannel-%d for band -%d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001363 __func__,startChannel,endChannel,operatingBand);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001364 /* Supplied channels are nt in the operating band so set the default
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 channels for the given operating band */
1366 startChannel = rfChannels[bandStartChannel].channelNum;
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07001367 endChannel = rfChannels[bandEndChannel].channelNum;
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001369
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 /*Search for the Active channels in the given range */
1371 for( loopStartCount = bandStartChannel; loopStartCount <= bandEndChannel; loopStartCount++ )
1372 {
1373 if((startChannel <= rfChannels[loopStartCount].channelNum)&&
1374 (endChannel >= rfChannels[loopStartCount].channelNum ))
1375 {
1376 if( regChannels[loopStartCount].enabled )
1377 {
1378 validChannelFlag = 1;
1379 break;
1380 }
1381 }
1382 }
1383 if(0 == validChannelFlag)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001384 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1386 "%s-No active channels present in the given range for the current region",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001387 __func__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001388 /* There is no active channel in the supplied range.Updating the config
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 with the default channels in the given band so that we can select the best channel in the sub-band*/
1390 startChannel = rfChannels[bandStartChannel].channelNum;
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07001391 endChannel = rfChannels[bandEndChannel].channelNum;
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001393
1394 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 operatingBand, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1396 {
1397 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1398 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND to CCn");
1399 return VOS_STATUS_E_FAULT;
1400 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001401 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 startChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1403 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001404
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1406 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1407 return VOS_STATUS_E_FAULT;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001408
1409 }
1410 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 endChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1412 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001413
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1415 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1416 return VOS_STATUS_E_FAULT;
1417 }
1418 return VOS_STATUS_SUCCESS;
1419}
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
1421/*==========================================================================
1422 FUNCTION WLANSAP_SetCounterMeasure
1423
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001424 DESCRIPTION
1425 This api function is used to disassociate all the stations and prevent
1426 association for any other station.Whenever Authenticator receives 2 mic failures
1427 within 60 seconds, Authenticator will enable counter measure at SAP Layer.
1428 Authenticator will start the 60 seconds timer. Core stack will not allow any
1429 STA to associate till HDD disables counter meassure. Core stack shall kick out all the
1430 STA which are currently associated and DIASSOC Event will be propogated to HDD for
1431 each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 will disable the counter meassure at core stack. Now core stack can allow STAs to associate.
1433
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001434 DEPENDENCIES
1435 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001436
1437 PARAMETERS
1438
1439 IN
1440pvosGCtx: Pointer to vos global context structure
1441bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE
1442will come out of this state.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001443
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001445 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001446
1447 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001448
1449 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001450============================================================================*/
1451VOS_STATUS
1452WLANSAP_SetCounterMeasure
1453(
1454 v_PVOID_t pvosGCtx,
1455 v_BOOL_t bEnable
1456)
1457{
1458 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1459
1460 /*------------------------------------------------------------------------
1461 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001462 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 ------------------------------------------------------------------------*/
1464 if (NULL == pSapCtx)
1465 {
1466 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001467 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 return VOS_STATUS_E_FAULT;
1469 }
1470
1471 sme_RoamTKIPCounterMeasures(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, bEnable);
1472
1473 return VOS_STATUS_SUCCESS;
1474}
1475
1476/*==========================================================================
1477
1478 FUNCTION WLANSAP_SetKeysSta
1479
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001480 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 This api function provides for Ap App/HDD to set key for a station.
1482
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001483 DEPENDENCIES
1484 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001485
1486 PARAMETERS
1487
1488 IN
1489pvosGCtx: Pointer to vos global context structure
1490pSetKeyInfo: tCsrRoamSetKey structure for the station
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001491
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001493 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001494
1495 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001496
1497 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001498============================================================================*/
1499VOS_STATUS
1500WLANSAP_SetKeySta
1501(
1502 v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo
1503)
1504{
1505 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1506 ptSapContext pSapCtx = NULL;
1507 v_PVOID_t hHal = NULL;
1508 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1509 v_U32_t roamId=0xFF;
1510
1511 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1512 {
1513 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1514 if (NULL == pSapCtx)
1515 {
1516 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001517 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 return VOS_STATUS_E_FAULT;
1519 }
1520 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1521 if (NULL == hHal)
1522 {
1523 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001524 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001525 return VOS_STATUS_E_FAULT;
1526 }
1527 halStatus = sme_RoamSetKey(hHal, pSapCtx->sessionId, pSetKeyInfo, &roamId);
1528
1529 if (halStatus == eHAL_STATUS_SUCCESS)
1530 {
1531 vosStatus = VOS_STATUS_SUCCESS;
1532 } else
1533 {
1534 vosStatus = VOS_STATUS_E_FAULT;
1535 }
1536 }
1537 else
1538 vosStatus = VOS_STATUS_E_FAULT;
1539
1540 return vosStatus;
1541}
1542
1543/*==========================================================================
1544 FUNCTION WLANSAP_DelKeySta
1545
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001546 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 This api function provides for Ap App/HDD to delete key for a station.
1548
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001549 DEPENDENCIES
1550 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001551
1552 PARAMETERS
1553
1554 IN
1555pvosGCtx: Pointer to vos global context structure
1556pSetKeyInfo: tCsrRoamRemoveKey structure for the station
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_DelKeySta
1567(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001568 v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 tCsrRoamRemoveKey *pRemoveKeyInfo
1570)
1571{
1572 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1573 ptSapContext pSapCtx = NULL;
1574 v_PVOID_t hHal = NULL;
1575 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1576 v_U32_t roamId=0xFF;
1577 tCsrRoamRemoveKey RemoveKeyInfo;
1578
1579 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1580 {
1581 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1582 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001583 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001585 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 return VOS_STATUS_E_FAULT;
1587 }
1588
1589 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1590 if (NULL == hHal)
1591 {
1592 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001593 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 return VOS_STATUS_E_FAULT;
1595 }
1596
1597 vos_mem_zero(&RemoveKeyInfo, sizeof(RemoveKeyInfo));
1598 RemoveKeyInfo.encType = pRemoveKeyInfo->encType;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001599 vos_mem_copy(RemoveKeyInfo.peerMac, pRemoveKeyInfo->peerMac, WNI_CFG_BSSID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 RemoveKeyInfo.keyId = pRemoveKeyInfo->keyId;
1601
1602 halStatus = sme_RoamRemoveKey(hHal, pSapCtx->sessionId, &RemoveKeyInfo, &roamId);
1603
1604 if (HAL_STATUS_SUCCESS(halStatus))
1605 {
1606 vosStatus = VOS_STATUS_SUCCESS;
1607 }
1608 else
1609 {
1610 vosStatus = VOS_STATUS_E_FAULT;
1611 }
1612 }
1613 else
1614 vosStatus = VOS_STATUS_E_FAULT;
1615
1616 return vosStatus;
1617}
1618
1619VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001620WLANSap_getstationIE_information(v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 v_U32_t *pLen,
1622 v_U8_t *pBuf)
1623{
1624 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1625 ptSapContext pSapCtx = NULL;
1626 v_U32_t len = 0;
1627
1628 if (VOS_STA_SAP_MODE == vos_get_conparam ( )){
1629 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1630 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001631 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001633 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 return VOS_STATUS_E_FAULT;
1635 }
1636 if (pLen)
1637 {
1638 len = *pLen;
1639 *pLen = pSapCtx->nStaWPARSnReqIeLength;
1640 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001641 "%s: WPAIE len : %x", __func__, *pLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 if(pBuf)
1643 {
1644 if(len >= pSapCtx->nStaWPARSnReqIeLength)
1645 {
1646 vos_mem_copy( pBuf, pSapCtx->pStaWpaRsnReqIE, pSapCtx->nStaWPARSnReqIeLength);
1647 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1648 "%s: WPAIE: %02x:%02x:%02x:%02x:%02x:%02x",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001649 __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 pBuf[0], pBuf[1], pBuf[2],
1651 pBuf[3], pBuf[4], pBuf[5]);
1652 vosStatus = VOS_STATUS_SUCCESS;
1653 }
1654 }
1655 }
1656 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001657
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 if( VOS_STATUS_E_FAILURE == vosStatus)
1659 {
1660 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1661 "%s: Error unable to populate the RSNWPAIE",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001662 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001663 }
1664
1665 return vosStatus;
1666
1667}
1668
1669/*==========================================================================
1670 FUNCTION WLANSAP_Set_WpsIe
1671
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001672 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 This api function provides for Ap App/HDD to set WPS IE.
1674
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001675 DEPENDENCIES
1676 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001677
1678 PARAMETERS
1679
1680 IN
1681pvosGCtx: Pointer to vos global context structure
1682pWPSIE: tSap_WPSIE structure that include WPS IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001683
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001685 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001686
1687 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001688
1689 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001690============================================================================*/
1691VOS_STATUS
1692WLANSAP_Set_WpsIe
1693(
1694 v_PVOID_t pvosGCtx, tSap_WPSIE *pSap_WPSIe
1695)
1696{
1697 ptSapContext pSapCtx = NULL;
1698 v_PVOID_t hHal = NULL;
1699
1700 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001701 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001702
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 if(VOS_STA_SAP_MODE == vos_get_conparam ( )) {
1704 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1705 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001706 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001708 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001709 return VOS_STATUS_E_FAULT;
1710 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001711
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1713 if ( NULL == hHal ){
1714 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001715 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 return VOS_STATUS_E_FAULT;
1717 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001718
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 if ( sap_AcquireGlobalLock( pSapCtx ) == VOS_STATUS_SUCCESS )
1720 {
1721 if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_BEACON_IE)
1722 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001723 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSBeaconIE, &pSap_WPSIe->sapwpsie.sapWPSBeaconIE, sizeof(tSap_WPSBeaconIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001725 else if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_PROBE_RSP_IE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 {
1727 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSProbeRspIE, &pSap_WPSIe->sapwpsie.sapWPSProbeRspIE, sizeof(tSap_WPSProbeRspIE));
1728 }
1729 else
1730 {
1731 sap_ReleaseGlobalLock( pSapCtx );
1732 return VOS_STATUS_E_FAULT;
1733 }
1734 sap_ReleaseGlobalLock( pSapCtx );
1735 return VOS_STATUS_SUCCESS;
1736 }
1737 else
1738 return VOS_STATUS_E_FAULT;
1739 }
1740 else
1741 return VOS_STATUS_E_FAULT;
1742}
1743
1744/*==========================================================================
1745 FUNCTION WLANSAP_Update_WpsIe
1746
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001747 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 This api function provides for Ap App/HDD to update WPS IEs.
1749
1750 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001751 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001752
1753 PARAMETERS
1754
1755 IN
1756pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001757
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001759 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001760
1761 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001762
1763 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001764============================================================================*/
1765VOS_STATUS
1766WLANSAP_Update_WpsIe
1767(
1768 v_PVOID_t pvosGCtx
1769)
1770{
1771 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1772 ptSapContext pSapCtx = NULL;
1773 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1774 v_PVOID_t hHal = NULL;
1775
1776 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001777 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001778
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
1780 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1781 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001782 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001784 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 return VOS_STATUS_E_FAULT;
1786 }
1787
1788 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1789 if ( NULL == hHal ){
1790 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001791 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 return VOS_STATUS_E_FAULT;
1793 }
1794
1795 halStatus = sme_RoamUpdateAPWPSIE( hHal, pSapCtx->sessionId, &pSapCtx->APWPSIEs);
1796
1797 if(halStatus == eHAL_STATUS_SUCCESS) {
1798 vosStatus = VOS_STATUS_SUCCESS;
1799 } else
1800 {
1801 vosStatus = VOS_STATUS_E_FAULT;
1802 }
1803
1804 }
1805
1806 return vosStatus;
1807}
1808
1809/*==========================================================================
1810 FUNCTION WLANSAP_Get_WPS_State
1811
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001812 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 This api function provides for Ap App/HDD to check if WPS session in process.
1814
1815 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001816 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001817
1818 PARAMETERS
1819
1820 IN
1821pvosGCtx: Pointer to vos global context structure
1822
1823 OUT
1824pbWPSState: Pointer to variable to indicate if it is in WPS Registration state
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001825
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001827 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001828
1829 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001830
1831 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001832============================================================================*/
1833VOS_STATUS
1834WLANSAP_Get_WPS_State
1835(
1836 v_PVOID_t pvosGCtx, v_BOOL_t *bWPSState
1837)
1838{
1839 ptSapContext pSapCtx = NULL;
1840 v_PVOID_t hHal = NULL;
1841
1842 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001843 "%s, %d", __func__, __LINE__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001844
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001846
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1848 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001849 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001851 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 return VOS_STATUS_E_FAULT;
1853 }
1854
1855 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1856 if ( NULL == hHal ){
1857 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001858 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 return VOS_STATUS_E_FAULT;
1860 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001861
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 if ( sap_AcquireGlobalLock(pSapCtx ) == VOS_STATUS_SUCCESS )
1863 {
1864 if(pSapCtx->APWPSIEs.SirWPSProbeRspIE.FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
1865 *bWPSState = eANI_BOOLEAN_TRUE;
1866 else
1867 *bWPSState = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001868
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 sap_ReleaseGlobalLock( pSapCtx );
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001870
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 return VOS_STATUS_SUCCESS;
1872 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001873 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 return VOS_STATUS_E_FAULT;
1875 }
1876 else
1877 return VOS_STATUS_E_FAULT;
1878
1879}
1880
1881VOS_STATUS
1882sap_AcquireGlobalLock
1883(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001884 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07001885)
1886{
1887 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1888
1889 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &pSapCtx->SapGlobalLock) ) )
1890 {
1891 vosStatus = VOS_STATUS_SUCCESS;
1892 }
1893
1894 return (vosStatus);
1895}
1896
1897VOS_STATUS
1898sap_ReleaseGlobalLock
1899(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001900 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07001901)
1902{
1903 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1904
1905 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &pSapCtx->SapGlobalLock) ) )
1906 {
1907 vosStatus = VOS_STATUS_SUCCESS;
1908 }
1909
1910 return (vosStatus);
1911}
1912
1913/*==========================================================================
1914 FUNCTION WLANSAP_Set_WPARSNIes
1915
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001916 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response.
1918
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001919 DEPENDENCIES
1920 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001921
1922 PARAMETERS
1923
1924 IN
1925 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001926 pWPARSNIEs: buffer to the WPA/RSN IEs
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 WPARSNIEsLen: length of WPA/RSN IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001928
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001930 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001931
1932 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001933
1934 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001935============================================================================*/
1936VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen)
1937{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001938
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 ptSapContext pSapCtx = NULL;
1940 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1941 v_PVOID_t hHal = NULL;
1942
1943 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
1944 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1945 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001946 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001948 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 return VOS_STATUS_E_FAULT;
1950 }
1951
1952 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1953 if ( NULL == hHal ){
1954 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001955 "%s: Invalid HAL pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 return VOS_STATUS_E_FAULT;
1957 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001958
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 pSapCtx->APWPARSNIEs.length = (tANI_U16)WPARSNIEsLen;
1960 vos_mem_copy(pSapCtx->APWPARSNIEs.rsnIEdata, pWPARSNIEs, WPARSNIEsLen);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001961
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 halStatus = sme_RoamUpdateAPWPARSNIEs( hHal, pSapCtx->sessionId, &pSapCtx->APWPARSNIEs);
1963
1964 if(halStatus == eHAL_STATUS_SUCCESS) {
1965 return VOS_STATUS_SUCCESS;
1966 } else
1967 {
1968 return VOS_STATUS_E_FAULT;
1969 }
1970 }
1971
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001972 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07001973}
1974
1975VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset)
1976{
1977 if (NULL == pvosGCtx)
1978 {
1979 return VOS_STATUS_E_FAULT;
1980 }
1981
1982 return (WLANTL_GetSoftAPStatistics(pvosGCtx, statBuf, bReset));
1983}
1984
1985#ifdef WLAN_FEATURE_P2P
1986/*==========================================================================
1987
1988 FUNCTION WLANSAP_SendAction
1989
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001990 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 This api function provides to send action frame sent by upper layer.
1992
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001993 DEPENDENCIES
1994 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001995
1996 PARAMETERS
1997
1998 IN
1999 pvosGCtx: Pointer to vos global context structure
2000 pBuf: Pointer of the action frame to be transmitted
2001 len: Length of the action frame
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002002
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002004 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
2006 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002007
2008 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002009============================================================================*/
2010VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf,
Jeff Johnsone7245742012-09-05 17:12:55 -07002011 tANI_U32 len, tANI_U16 wait )
Jeff Johnson295189b2012-06-20 16:38:30 -07002012{
2013 ptSapContext pSapCtx = NULL;
2014 v_PVOID_t hHal = NULL;
2015 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2016
2017 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2018 {
2019 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2020 if (NULL == pSapCtx)
2021 {
2022 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002023 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 return VOS_STATUS_E_FAULT;
2025 }
2026 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2027 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2028 {
2029 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2030 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002031 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002032 return VOS_STATUS_E_FAULT;
2033 }
2034
Jeff Johnsone7245742012-09-05 17:12:55 -07002035 halStatus = sme_sendAction( hHal, pSapCtx->sessionId, pBuf, len, 0 , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002036
2037 if ( eHAL_STATUS_SUCCESS == halStatus )
2038 {
2039 return VOS_STATUS_SUCCESS;
2040 }
2041 }
2042
2043 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2044 "Failed to Send Action Frame");
2045
2046 return VOS_STATUS_E_FAULT;
2047}
2048
2049/*==========================================================================
2050
2051 FUNCTION WLANSAP_RemainOnChannel
2052
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002053 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 This api function provides to set Remain On channel on specified channel
2055 for specified duration.
2056
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002057 DEPENDENCIES
2058 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002059
2060 PARAMETERS
2061
2062 IN
2063 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002064 channel: Channel on which driver has to listen
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 duration: Duration for which driver has to listen on specified channel
2066 callback: Callback function to be called once Listen is done.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002067 pContext: Context needs to be called in callback function.
2068
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002070 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002071
2072 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002073
2074 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002075============================================================================*/
2076VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx,
2077 tANI_U8 channel, tANI_U32 duration,
2078 remainOnChanCallback callback,
2079 void *pContext )
2080{
2081 ptSapContext pSapCtx = NULL;
2082 v_PVOID_t hHal = NULL;
2083 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2084
2085 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2086 {
2087 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2088 if (NULL == pSapCtx)
2089 {
2090 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002091 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 return VOS_STATUS_E_FAULT;
2093 }
2094 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2095 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2096 {
2097 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2098 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002099 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 return VOS_STATUS_E_FAULT;
2101 }
2102
2103 halStatus = sme_RemainOnChannel( hHal, pSapCtx->sessionId,
2104 channel, duration, callback, pContext );
2105
2106 if( eHAL_STATUS_SUCCESS == halStatus )
2107 {
2108 return VOS_STATUS_SUCCESS;
2109 }
2110 }
2111
2112 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2113 "Failed to Set Remain on Channel");
2114
2115 return VOS_STATUS_E_FAULT;
2116}
2117
2118/*==========================================================================
2119
2120 FUNCTION WLANSAP_CancelRemainOnChannel
2121
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002122 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 This api cancel previous remain on channel request.
2124
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002125 DEPENDENCIES
2126 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002127
2128 PARAMETERS
2129
2130 IN
2131 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002132
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002134 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002135
2136 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002137
2138 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002139============================================================================*/
2140VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx )
2141{
2142 ptSapContext pSapCtx = NULL;
2143 v_PVOID_t hHal = NULL;
2144 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2145
2146 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2147 {
2148 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2149 if (NULL == pSapCtx)
2150 {
2151 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002152 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 return VOS_STATUS_E_FAULT;
2154 }
2155 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2156 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2157 {
2158 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2159 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002160 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 return VOS_STATUS_E_FAULT;
2162 }
2163
2164 halStatus = sme_CancelRemainOnChannel( hHal, pSapCtx->sessionId );
2165
2166 if( eHAL_STATUS_SUCCESS == halStatus )
2167 {
2168 return VOS_STATUS_SUCCESS;
2169 }
2170 }
2171
2172 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2173 "Failed to Cancel Remain on Channel");
2174
2175 return VOS_STATUS_E_FAULT;
2176}
2177
2178/*==========================================================================
2179
2180 FUNCTION WLANSAP_RegisterMgmtFrame
2181
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002182 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 HDD use this API to register specified type of frame with CORE stack.
2184 On receiving such kind of frame CORE stack should pass this frame to HDD
2185
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002186 DEPENDENCIES
2187 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002188
2189 PARAMETERS
2190
2191 IN
2192 pvosGCtx: Pointer to vos global context structure
2193 frameType: frameType that needs to be registered with PE.
2194 matchData: Data pointer which should be matched after frame type is matched.
2195 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002196
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002198 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002199
2200 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002201
2202 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002203============================================================================*/
2204VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2205 tANI_U8* matchData, tANI_U16 matchLen )
2206{
2207 ptSapContext pSapCtx = NULL;
2208 v_PVOID_t hHal = NULL;
2209 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2210
2211 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2212 {
2213 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2214 if (NULL == pSapCtx)
2215 {
2216 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002217 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 return VOS_STATUS_E_FAULT;
2219 }
2220 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2221 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2222 {
2223 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2224 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002225 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 return VOS_STATUS_E_FAULT;
2227 }
2228
2229 halStatus = sme_RegisterMgmtFrame(hHal, pSapCtx->sessionId,
2230 frameType, matchData, matchLen);
2231
2232 if( eHAL_STATUS_SUCCESS == halStatus )
2233 {
2234 return VOS_STATUS_SUCCESS;
2235 }
2236 }
2237
2238 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2239 "Failed to Register MGMT frame");
2240
2241 return VOS_STATUS_E_FAULT;
2242}
2243
2244/*==========================================================================
2245
2246 FUNCTION WLANSAP_DeRegisterMgmtFrame
2247
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002248 DESCRIPTION
2249 This API is used to deregister previously registered frame.
Jeff Johnson295189b2012-06-20 16:38:30 -07002250
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002251 DEPENDENCIES
2252 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
2254 PARAMETERS
2255
2256 IN
2257 pvosGCtx: Pointer to vos global context structure
2258 frameType: frameType that needs to be De-registered with PE.
2259 matchData: Data pointer which should be matched after frame type is matched.
2260 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002261
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002263 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002264
2265 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002266
2267 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002268============================================================================*/
2269VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2270 tANI_U8* matchData, tANI_U16 matchLen )
2271{
2272 ptSapContext pSapCtx = NULL;
2273 v_PVOID_t hHal = NULL;
2274 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2275
2276 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2277 {
2278 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2279 if (NULL == pSapCtx)
2280 {
2281 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002282 "%s: Invalid SAP pointer from pvosGCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 return VOS_STATUS_E_FAULT;
2284 }
2285 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2286 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2287 {
2288 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2289 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002290 __func__, hHal, pSapCtx->isSapSessionOpen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 return VOS_STATUS_E_FAULT;
2292 }
2293
2294 halStatus = sme_DeregisterMgmtFrame( hHal, pSapCtx->sessionId,
2295 frameType, matchData, matchLen );
2296
2297 if( eHAL_STATUS_SUCCESS == halStatus )
2298 {
2299 return VOS_STATUS_SUCCESS;
2300 }
2301 }
2302
2303 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2304 "Failed to Deregister MGMT frame");
2305
2306 return VOS_STATUS_E_FAULT;
2307}
2308#endif // WLAN_FEATURE_P2P