blob: e5324d1b3c962b41b6367e62602165bcd971b824 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*===========================================================================
23
24 s a p M o d u l e . C
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070025
Jeff Johnson295189b2012-06-20 16:38:30 -070026 OVERVIEW:
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070027
Jeff Johnson295189b2012-06-20 16:38:30 -070028 This software unit holds the implementation of the WLAN SAP modules
29 functions providing EXTERNAL APIs. It is also where the global SAP module
30 context gets initialised
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070031
32 DEPENDENCIES:
Jeff Johnson295189b2012-06-20 16:38:30 -070033
34 Are listed for each API below.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070035
Jeff Johnson295189b2012-06-20 16:38:30 -070036 Copyright (c) 2010 QUALCOMM Incorporated.
37 All Rights Reserved.
38 Qualcomm Confidential and Proprietary
39===========================================================================*/
40
41/*===========================================================================
42
43 EDIT HISTORY FOR FILE
44
45
46 This section contains comments describing changes made to the module.
47 Notice that changes are listed in reverse chronological order.
48
49
50
51 when who what, where, why
52---------- --- --------------------------------------------------------
5303/15/10 SOFTAP team Created module
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07005406/03/10 js Added support to hostapd driven
Jeff Johnson295189b2012-06-20 16:38:30 -070055 * deauth/disassoc/mic failure
56
57===========================================================================*/
58
59/* $Header$ */
60
61/*----------------------------------------------------------------------------
62 * Include Files
63 * -------------------------------------------------------------------------*/
64#include "wlan_qct_tl.h"
65#include "vos_trace.h"
66
67// Pick up the sme callback registration API
68#include "sme_Api.h"
69
70// SAP API header file
71
72#include "sapInternal.h"
73#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
74#include "halInternal.h"
75#endif
76#include "smeInside.h"
77
78/*----------------------------------------------------------------------------
79 * Preprocessor Definitions and Constants
80 * -------------------------------------------------------------------------*/
81#define SAP_DEBUG
82
83/*----------------------------------------------------------------------------
84 * Type Declarations
85 * -------------------------------------------------------------------------*/
86
87
88/*----------------------------------------------------------------------------
89 * Global Data Definitions
90 * -------------------------------------------------------------------------*/
91
92/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -070093 * External declarations for global context
Jeff Johnson295189b2012-06-20 16:38:30 -070094 * -------------------------------------------------------------------------*/
95// No! Get this from VOS.
96// The main per-Physical Link (per WLAN association) context.
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -070097ptSapContext gpSapCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -070098
99/*----------------------------------------------------------------------------
100 * Static Variable Definitions
101 * -------------------------------------------------------------------------*/
102
103/*----------------------------------------------------------------------------
104 * Static Function Declarations and Definitions
105 * -------------------------------------------------------------------------*/
106
107/*----------------------------------------------------------------------------
108 * Externalized Function Definitions
109* -------------------------------------------------------------------------*/
110
111/*----------------------------------------------------------------------------
112 * Function Declarations and Documentation
113 * -------------------------------------------------------------------------*/
114
115/*==========================================================================
116 FUNCTION WLANSAP_Open
117
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700118 DESCRIPTION
119 Called at driver initialization (vos_open). SAP will initialize
120 all its internal resources and will wait for the call to start to
121 register with the other modules.
122
123 DEPENDENCIES
124
125 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700126
127 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700128 pvosGCtx : Pointer to the global vos context; a handle to SAP's
129 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700130
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700131 RETURN VALUE
132 The result code associated with performing the operation
133
134 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
135 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700136 VOS_STATUS_SUCCESS: Success
137
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700138 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700139============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700140VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700141WLANSAP_Open
142(
143 v_PVOID_t pvosGCtx
144)
145{
146
147 ptSapContext pSapCtx = NULL;
148 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
149 VOS_ASSERT(pvosGCtx);
150 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700151 Allocate (and sanity check?!) SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 ------------------------------------------------------------------------*/
153 vos_alloc_context(pvosGCtx, VOS_MODULE_ID_SAP, (v_VOID_t **)&pSapCtx, sizeof(tSapContext));
154
155 if (NULL == pSapCtx)
156 {
157 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
158 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
159 return VOS_STATUS_E_FAULT;
160 }
161
162 vos_mem_zero(pSapCtx, sizeof(tSapContext));
163
164 /*------------------------------------------------------------------------
165 Clean up SAP control block, initialize all values
166 ------------------------------------------------------------------------*/
167 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Open");
168
169 WLANSAP_CleanCB(pSapCtx, 0 /*do not empty*/);
170
171 // Setup the "link back" to the VOSS context
172 pSapCtx->pvosGCtx = pvosGCtx;
173
174 // Store a pointer to the SAP context provided by VOSS
175 gpSapCtx = pSapCtx;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700176
Jeff Johnson295189b2012-06-20 16:38:30 -0700177 /*------------------------------------------------------------------------
178 Allocate internal resources
179 ------------------------------------------------------------------------*/
180
181 return VOS_STATUS_SUCCESS;
182}// WLANSAP_Open
183
184/*==========================================================================
185 FUNCTION WLANSAP_Start
186
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700187 DESCRIPTION
188 Called as part of the overall start procedure (vos_start). SAP will
189 use this call to register with TL as the SAP entity for
190 SAP RSN frames.
Jeff Johnson295189b2012-06-20 16:38:30 -0700191
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700192 DEPENDENCIES
193
194 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700195
196 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700197 pvosGCtx : Pointer to the global vos context; a handle to SAP's
198 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700201 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700202
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700203 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
204 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700205 VOS_STATUS_SUCCESS: Success
206
207 SIDE EFFECTS
208============================================================================*/
209
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700210VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700211WLANSAP_Start
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700212(
213 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700214)
215{
216#ifdef WLAN_SOFTAP_FEATURE
217 ptSapContext pSapCtx = NULL;
218
219 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
220
221 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
222 "WLANSAP_Start invoked successfully\n");
223 /*------------------------------------------------------------------------
224 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700225 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700226 ------------------------------------------------------------------------*/
227 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700228 if ( NULL == pSapCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 {
230 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
231 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
232 return VOS_STATUS_E_FAULT;
233 }
234
235 /*------------------------------------------------------------------------
236 For now, presume security is not enabled.
237 -----------------------------------------------------------------------*/
238 pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE;
239
240
241 /*------------------------------------------------------------------------
242 Now configure the roaming profile links. To SSID and bssid.
243 ------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700244 // We have room for two SSIDs.
245 pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.
246 pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList; //Array of two
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].SSID.length = 0;
248 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].handoffPermitted = VOS_FALSE;
249 pSapCtx->csrRoamProfile.SSIDs.SSIDList[0].ssidHidden = pSapCtx->SSIDList[0].ssidHidden;
250
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700251 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.
252 pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid;
Jeff Johnson295189b2012-06-20 16:38:30 -0700253
254 // Now configure the auth type in the roaming profile. To open.
255 pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700256
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock)))
258 {
259 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700260 "WLANSAP_Start failed init lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 return VOS_STATUS_E_FAULT;
262 }
263
264
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700265#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700266
267 return VOS_STATUS_SUCCESS;
268}/* WLANSAP_Start */
269
270/*==========================================================================
271
272 FUNCTION WLANSAP_Stop
273
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700274 DESCRIPTION
275 Called by vos_stop to stop operation in SAP, before close. SAP will suspend all
276 BT-AMP Protocol Adaption Layer operation and will wait for the close
277 request to clean up its resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700278
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700279 DEPENDENCIES
280
281 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700282
283 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700284 pvosGCtx : Pointer to the global vos context; a handle to SAP's
285 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700286
287 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700288 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700289
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700290 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
291 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 VOS_STATUS_SUCCESS: Success
293
294 SIDE EFFECTS
295============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700296VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700297WLANSAP_Stop
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700298(
299 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700300)
301{
302
303#ifdef WLAN_SOFTAP_FEATURE
304 ptSapContext pSapCtx = NULL;
305
306 /*------------------------------------------------------------------------
307 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700308 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 ------------------------------------------------------------------------*/
310 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
311 "WLANSAP_Stop invoked successfully ");
312
313 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
314 if (NULL == pSapCtx)
315 {
316 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
317 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
318 return VOS_STATUS_E_FAULT;
319 }
320
321 sapFreeRoamProfile(&pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700322
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pSapCtx->SapGlobalLock ) ) )
324 {
325 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700326 "WLANSAP_Stop failed destroy lock\n");
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 return VOS_STATUS_E_FAULT;
328 }
329 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700330 Stop SAP (de-register RSN handler!?)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 ------------------------------------------------------------------------*/
332#endif
333
334 return VOS_STATUS_SUCCESS;
335}/* WLANSAP_Stop */
336
337/*==========================================================================
338 FUNCTION WLANSAP_Close
339
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700340 DESCRIPTION
341 Called by vos_close during general driver close procedure. SAP will clean up
342 all the internal resources.
Jeff Johnson295189b2012-06-20 16:38:30 -0700343
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700344 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700345
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700346 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700347
348 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700349 pvosGCtx : Pointer to the global vos context; a handle to SAP's
350 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700351
352 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700353 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700354
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700355 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
356 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 VOS_STATUS_SUCCESS: Success
358
359 SIDE EFFECTS
360============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700361VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700362WLANSAP_Close
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700363(
364 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700365)
366{
367#ifdef WLAN_SOFTAP_FEATURE
368 ptSapContext pSapCtx = NULL;
369 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
370
371 /*------------------------------------------------------------------------
372 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700373 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 ------------------------------------------------------------------------*/
375 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
376 "WLANSAP_Close invoked");
377
378 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
379 if (NULL == pSapCtx)
380 {
381 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
382 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
383 return VOS_STATUS_E_FAULT;
384 }
385
386 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700387 Cleanup SAP control block.
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 ------------------------------------------------------------------------*/
389 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_Close");
390 WLANSAP_CleanCB(pSapCtx, VOS_TRUE /* empty queues/lists/pkts if any*/);
391
392 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700393 Free SAP context from VOSS global
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 ------------------------------------------------------------------------*/
395 vos_free_context(pvosGCtx, VOS_MODULE_ID_SAP, pSapCtx);
396
397#endif
398 return VOS_STATUS_SUCCESS;
399}/* WLANSAP_Close */
400
401/*----------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700402 * Utility Function implementations
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 * -------------------------------------------------------------------------*/
404
405/*==========================================================================
406
407 FUNCTION WLANSAP_CleanCB
408
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700409 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 Clear out all fields in the SAP context.
411
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700412 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700414 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700415
416 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700417 pvosGCtx : Pointer to the global vos context; a handle to SAP's
418 control block can be extracted from its context
Jeff Johnson295189b2012-06-20 16:38:30 -0700419
420 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700421 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700423 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
424 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 VOS_STATUS_SUCCESS: Success
426
427 SIDE EFFECTS
428============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700429VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700430WLANSAP_CleanCB
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700431(
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 ptSapContext pSapCtx,
433 v_U32_t freeFlag // 0 /*do not empty*/);
434)
435{
436#ifdef WLAN_SOFTAP_FEATURE
437 /*------------------------------------------------------------------------
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700438 Sanity check SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 ------------------------------------------------------------------------*/
440
441 if (NULL == pSapCtx)
442 {
443 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
444 "%s: Invalid SAP pointer", __FUNCTION__);
445 return VOS_STATUS_E_FAULT;
446 }
447
448 /*------------------------------------------------------------------------
449 Clean up SAP control block, initialize all values
450 ------------------------------------------------------------------------*/
451 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB");
452
453 vos_mem_zero( pSapCtx, sizeof(tSapContext));
454
455 pSapCtx->pvosGCtx = NULL;
456
457 pSapCtx->sapsMachine= eSAP_DISCONNECTED;
458
459 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: Initializing State: %d, sapContext value = %x",
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700460 __FUNCTION__, pSapCtx->sapsMachine, pSapCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 pSapCtx->sessionId = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700462 pSapCtx->channel = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463
464#endif
465 return VOS_STATUS_SUCCESS;
466}// WLANSAP_CleanCB
467
468/*==========================================================================
469 FUNCTION WLANSAP_pmcFullPwrReqCB
470
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700471 DESCRIPTION
472 Callback provide to PMC in the pmcRequestFullPower API.
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700474 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700475
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700476 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700477
478 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700479 callbackContext: The user passed in a context to identify
480 status: The halStatus
Jeff Johnson295189b2012-06-20 16:38:30 -0700481
482 RETURN VALUE
483 None
484
485 SIDE EFFECTS
486============================================================================*/
487void
488WLANSAP_pmcFullPwrReqCB
489(
490 void *callbackContext,
491 eHalStatus status
492)
493{
494 if(HAL_STATUS_SUCCESS(status))
495 {
496 //If success what else to be handled???
497 }
498 else
499 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700500 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n");
502
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 }
504
505}// WLANSAP_pmcFullPwrReqCB
506/*==========================================================================
507 FUNCTION WLANSAP_getState
508
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700509 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 This api returns the current SAP state to the caller.
511
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700512 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700513
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700514 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700515
516 IN
517 pContext : Pointer to Sap Context structure
518
519 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700520 Returns the SAP FSM state.
Jeff Johnson295189b2012-06-20 16:38:30 -0700521============================================================================*/
522
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700523v_U8_t WLANSAP_getState
Jeff Johnson295189b2012-06-20 16:38:30 -0700524(
525 v_PVOID_t pvosGCtx
526)
527{
528 ptSapContext pSapCtx = NULL;
529
530 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
531
532 if ( NULL == pSapCtx )
533 {
534 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
535 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
536 return VOS_STATUS_E_FAULT;
537 }
538 return pSapCtx->sapsMachine;
539}
540
541/*==========================================================================
542 FUNCTION WLANSAP_StartBss
543
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700544 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 This api function provides SAP FSM event eWLAN_SAP_PHYSICAL_LINK_CREATE for
546 starting AP BSS
547
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700548 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700549
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700550 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700551
552 IN
553 pContext : Pointer to Sap Context structure
554 pQctCommitConfig : Pointer to configuration structure passed down from HDD(HostApd for Android)
555 hdd_SapEventCallback: Callback function in HDD called by SAP to inform HDD about SAP results
556 pUsrContext : Parameter that will be passed back in all the SAP callback events.
557
558 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700559 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700560
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700561 VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
562 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 VOS_STATUS_SUCCESS: Success
564
565 SIDE EFFECTS
566============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700567VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700568WLANSAP_StartBss
569(
570 v_PVOID_t pvosGCtx,//pwextCtx
571 tpWLAN_SAPEventCB pSapEventCallback,
572 tsap_Config_t *pConfig,
573 v_PVOID_t pUsrContext
574)
575{
576 tWLAN_SAPEvent sapEvent; /* State machine event*/
577 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
578 ptSapContext pSapCtx = NULL;
579 tANI_BOOLEAN restartNeeded;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700580 tHalHandle hHal;
581
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
583
584 /*------------------------------------------------------------------------
585 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700586 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 ------------------------------------------------------------------------*/
588 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
589 "WLANSAP_StartBss");
590
591 if (VOS_STA_SAP_MODE == vos_get_conparam ())
592 {
593 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
594 if ( NULL == pSapCtx )
595 {
596 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
597 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
598 return VOS_STATUS_E_FAULT;
599 }
600 pSapCtx->sapsMachine = eSAP_DISCONNECTED;
601
602 /* Channel selection is auto or configured */
603 pSapCtx->channel = pConfig->channel;
604 pSapCtx->pUsrContext = pUsrContext;
605
606 //Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
607 pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700608 vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 pSapCtx->self_mac_addr,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700610 sizeof( tCsrBssid ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700611
612 //Save a copy to SAP context
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700613 vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
615 vos_mem_copy(pSapCtx->self_mac_addr,
616 pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
617
618 //copy the configuration items to csrProfile
619 sapconvertToCsrProfile( pConfig, eCSR_BSS_TYPE_INFRA_AP, &pSapCtx->csrRoamProfile);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700620 hHal = (tHalHandle)VOS_GET_HAL_CB(pvosGCtx);
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 if (NULL == hHal)
622 {
623 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
624 "%s: Invalid MAC context from pvosGCtx", __FUNCTION__);
625 }
626 else
627 {
628 //If concurrent session is running that is already associated
629 //then we just follow that sessions country info (whether
630 //present or not doesn't maater as we have to follow whatever
631 //STA session does)
632 if (0 == sme_GetConcurrentOperationChannel(hHal))
633 {
634 /* Setting the region/country information */
635 sme_setRegInfo(hHal, pConfig->countryCode);
636 sme_ResetCountryCodeInformation(hHal, &restartNeeded);
637 }
638 }
639
640 // Copy MAC filtering settings to sap context
641 pSapCtx->eSapMacAddrAclMode = pConfig->SapMacaddr_acl;
642 vos_mem_copy(pSapCtx->acceptMacList, pConfig->accept_mac, sizeof(pConfig->accept_mac));
643 pSapCtx->nAcceptMac = pConfig->num_accept_mac;
644 sapSortMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
645 vos_mem_copy(pSapCtx->denyMacList, pConfig->deny_mac, sizeof(pConfig->deny_mac));
646 pSapCtx->nDenyMac = pConfig->num_deny_mac;
647 sapSortMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac);
648
649 /* Fill in the event structure for FSM */
650 sapEvent.event = eSAP_HDD_START_INFRA_BSS;
651 sapEvent.params = 0;//pSapPhysLinkCreate
652
653 /* Store the HDD callback in SAP context */
654 pSapCtx->pfnSapEventCallback = pSapEventCallback;
655
656 /* Handle event*/
657 vosStatus = sapFsm(pSapCtx, &sapEvent);
658 }
659 else
660 {
661 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
662 "SoftAp role has not been enabled");
663 }
664
665 return vosStatus;
666}// WLANSAP_StartBss
667
668/*==========================================================================
669 FUNCTION WLANSAP_StopBss
670
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700671 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 This api function provides SAP FSM event eSAP_HDD_STOP_INFRA_BSS for
673 stopping AP BSS
674
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700675 DEPENDENCIES
Jeff Johnson295189b2012-06-20 16:38:30 -0700676
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700677 PARAMETERS
Jeff Johnson295189b2012-06-20 16:38:30 -0700678
679 IN
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700680 pvosGCtx : Pointer to the global vos context; a handle to SAP's
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 control block can be extracted from its contexe
682
683 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700684 The result code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700685
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700686 VOS_STATUS_E_FAULT: Pointer to VOSS GC is NULL ; access would cause a page
687 fault
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 VOS_STATUS_SUCCESS: Success
689
690 SIDE EFFECTS
691============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700692VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700693WLANSAP_StopBss
694(
695 v_PVOID_t pvosGCtx
696)
697{
698 tWLAN_SAPEvent sapEvent; /* State machine event*/
699 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
700 ptSapContext pSapCtx = NULL;
701 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
702
703 /*------------------------------------------------------------------------
704 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700705 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 ------------------------------------------------------------------------*/
707 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
708 "WLANSAP_StopBss");
709
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700710 if ( NULL == pvosGCtx )
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 {
712 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
713 "%s: Invalid Global VOSS handle", __FUNCTION__);
714 return VOS_STATUS_E_FAULT;
715 }
716
717 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
718
719 if (NULL == pSapCtx )
720 {
721 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
722 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
723 return VOS_STATUS_E_FAULT;
724 }
725
726 /* Fill in the event structure for FSM */
727 sapEvent.event = eSAP_HDD_STOP_INFRA_BSS;
728 sapEvent.params = 0;
729
730 /* Handle event*/
731 vosStatus = sapFsm(pSapCtx, &sapEvent);
732
733 return vosStatus;
734}
735
736/*==========================================================================
737 FUNCTION WLANSAP_GetAssocStations
738
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700739 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 This api function is used to probe the list of associated stations from various modules of CORE stack
741
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700742 DEPENDENCIES
743 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700744
745 PARAMETERS
746
747 IN
748 pvosGCtx : Pointer to vos global context structure
749 modId : Module from whom list of associtated stations is supposed to be probed. If an invalid module is passed
750 then by default VOS_MODULE_ID_PE will be probed
751 IN/OUT
752 pAssocStas : Pointer to list of associated stations that are known to the module specified in mod parameter
753
754 NOTE: The memory for this list will be allocated by the caller of this API
755
756 RETURN VALUE
757 The VOS_STATUS code associated with performing the operation
758
759 VOS_STATUS_SUCCESS: Success
760
761 SIDE EFFECTS
762============================================================================*/
763VOS_STATUS
764WLANSAP_GetAssocStations
765(
766 v_PVOID_t pvosGCtx,
767 VOS_MODULE_ID modId,
768 tpSap_AssocMacAddr pAssocStas
769)
770{
771 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
772
773 /*------------------------------------------------------------------------
774 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700775 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 ------------------------------------------------------------------------*/
777 if (NULL == pSapCtx)
778 {
779 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
780 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
781 return VOS_STATUS_E_FAULT;
782 }
783
784 sme_RoamGetAssociatedStas( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
785 modId,
786 pSapCtx->pUsrContext,
787 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
788 (v_U8_t *)pAssocStas );
789
790 return VOS_STATUS_SUCCESS;
791}
792
793
794/*==========================================================================
795 FUNCTION WLANSAP_RemoveWpsSessionOverlap
796
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700797 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 This api function provides for Ap App/HDD to remove an entry from session session overlap info.
799
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700800 DEPENDENCIES
801 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700802
803 PARAMETERS
804
805 IN
806 pvosGCtx: Pointer to vos global context structure
807 pRemoveMac: pointer to v_MACADDR_t for session MAC address
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700808
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700810 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812 VOS_STATUS_SUCCESS: Success
813 VOS_STATUS_E_FAULT: Session is not dectected. The parameter is function not valid.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700814
815 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700816============================================================================*/
817VOS_STATUS
818WLANSAP_RemoveWpsSessionOverlap
819
820(
821 v_PVOID_t pvosGCtx,
822 v_MACADDR_t pRemoveMac
823)
824{
825 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
826
827 /*------------------------------------------------------------------------
828 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700829 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 ------------------------------------------------------------------------*/
831 if (NULL == pSapCtx)
832 {
833 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
834 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
835 return VOS_STATUS_E_FAULT;
836 }
837
838 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
839 pSapCtx->pUsrContext,
840 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
841 pRemoveMac);
842
843 return VOS_STATUS_SUCCESS;
844}
845
846/*==========================================================================
847 FUNCTION WLANSAP_getWpsSessionOverlap
848
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700849 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 This api function provides for Ap App/HDD to get WPS session overlap info.
851
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700852 DEPENDENCIES
853 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -0700854
855 PARAMETERS
856
857 IN
858 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700859
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700861 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -0700862
863 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700864
865 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -0700866============================================================================*/
867VOS_STATUS
868WLANSAP_getWpsSessionOverlap
869(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700870 v_PVOID_t pvosGCtx
Jeff Johnson295189b2012-06-20 16:38:30 -0700871)
872{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700873 v_MACADDR_t pRemoveMac = VOS_MAC_ADDR_ZERO_INITIALIZER;
Jeff Johnson295189b2012-06-20 16:38:30 -0700874
875 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
876
877 /*------------------------------------------------------------------------
878 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700879 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 ------------------------------------------------------------------------*/
881 if (NULL == pSapCtx)
882 {
883 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
884 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
885 return VOS_STATUS_E_FAULT;
886 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700887
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 sme_RoamGetWpsSessionOverlap( VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
889 pSapCtx->pUsrContext,
890 (v_PVOID_t *)pSapCtx->pfnSapEventCallback,
891 pRemoveMac);
892
893 return VOS_STATUS_SUCCESS;
894}
895
896
897/* This routine will set the mode of operation for ACL dynamically*/
898VOS_STATUS
899WLANSAP_SetMode ( v_PVOID_t pvosGCtx, v_U32_t mode)
900{
901 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
902
903 if (NULL == pSapCtx)
904 {
905 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
906 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
907 return VOS_STATUS_E_FAULT;
908 }
909
910 pSapCtx->eSapMacAddrAclMode = (eSapMacAddrACL)mode;
911 return VOS_STATUS_SUCCESS;
912}
913
914/* This routine will clear all the entries in accept list as well as deny list */
915
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700916VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700917WLANSAP_ClearACL( v_PVOID_t pvosGCtx)
918{
919 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
920 v_U8_t i;
921
922 if (NULL == pSapCtx)
923 {
924 return VOS_STATUS_E_RESOURCES;
925 }
926
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700927 if (pSapCtx->denyMacList != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 {
929 for (i = 0; i < (pSapCtx->nDenyMac-1); i++)
930 {
931 vos_mem_zero((pSapCtx->denyMacList+i)->bytes, sizeof(v_MACADDR_t));
932
933 }
934 }
935 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
936 pSapCtx->nDenyMac = 0;
937
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700938 if (pSapCtx->acceptMacList!=NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 {
940 for (i = 0; i < (pSapCtx->nAcceptMac-1); i++)
941 {
942 vos_mem_zero((pSapCtx->acceptMacList+i)->bytes, sizeof(v_MACADDR_t));
943
944 }
945 }
946 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
947 pSapCtx->nAcceptMac = 0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700948
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 return VOS_STATUS_SUCCESS;
950}
951
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700952VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -0700953WLANSAP_ModifyACL
954(
955 v_PVOID_t pvosGCtx,
956 v_U8_t *pPeerStaMac,
957 eSapACLType listType,
958 eSapACLCmdType cmd
959)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700960{
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 eSapBool staInWhiteList=eSAP_FALSE, staInBlackList=eSAP_FALSE;
962 v_U8_t staWLIndex, staBLIndex;
963 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
964
965 if (NULL == pSapCtx)
966 {
967 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
968 "%s: Invalid SAP Context", __FUNCTION__);
969 return VOS_STATUS_E_FAULT;
970 }
971
972 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"Modify ACL entered\n"
973 "Before modification of ACL\n"
974 "size of accept and deny lists %d %d",
975 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
976 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
977 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
978 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
979 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
980
981 /* the expectation is a mac addr will not be in both the lists at the same time.
982 It is the responsiblity of userspace to ensure this */
983 staInWhiteList = sapSearchMacList(pSapCtx->acceptMacList, pSapCtx->nAcceptMac, pPeerStaMac, &staWLIndex);
984 staInBlackList = sapSearchMacList(pSapCtx->denyMacList, pSapCtx->nDenyMac, pPeerStaMac, &staBLIndex);
985
986 if (staInWhiteList && staInBlackList)
987 {
988 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
989 "Peer mac %02x:%02x:%02x:%02x:%02x:%02x found in white and black lists."
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700990 "Initial lists passed incorrect. Cannot execute this command.",
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
992 pPeerStaMac[4], pPeerStaMac[5]);
993 return VOS_STATUS_E_FAILURE;
994
995 }
996
997 switch(listType)
998 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -0700999 case eSAP_WHITE_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "cmd %d", cmd);
1001 if (cmd == ADD_STA_TO_ACL)
1002 {
1003 //error check
1004 // if list is already at max, return failure
1005 if (pSapCtx->nAcceptMac == MAX_MAC_ADDRESS_ACCEPTED)
1006 {
1007 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001008 "White list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x",
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1010 pPeerStaMac[4], pPeerStaMac[5]);
1011 return VOS_STATUS_E_FAILURE;
1012 }
1013 if (staInWhiteList)
1014 {
1015 //Do nothing if already present in white list. Just print a warning
1016 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1017 "MAC address already present in white list %02x:%02x:%02x:%02x:%02x:%02x",
1018 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1019 pPeerStaMac[4], pPeerStaMac[5]);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001020 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 {
1022 if (staInBlackList)
1023 {
1024 //remove it from black list before adding to the white list
1025 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1026 "STA present in black list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001027 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 }
1029 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001030 "... Now add to the white list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 sapAddMacToACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, pPeerStaMac);
1032 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1033 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001034 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 }
1036 else if (cmd == DELETE_STA_FROM_ACL)
1037 {
1038 if (staInWhiteList)
1039 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001040 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from white list");
1041 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW, "size of accept and deny lists %d %d",
1043 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1044 }
1045 else
1046 {
1047 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1048 "MAC address to be deleted is not present in the white list %02x:%02x:%02x:%02x:%02x:%02x",
1049 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1050 pPeerStaMac[4], pPeerStaMac[5]);
1051 return VOS_STATUS_E_FAILURE;
1052 }
1053 }
1054 else
1055 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001056 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 return VOS_STATUS_E_FAILURE;
1058 }
1059 break;
1060
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001061 case eSAP_BLACK_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,
1063 "cmd %d", cmd);
1064 if (cmd == ADD_STA_TO_ACL)
1065 {
1066 //error check
1067 // if list is already at max, return failure
1068 if (pSapCtx->nDenyMac == MAX_MAC_ADDRESS_ACCEPTED)
1069 {
1070 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1071 "Black list is already maxed out. Cannot accept %02x:%02x:%02x:%02x:%02x:%02x",
1072 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1073 pPeerStaMac[4], pPeerStaMac[5]);
1074 return VOS_STATUS_E_FAILURE;
1075 }
1076 if (staInBlackList)
1077 {
1078 //Do nothing if already present in white list
1079 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1080 "MAC address already present in black list %02x:%02x:%02x:%02x:%02x:%02x",
1081 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1082 pPeerStaMac[4], pPeerStaMac[5]);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001083 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 {
1085 if (staInWhiteList)
1086 {
1087 //remove it from white list before adding to the white list
1088 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1089 "Present in white list so first remove from it");
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001090 sapRemoveMacFromACL(pSapCtx->acceptMacList, &pSapCtx->nAcceptMac, staWLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 }
1092 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001093 "... Now add to black list");
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 sapAddMacToACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, pPeerStaMac);
1095 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"size of accept and deny lists %d %d",
1096 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001097 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 }
1099 else if (cmd == DELETE_STA_FROM_ACL)
1100 {
1101 if (staInBlackList)
1102 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001103 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, "Delete from black list");
1104 sapRemoveMacFromACL(pSapCtx->denyMacList, &pSapCtx->nDenyMac, staBLIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"no accept and deny mac %d %d",
1106 pSapCtx->nAcceptMac, pSapCtx->nDenyMac);
1107 }
1108 else
1109 {
1110 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_WARN,
1111 "MAC address to be deleted is not present in the black list %02x:%02x:%02x:%02x:%02x:%02x",
1112 pPeerStaMac[0], pPeerStaMac[1], pPeerStaMac[2], pPeerStaMac[3],
1113 pPeerStaMac[4], pPeerStaMac[5]);
1114 return VOS_STATUS_E_FAILURE;
1115 }
1116 }
1117 else
1118 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001119 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "Invalid cmd type passed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 return VOS_STATUS_E_FAILURE;
1121 }
1122 break;
1123
1124 default:
1125 {
1126 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1127 "Invalid list type passed %d",listType);
1128 return VOS_STATUS_E_FAILURE;
1129 }
1130 }
1131 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_LOW,"After modification of ACL");
1132 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** WHITE LIST ***");
1133 sapPrintACL(pSapCtx->acceptMacList, pSapCtx->nAcceptMac);
1134 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,"*** BLACK LIST ***");
1135 sapPrintACL(pSapCtx->denyMacList, pSapCtx->nDenyMac);
1136 return VOS_STATUS_SUCCESS;
1137}
1138
1139/*==========================================================================
1140 FUNCTION WLANSAP_DisassocSta
1141
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001142 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 This api function provides for Ap App/HDD initiated disassociation of station
1144
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001145 DEPENDENCIES
1146 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001147
1148 PARAMETERS
1149
1150 IN
1151 pvosGCtx : Pointer to vos global context structure
1152 pPeerStaMac : Mac address of the station to disassociate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001153
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001155 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001156
1157 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001158
1159 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001160============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001161VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001162WLANSAP_DisassocSta
1163(
1164 v_PVOID_t pvosGCtx,
1165 v_U8_t *pPeerStaMac
1166)
1167{
1168 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1169
1170 /*------------------------------------------------------------------------
1171 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001172 Extract SAP control block
1173 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 if (NULL == pSapCtx)
1175 {
1176 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1177 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1178 return VOS_STATUS_E_FAULT;
1179 }
1180
1181 sme_RoamDisconnectSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
1182 pPeerStaMac);
1183
1184 return VOS_STATUS_SUCCESS;
1185}
1186
1187#ifdef WLAN_SOFTAP_FEATURE
1188/*==========================================================================
1189 FUNCTION WLANSAP_DeauthSta
1190
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001191 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 This api function provides for Ap App/HDD initiated deauthentication of station
1193
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001194 DEPENDENCIES
1195 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001196
1197 PARAMETERS
1198
1199 IN
1200 pvosGCtx : Pointer to vos global context structure
1201 pPeerStaMac : Mac address of the station to deauthenticate
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001202
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001204 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001205
1206 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001207
1208 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001209============================================================================*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001210VOS_STATUS
Jeff Johnson295189b2012-06-20 16:38:30 -07001211WLANSAP_DeauthSta
1212(
1213 v_PVOID_t pvosGCtx,
1214 v_U8_t *pPeerStaMac
1215)
1216{
1217 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1218
1219 /*------------------------------------------------------------------------
1220 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001221 Extract SAP control block
1222 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 if (NULL == pSapCtx)
1224 {
1225 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1226 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1227 return VOS_STATUS_E_FAULT;
1228 }
1229
1230 sme_RoamDeauthSta(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId,
1231 pPeerStaMac);
1232
1233 return VOS_STATUS_SUCCESS;
1234}
1235/*==========================================================================
1236 FUNCTION WLANSAP_SetChannelRange
1237
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001238 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 This api function sets the range of channels for AP.
1240
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001241 DEPENDENCIES
1242 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001243
1244 PARAMETERS
1245
1246 IN
1247 startChannel : start channel
1248 endChannel : End channel
1249 operatingBand : Operating band (2.4GHz/5GHz)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001250
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001252 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001253
1254 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001255
1256 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001257============================================================================*/
1258VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001259WLANSAP_SetChannelRange(tHalHandle hHal,v_U8_t startChannel, v_U8_t endChannel,
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 v_U8_t operatingBand)
1261{
1262
1263 v_U8_t validChannelFlag =0;
1264 v_U8_t loopStartCount =0;
1265 v_U8_t loopEndCount =0;
1266 v_U8_t bandStartChannel =0;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001267 v_U8_t bandEndChannel =0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001268
1269 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1270 "WLANSAP_SetChannelRange:startChannel %d,EndChannel %d,Operatingband:%d",
1271 startChannel,endChannel,operatingBand);
1272
1273 /*------------------------------------------------------------------------
1274 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001275 ------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 if (( WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMIN > operatingBand)||
1277 (WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND_APMAX < operatingBand))
1278 {
1279 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1280 "Invalid operatingBand on WLANSAP_SetChannelRange");
1281 return VOS_STATUS_E_FAULT;
1282 }
1283 if (( WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMIN > startChannel)||
1284 (WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL_APMAX < startChannel))
1285 {
1286 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1287 "Invalid startChannel value on WLANSAP_SetChannelRange");
1288 return VOS_STATUS_E_FAULT;
1289 }
1290 if (( WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMIN > endChannel)||
1291 (WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL_APMAX < endChannel))
1292 {
1293 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1294 "Invalid endChannel value on WLANSAP_SetChannelRange");
1295 return VOS_STATUS_E_FAULT;
1296 }
1297 switch(operatingBand)
1298 {
1299 case RF_SUBBAND_2_4_GHZ:
1300 bandStartChannel = RF_CHAN_1;
1301 bandEndChannel = RF_CHAN_14;
1302 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001303
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 case RF_SUBBAND_5_LOW_GHZ:
1305 bandStartChannel = RF_CHAN_36;
1306 bandEndChannel = RF_CHAN_64;
1307 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001308
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 case RF_SUBBAND_5_MID_GHZ:
1310 bandStartChannel = RF_CHAN_100;
1311 bandEndChannel = RF_CHAN_140;
1312 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001313
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 case RF_SUBBAND_5_HIGH_GHZ:
1315 bandStartChannel = RF_CHAN_149;
1316 bandEndChannel = RF_CHAN_165;
1317 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001318
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 default:
1320 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1321 "Invalid operatingBand value on WLANSAP_SetChannelRange");
1322 break;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001323 }
1324
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 /* Validating the start channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001326 for(loopStartCount = bandStartChannel ; loopStartCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 loopStartCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001328 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 if(rfChannels[loopStartCount].channelNum == startChannel )
1330 {
1331 /* start channel is in the range */
1332 break;
1333 }
1334 }
1335 /* Validating the End channel is in range or not*/
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001336 for(loopEndCount = bandStartChannel ; loopEndCount <= bandEndChannel ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 loopEndCount++)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001338 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 if(rfChannels[loopEndCount].channelNum == endChannel )
1340 {
1341 /* End channel is in the range */
1342 break;
1343 }
1344 }
1345 if((loopStartCount > bandEndChannel)||(loopEndCount > bandEndChannel))
1346 {
1347 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1348 "%s: Invalid startChannel-%d or EndChannel-%d for band -%d",
1349 __FUNCTION__,startChannel,endChannel,operatingBand);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001350 /* Supplied channels are nt in the operating band so set the default
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 channels for the given operating band */
1352 startChannel = rfChannels[bandStartChannel].channelNum;
1353 endChannel = rfChannels[bandEndChannel].channelNum;;
1354 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001355
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 /*Search for the Active channels in the given range */
1357 for( loopStartCount = bandStartChannel; loopStartCount <= bandEndChannel; loopStartCount++ )
1358 {
1359 if((startChannel <= rfChannels[loopStartCount].channelNum)&&
1360 (endChannel >= rfChannels[loopStartCount].channelNum ))
1361 {
1362 if( regChannels[loopStartCount].enabled )
1363 {
1364 validChannelFlag = 1;
1365 break;
1366 }
1367 }
1368 }
1369 if(0 == validChannelFlag)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001370 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1372 "%s-No active channels present in the given range for the current region",
1373 __FUNCTION__);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001374 /* There is no active channel in the supplied range.Updating the config
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 with the default channels in the given band so that we can select the best channel in the sub-band*/
1376 startChannel = rfChannels[bandStartChannel].channelNum;
1377 endChannel = rfChannels[bandEndChannel].channelNum;;
1378 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001379
1380 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 operatingBand, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1382 {
1383 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1384 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND to CCn");
1385 return VOS_STATUS_E_FAULT;
1386 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001387 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 startChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1389 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001390
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1392 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1393 return VOS_STATUS_E_FAULT;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001394
1395 }
1396 if (ccmCfgSetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL,
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 endChannel, NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
1398 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001399
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1401 "Could not pass on WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL to CCM");
1402 return VOS_STATUS_E_FAULT;
1403 }
1404 return VOS_STATUS_SUCCESS;
1405}
1406#endif
1407
1408/*==========================================================================
1409 FUNCTION WLANSAP_SetCounterMeasure
1410
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001411 DESCRIPTION
1412 This api function is used to disassociate all the stations and prevent
1413 association for any other station.Whenever Authenticator receives 2 mic failures
1414 within 60 seconds, Authenticator will enable counter measure at SAP Layer.
1415 Authenticator will start the 60 seconds timer. Core stack will not allow any
1416 STA to associate till HDD disables counter meassure. Core stack shall kick out all the
1417 STA which are currently associated and DIASSOC Event will be propogated to HDD for
1418 each STA to clean up the HDD STA table.Once the 60 seconds timer expires, Authenticator
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 will disable the counter meassure at core stack. Now core stack can allow STAs to associate.
1420
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001421 DEPENDENCIES
1422 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001423
1424 PARAMETERS
1425
1426 IN
1427pvosGCtx: Pointer to vos global context structure
1428bEnable: If TRUE than all stations will be disassociated and no more will be allowed to associate. If FALSE than CORE
1429will come out of this state.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001430
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001432 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001433
1434 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001435
1436 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001437============================================================================*/
1438VOS_STATUS
1439WLANSAP_SetCounterMeasure
1440(
1441 v_PVOID_t pvosGCtx,
1442 v_BOOL_t bEnable
1443)
1444{
1445 ptSapContext pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1446
1447 /*------------------------------------------------------------------------
1448 Sanity check
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001449 Extract SAP control block
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 ------------------------------------------------------------------------*/
1451 if (NULL == pSapCtx)
1452 {
1453 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1454 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1455 return VOS_STATUS_E_FAULT;
1456 }
1457
1458 sme_RoamTKIPCounterMeasures(VOS_GET_HAL_CB(pSapCtx->pvosGCtx), pSapCtx->sessionId, bEnable);
1459
1460 return VOS_STATUS_SUCCESS;
1461}
1462
1463/*==========================================================================
1464
1465 FUNCTION WLANSAP_SetKeysSta
1466
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001467 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 This api function provides for Ap App/HDD to set key for a station.
1469
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001470 DEPENDENCIES
1471 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
1473 PARAMETERS
1474
1475 IN
1476pvosGCtx: Pointer to vos global context structure
1477pSetKeyInfo: tCsrRoamSetKey structure for the station
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001478
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001480 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001481
1482 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001483
1484 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001485============================================================================*/
1486VOS_STATUS
1487WLANSAP_SetKeySta
1488(
1489 v_PVOID_t pvosGCtx, tCsrRoamSetKey *pSetKeyInfo
1490)
1491{
1492 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1493 ptSapContext pSapCtx = NULL;
1494 v_PVOID_t hHal = NULL;
1495 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1496 v_U32_t roamId=0xFF;
1497
1498 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1499 {
1500 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1501 if (NULL == pSapCtx)
1502 {
1503 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1504 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1505 return VOS_STATUS_E_FAULT;
1506 }
1507 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1508 if (NULL == hHal)
1509 {
1510 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1511 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1512 return VOS_STATUS_E_FAULT;
1513 }
1514 halStatus = sme_RoamSetKey(hHal, pSapCtx->sessionId, pSetKeyInfo, &roamId);
1515
1516 if (halStatus == eHAL_STATUS_SUCCESS)
1517 {
1518 vosStatus = VOS_STATUS_SUCCESS;
1519 } else
1520 {
1521 vosStatus = VOS_STATUS_E_FAULT;
1522 }
1523 }
1524 else
1525 vosStatus = VOS_STATUS_E_FAULT;
1526
1527 return vosStatus;
1528}
1529
1530/*==========================================================================
1531 FUNCTION WLANSAP_DelKeySta
1532
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001533 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 This api function provides for Ap App/HDD to delete key for a station.
1535
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001536 DEPENDENCIES
1537 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001538
1539 PARAMETERS
1540
1541 IN
1542pvosGCtx: Pointer to vos global context structure
1543pSetKeyInfo: tCsrRoamRemoveKey structure for the station
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001544
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001546 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001547
1548 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001549
1550 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001551============================================================================*/
1552VOS_STATUS
1553WLANSAP_DelKeySta
1554(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001555 v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001556 tCsrRoamRemoveKey *pRemoveKeyInfo
1557)
1558{
1559 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1560 ptSapContext pSapCtx = NULL;
1561 v_PVOID_t hHal = NULL;
1562 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1563 v_U32_t roamId=0xFF;
1564 tCsrRoamRemoveKey RemoveKeyInfo;
1565
1566 if (VOS_STA_SAP_MODE == vos_get_conparam ( ))
1567 {
1568 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1569 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001570 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1572 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1573 return VOS_STATUS_E_FAULT;
1574 }
1575
1576 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1577 if (NULL == hHal)
1578 {
1579 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1580 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1581 return VOS_STATUS_E_FAULT;
1582 }
1583
1584 vos_mem_zero(&RemoveKeyInfo, sizeof(RemoveKeyInfo));
1585 RemoveKeyInfo.encType = pRemoveKeyInfo->encType;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001586 vos_mem_copy(RemoveKeyInfo.peerMac, pRemoveKeyInfo->peerMac, WNI_CFG_BSSID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 RemoveKeyInfo.keyId = pRemoveKeyInfo->keyId;
1588
1589 halStatus = sme_RoamRemoveKey(hHal, pSapCtx->sessionId, &RemoveKeyInfo, &roamId);
1590
1591 if (HAL_STATUS_SUCCESS(halStatus))
1592 {
1593 vosStatus = VOS_STATUS_SUCCESS;
1594 }
1595 else
1596 {
1597 vosStatus = VOS_STATUS_E_FAULT;
1598 }
1599 }
1600 else
1601 vosStatus = VOS_STATUS_E_FAULT;
1602
1603 return vosStatus;
1604}
1605
1606VOS_STATUS
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001607WLANSap_getstationIE_information(v_PVOID_t pvosGCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 v_U32_t *pLen,
1609 v_U8_t *pBuf)
1610{
1611 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1612 ptSapContext pSapCtx = NULL;
1613 v_U32_t len = 0;
1614
1615 if (VOS_STA_SAP_MODE == vos_get_conparam ( )){
1616 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1617 if (NULL == pSapCtx)
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001618 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1620 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1621 return VOS_STATUS_E_FAULT;
1622 }
1623 if (pLen)
1624 {
1625 len = *pLen;
1626 *pLen = pSapCtx->nStaWPARSnReqIeLength;
1627 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1628 "%s: WPAIE len : %x", __FUNCTION__, *pLen);
1629 if(pBuf)
1630 {
1631 if(len >= pSapCtx->nStaWPARSnReqIeLength)
1632 {
1633 vos_mem_copy( pBuf, pSapCtx->pStaWpaRsnReqIE, pSapCtx->nStaWPARSnReqIeLength);
1634 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
1635 "%s: WPAIE: %02x:%02x:%02x:%02x:%02x:%02x",
1636 __FUNCTION__,
1637 pBuf[0], pBuf[1], pBuf[2],
1638 pBuf[3], pBuf[4], pBuf[5]);
1639 vosStatus = VOS_STATUS_SUCCESS;
1640 }
1641 }
1642 }
1643 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001644
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 if( VOS_STATUS_E_FAILURE == vosStatus)
1646 {
1647 VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1648 "%s: Error unable to populate the RSNWPAIE",
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001649 __FUNCTION__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 }
1651
1652 return vosStatus;
1653
1654}
1655
1656/*==========================================================================
1657 FUNCTION WLANSAP_Set_WpsIe
1658
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001659 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 This api function provides for Ap App/HDD to set WPS IE.
1661
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001662 DEPENDENCIES
1663 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001664
1665 PARAMETERS
1666
1667 IN
1668pvosGCtx: Pointer to vos global context structure
1669pWPSIE: tSap_WPSIE structure that include WPS IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001672 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001673
1674 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001675
1676 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001677============================================================================*/
1678VOS_STATUS
1679WLANSAP_Set_WpsIe
1680(
1681 v_PVOID_t pvosGCtx, tSap_WPSIE *pSap_WPSIe
1682)
1683{
1684 ptSapContext pSapCtx = NULL;
1685 v_PVOID_t hHal = NULL;
1686
1687 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001688 "%s, %d", __FUNCTION__, __LINE__);
1689
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 if(VOS_STA_SAP_MODE == vos_get_conparam ( )) {
1691 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1692 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001693 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1695 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1696 return VOS_STATUS_E_FAULT;
1697 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001698
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1700 if ( NULL == hHal ){
1701 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1702 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1703 return VOS_STATUS_E_FAULT;
1704 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001705
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 if ( sap_AcquireGlobalLock( pSapCtx ) == VOS_STATUS_SUCCESS )
1707 {
1708 if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_BEACON_IE)
1709 {
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001710 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSBeaconIE, &pSap_WPSIe->sapwpsie.sapWPSBeaconIE, sizeof(tSap_WPSBeaconIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001712 else if (pSap_WPSIe->sapWPSIECode == eSAP_WPS_PROBE_RSP_IE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 {
1714 vos_mem_copy(&pSapCtx->APWPSIEs.SirWPSProbeRspIE, &pSap_WPSIe->sapwpsie.sapWPSProbeRspIE, sizeof(tSap_WPSProbeRspIE));
1715 }
1716 else
1717 {
1718 sap_ReleaseGlobalLock( pSapCtx );
1719 return VOS_STATUS_E_FAULT;
1720 }
1721 sap_ReleaseGlobalLock( pSapCtx );
1722 return VOS_STATUS_SUCCESS;
1723 }
1724 else
1725 return VOS_STATUS_E_FAULT;
1726 }
1727 else
1728 return VOS_STATUS_E_FAULT;
1729}
1730
1731/*==========================================================================
1732 FUNCTION WLANSAP_Update_WpsIe
1733
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001734 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 This api function provides for Ap App/HDD to update WPS IEs.
1736
1737 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001738 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001739
1740 PARAMETERS
1741
1742 IN
1743pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001744
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001746 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001747
1748 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001749
1750 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001751============================================================================*/
1752VOS_STATUS
1753WLANSAP_Update_WpsIe
1754(
1755 v_PVOID_t pvosGCtx
1756)
1757{
1758 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1759 ptSapContext pSapCtx = NULL;
1760 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1761 v_PVOID_t hHal = NULL;
1762
1763 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001764 "%s, %d", __FUNCTION__, __LINE__);
1765
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
1767 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1768 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001769 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1771 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1772 return VOS_STATUS_E_FAULT;
1773 }
1774
1775 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1776 if ( NULL == hHal ){
1777 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1778 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1779 return VOS_STATUS_E_FAULT;
1780 }
1781
1782 halStatus = sme_RoamUpdateAPWPSIE( hHal, pSapCtx->sessionId, &pSapCtx->APWPSIEs);
1783
1784 if(halStatus == eHAL_STATUS_SUCCESS) {
1785 vosStatus = VOS_STATUS_SUCCESS;
1786 } else
1787 {
1788 vosStatus = VOS_STATUS_E_FAULT;
1789 }
1790
1791 }
1792
1793 return vosStatus;
1794}
1795
1796/*==========================================================================
1797 FUNCTION WLANSAP_Get_WPS_State
1798
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001799 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 This api function provides for Ap App/HDD to check if WPS session in process.
1801
1802 DEPENDENCIES
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001803 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001804
1805 PARAMETERS
1806
1807 IN
1808pvosGCtx: Pointer to vos global context structure
1809
1810 OUT
1811pbWPSState: Pointer to variable to indicate if it is in WPS Registration state
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001812
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001814 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001815
1816 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001817
1818 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001819============================================================================*/
1820VOS_STATUS
1821WLANSAP_Get_WPS_State
1822(
1823 v_PVOID_t pvosGCtx, v_BOOL_t *bWPSState
1824)
1825{
1826 ptSapContext pSapCtx = NULL;
1827 v_PVOID_t hHal = NULL;
1828
1829 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001830 "%s, %d", __FUNCTION__, __LINE__);
1831
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001833
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1835 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001836 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1838 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1839 return VOS_STATUS_E_FAULT;
1840 }
1841
1842 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1843 if ( NULL == hHal ){
1844 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1845 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1846 return VOS_STATUS_E_FAULT;
1847 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001848
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 if ( sap_AcquireGlobalLock(pSapCtx ) == VOS_STATUS_SUCCESS )
1850 {
1851 if(pSapCtx->APWPSIEs.SirWPSProbeRspIE.FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
1852 *bWPSState = eANI_BOOLEAN_TRUE;
1853 else
1854 *bWPSState = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001855
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 sap_ReleaseGlobalLock( pSapCtx );
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001857
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 return VOS_STATUS_SUCCESS;
1859 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001860 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 return VOS_STATUS_E_FAULT;
1862 }
1863 else
1864 return VOS_STATUS_E_FAULT;
1865
1866}
1867
1868VOS_STATUS
1869sap_AcquireGlobalLock
1870(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001871 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07001872)
1873{
1874 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1875
1876 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &pSapCtx->SapGlobalLock) ) )
1877 {
1878 vosStatus = VOS_STATUS_SUCCESS;
1879 }
1880
1881 return (vosStatus);
1882}
1883
1884VOS_STATUS
1885sap_ReleaseGlobalLock
1886(
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001887 ptSapContext pSapCtx
Jeff Johnson295189b2012-06-20 16:38:30 -07001888)
1889{
1890 VOS_STATUS vosStatus = VOS_STATUS_E_FAULT;
1891
1892 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &pSapCtx->SapGlobalLock) ) )
1893 {
1894 vosStatus = VOS_STATUS_SUCCESS;
1895 }
1896
1897 return (vosStatus);
1898}
1899
1900/*==========================================================================
1901 FUNCTION WLANSAP_Set_WPARSNIes
1902
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001903 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 This api function provides for Ap App/HDD to set AP WPA and RSN IE in its beacon and probe response.
1905
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001906 DEPENDENCIES
1907 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001908
1909 PARAMETERS
1910
1911 IN
1912 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001913 pWPARSNIEs: buffer to the WPA/RSN IEs
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 WPARSNIEsLen: length of WPA/RSN IEs
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001915
Jeff Johnson295189b2012-06-20 16:38:30 -07001916 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001917 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001918
1919 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001920
1921 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001922============================================================================*/
1923VOS_STATUS WLANSAP_Set_WPARSNIes(v_PVOID_t pvosGCtx, v_U8_t *pWPARSNIEs, v_U32_t WPARSNIEsLen)
1924{
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001925
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 ptSapContext pSapCtx = NULL;
1927 eHalStatus halStatus = eHAL_STATUS_FAILURE;
1928 v_PVOID_t hHal = NULL;
1929
1930 if(VOS_STA_SAP_MODE == vos_get_conparam ( )){
1931 pSapCtx = VOS_GET_SAP_CB(pvosGCtx);
1932 if ( NULL == pSapCtx )
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001933 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1935 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
1936 return VOS_STATUS_E_FAULT;
1937 }
1938
1939 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
1940 if ( NULL == hHal ){
1941 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
1942 "%s: Invalid HAL pointer from pvosGCtx", __FUNCTION__);
1943 return VOS_STATUS_E_FAULT;
1944 }
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 pSapCtx->APWPARSNIEs.length = (tANI_U16)WPARSNIEsLen;
1947 vos_mem_copy(pSapCtx->APWPARSNIEs.rsnIEdata, pWPARSNIEs, WPARSNIEsLen);
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001948
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 halStatus = sme_RoamUpdateAPWPARSNIEs( hHal, pSapCtx->sessionId, &pSapCtx->APWPARSNIEs);
1950
1951 if(halStatus == eHAL_STATUS_SUCCESS) {
1952 return VOS_STATUS_SUCCESS;
1953 } else
1954 {
1955 return VOS_STATUS_E_FAULT;
1956 }
1957 }
1958
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001959 return VOS_STATUS_E_FAULT;
Jeff Johnson295189b2012-06-20 16:38:30 -07001960}
1961
1962VOS_STATUS WLANSAP_GetStatistics(v_PVOID_t pvosGCtx, tSap_SoftapStats *statBuf, v_BOOL_t bReset)
1963{
1964 if (NULL == pvosGCtx)
1965 {
1966 return VOS_STATUS_E_FAULT;
1967 }
1968
1969 return (WLANTL_GetSoftAPStatistics(pvosGCtx, statBuf, bReset));
1970}
1971
1972#ifdef WLAN_FEATURE_P2P
1973/*==========================================================================
1974
1975 FUNCTION WLANSAP_SendAction
1976
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001977 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 This api function provides to send action frame sent by upper layer.
1979
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001980 DEPENDENCIES
1981 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07001982
1983 PARAMETERS
1984
1985 IN
1986 pvosGCtx: Pointer to vos global context structure
1987 pBuf: Pointer of the action frame to be transmitted
1988 len: Length of the action frame
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001989
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001991 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07001992
1993 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07001994
1995 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07001996============================================================================*/
1997VOS_STATUS WLANSAP_SendAction( v_PVOID_t pvosGCtx, const tANI_U8 *pBuf,
Jeff Johnsone7245742012-09-05 17:12:55 -07001998 tANI_U32 len, tANI_U16 wait )
Jeff Johnson295189b2012-06-20 16:38:30 -07001999{
2000 ptSapContext pSapCtx = NULL;
2001 v_PVOID_t hHal = NULL;
2002 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2003
2004 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2005 {
2006 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2007 if (NULL == pSapCtx)
2008 {
2009 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2010 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
2011 return VOS_STATUS_E_FAULT;
2012 }
2013 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2014 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2015 {
2016 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2017 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2018 __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
2019 return VOS_STATUS_E_FAULT;
2020 }
2021
Jeff Johnsone7245742012-09-05 17:12:55 -07002022 halStatus = sme_sendAction( hHal, pSapCtx->sessionId, pBuf, len, 0 , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002023
2024 if ( eHAL_STATUS_SUCCESS == halStatus )
2025 {
2026 return VOS_STATUS_SUCCESS;
2027 }
2028 }
2029
2030 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2031 "Failed to Send Action Frame");
2032
2033 return VOS_STATUS_E_FAULT;
2034}
2035
2036/*==========================================================================
2037
2038 FUNCTION WLANSAP_RemainOnChannel
2039
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002040 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 This api function provides to set Remain On channel on specified channel
2042 for specified duration.
2043
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002044 DEPENDENCIES
2045 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002046
2047 PARAMETERS
2048
2049 IN
2050 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002051 channel: Channel on which driver has to listen
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 duration: Duration for which driver has to listen on specified channel
2053 callback: Callback function to be called once Listen is done.
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002054 pContext: Context needs to be called in callback function.
2055
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002057 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002058
2059 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002060
2061 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002062============================================================================*/
2063VOS_STATUS WLANSAP_RemainOnChannel( v_PVOID_t pvosGCtx,
2064 tANI_U8 channel, tANI_U32 duration,
2065 remainOnChanCallback callback,
2066 void *pContext )
2067{
2068 ptSapContext pSapCtx = NULL;
2069 v_PVOID_t hHal = NULL;
2070 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2071
2072 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2073 {
2074 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2075 if (NULL == pSapCtx)
2076 {
2077 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2078 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
2079 return VOS_STATUS_E_FAULT;
2080 }
2081 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2082 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2083 {
2084 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2085 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2086 __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
2087 return VOS_STATUS_E_FAULT;
2088 }
2089
2090 halStatus = sme_RemainOnChannel( hHal, pSapCtx->sessionId,
2091 channel, duration, callback, pContext );
2092
2093 if( eHAL_STATUS_SUCCESS == halStatus )
2094 {
2095 return VOS_STATUS_SUCCESS;
2096 }
2097 }
2098
2099 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2100 "Failed to Set Remain on Channel");
2101
2102 return VOS_STATUS_E_FAULT;
2103}
2104
2105/*==========================================================================
2106
2107 FUNCTION WLANSAP_CancelRemainOnChannel
2108
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002109 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 This api cancel previous remain on channel request.
2111
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002112 DEPENDENCIES
2113 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 PARAMETERS
2116
2117 IN
2118 pvosGCtx: Pointer to vos global context structure
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002119
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002121 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002122
2123 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002124
2125 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002126============================================================================*/
2127VOS_STATUS WLANSAP_CancelRemainOnChannel( v_PVOID_t pvosGCtx )
2128{
2129 ptSapContext pSapCtx = NULL;
2130 v_PVOID_t hHal = NULL;
2131 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2132
2133 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2134 {
2135 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2136 if (NULL == pSapCtx)
2137 {
2138 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2139 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
2140 return VOS_STATUS_E_FAULT;
2141 }
2142 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2143 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2144 {
2145 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2146 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2147 __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
2148 return VOS_STATUS_E_FAULT;
2149 }
2150
2151 halStatus = sme_CancelRemainOnChannel( hHal, pSapCtx->sessionId );
2152
2153 if( eHAL_STATUS_SUCCESS == halStatus )
2154 {
2155 return VOS_STATUS_SUCCESS;
2156 }
2157 }
2158
2159 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2160 "Failed to Cancel Remain on Channel");
2161
2162 return VOS_STATUS_E_FAULT;
2163}
2164
2165/*==========================================================================
2166
2167 FUNCTION WLANSAP_RegisterMgmtFrame
2168
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002169 DESCRIPTION
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 HDD use this API to register specified type of frame with CORE stack.
2171 On receiving such kind of frame CORE stack should pass this frame to HDD
2172
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002173 DEPENDENCIES
2174 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002175
2176 PARAMETERS
2177
2178 IN
2179 pvosGCtx: Pointer to vos global context structure
2180 frameType: frameType that needs to be registered with PE.
2181 matchData: Data pointer which should be matched after frame type is matched.
2182 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002183
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002185 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002186
2187 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002188
2189 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002190============================================================================*/
2191VOS_STATUS WLANSAP_RegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2192 tANI_U8* matchData, tANI_U16 matchLen )
2193{
2194 ptSapContext pSapCtx = NULL;
2195 v_PVOID_t hHal = NULL;
2196 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2197
2198 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2199 {
2200 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2201 if (NULL == pSapCtx)
2202 {
2203 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2204 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
2205 return VOS_STATUS_E_FAULT;
2206 }
2207 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2208 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2209 {
2210 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2211 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2212 __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
2213 return VOS_STATUS_E_FAULT;
2214 }
2215
2216 halStatus = sme_RegisterMgmtFrame(hHal, pSapCtx->sessionId,
2217 frameType, matchData, matchLen);
2218
2219 if( eHAL_STATUS_SUCCESS == halStatus )
2220 {
2221 return VOS_STATUS_SUCCESS;
2222 }
2223 }
2224
2225 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2226 "Failed to Register MGMT frame");
2227
2228 return VOS_STATUS_E_FAULT;
2229}
2230
2231/*==========================================================================
2232
2233 FUNCTION WLANSAP_DeRegisterMgmtFrame
2234
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002235 DESCRIPTION
2236 This API is used to deregister previously registered frame.
Jeff Johnson295189b2012-06-20 16:38:30 -07002237
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002238 DEPENDENCIES
2239 NA.
Jeff Johnson295189b2012-06-20 16:38:30 -07002240
2241 PARAMETERS
2242
2243 IN
2244 pvosGCtx: Pointer to vos global context structure
2245 frameType: frameType that needs to be De-registered with PE.
2246 matchData: Data pointer which should be matched after frame type is matched.
2247 matchLen: Length of the matchData
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002248
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 RETURN VALUE
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002250 The VOS_STATUS code associated with performing the operation
Jeff Johnson295189b2012-06-20 16:38:30 -07002251
2252 VOS_STATUS_SUCCESS: Success
Madan Mohan Koyyalamudi33a178c2012-09-18 18:17:13 -07002253
2254 SIDE EFFECTS
Jeff Johnson295189b2012-06-20 16:38:30 -07002255============================================================================*/
2256VOS_STATUS WLANSAP_DeRegisterMgmtFrame( v_PVOID_t pvosGCtx, tANI_U16 frameType,
2257 tANI_U8* matchData, tANI_U16 matchLen )
2258{
2259 ptSapContext pSapCtx = NULL;
2260 v_PVOID_t hHal = NULL;
2261 eHalStatus halStatus = eHAL_STATUS_FAILURE;
2262
2263 if( VOS_STA_SAP_MODE == vos_get_conparam ( ) )
2264 {
2265 pSapCtx = VOS_GET_SAP_CB( pvosGCtx );
2266 if (NULL == pSapCtx)
2267 {
2268 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2269 "%s: Invalid SAP pointer from pvosGCtx", __FUNCTION__);
2270 return VOS_STATUS_E_FAULT;
2271 }
2272 hHal = VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
2273 if( ( NULL == hHal ) || ( eSAP_TRUE != pSapCtx->isSapSessionOpen ) )
2274 {
2275 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2276 "%s: HAL pointer (%p) NULL OR SME session is not open (%d)",
2277 __FUNCTION__, hHal, pSapCtx->isSapSessionOpen );
2278 return VOS_STATUS_E_FAULT;
2279 }
2280
2281 halStatus = sme_DeregisterMgmtFrame( hHal, pSapCtx->sessionId,
2282 frameType, matchData, matchLen );
2283
2284 if( eHAL_STATUS_SUCCESS == halStatus )
2285 {
2286 return VOS_STATUS_SUCCESS;
2287 }
2288 }
2289
2290 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
2291 "Failed to Deregister MGMT frame");
2292
2293 return VOS_STATUS_E_FAULT;
2294}
2295#endif // WLAN_FEATURE_P2P