support different wifi bt chip auto compatible
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / mt5931_kk / drv_wlan / include / mgmt / sec_fsm.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_WIFI_DRIVER_V2_3/include/mgmt/sec_fsm.h#1 $
3 */
4
5 /*! \file   sec_fsm.h
6     \brief  Declaration of functions and finite state machine for SECURITY Module.
7
8     Function declaration for privacy.c and SEC_STATE for SECURITY FSM.
9 */
10
11 /*******************************************************************************
12 * Copyright (c) 2007 MediaTek Inc.
13 *
14 * All rights reserved. Copying, compilation, modification, distribution
15 * or any other use whatsoever of this material is strictly prohibited
16 * except in accordance with a Software License Agreement with
17 * MediaTek Inc.
18 ********************************************************************************
19 */
20
21 /*******************************************************************************
22 * LEGAL DISCLAIMER
23 *
24 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
25 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
26 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
27 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
28 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
29 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
30 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
31 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
32 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
33 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
34 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
35 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
36 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
37 *
38 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
39 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
40 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
41 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
42 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
43 *
44 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
45 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
46 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
47 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
48 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
49 * (ICC).
50 ********************************************************************************
51 */
52
53 /*
54 ** $Log: sec_fsm.h $
55  *
56  * 09 29 2010 wh.su
57  * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
58  * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue.
59  *
60  * 09 21 2010 kevin.huang
61  * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
62  * Eliminate Linux Compile Warning
63  *
64  * 09 03 2010 kevin.huang
65  * NULL
66  * Refine #include sequence and solve recursive/nested #include issue
67  *
68  * 08 20 2010 wh.su
69  * NULL
70  * adding the eapol callback setting.
71  *
72  * 08 19 2010 wh.su
73  * NULL
74  * adding the tx pkt call back handle for countermeasure.
75  *
76  * 07 08 2010 cp.wu
77  *
78  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
79  *
80  * 06 21 2010 wh.su
81  * [WPD00003840][MT6620 5931] Security migration
82  * modify some code for concurrent network.
83  *
84  * 06 19 2010 wh.su
85  * [WPD00003840][MT6620 5931] Security migration
86  * consdier the concurrent network setting.
87  *
88  * 03 04 2010 wh.su
89  * [BORA00000605][WIFISYS] Phase3 Integration
90  * Code refine, and remove non-used code.
91  *
92  * 03 03 2010 wh.su
93  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
94  * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
95  *
96  * 03 01 2010 wh.su
97  * [BORA00000605][WIFISYS] Phase3 Integration
98  * Refine the variable and parameter for security.
99  *
100  * 12 18 2009 cm.chang
101  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
102  * .
103  *
104  * Dec 7 2009 mtk01088
105  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
106  * fixed the deauth Tx done callback parameter
107  *
108  * Dec 4 2009 mtk01088
109  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
110  * adding the reference function declaration
111  *
112  * Dec 3 2009 mtk01088
113  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
114  * delete non-used code
115  *
116  * Dec 1 2009 mtk01088
117  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
118  * adjust the function prototype
119  *
120  * Nov 23 2009 mtk01088
121  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
122  * adjust the function declaration
123  *
124  * Nov 19 2009 mtk01088
125  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
126  * adding the security variable
127  *
128  * Nov 18 2009 mtk01088
129  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
130  *
131 **  \main\maintrunk.MT5921\14 2009-04-06 15:35:47 GMT mtk01088
132 **  add the variable to set the disable AP selection for privacy check, for wps open networking.
133 **  \main\maintrunk.MT5921\13 2008-11-19 11:46:01 GMT mtk01088
134 **  rename some variable with pre-fix to avoid the misunderstanding
135 **  \main\maintrunk.MT5921\12 2008-08-28 20:37:11 GMT mtk01088
136 **  remove non-used code
137 **
138 **  \main\maintrunk.MT5921\11 2008-03-18 09:51:52 GMT mtk01088
139 **  Add function declaration for timer to indicate pmkid candidate
140 **  \main\maintrunk.MT5921\10 2008-02-29 15:12:08 GMT mtk01088
141 **  add variable for sw port control
142 **  \main\maintrunk.MT5921\9 2008-02-29 12:37:30 GMT mtk01088
143 **  rename the security related function declaration
144 **  \main\maintrunk.MT5921\8 2007-12-27 13:59:08 GMT mtk01088
145 **  adjust the wlan table and sec fsm init timing
146 **  \main\maintrunk.MT5921\7 2007-11-20 10:39:49 GMT mtk01088
147 **  add function timer for wait EAPoL Error timeout
148 **  \main\maintrunk.MT5921\6 2007-11-06 20:39:08 GMT mtk01088
149 **  rename the counter measure timer
150 **  \main\maintrunk.MT5921\5 2007-11-06 20:14:31 GMT mtk01088
151 **  add a abort function
152 ** Revision 1.5  2007/07/16 02:33:42  MTK01088
153 ** change the ENUM declaration structure prefix from r to e
154 **
155 ** Revision 1.4  2007/07/09 06:23:10  MTK01088
156 ** update
157 **
158 ** Revision 1.3  2007/07/04 10:09:04  MTK01088
159 ** adjust the state for security fsm
160 ** change function name
161 **
162 ** Revision 1.2  2007/07/03 08:13:22  MTK01088
163 ** change the sec fsm state
164 ** add the event for sec fsm
165 **
166 ** Revision 1.1  2007/06/27 06:20:35  MTK01088
167 ** add the sec fsm header file
168 **
169 **
170 */
171 #ifndef _SEC_FSM_H
172 #define _SEC_FSM_H
173
174 /*******************************************************************************
175 *                         C O M P I L E R   F L A G S
176 ********************************************************************************
177 */
178
179 /*******************************************************************************
180 *                    E X T E R N A L   R E F E R E N C E S
181 ********************************************************************************
182 */
183  
184 /*******************************************************************************
185 *                              C O N S T A N T S
186 ********************************************************************************
187 */
188
189 /* TKIP CounterMeasure interval for Rejoin to Network. */
190 #define COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC        60
191
192 /* Timeout to wait the EAPoL Error Report frame Send out. */
193 #define EAPOL_REPORT_SEND_TIMEOUT_INTERVAL_SEC       1
194
195 /*******************************************************************************
196 *                             D A T A   T Y P E S
197 ********************************************************************************
198 */
199
200 typedef UINT_32             SEC_STATUS, *P_SEC_STATUS;
201
202 #if 0
203 /* WPA2 PMKID candicate structure */
204 typedef struct _PMKID_CANDICATE_T {
205     UINT_8              aucBssid[MAC_ADDR_LEN];    /* MAC address */
206     UINT_32             u4PreAuthFlags;
207 } PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T;
208 #endif
209
210 typedef SEC_STATUS (*PFN_SEC_FSM_STATE_HANDLER)(VOID);
211
212 /*******************************************************************************
213 *                            P U B L I C   D A T A
214 ********************************************************************************
215 */
216
217 /*******************************************************************************
218 *                           P R I V A T E   D A T A
219 ********************************************************************************
220 */
221
222 /*******************************************************************************
223 *                                 M A C R O S
224 ********************************************************************************
225 */
226 #define SEC_STATE_TRANSITION_FLAG   fgIsTransition
227 #define SEC_NEXT_STATE_VAR          eNextState
228
229 #define SEC_STATE_TRANSITION(prAdapter, prSta, eFromState, eToState) \
230         { secFsmTrans_ ## eFromState ## _to_ ## eToState(prAdapter, prSta); \
231           SEC_NEXT_STATE_VAR = SEC_STATE_ ## eToState; \
232           SEC_STATE_TRANSITION_FLAG = (BOOLEAN)TRUE; \
233         }
234
235 /*******************************************************************************
236 *                  F U N C T I O N   D E C L A R A T I O N S
237 ********************************************************************************
238 */
239
240 /*--------------------------------------------------------------*/
241 /* Routines to handle the sec check                             */
242 /*--------------------------------------------------------------*/
243 /***** Routines in sec_fsm.c *****/
244 VOID
245 secFsmInit(
246     IN P_ADAPTER_T          prAdapter,
247     IN P_STA_RECORD_T       prSta
248     );
249
250 VOID
251 secFsmEventInit(
252     IN P_ADAPTER_T          prAdapter,
253     IN P_STA_RECORD_T       prSta
254     );
255
256 VOID
257 secFsmEventStart(
258     IN P_ADAPTER_T          prAdapter,
259     IN P_STA_RECORD_T       prSta
260     );
261
262 VOID
263 secFsmEventAbort(
264     IN P_ADAPTER_T          prAdapter,
265     IN P_STA_RECORD_T       prSta
266     );
267
268 BOOLEAN
269 secFsmEventPTKInstalled(
270     IN P_ADAPTER_T          prAdapter,
271     IN P_STA_RECORD_T       prSta
272     );
273
274 VOID
275 secFsmEvent2ndEapolTx(
276     IN P_ADAPTER_T          prAdapter,
277     IN P_STA_RECORD_T       prSta
278     );
279
280 VOID
281 secFsmEvent4ndEapolTxDone(
282     IN P_ADAPTER_T          prAdapter,
283     IN P_STA_RECORD_T       prSta
284     );
285
286 VOID
287 secFsmEventEapolTxDone (
288     IN P_ADAPTER_T          prAdapter,
289     IN P_STA_RECORD_T       prStaRec,
290     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
291     );
292
293 VOID
294 secFsmEventEapolTxTimeout (
295     IN P_ADAPTER_T            prAdapter,
296     IN UINT_32                u4Parm
297     );
298
299 VOID
300 secFsmEventDeauthTxDone(
301     IN P_ADAPTER_T          prAdapter,
302     IN P_MSDU_INFO_T        prMsduInfo,
303     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
304     );
305
306 VOID
307 secFsmEventStartCounterMeasure(
308     IN P_ADAPTER_T          prAdapter,
309     IN P_STA_RECORD_T       prSta
310     );
311
312 VOID
313 secFsmEventEndOfCounterMeasure(
314     IN P_ADAPTER_T          prAdapter,
315     IN UINT_32              u4Parm
316     );
317
318 /*******************************************************************************
319 *                              F U N C T I O N S
320 ********************************************************************************
321 */
322 #endif /* _SEC_FSM_H */
323
324