wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6620 / wlan / include / mgmt / sec_fsm.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_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
13 /*
14 ** $Log: sec_fsm.h $
15  *
16  * 09 29 2010 wh.su
17  * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
18  * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue.
19  *
20  * 09 21 2010 kevin.huang
21  * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
22  * Eliminate Linux Compile Warning
23  *
24  * 09 03 2010 kevin.huang
25  * NULL
26  * Refine #include sequence and solve recursive/nested #include issue
27  *
28  * 08 20 2010 wh.su
29  * NULL
30  * adding the eapol callback setting.
31  *
32  * 08 19 2010 wh.su
33  * NULL
34  * adding the tx pkt call back handle for countermeasure.
35  *
36  * 07 08 2010 cp.wu
37  *
38  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
39  *
40  * 06 21 2010 wh.su
41  * [WPD00003840][MT6620 5931] Security migration
42  * modify some code for concurrent network.
43  *
44  * 06 19 2010 wh.su
45  * [WPD00003840][MT6620 5931] Security migration
46  * consdier the concurrent network setting.
47  *
48  * 03 04 2010 wh.su
49  * [BORA00000605][WIFISYS] Phase3 Integration
50  * Code refine, and remove non-used code.
51  *
52  * 03 03 2010 wh.su
53  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
54  * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
55  *
56  * 03 01 2010 wh.su
57  * [BORA00000605][WIFISYS] Phase3 Integration
58  * Refine the variable and parameter for security.
59  *
60  * 12 18 2009 cm.chang
61  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
62  * .
63  *
64  * Dec 7 2009 mtk01088
65  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
66  * fixed the deauth Tx done callback parameter
67  *
68  * Dec 4 2009 mtk01088
69  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
70  * adding the reference function declaration
71  *
72  * Dec 3 2009 mtk01088
73  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
74  * delete non-used code
75  *
76  * Dec 1 2009 mtk01088
77  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
78  * adjust the function prototype
79  *
80  * Nov 23 2009 mtk01088
81  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
82  * adjust the function declaration
83  *
84  * Nov 19 2009 mtk01088
85  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
86  * adding the security variable
87  *
88  * Nov 18 2009 mtk01088
89  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
90  *
91 **  \main\maintrunk.MT5921\14 2009-04-06 15:35:47 GMT mtk01088
92 **  add the variable to set the disable AP selection for privacy check, for wps open networking.
93 **  \main\maintrunk.MT5921\13 2008-11-19 11:46:01 GMT mtk01088
94 **  rename some variable with pre-fix to avoid the misunderstanding
95 **  \main\maintrunk.MT5921\12 2008-08-28 20:37:11 GMT mtk01088
96 **  remove non-used code
97 **
98 **  \main\maintrunk.MT5921\11 2008-03-18 09:51:52 GMT mtk01088
99 **  Add function declaration for timer to indicate pmkid candidate
100 **  \main\maintrunk.MT5921\10 2008-02-29 15:12:08 GMT mtk01088
101 **  add variable for sw port control
102 **  \main\maintrunk.MT5921\9 2008-02-29 12:37:30 GMT mtk01088
103 **  rename the security related function declaration
104 **  \main\maintrunk.MT5921\8 2007-12-27 13:59:08 GMT mtk01088
105 **  adjust the wlan table and sec fsm init timing
106 **  \main\maintrunk.MT5921\7 2007-11-20 10:39:49 GMT mtk01088
107 **  add function timer for wait EAPoL Error timeout
108 **  \main\maintrunk.MT5921\6 2007-11-06 20:39:08 GMT mtk01088
109 **  rename the counter measure timer
110 **  \main\maintrunk.MT5921\5 2007-11-06 20:14:31 GMT mtk01088
111 **  add a abort function
112 ** Revision 1.5  2007/07/16 02:33:42  MTK01088
113 ** change the ENUM declaration structure prefix from r to e
114 **
115 ** Revision 1.4  2007/07/09 06:23:10  MTK01088
116 ** update
117 **
118 ** Revision 1.3  2007/07/04 10:09:04  MTK01088
119 ** adjust the state for security fsm
120 ** change function name
121 **
122 ** Revision 1.2  2007/07/03 08:13:22  MTK01088
123 ** change the sec fsm state
124 ** add the event for sec fsm
125 **
126 ** Revision 1.1  2007/06/27 06:20:35  MTK01088
127 ** add the sec fsm header file
128 **
129 **
130 */
131 #ifndef _SEC_FSM_H
132 #define _SEC_FSM_H
133
134 /*******************************************************************************
135 *                         C O M P I L E R   F L A G S
136 ********************************************************************************
137 */
138
139 /*******************************************************************************
140 *                    E X T E R N A L   R E F E R E N C E S
141 ********************************************************************************
142 */
143  
144 /*******************************************************************************
145 *                              C O N S T A N T S
146 ********************************************************************************
147 */
148
149 /* TKIP CounterMeasure interval for Rejoin to Network. */
150 #define COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC        60
151
152 /* Timeout to wait the EAPoL Error Report frame Send out. */
153 #define EAPOL_REPORT_SEND_TIMEOUT_INTERVAL_SEC       1
154
155 /*******************************************************************************
156 *                             D A T A   T Y P E S
157 ********************************************************************************
158 */
159
160 typedef UINT_32             SEC_STATUS, *P_SEC_STATUS;
161
162 #if 0
163 /* WPA2 PMKID candicate structure */
164 typedef struct _PMKID_CANDICATE_T {
165     UINT_8              aucBssid[MAC_ADDR_LEN];    /* MAC address */
166     UINT_32             u4PreAuthFlags;
167 } PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T;
168 #endif
169
170 typedef SEC_STATUS (*PFN_SEC_FSM_STATE_HANDLER)(VOID);
171
172 /*******************************************************************************
173 *                            P U B L I C   D A T A
174 ********************************************************************************
175 */
176
177 /*******************************************************************************
178 *                           P R I V A T E   D A T A
179 ********************************************************************************
180 */
181
182 /*******************************************************************************
183 *                                 M A C R O S
184 ********************************************************************************
185 */
186 #define SEC_STATE_TRANSITION_FLAG   fgIsTransition
187 #define SEC_NEXT_STATE_VAR          eNextState
188
189 #define SEC_STATE_TRANSITION(prAdapter, prSta, eFromState, eToState) \
190         { secFsmTrans_ ## eFromState ## _to_ ## eToState(prAdapter, prSta); \
191           SEC_NEXT_STATE_VAR = SEC_STATE_ ## eToState; \
192           SEC_STATE_TRANSITION_FLAG = (BOOLEAN)TRUE; \
193         }
194
195 /*******************************************************************************
196 *                  F U N C T I O N   D E C L A R A T I O N S
197 ********************************************************************************
198 */
199
200 /*--------------------------------------------------------------*/
201 /* Routines to handle the sec check                             */
202 /*--------------------------------------------------------------*/
203 /***** Routines in sec_fsm.c *****/
204 VOID
205 secFsmInit(
206     IN P_ADAPTER_T          prAdapter,
207     IN P_STA_RECORD_T       prSta
208     );
209
210 VOID
211 secFsmEventInit(
212     IN P_ADAPTER_T          prAdapter,
213     IN P_STA_RECORD_T       prSta
214     );
215
216 VOID
217 secFsmEventStart(
218     IN P_ADAPTER_T          prAdapter,
219     IN P_STA_RECORD_T       prSta
220     );
221
222 VOID
223 secFsmEventAbort(
224     IN P_ADAPTER_T          prAdapter,
225     IN P_STA_RECORD_T       prSta
226     );
227
228 BOOLEAN
229 secFsmEventPTKInstalled(
230     IN P_ADAPTER_T          prAdapter,
231     IN P_STA_RECORD_T       prSta
232     );
233
234 VOID
235 secFsmEvent2ndEapolTx(
236     IN P_ADAPTER_T          prAdapter,
237     IN P_STA_RECORD_T       prSta
238     );
239
240 VOID
241 secFsmEvent4ndEapolTxDone(
242     IN P_ADAPTER_T          prAdapter,
243     IN P_STA_RECORD_T       prSta
244     );
245
246 VOID
247 secFsmEventEapolTxDone (
248     IN P_ADAPTER_T          prAdapter,
249     IN P_STA_RECORD_T       prStaRec,
250     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
251     );
252
253 VOID
254 secFsmEventEapolTxTimeout (
255     IN P_ADAPTER_T            prAdapter,
256     IN UINT_32                u4Parm
257     );
258
259 VOID
260 secFsmEventDeauthTxDone(
261     IN P_ADAPTER_T          prAdapter,
262     IN P_MSDU_INFO_T        prMsduInfo,
263     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
264     );
265
266 VOID
267 secFsmEventStartCounterMeasure(
268     IN P_ADAPTER_T          prAdapter,
269     IN P_STA_RECORD_T       prSta
270     );
271
272 VOID
273 secFsmEventEndOfCounterMeasure(
274     IN P_ADAPTER_T          prAdapter,
275     IN UINT_32              u4Parm
276     );
277
278 /*******************************************************************************
279 *                              F U N C T I O N S
280 ********************************************************************************
281 */
282 #endif /* _SEC_FSM_H */
283
284