blob: 5d51563ccc0e05613e459b341df7323f47367378 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42#ifndef WLAN_QCT_WLANSAP_INTERNAL_H
43#define WLAN_QCT_WLANSAP_INTERNAL_H
44
45/*===========================================================================
46
47 W L A N S A P P A L L A Y E R
48 I N T E R N A L A P I
49
50
51DESCRIPTION
52 This file contains the internal API exposed by the wlan SAP PAL layer
53 module.
54
55
56 Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved.
57 Qualcomm Confidential and Proprietary
58===========================================================================*/
59
60
61/*===========================================================================
62
63 EDIT HISTORY FOR FILE
64
65
66 This section contains comments describing changes made to the module.
67 Notice that changes are listed in reverse chronological order.
68
69
70 $Header: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/src/bapInternal.h,v 1.7 2009/03/09 08:50:43 rgidvani Exp rgidvani $ $DateTime: $ $Author: jzmuda $
71
72
73when who what, where, why
74-------- --- ----------------------------------------------------------
7509/15/08 SOFTAP Created module.
76
77===========================================================================*/
78
79
80
81/*===========================================================================
82
83 INCLUDE FILES FOR MODULE
84
85===========================================================================*/
86
87/*----------------------------------------------------------------------------
88 * Include Files
89 * -------------------------------------------------------------------------*/
90#include "vos_api.h"
91#include "vos_packet.h"
92
93// Pick up the CSR API definitions
94#include "csrApi.h"
95#include "sapApi.h"
96#include "sapFsm_ext.h"
97#include "sapChSelect.h"
98
99/*----------------------------------------------------------------------------
100 * Preprocessor Definitions and Constants
101 * -------------------------------------------------------------------------*/
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105
106
107/*----------------------------------------------------------------------------
108 * Defines
109 * -------------------------------------------------------------------------*/
110#define SAP_DEBUG
111// Used to enable or disable security on the BT-AMP link
112#define WLANSAP_SECURITY_ENABLED_STATE VOS_TRUE
113// How do I get SAP context from voss context?
114#define VOS_GET_SAP_CB(ctx) vos_get_context( VOS_MODULE_ID_SAP, ctx)
115
116#if defined(FEATURE_WLAN_NON_INTEGRATED_SOC)
117// How do I get halHandle from voss context?
118#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_HAL, ctx)
119#else
120#define VOS_GET_HAL_CB(ctx) vos_get_context( VOS_MODULE_ID_PE, ctx)
121#endif
122//MAC Address length
123#define ANI_EAPOL_KEY_RSN_NONCE_SIZE 32
124
125extern sRegulatoryChannel *regChannels;
126extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
127
128/*----------------------------------------------------------------------------
129 * Typedefs
130 * -------------------------------------------------------------------------*/
131typedef struct sSapContext tSapContext;
132// tSapContext, *ptSapContext;
133/*----------------------------------------------------------------------------
134 * Type Declarations - For internal SAP context information
135 * -------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------
137 * Opaque SAP context Type Declaration
138 * -------------------------------------------------------------------------*/
139// We were only using this syntax, when this was truly opaque.
140// (I.E., it was defined in a different file.)
141
142
143/* SAP FSM states for Access Point role */
144typedef enum {
145 eSAP_DISCONNECTED,
146 eSAP_CH_SELECT,
147 eSAP_STARTING,
148 eSAP_STARTED,
149 eSAP_DISCONNECTING
150} eSapFsmStates_t;
151
152/*----------------------------------------------------------------------------
153 * SAP context Data Type Declaration
154 * -------------------------------------------------------------------------*/
155 /*----------------------------------------------------------------------------
156 * Type Declarations - QOS related
157 * -------------------------------------------------------------------------*/
158/* SAP QOS config */
159typedef struct sSapQosCfg {
160 v_U8_t WmmIsEnabled;
161} tSapQosCfg;
162
163typedef struct sSapContext {
164
165 vos_lock_t SapGlobalLock;
166
167 // Include the current channel of AP
168 v_U32_t channel;
Madan Mohan Koyyalamudi5aef2af2012-10-05 11:56:27 -0700169
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 // Include the SME(CSR) sessionId here
171 v_U8_t sessionId;
172
173 // Include the key material for this physical link
174 v_U8_t key_type;
175 v_U8_t key_length;
176 v_U8_t key_material[32];
177
178 // Include the associations MAC addresses
179 v_U8_t self_mac_addr[VOS_MAC_ADDRESS_LEN];
180
181 // Own SSID
182 v_U8_t ownSsid[MAX_SSID_LEN];
183 v_U32_t ownSsidLen;
184
185 // Flag for signaling if security is enabled
186 v_U8_t ucSecEnabled;
187
188 // Include the SME(CSR) context here
189 tCsrRoamProfile csrRoamProfile;
190 v_U32_t csrRoamId;
191
192 //Sap session
193 tANI_BOOLEAN isSapSessionOpen;
194
195 // SAP event Callback to hdd
196 tpWLAN_SAPEventCB pfnSapEventCallback;
197
198 // Include the enclosing VOSS context here
199 v_PVOID_t pvosGCtx;
200
201 // Include the state machine structure here, state var that keeps track of state machine
202 eSapFsmStates_t sapsMachine;
203
204 // Actual storage for AP and self (STA) SSID
205 tCsrSSIDInfo SSIDList[2];
206
207 // Actual storage for AP bssid
208 tCsrBssid bssid;
209
210 // Mac filtering settings
211 eSapMacAddrACL eSapMacAddrAclMode;
212 v_MACADDR_t acceptMacList[MAX_MAC_ADDRESS_ACCEPTED];
213 v_U8_t nAcceptMac;
214 v_MACADDR_t denyMacList[MAX_MAC_ADDRESS_DENIED];
215 v_U8_t nDenyMac;
216
217 // QOS config
218 tSapQosCfg SapQosCfg;
219
220 v_PVOID_t pUsrContext;
221
222 v_U32_t nStaWPARSnReqIeLength;
223 v_U8_t pStaWpaRsnReqIE[MAX_ASSOC_IND_IE_LEN];
224 tSirAPWPSIEs APWPSIEs;
225 tSirRSNie APWPARSNIEs;
226
227 v_U32_t nStaAddIeLength;
228 v_U8_t pStaAddIE[MAX_ASSOC_IND_IE_LEN];
229 v_U8_t *channelList;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700230 tSapChannelListInfo SapChnlList;
Jeff Johnson295189b2012-06-20 16:38:30 -0700231} *ptSapContext;
232
233
234/*----------------------------------------------------------------------------
235 * External declarations for global context
236 * -------------------------------------------------------------------------*/
237// The main per-Physical Link (per WLAN association) context.
238extern ptSapContext gpSapCtx;
239
240/*----------------------------------------------------------------------------
241 * SAP state machine event definition
242 * -------------------------------------------------------------------------*/
243/* The event structure */
244typedef struct sWLAN_SAPEvent {
245 v_PVOID_t params; /* A VOID pointer type for all possible inputs */
246 v_U32_t event; /* State machine input event message */
247 v_U32_t u1; /* introduced to handle csrRoamCompleteCallback roamStatus */
248 v_U32_t u2; /* introduced to handle csrRoamCompleteCallback roamResult */
249} tWLAN_SAPEvent, *ptWLAN_SAPEvent;
250
251/*----------------------------------------------------------------------------
252 * Function Declarations and Documentation
253 * -------------------------------------------------------------------------*/
254
255/*==========================================================================
256
257 FUNCTION WLANSAP_ScanCallback()
258
259 DESCRIPTION
260 Callback for Scan (scan results) Events
261
262 DEPENDENCIES
263 NA.
264
265 PARAMETERS
266
267 IN
268 tHalHandle: the tHalHandle passed in with the scan request
269 *p2: the second context pass in for the caller, opaque sap Handle here
270 scanID:
271 status: Status of scan -success, failure or abort
272
273 RETURN VALUE
274 The eHalStatus code associated with performing the operation
275
276 eHAL_STATUS_SUCCESS: Success
277
278 SIDE EFFECTS
279
280============================================================================*/
281eHalStatus
282WLANSAP_ScanCallback
283(
284 tHalHandle halHandle,
285 void *pContext,
286 v_U32_t scanID,
287 eCsrScanStatus scanStatus
288);
289
290/*==========================================================================
291
292 FUNCTION WLANSAP_RoamCallback()
293
294 DESCRIPTION
295 Callback for Roam (connection status) Events
296
297 DEPENDENCIES
298 NA.
299
300 PARAMETERS
301
302 IN
303 pContext: is the pContext passed in with the roam request
304 pCsrRoamInfo: is a pointer to a tCsrRoamInfo, see definition of eRoamCmdStatus and
305 eRoamCmdResult: for detail valid members. It may be NULL
306 roamId: is to identify the callback related roam request. 0 means unsolicited
307 roamStatus: is a flag indicating the status of the callback
308 roamResult: is the result
309
310 RETURN VALUE
311 The eHalStatus code associated with performing the operation
312
313 eHAL_STATUS_SUCCESS: Success
314
315 SIDE EFFECTS
316
317============================================================================*/
318eHalStatus
319WLANSAP_RoamCallback
320(
321 void *pContext,
322 tCsrRoamInfo *pCsrRoamInfo,
323 v_U32_t roamId,
324 eRoamCmdStatus roamStatus,
325 eCsrRoamResult roamResult
326);
327
328/*==========================================================================
329
330 FUNCTION WLANSAP_CleanCB
331
332 DESCRIPTION
333 Clear out all fields in the SAP context.
334
335 DEPENDENCIES
336
337 PARAMETERS
338
339 IN
340 pSapCtx: pointer to the SAP control block
341 freeFlag: flag indicating whether to free any allocations.
342
343 RETURN VALUE
344 The result code associated with performing the operation
345
346 VOS_STATUS_E_FAULT: pointer to SAP cb is NULL ; access would cause a page
347 fault
348 VOS_STATUS_SUCCESS: Everything is good :)
349
350 SIDE EFFECTS
351
352============================================================================*/
353VOS_STATUS
354WLANSAP_CleanCB
355(
356 ptSapContext pSapCtx,
357 v_U32_t freeFlag /* If 0 do not empty */
358);
359/*==========================================================================
360
361 FUNCTION WLANSapFsm
362
363 DESCRIPTION
364 SAP forward state machine to handle the states of the SAP
365
366 DEPENDENCIES
367
368 PARAMETERS
369
370 IN
371 sapContext: pointer to the SAP control block
372 sapEvent : SAP event
373 status : status of SAP state machine
374
375 RETURN VALUE
376 Status of the SAP forward machine
377
378 VOS_STATUS_E_FAULT: pointer to SAP cb is NULL ; access would cause a page
379 fault
380 VOS_STATUS_SUCCESS: Everything is good :)
381
382 SIDE EFFECTS
383
384============================================================================*/
385
386VOS_STATUS
387SapFsm
388(
389 ptSapContext sapContext, /* sapContext value */
390 ptWLAN_SAPEvent sapEvent, /* State machine event */
391 v_U8_t *status /* return the SAP status here */
392);
393
394/*==========================================================================
395
396 FUNCTION WLANSAP_pmcFullPwrReqCB
397
398 DESCRIPTION
399 Callback provide to PMC in the pmcRequestFullPower API.
400
401 DEPENDENCIES
402
403 PARAMETERS
404
405 IN
406 callbackContext: The user passed in a context to identify
407 status: The halStatus
408
409 RETURN VALUE
410 None
411
412 SIDE EFFECTS
413
414============================================================================*/
415void
416WLANSAP_pmcFullPwrReqCB
417(
418 void *callbackContext,
419 eHalStatus status
420);
421
422/*==========================================================================
423
424 FUNCTION sapSelectChannel
425
426 DESCRIPTION
427 Runs a algorithm to select the best channel to operate in for Soft AP in 2.4GHz band
428
429 DEPENDENCIES
430
431 PARAMETERS
432
433 IN
434 halHandle : Pointer to HAL handle
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700435 pSapCtx : Pointer to SAP context
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 pResult : Pointer to tScanResultHandle
437
438 RETURN VALUE
439 If SUCCESS channel number or zero for FAILURE.
440
441 SIDE EFFECTS
442
443============================================================================*/
Madan Mohan Koyyalamudi5aef2af2012-10-05 11:56:27 -0700444
445v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResultHandle pScanResult);
Jeff Johnson295189b2012-06-20 16:38:30 -0700446
447/*==========================================================================
448
449 FUNCTION sapSignalHDDevent
450
451 DESCRIPTION
452 SAP HDD event callback function
453
454 DEPENDENCIES
455
456 PARAMETERS
457
458 IN
459 sapContext : Pointer to SAP handle
460 pCsrRoamInfo : csrRoamprofile
461 sapHddevent : SAP HDD callback event
462
463 RETURN VALUE
464 If SUCCESS or FAILURE.
465
466 SIDE EFFECTS
467
468============================================================================*/
469
470VOS_STATUS
471sapSignalHDDevent( ptSapContext sapContext, tCsrRoamInfo * pCsrRoamInfo, eSapHddEvent sapHddevent, void *);
472
473/*==========================================================================
474
475 FUNCTION sapFsm
476
477 DESCRIPTION
478 SAP Forward state machine
479
480 DEPENDENCIES
481
482 PARAMETERS
483
484 IN
485 sapContext : Pointer to SAP handle
486 sapEvent : state machine event
487
488 RETURN VALUE
489 If SUCCESS or FAILURE.
490
491 SIDE EFFECTS
492
493============================================================================*/
494VOS_STATUS
495sapFsm
496(
497 ptSapContext sapContext, /* sapContext value */
498 ptWLAN_SAPEvent sapEvent /* State machine event */
499);
500
501/*==========================================================================
502
503 FUNCTION sapConvertToCsrProfile
504
505 DESCRIPTION
506 sapConvertToCsrProfile
507
508 DEPENDENCIES
509
510 PARAMETERS
511
512 IN
513 pconfig_params : Pointer to configuration structure
514 bssType : SoftAP type
515 profile : pointer to a csrProfile that needs to be passed
516
517 RETURN VALUE
518 If SUCCESS or FAILURE.
519
520 SIDE EFFECTS
521
522============================================================================*/
523eSapStatus
524sapconvertToCsrProfile(tsap_Config_t *pconfig_params, eCsrRoamBssType bssType, tCsrRoamProfile *profile);
525
526/*==========================================================================
527
528 FUNCTION sapFreeRoamProfile
529
530 DESCRIPTION
531 sapConvertToCsrProfile
532
533 DEPENDENCIES
534
535 PARAMETERS
536
537 IN
538 profile : pointer to a csrProfile that needs to be freed
539
540 RETURN VALUE
541 If SUCCESS or FAILURE.
542
543 SIDE EFFECTS
544
545============================================================================*/
546void sapFreeRoamProfile(tCsrRoamProfile *profile);
547
548/*==========================================================================
549
550 FUNCTION sapIsPeerMacAllowed
551
552 DESCRIPTION
553 Function to implement MAC filtering for station association in SoftAP
554
555 DEPENDENCIES
556
557 PARAMETERS
558
559 IN
560 sapContext : Pointer to SAP handle
561 peerMac : Mac address of the peer
562
563 RETURN VALUE
564 If SUCCESS or FAILURE.
565
566 SIDE EFFECTS
567
568============================================================================*/
569VOS_STATUS
570sapIsPeerMacAllowed(ptSapContext sapContext, v_U8_t *peerMac);
571
572/*==========================================================================
573
574 FUNCTION sapSortMacList
575
576 DESCRIPTION
577 Function to implement sorting of MAC addresses
578
579 DEPENDENCIES
580
581 PARAMETERS
582
583 IN
584 macList : Pointer to mac address array
585 size : Number of entries in mac address array
586
587 RETURN VALUE
588 None
589
590 SIDE EFFECTS
591
592============================================================================*/
593void
594sapSortMacList(v_MACADDR_t *macList, v_U8_t size);
595
596/*==========================================================================
597
598 FUNCTION sapAddMacToACL
599
600 DESCRIPTION
601 Function to ADD a mac address in an ACL.
602 The function ensures that the ACL list remains sorted after the addition.
603 This API does not take care of buffer overflow i.e. if the list is already maxed out while adding a mac address,
604 it will still try to add.
605 The caller must take care that the ACL size is less than MAX_MAC_ADDRESS_ACCEPTED before calling this function.
606
607 DEPENDENCIES
608
609 PARAMETERS
610
611 IN
612 macList : ACL list of mac addresses (black/white list)
613 size (I/O) : size of the ACL. It is an I/O arg. The API takes care of incrementing the size by 1.
614 peerMac : Mac address of the peer to be added
615
616 RETURN VALUE
617 None.
618
619 SIDE EFFECTS
620
621============================================================================*/
622void
623sapAddMacToACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t *peerMac);
624
625/*==========================================================================
626
627 FUNCTION sapRemoveMacFromACL
628
629 DESCRIPTION
630 Function to REMOVE a mac address from an ACL.
631 The function ensures that the ACL list remains sorted after the DELETION.
632
633 DEPENDENCIES
634
635 PARAMETERS
636
637 IN
638 macList : ACL list of mac addresses (black/white list)
639 size (I/O) : size of the ACL. It is an I/O arg. The API takes care of decrementing the size by 1.
640 index : index in the ACL list where the peerMac is present
641 This index can be found by using the "sapSearchMacList" API which returns the index of the MAC
642 addr, if found in an ACL, in one of the arguments passed by the caller.
643
644 RETURN VALUE
645 None.
646
647 SIDE EFFECTS
648
649============================================================================*/
650void
651sapRemoveMacFromACL(v_MACADDR_t *macList, v_U8_t *size, v_U8_t index);
652
653/*==========================================================================
654
655 FUNCTION sapPrintACL
656
657 DESCRIPTION
658 Function to print all the mac address of an ACL.
659 Useful for debug.
660
661 DEPENDENCIES
662
663 PARAMETERS
664
665 IN
666 macList : ACL list of mac addresses (black/white list)
667 size : size of the ACL
668
669 RETURN VALUE
670 None.
671
672 SIDE EFFECTS
673
674============================================================================*/
675void
676sapPrintACL(v_MACADDR_t *macList, v_U8_t size);
677
678/*==========================================================================
679
680 FUNCTION sapSearchMacList
681
682 DESCRIPTION
683 Function to search for a mac address in an ACL
684
685 DEPENDENCIES
686
687 PARAMETERS
688
689 IN
690 macList : list of mac addresses (black/white list)
691 num_mac : size of the ACL
692 peerMac : Mac address of the peer
693 OP
694 index : the index at which the peer mac is found
695 this value gets filled in this function. If the caller is not interested
696 in the index of the peerMac to be searched, it can pass NULL here.
697
698 RETURN VALUE
699 SUCCESS : if the mac addr being searched for is found
700 FAILURE : if the mac addr being searched for is NOT found
701
702 SIDE EFFECTS
703
704============================================================================*/
705eSapBool
706sapSearchMacList(v_MACADDR_t *macList, v_U8_t num_mac, v_U8_t *peerMac, v_U8_t *index);
707
708
709/*==========================================================================
710
711 FUNCTION sap_AcquireGlobalLock
712
713 DESCRIPTION
714 Function to implement acquire SAP global lock
715
716 DEPENDENCIES
717
718 PARAMETERS
719
720 IN
721 sapContext : Pointer to SAP handle
722 peerMac : Mac address of the peer
723
724 RETURN VALUE
725 If SUCCESS or FAILURE.
726
727 SIDE EFFECTS
728
729============================================================================*/
730VOS_STATUS
731sap_AcquireGlobalLock( ptSapContext pSapCtx );
732
733/*==========================================================================
734
735 FUNCTION sapIsPeerMacAllowed
736
737 DESCRIPTION
738 Function to implement release SAP global lock
739
740 DEPENDENCIES
741
742 PARAMETERS
743
744 IN
745 sapContext : Pointer to SAP handle
746 peerMac : Mac address of the peer
747
748 RETURN VALUE
749 If SUCCESS or FAILURE.
750
751 SIDE EFFECTS
752
753============================================================================*/
754VOS_STATUS
755sap_ReleaseGlobalLock( ptSapContext pSapCtx );
756
Madan Mohan Koyyalamudi527935a2012-12-04 16:41:16 -0800757VOS_STATUS
758wlan_sap_select_cbmode(void *pAdapter,eSapPhyMode SapHw_mode, v_U8_t channel);
759
Jeff Johnson295189b2012-06-20 16:38:30 -0700760#ifdef __cplusplus
761}
762#endif
763#endif /* #ifndef WLAN_QCT_WLANSAP_INTERNAL_H */
764