7d09deb1ea19a238c4a646f9fef89b9dd28f2ab0
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / mt5931_kk / drv_wlan / mgmt / sec_fsm.c
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_WIFI_DRIVER_V2_3/mgmt/sec_fsm.c#1 $
3 */
4
5 /*! \file   "sec_fsm.c"
6     \brief  This is the file implement security check state machine.
7
8     In security module, do the port control check after success join to an AP,
9     and the path to NORMAL TR, the state machine handle these state transition.
10 */
11
12 /*******************************************************************************
13 * Copyright (c) 2007 MediaTek Inc.
14 *
15 * All rights reserved. Copying, compilation, modification, distribution
16 * or any other use whatsoever of this material is strictly prohibited
17 * except in accordance with a Software License Agreement with
18 * MediaTek Inc.
19 ********************************************************************************
20 */
21
22 /*******************************************************************************
23 * LEGAL DISCLAIMER
24 *
25 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
26 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
27 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
28 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
29 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
30 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
31 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
32 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
33 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
34 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
35 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
36 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
37 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
38 *
39 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
40 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
41 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
42 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
43 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
44 *
45 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
46 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
47 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
48 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
49 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
50 * (ICC).
51 ********************************************************************************
52 */
53
54 /*
55 ** $Log: sec_fsm.c $
56  *
57  * 11 24 2011 wh.su
58  * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
59  * Adjust code for DBG and CONFIG_XLOG.
60  *
61  * 11 11 2011 wh.su
62  * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
63  * modify the xlog related code.
64  *
65  * 11 10 2011 wh.su
66  * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
67  * change the debug module level.
68  *
69  * 11 02 2011 wh.su
70  * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
71  * adding the code for XLOG.
72  *
73  * 03 29 2011 wh.su
74  * [WCXRP00000248] [MT6620 Wi-Fi][FW]Fixed the Klockwork error
75  * fixed the kclocwork error.
76  *
77  * 01 26 2011 yuche.tsai
78  * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
79  * .
80  *
81  * 01 25 2011 yuche.tsai
82  * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
83  * Fix Compile Error when DBG is disabled.
84  *
85  * 01 25 2011 yuche.tsai
86  * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
87  * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role.
88  *
89  * 09 29 2010 wh.su
90  * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
91  * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue.
92  *
93  * 09 24 2010 wh.su
94  * NULL
95  * [WCXRP00005002][MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning.
96  *
97  * 09 03 2010 kevin.huang
98  * NULL
99  * Refine #include sequence and solve recursive/nested #include issue
100  *
101  * 08 20 2010 wh.su
102  * NULL
103  * adding the eapol callback setting.
104  *
105  * 08 19 2010 wh.su
106  * NULL
107  * adding the tx pkt call back handle for countermeasure.
108  *
109  * 07 19 2010 wh.su
110  *
111  * fixed the compilng error at debug mode.
112  *
113  * 07 08 2010 cp.wu
114  *
115  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
116  *
117  * 06 21 2010 wh.su
118  * [WPD00003840][MT6620 5931] Security migration
119  * modify some code for concurrent network.
120  *
121  * 06 19 2010 wh.su
122  * [WPD00003840][MT6620 5931] Security migration
123  * consdier the concurrent network setting.
124  *
125  * 05 28 2010 wh.su
126  * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing
127  * fixed the ad-hoc wpa-none send non-encrypted frame issue.
128  *
129  * 05 24 2010 kevin.huang
130  * [BORA00000794][WIFISYS][New Feature]Power Management Support
131  * Refine authSendAuthFrame() for NULL STA_RECORD_T case and minimum deauth interval.
132  *
133  * 04 24 2010 cm.chang
134  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
135  * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW
136  *
137  * 04 13 2010 wh.su
138  * [BORA00000680][MT6620] Support the statistic for Microsoft os query
139  * fixed the Klocwork error and refine the class error message.
140  *
141  * 03 03 2010 wh.su
142  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
143  * move the AIS specific variable for security to AIS specific structure.
144  *
145  * 03 03 2010 wh.su
146  * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
147  * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype.
148  *
149  * 03 01 2010 wh.su
150  * [BORA00000605][WIFISYS] Phase3 Integration
151  * Refine the variable and parameter for security.
152  *
153  * 01 27 2010 wh.su
154  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
155  * add and fixed some security function.
156  *
157  * 01 13 2010 wh.su
158  * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
159  * fixed the compiling warning
160  *
161  * 12 18 2009 cm.chang
162  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
163  * .
164  *
165  * Dec 7 2009 mtk01088
166  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
167  * refine some code
168  *
169  * Dec 4 2009 mtk01088
170  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
171  * refine the code
172  *
173  * Dec 1 2009 mtk01088
174  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
175  * code refine
176  *
177  * Nov 23 2009 mtk01088
178  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
179  * adjust the function name
180  *
181  * Nov 19 2009 mtk01088
182  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
183  * adjust the state machine, to meet the firmware security design v1.1
184  *
185  * Nov 18 2009 mtk01088
186  * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
187  *
188 **
189 */
190
191 /*******************************************************************************
192 *                         C O M P I L E R   F L A G S
193 ********************************************************************************
194 */
195
196 /*******************************************************************************
197 *                    E X T E R N A L   R E F E R E N C E S
198 ********************************************************************************
199 */
200 #include "precomp.h"
201
202 #if CFG_RSN_MIGRATION
203
204 /*******************************************************************************
205 *                              C O N S T A N T S
206 ********************************************************************************
207 */
208
209 /*******************************************************************************
210 *                             D A T A   T Y P E S
211 ********************************************************************************
212 */
213
214 /*******************************************************************************
215 *                            P U B L I C   D A T A
216 ********************************************************************************
217 */
218
219 /*******************************************************************************
220 *                           P R I V A T E   D A T A
221 ********************************************************************************
222 */
223 #if DBG
224 /*lint -save -e64 Type mismatch */
225 static PUINT_8 apucDebugSecState[SEC_STATE_NUM] = {
226     (PUINT_8)DISP_STRING("SEC_STATE_INIT"),
227     (PUINT_8)DISP_STRING("SEC_STATE_INITIATOR_PORT_BLOCKED"),
228     (PUINT_8)DISP_STRING("SEC_STATE_RESPONDER_PORT_BLOCKED"),
229     (PUINT_8)DISP_STRING("SEC_STATE_CHECK_OK"),
230     (PUINT_8)DISP_STRING("SEC_STATE_SEND_EAPOL"),
231     (PUINT_8)DISP_STRING("SEC_STATE_SEND_DEAUTH"),
232     (PUINT_8)DISP_STRING("SEC_STATE_COUNTERMEASURE"),
233 };
234 /*lint -restore */
235 #endif /* DBG */
236
237 /*******************************************************************************
238 *                                 M A C R O S
239 ********************************************************************************
240 */
241
242 /*******************************************************************************
243 *                   F U N C T I O N   D E C L A R A T I O N S
244 ********************************************************************************
245 */
246
247 /*******************************************************************************
248 *                              F U N C T I O N S
249 ********************************************************************************
250 */
251
252 /*----------------------------------------------------------------------------*/
253 /*!
254 * \brief This function will do initialization of Security FSM and all variables in
255 *        SEC_INFO_T.
256 *
257 * \param[in] prSta            Pointer to the STA record
258 *
259 * \return none
260 */
261 /*----------------------------------------------------------------------------*/
262 VOID
263 secFsmInit (
264     IN P_ADAPTER_T          prAdapter,
265     IN P_STA_RECORD_T       prSta
266     )
267 {
268     P_SEC_INFO_T            prSecInfo;
269     P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo;
270
271     ASSERT(prSta);
272
273     prSecInfo = &prSta->rSecInfo;
274
275     #if 1 /* MT6620 */
276     //At MT5921, is ok, but at MT6620, firmware base ASIC, the firmware
277     //will lost these data, thus, driver have to keep the wep material and
278     //setting to firmware while awake from D3.
279     #endif
280
281     prSecInfo->eCurrentState = SEC_STATE_INIT;
282
283     prSecInfo->fg2nd1xSend = FALSE;
284     prSecInfo->fgKeyStored = FALSE;
285
286     if (IS_STA_IN_AIS(prSta)) {
287         prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo;
288
289         prAisSpecBssInfo->u4RsnaLastMICFailTime = 0;
290         prAisSpecBssInfo->fgCheckEAPoLTxDone = FALSE;
291
292         cnmTimerInitTimer(prAdapter,
293                        &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer,
294                        (PFN_MGMT_TIMEOUT_FUNC)secFsmEventEapolTxTimeout,
295                        (UINT_32)prSta);
296
297         cnmTimerInitTimer(prAdapter,
298                        &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer,
299                        (PFN_MGMT_TIMEOUT_FUNC)secFsmEventEndOfCounterMeasure,
300                        (UINT_32)prSta);
301
302     }
303     return;
304 }
305
306
307 /*----------------------------------------------------------------------------*/
308 /*!
309 * \brief This function will do uninitialization of Security FSM and all variables in
310 *        SEC_INFO_T.
311 *
312 * \param[in] prSta            Pointer to the STA record
313 *
314 * \return none
315 */
316 /*----------------------------------------------------------------------------*/
317 VOID /* whsu:Todo: */
318 secFsmUnInit (
319     IN P_ADAPTER_T          prAdapter,
320     IN P_STA_RECORD_T       prSta
321     )
322 {
323     P_SEC_INFO_T prSecInfo;
324
325     ASSERT(prSta);
326
327     prSecInfo = &prSta->rSecInfo;
328
329     prSecInfo->fg2nd1xSend = FALSE;
330     prSecInfo->fgKeyStored = FALSE;
331
332     //nicPrivacyRemoveWlanTable(prSta->ucWTEntry);
333
334     if (IS_STA_IN_AIS(prSta)) {
335         cnmTimerStopTimer(prAdapter,
336                        &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer);
337         cnmTimerStopTimer(prAdapter,
338                        &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer);
339     }
340
341 }
342
343
344 /*----------------------------------------------------------------------------*/
345 /*!
346 * \brief This function will do action part while in STATE transition of
347 *        STANDBY to CHECK_OK.
348 *
349 * \param[in] prSta            Pointer to the Sta record
350 *
351 * \return - none
352 */
353 /*----------------------------------------------------------------------------*/
354 __KAL_INLINE__ VOID
355 secFsmTrans_INIT_to_CHECK_OK (
356     IN P_ADAPTER_T          prAdapter,
357     IN P_STA_RECORD_T       prSta
358     )
359 {
360     secSetPortBlocked(prAdapter, prSta, FALSE);
361
362     return;
363 }
364
365
366 /*----------------------------------------------------------------------------*/
367 /*!
368 * \brief This function will do action part while in STATE transition of
369 *        INIT to INITIATOR_PORT_BLOCKED.
370 *
371 * \param[in] prSta            Pointer to the Sta record
372 *
373 * \return - none
374 */
375 /*----------------------------------------------------------------------------*/
376 __KAL_INLINE__ VOID
377 secFsmTrans_INIT_to_INITIATOR_PORT_BLOCKED (
378     IN P_ADAPTER_T          prAdapter,
379     IN P_STA_RECORD_T       prSta
380     )
381 {
382
383     return;
384 }
385
386
387 /*----------------------------------------------------------------------------*/
388 /*!
389 * \brief This function will do action part while in STATE transition of
390 *        INIT to RESPONDER_PORT_BLOCKED.
391 *
392 * \param[in] prSta            Pointer to the Sta record
393 *
394 * \return - none
395 */
396 /*----------------------------------------------------------------------------*/
397 __KAL_INLINE__ VOID
398 secFsmTrans_INIT_to_RESPONDER_PORT_BLOCKED (
399     IN P_ADAPTER_T          prAdapter,
400     IN P_STA_RECORD_T       prSta
401     )
402 {
403     return;
404 }
405
406
407 /*----------------------------------------------------------------------------*/
408 /*!
409 * \brief This function will do action part while in STATE transition of
410 *        INITIATOR_PORT_BLOCKED to CHECK_OK.
411 *
412 * \param[in] prSta            Pointer to the Sta record
413 *
414 * \return - none
415 */
416 /*----------------------------------------------------------------------------*/
417 __KAL_INLINE__ VOID
418 secFsmTrans_INITIATOR_PORT_BLOCKED_to_CHECK_OK (
419     IN P_ADAPTER_T          prAdapter,
420     IN P_STA_RECORD_T       prSta
421     )
422 {
423     secSetPortBlocked(prAdapter, prSta, FALSE);
424     return;
425 }
426
427
428 /*----------------------------------------------------------------------------*/
429 /*!
430 * \brief This function will do action part while in STATE transition of
431 *        RESPONDER_PORT_BLOCKED to CHECK_OK.
432 *
433 * \param[in] prSta            Pointer to the Sta record
434 *
435 * \return - none
436 */
437 /*----------------------------------------------------------------------------*/
438 __KAL_INLINE__ VOID
439 secFsmTrans_RESPONDER_PORT_BLOCKED_to_CHECK_OK (
440     IN P_ADAPTER_T          prAdapter,
441     IN P_STA_RECORD_T       prSta
442     )
443 {
444     secSetPortBlocked(prAdapter, prSta, FALSE);
445     return;
446 }
447
448
449 /*----------------------------------------------------------------------------*/
450 /*!
451 * \brief This function will do action part while in STATE transition of
452 *        CHECK_OK to SEND_EAPOL
453 *
454 * \param[in] prSta            Pointer to the Sta record
455 *
456 * \return -
457 */
458 /*----------------------------------------------------------------------------*/
459 __KAL_INLINE__ VOID
460 secFsmTrans_CHECK_OK_to_SEND_EAPOL (
461     IN P_ADAPTER_T          prAdapter,
462     IN P_STA_RECORD_T       prSta
463     )
464 {
465
466     P_AIS_SPECIFIC_BSS_INFO_T prAisBssInfo;
467
468     ASSERT(prAdapter);
469
470     ASSERT(prSta);
471
472     prAisBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo;
473
474     ASSERT(prAisBssInfo);
475
476     if (!IS_STA_IN_AIS(prSta)) {
477         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
478         //ASSERT(0);
479         return;
480     }
481
482     prAisBssInfo->fgCheckEAPoLTxDone = TRUE;
483
484     //cnmTimerStartTimer(prAdapter,
485     //              &prAisBssInfo->rRsnaEAPoLReportTimeoutTimer,
486     //              SEC_TO_MSEC(EAPOL_REPORT_SEND_TIMEOUT_INTERVAL_SEC));
487
488     return;
489 }
490
491
492 /*----------------------------------------------------------------------------*/
493 /*!
494 * \brief This function will do action part while in STATE transition of
495 *        SEND_EAPOL to SEND_DEAUTH.
496 *
497 * \param[in] prSta            Pointer to the Sta record
498 *
499 * \return - none
500 */
501 /*----------------------------------------------------------------------------*/
502 __KAL_INLINE__ VOID
503 secFsmTrans_SEND_EAPOL_to_SEND_DEAUTH (
504     IN P_ADAPTER_T          prAdapter,
505     IN P_STA_RECORD_T       prSta
506     )
507 {
508
509     if (!IS_STA_IN_AIS(prSta)) {
510         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
511         //ASSERT(0);
512         return;
513     }
514
515     /* Compose deauth frame to AP, a call back function for tx done */
516     if (authSendDeauthFrame(prAdapter,
517                             prSta,
518                             (P_SW_RFB_T)NULL,
519                             REASON_CODE_MIC_FAILURE,
520                             (PFN_TX_DONE_HANDLER)secFsmEventDeauthTxDone) != WLAN_STATUS_SUCCESS) {
521         ASSERT(FALSE);
522     }
523 }
524
525
526 /*----------------------------------------------------------------------------*/
527 /*!
528 * \brief This function will do action part while in STATE transition of
529 *        SEND_DEAUTH to COUNTERMEASURE.
530 *
531 * \param[in] prSta            Pointer to the Sta record
532 *
533 * \return -
534 */
535 /*----------------------------------------------------------------------------*/
536 __KAL_INLINE__ VOID
537 secFsmTrans_SEND_DEAUTH_to_COUNTERMEASURE (
538     IN P_ADAPTER_T          prAdapter,
539     IN P_STA_RECORD_T       prSta
540     )
541 {
542     ASSERT(prAdapter);
543     ASSERT(prSta);
544
545     if (!IS_STA_IN_AIS(prSta)) {
546         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
547         //ASSERT(0);
548         return;
549     }
550
551     //Start the 60 sec timer
552     cnmTimerStartTimer(prAdapter,
553                 &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer,
554                 SEC_TO_MSEC(COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC));
555     return;
556 }
557
558
559 /*----------------------------------------------------------------------------*/
560 /*!
561 * \brief This function will do action part while in STATE transition of
562 *        SEND_DEAUTH to COUNTERMEASURE.
563 *
564 * \param[in] prSta            Pointer to the Sta record
565 *
566 * \return -
567 */
568 /*----------------------------------------------------------------------------*/
569 __KAL_INLINE__ VOID
570 secFsmTrans_COUNTERMEASURE_to_INIT (
571     IN P_ADAPTER_T          prAdapter,
572     IN P_STA_RECORD_T       prSta
573     )
574 {
575
576     //Clear the counter measure flag
577     return;
578 }
579
580 /*----------------------------------------------------------------------------*/
581 /*!
582 * \brief The Core FSM engine of security module.
583 *
584 * \param[in] prSta            Pointer to the Sta record
585 * \param[in] eNextState    Enum value of next sec STATE
586 *
587 * \return -
588 */
589 /*----------------------------------------------------------------------------*/
590 VOID
591 secFsmSteps (
592     IN P_ADAPTER_T          prAdapter,
593     IN P_STA_RECORD_T       prSta,
594     IN ENUM_SEC_STATE_T     eNextState
595     )
596 {
597     P_SEC_INFO_T            prSecInfo;
598     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
599
600     ASSERT(prSta);
601
602     prSecInfo = &prSta->rSecInfo;
603     ASSERT(prSecInfo);
604
605     DEBUGFUNC("secFsmSteps");
606     do {
607         /* Do entering Next State */
608         prSecInfo->ePreviousState = prSecInfo->eCurrentState;
609
610         /* Do entering Next State */
611 #if DBG
612         DBGLOG(RSN, STATE, ("\n"MACSTR" TRANSITION: [%s] -> [%s]\n\n",
613                             MAC2STR(prSta->aucMacAddr),
614                             apucDebugSecState[prSecInfo->eCurrentState],
615                             apucDebugSecState[eNextState]));
616 #else
617         DBGLOG(RSN, STATE, ("\n"MACSTR" [%d] TRANSITION: [%d] -> [%d]\n\n",
618                             MAC2STR(prSta->aucMacAddr),
619                             DBG_RSN_IDX,
620                             prSecInfo->eCurrentState,
621                             eNextState));
622 #endif
623         prSecInfo->eCurrentState = eNextState;
624
625         fgIsTransition = (BOOLEAN)FALSE;
626 #if 0
627         /* Do tasks of the State that we just entered */
628         switch (prSecInfo->eCurrentState) {
629         case SEC_STATE_INIT:
630         break;
631         case SEC_STATE_INITIATOR_PORT_BLOCKED:
632         break;
633         case SEC_STATE_RESPONDER_PORT_BLOCKED:
634         break;
635         case SEC_STATE_CHECK_OK:
636         break;
637         case SEC_STATE_SEND_EAPOL:
638         break;
639         case SEC_STATE_SEND_DEAUTH:
640         break;
641         case SEC_STATE_COUNTERMEASURE:
642         break;
643         default:
644             ASSERT(0); /* Make sure we have handle all STATEs */
645         break;
646         }
647 #endif
648     }
649     while (fgIsTransition);
650
651     return;
652
653 }
654
655
656 /*----------------------------------------------------------------------------*/
657 /*!
658 * \brief This function will do initialization of Security FSM and all variables in
659 *        SEC_INFO_T.
660 *
661 * \param[in] prSta            Pointer to the Sta record
662 *
663 * \return none
664 */
665 /*----------------------------------------------------------------------------*/
666 VOID
667 secFsmEventStart (
668     IN P_ADAPTER_T          prAdapter,
669     IN P_STA_RECORD_T       prSta
670     )
671 {
672     P_SEC_INFO_T            prSecInfo;
673     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
674     ENUM_SEC_STATE_T        eNextState;
675
676     DBGLOG(RSN, TRACE, ("secFsmRunEventStart\n"));
677
678     ASSERT(prSta);
679
680     if (!prSta)
681         return;
682
683     if (!IS_STA_IN_AIS(prSta))
684         return;
685
686     DBGLOG(RSN, TRACE, ("secFsmRunEventStart for sta "MACSTR" network %d\n",
687         MAC2STR(prSta->aucMacAddr), prSta->ucNetTypeIndex));
688
689     prSecInfo = (P_SEC_INFO_T)&prSta->rSecInfo;
690
691     eNextState = prSecInfo->eCurrentState;
692
693     secSetPortBlocked(prAdapter, prSta, TRUE);
694
695     //prSta->fgTransmitKeyExist = FALSE;
696     //whsu:: nicPrivacySetStaDefaultWTIdx(prSta);
697
698 #if 1 /* Since the 1x and key can set to firmware in order, always enter the check ok state */
699     SEC_STATE_TRANSITION(prAdapter, prSta, INIT, CHECK_OK);
700 #else
701     if (IS_STA_IN_AIS(prSta->eStaType)) {
702         if (secRsnKeyHandshakeEnabled(prAdapter) == TRUE
703 #if CFG_SUPPORT_WAPI
704             || (prAdapter->rWifiVar.rConnSettings.fgWapiMode)
705 #endif
706             ) {
707             prSta->fgTransmitKeyExist = FALSE;
708             //nicPrivacyInitialize(prSta->ucNetTypeIndex);
709             SEC_STATE_TRANSITION(prAdapter, prSta, INIT, INITIATOR_PORT_BLOCKED);
710         }
711         else {
712             SEC_STATE_TRANSITION(prAdapter, prSta, INIT, CHECK_OK);
713         }
714     }
715 #if CFG_ENABLE_WIFI_DIRECT || CFG_ENABLE_BT_OVER_WIFI
716     #if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_BT_OVER_WIFI
717     else if ((prSta->eStaType == STA_TYPE_BOW_CLIENT) ||
718         (prSta->eStaType == STA_TYPE_P2P_GC))
719     #elif CFG_ENABLE_WIFI_DIRECT
720     else if (prSta->eStaType == STA_TYPE_P2P_GC)
721     #elif CFG_ENABLE_BT_OVER_WIFI
722     else if (prSta->eStaType == STA_TYPE_BOW_CLIENT)
723     #endif
724     {
725         SEC_STATE_TRANSITION(prAdapter, prSta, INIT, RESPONDER_PORT_BLOCKED);
726     }
727 #endif
728     else {
729         SEC_STATE_TRANSITION(prAdapter, prSta, INIT, INITIATOR_PORT_BLOCKED);
730     }
731 #endif
732     if (prSecInfo->eCurrentState != eNextState) {
733         secFsmSteps(prAdapter, prSta, eNextState);
734     }
735
736     return;
737 } /* secFsmRunEventStart */
738
739
740 /*----------------------------------------------------------------------------*/
741 /*!
742 * \brief This function called by reset procedure to force the sec fsm enter
743 *        idle state
744 *
745 * \param[in] ucNetTypeIdx  The Specific Network type index
746 * \param[in] prSta         Pointer to the Sta record
747 *
748 * \return none
749 */
750 /*----------------------------------------------------------------------------*/
751 VOID
752 secFsmEventAbort (
753     IN P_ADAPTER_T          prAdapter,
754     IN P_STA_RECORD_T       prSta
755     )
756 {
757     P_SEC_INFO_T            prSecInfo;
758
759     DBGLOG(RSN, TRACE, ("secFsmEventAbort for sta "MACSTR" network %d\n",
760         MAC2STR(prSta->aucMacAddr), prSta->ucNetTypeIndex));
761
762     ASSERT(prSta);
763
764     if (!prSta)
765         return;
766
767     if (!IS_STA_IN_AIS(prSta))
768         return;
769
770     prSecInfo = (P_SEC_INFO_T)&prSta->rSecInfo;
771
772     prSta->fgTransmitKeyExist = FALSE;
773
774     secSetPortBlocked(prAdapter, prSta, TRUE);
775
776     if (prSecInfo == NULL)
777         return;
778
779     if (IS_STA_IN_AIS(prSta)) {
780
781         prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist = FALSE;
782
783         if (prSecInfo->eCurrentState == SEC_STATE_SEND_EAPOL) {
784             if (prAdapter->rWifiVar.rAisSpecificBssInfo.fgCheckEAPoLTxDone == FALSE) {
785                 DBGLOG(RSN, TRACE, ("EAPOL STATE not match the flag\n"));
786                 //cnmTimerStopTimer(prAdapter, &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer);
787             }
788         }
789     }
790     prSecInfo->eCurrentState = SEC_STATE_INIT;
791 }
792
793
794 /*----------------------------------------------------------------------------*/
795 /*!
796 * \brief This function will indicate an Event of "2nd EAPoL Tx is sending" to Sec FSM.
797 *
798 * \param[in] prSta            Pointer to the Sta record
799 *
800 * \return -
801 */
802 /*----------------------------------------------------------------------------*/
803 VOID
804 secFsmEvent2ndEapolTx (
805     IN P_ADAPTER_T          prAdapter,
806     IN P_STA_RECORD_T       prSta
807     )
808 {
809     P_SEC_INFO_T            prSecInfo;
810     ENUM_SEC_STATE_T        eNextState;
811     //BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
812
813     DEBUGFUNC("secFsmRunEvent2ndEapolTx");
814
815     ASSERT(prSta);
816
817     prSecInfo = &prSta->rSecInfo;
818     eNextState = prSecInfo->eCurrentState;
819
820 #if DBG
821     DBGLOG(RSN, TRACE, (MACSTR" Sec state %s\n", MAC2STR(prSta->aucMacAddr),
822         apucDebugSecState[prSecInfo->eCurrentState]));
823 #else
824     DBGLOG(RSN, TRACE, (MACSTR" Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState));
825 #endif
826
827     switch(prSecInfo->eCurrentState) {
828     case SEC_STATE_INITIATOR_PORT_BLOCKED :
829     case SEC_STATE_CHECK_OK :
830         prSecInfo->fg2nd1xSend = TRUE;
831         break;
832     default:
833 #if DBG
834         DBGLOG(RSN, WARN, ("Rcv 2nd EAPoL at %s\n", apucDebugSecState[prSecInfo->eCurrentState]));
835 #else
836         DBGLOG(RSN, WARN, ("Rcv 2nd EAPoL at [%d]\n", prSecInfo->eCurrentState));
837 #endif
838         break;
839     }
840
841     if (prSecInfo->eCurrentState != eNextState) {
842         secFsmSteps(prAdapter, prSta, eNextState);
843     }
844
845     return;
846
847 }/* secFsmRunEvent2ndEapolTx */
848
849
850 /*----------------------------------------------------------------------------*/
851 /*!
852 * \brief This function will indicate an Event of "4th EAPoL Tx is Tx done" to Sec FSM.
853 *
854 * \param[in] prSta            Pointer to the Sta record
855 *
856 * \return -
857 */
858 /*----------------------------------------------------------------------------*/
859 VOID
860 secFsmEvent4ndEapolTxDone (
861     IN P_ADAPTER_T          prAdapter,
862     IN P_STA_RECORD_T       prSta
863     )
864 {
865     P_SEC_INFO_T            prSecInfo;
866     ENUM_SEC_STATE_T        eNextState;
867     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
868     P_CMD_802_11_KEY        prStoredKey;
869
870     DEBUGFUNC("secFsmRunEvent4ndEapolTx");
871
872     ASSERT(prSta);
873
874     prSecInfo = &prSta->rSecInfo;
875     eNextState = prSecInfo->eCurrentState;
876
877 #if DBG
878     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr),
879         apucDebugSecState[prSecInfo->eCurrentState]));
880 #else
881     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState));
882 #endif
883
884     switch(prSecInfo->eCurrentState) {
885     case SEC_STATE_INITIATOR_PORT_BLOCKED :
886     case SEC_STATE_CHECK_OK :
887         prSecInfo->fg2nd1xSend = FALSE;
888         if (prSecInfo->fgKeyStored) {
889             prStoredKey = (P_CMD_802_11_KEY)prSecInfo->aucStoredKey;
890
891             //prSta = rxmLookupStaRecIndexFromTA(prStoredKey->aucPeerAddr);
892             //if (nicPrivacySetKeyEntry(prStoredKey, prSta->ucWTEntry) == FALSE)
893             //    DBGLOG(RSN, WARN, ("nicPrivacySetKeyEntry() fail,..\n"));
894
895             //key update
896             prSecInfo->fgKeyStored = FALSE;
897             prSta->fgTransmitKeyExist = TRUE;
898         }
899         if (prSecInfo->eCurrentState == SEC_STATE_INITIATOR_PORT_BLOCKED) {
900             SEC_STATE_TRANSITION(prAdapter, prSta, INITIATOR_PORT_BLOCKED, CHECK_OK);
901         }
902         break;
903     default:
904
905 #if DBG
906         DBGLOG(RSN, WARN, ("Rcv thh EAPoL Tx done at %s\n", apucDebugSecState[prSecInfo->eCurrentState]));
907 #else
908         DBGLOG(RSN, WARN, ("Rcv thh EAPoL Tx done at [%d]\n", prSecInfo->eCurrentState));
909 #endif
910         break;
911     }
912
913     if (prSecInfo->eCurrentState != eNextState) {
914         secFsmSteps(prAdapter, prSta, eNextState);
915     }
916
917     return;
918
919 }/* secFsmRunEvent4ndEapolTx */
920
921
922 /*----------------------------------------------------------------------------*/
923 /*!
924 * \brief This function will indicate an Event of "Pairwise key installed" to SEC FSM.
925 *
926 * \param[in] prSta            Pointer to the Sta record
927 *
928 * \retval TRUE The key can be installed to HW
929 * \retval FALSE The kay conflict with the current key, abort it
930 */
931 /*----------------------------------------------------------------------------*/
932 BOOLEAN
933 secFsmEventPTKInstalled (
934     IN P_ADAPTER_T          prAdapter,
935     IN P_STA_RECORD_T       prSta
936     )
937 {
938     P_SEC_INFO_T            prSecInfo;
939     ENUM_SEC_STATE_T        eNextState;
940     BOOLEAN                 fgStatus = TRUE;
941     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
942
943     ASSERT(prSta);
944
945     prSecInfo = &prSta->rSecInfo;
946     if (prSecInfo == NULL)
947         return TRUE; /* Not PTK */
948
949 #if DBG
950     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr),
951         apucDebugSecState[prSecInfo->eCurrentState]));
952 #else
953     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState));
954 #endif
955
956     eNextState = prSecInfo->eCurrentState;
957
958     switch(prSecInfo->eCurrentState) {
959     case SEC_STATE_INIT:
960         /* Legacy wep, wpa-none */
961         break;
962
963     case SEC_STATE_INITIATOR_PORT_BLOCKED:
964         if (prSecInfo->fg2nd1xSend) {
965         }
966         else {
967             SEC_STATE_TRANSITION(prAdapter, prSta, INITIATOR_PORT_BLOCKED, CHECK_OK);
968         }
969         break;
970
971     case SEC_STATE_RESPONDER_PORT_BLOCKED:
972         SEC_STATE_TRANSITION(prAdapter, prSta, RESPONDER_PORT_BLOCKED, CHECK_OK);
973         break;
974
975
976     case SEC_STATE_CHECK_OK:
977         break;
978
979     default:
980         fgStatus = FALSE;
981         break;
982     }
983
984     if (prSecInfo->eCurrentState != eNextState) {
985         secFsmSteps(prAdapter, prSta, eNextState);
986     }
987
988     return fgStatus;
989
990 } /* end of secFsmRunEventPTKInstalled() */
991
992
993 /*----------------------------------------------------------------------------*/
994 /*!
995 * \brief This function will indicate an Event of "Counter Measure" to SEC FSM.
996 *
997 * \param[in] prSta            Pointer to the Sta record
998 *
999 * \return -
1000 */
1001 /*----------------------------------------------------------------------------*/
1002 VOID
1003 secFsmEventStartCounterMeasure (
1004     IN P_ADAPTER_T          prAdapter,
1005     IN P_STA_RECORD_T       prSta
1006     )
1007 {
1008     P_SEC_INFO_T            prSecInfo;
1009     ENUM_SEC_STATE_T        eNextState;
1010     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
1011
1012     DEBUGFUNC("secFsmRunEventStartCounterMeasure");
1013
1014     ASSERT(prSta);
1015
1016     if (!IS_STA_IN_AIS(prSta)) {
1017         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
1018         //ASSERT(0);
1019         return;
1020     }
1021
1022     prSecInfo = &prSta->rSecInfo;
1023
1024     eNextState = prSecInfo->eCurrentState;
1025
1026 #if DBG
1027     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr),
1028         apucDebugSecState[prSecInfo->eCurrentState]));
1029 #else
1030     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState));
1031 #endif
1032
1033     prAdapter->rWifiVar.rAisSpecificBssInfo.u4RsnaLastMICFailTime = 0;
1034
1035     switch(prSecInfo->eCurrentState) {
1036     case SEC_STATE_CHECK_OK:
1037         {
1038             prAdapter->rWifiVar.rAisSpecificBssInfo.fgCounterMeasure = TRUE;
1039
1040             //<Todo> dls port control
1041             SEC_STATE_TRANSITION(prAdapter, prSta, CHECK_OK, SEND_EAPOL);
1042         }
1043         break;
1044
1045     default:
1046         break;
1047     }
1048
1049     /* Call arbFsmSteps() when we are going to change ARB STATE */
1050     if (prSecInfo->eCurrentState != eNextState) {
1051         secFsmSteps(prAdapter, prSta, eNextState);
1052     }
1053
1054     return;
1055
1056 } /* secFsmRunEventStartCounterMeasure */
1057
1058
1059 /*----------------------------------------------------------------------------*/
1060 /*!
1061 * \brief This function will indicate an Event of "802.1x EAPoL Tx Done" to Sec FSM.
1062 *
1063 * \param[in] prSta            Pointer to the Sta record
1064 *
1065 * \return -
1066 */
1067 /*----------------------------------------------------------------------------*/
1068 VOID
1069 secFsmEventEapolTxDone (
1070     IN P_ADAPTER_T            prAdapter,
1071     IN P_STA_RECORD_T         prStaRec,
1072     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
1073     )
1074 {
1075     P_SEC_INFO_T              prSecInfo;
1076     ENUM_SEC_STATE_T          eNextState;
1077     BOOLEAN                   fgIsTransition = (BOOLEAN)FALSE;
1078     P_AIS_SPECIFIC_BSS_INFO_T prAisBssInfo;
1079
1080     DEBUGFUNC("secFsmRunEventEapolTxDone");
1081
1082     ASSERT(prStaRec);
1083
1084     if (rTxDoneStatus != TX_RESULT_SUCCESS) {
1085         DBGLOG(RSN, INFO, ("Error EAPoL fram fail to send!!\n"));
1086         //ASSERT(0);
1087         return;
1088     }
1089
1090     if (!IS_STA_IN_AIS(prStaRec)) {
1091         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
1092         //ASSERT(0);
1093         return;
1094     }
1095
1096     prAisBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo;
1097
1098     ASSERT(prAisBssInfo);
1099
1100     prSecInfo = &prStaRec->rSecInfo;
1101     eNextState = prSecInfo->eCurrentState;
1102
1103 #if DBG
1104     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prStaRec->aucMacAddr),
1105         apucDebugSecState[prSecInfo->eCurrentState]));
1106 #else
1107     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prStaRec->aucMacAddr), prSecInfo->eCurrentState));
1108 #endif
1109
1110     switch(prSecInfo->eCurrentState) {
1111     case SEC_STATE_SEND_EAPOL:
1112         if (prAisBssInfo->fgCheckEAPoLTxDone == FALSE) {
1113             ASSERT(0);
1114         }
1115
1116         prAisBssInfo->fgCheckEAPoLTxDone = FALSE;
1117         //cnmTimerStopTimer(prAdapter, &prAisBssInfo->rRsnaEAPoLReportTimeoutTimer);
1118
1119         SEC_STATE_TRANSITION(prAdapter, prStaRec, SEND_EAPOL, SEND_DEAUTH);
1120         break;
1121     default:
1122         break;
1123     }
1124
1125     if (prSecInfo->eCurrentState != eNextState) {
1126         secFsmSteps(prAdapter, prStaRec, eNextState);
1127     }
1128
1129     return;
1130
1131 }/* secFsmRunEventEapolTxDone */
1132
1133
1134 /*----------------------------------------------------------------------------*/
1135 /*!
1136 * \brief This function will indicate an Event of "Deauth frame Tx Done" to Sec FSM.
1137 *
1138 * \param[in] pMsduInfo            Pointer to the Msdu Info
1139 * \param[in] rStatus              The Tx done status
1140 *
1141 * \return -
1142 *
1143 * \note after receive deauth frame, callback function call this
1144 */
1145 /*----------------------------------------------------------------------------*/
1146 VOID
1147 secFsmEventDeauthTxDone (
1148     IN P_ADAPTER_T            prAdapter,
1149     IN P_MSDU_INFO_T          prMsduInfo,
1150     IN ENUM_TX_RESULT_CODE_T  rTxDoneStatus
1151     )
1152 {
1153     P_STA_RECORD_T            prStaRec;
1154     P_SEC_INFO_T              prSecInfo;
1155     ENUM_SEC_STATE_T          eNextState;
1156     BOOLEAN                   fgIsTransition = (BOOLEAN)FALSE;
1157
1158     DEBUGFUNC("secFsmRunEventDeauthTxDone");
1159
1160     ASSERT(prMsduInfo);
1161
1162     prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex);
1163
1164     ASSERT(prStaRec);
1165
1166     if (!prStaRec)
1167         return;
1168
1169     if (!IS_STA_IN_AIS(prStaRec)) {
1170         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
1171         //ASSERT(0);
1172         return;
1173     }
1174
1175     prSecInfo = (P_SEC_INFO_T)&prStaRec->rSecInfo;
1176
1177 #if DBG
1178     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prStaRec->aucMacAddr),
1179         apucDebugSecState[prSecInfo->eCurrentState]));
1180 #else
1181     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prStaRec->aucMacAddr), prSecInfo->eCurrentState));
1182 #endif
1183
1184     switch(prSecInfo->eCurrentState) {
1185     case SEC_STATE_SEND_DEAUTH:
1186
1187         DBGLOG(RSN, TRACE, ("Set timer %d\n", COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC));
1188
1189         SEC_STATE_TRANSITION(prAdapter, prStaRec, SEND_DEAUTH, COUNTERMEASURE);
1190
1191         break;
1192
1193     default:
1194         ASSERT(0);
1195         break;
1196     }
1197
1198     return;
1199 }/* secFsmRunEventDeauthTxDone */
1200
1201
1202 /*----------------------------------------------------------------------------*/
1203 /*!
1204 * \brief This function will check the eapol error frame fail to send issue.
1205 *
1206 * \param[in] prSta            Pointer to the Sta record
1207 *
1208 * \return -
1209 */
1210 /*----------------------------------------------------------------------------*/
1211 VOID
1212 secFsmEventEapolTxTimeout (
1213     IN P_ADAPTER_T            prAdapter,
1214     IN UINT_32                u4Parm
1215     )
1216 {
1217     P_STA_RECORD_T            prStaRec;
1218
1219     DEBUGFUNC("secFsmRunEventEapolTxTimeout");
1220
1221     prStaRec = (P_STA_RECORD_T)u4Parm;
1222
1223     ASSERT(prStaRec);
1224
1225     /* Todo:: How to handle the Eapol Error fail to send case? */
1226     ASSERT(0);
1227
1228     return;
1229
1230 }/* secFsmEventEapolTxTimeout */
1231
1232
1233 /*----------------------------------------------------------------------------*/
1234 /*!
1235 * \brief This function will stop the counterMeasure duration.
1236 *
1237 * \param[in] prSta            Pointer to the Sta record
1238 *
1239 * \return -
1240 */
1241 /*----------------------------------------------------------------------------*/
1242 VOID
1243 secFsmEventEndOfCounterMeasure (
1244     IN P_ADAPTER_T          prAdapter,
1245     UINT_32                 u4Parm
1246     )
1247 {
1248     P_STA_RECORD_T          prSta;
1249     P_SEC_INFO_T            prSecInfo;
1250     ENUM_SEC_STATE_T        eNextState;
1251     BOOLEAN                 fgIsTransition = (BOOLEAN)FALSE;
1252
1253     DEBUGFUNC("secFsmRunEventEndOfCounterMeasure");
1254
1255     prSta = (P_STA_RECORD_T)u4Parm;
1256
1257     ASSERT(prSta);
1258
1259     if (!IS_STA_IN_AIS(prSta)) {
1260         DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n"));
1261         //ASSERT(0);
1262         return;
1263     }
1264
1265     prSecInfo = &prSta->rSecInfo;
1266     eNextState = prSecInfo->eCurrentState;
1267
1268 #if DBG
1269     DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr),
1270         apucDebugSecState[prSecInfo->eCurrentState]));
1271 #else
1272     DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState));
1273 #endif
1274
1275     switch(prSecInfo->eCurrentState) {
1276     case SEC_STATE_SEND_DEAUTH:
1277         {
1278             prAdapter->rWifiVar.rAisSpecificBssInfo.fgCounterMeasure = FALSE;
1279
1280             SEC_STATE_TRANSITION(prAdapter, prSta, COUNTERMEASURE, INIT);
1281         }
1282         break;
1283
1284     default:
1285         ASSERT(0);
1286     }
1287
1288     /* Call arbFsmSteps() when we are going to change ARB STATE */
1289     if (prSecInfo->eCurrentState != eNextState) {
1290         secFsmSteps(prAdapter, prSta, eNextState);
1291     }
1292
1293     return;
1294 }/* end of secFsmRunEventEndOfCounterMeasure */
1295 #endif