wlan: Add SAE auth timer

propagation from qcacld-3.0 to prima

Add changes related to SAE auth timer to handle SAE authentication.
Start SAE auth timer of duration LIM_AUTH_SAE_TIMER_MS when driver
wants to trigger SAE authentication. If SAE authentication is not
completed in LIM_AUTH_SAE_TIMER_MS, then report failure to
supplicant.

Change-Id: I09bc0e365b9e5e352d927972ba31e3ca4d0cf493
CRs-Fixed: 2533723
diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.c b/CORE/MAC/src/pe/lim/limTimerUtils.c
index 5a5163a..f5bb4d3 100644
--- a/CORE/MAC/src/pe/lim/limTimerUtils.c
+++ b/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017, 2019 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -56,6 +56,11 @@
 #define LIM_JOIN_PROBE_REQ_TIMER_MS              200
 #define LIM_AUTH_RETRY_TIMER_MS              60
 
+/*
+ * SAE auth timer of 5secs. This is required for duration of entire SAE
+ * authentication.
+ */
+#define LIM_AUTH_SAE_TIMER_MS 5000
 
 //default beacon interval value used in HB timer interval calculation
 #define LIM_HB_TIMER_BEACON_INTERVAL             100
@@ -431,6 +436,18 @@
             goto err_timer;
         }
 
+       /*
+        * SAE auth timer of 5secs. This is required for duration of entire SAE
+        * authentication.
+        */
+       if ((tx_timer_create(&pMac->lim.limTimers.sae_auth_timer,
+             "SAE AUTH Timer", limTimerHandler, SIR_LIM_AUTH_SAE_TIMEOUT,
+             SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0, TX_NO_ACTIVATE)) !=
+             TX_SUCCESS) {
+           limLog(pMac, LOGP, FL("could not create SAE AUTH Timer"));
+           goto err_timer;
+       }
+
         if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
                       &cfgValue) != eSIR_SUCCESS)
         {
@@ -784,6 +801,7 @@
         tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
         tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
         tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
+        tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
 
         if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
         {
@@ -1935,6 +1953,21 @@
                 limLog(pMac, LOGE, FL("Unable to change g_lim_ap_ecsa_timer timer"));
         }
 
+    case eLIM_AUTH_SAE_TIMER:
+        if (tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer)
+            != TX_SUCCESS) {
+            limLog(pMac, LOGP, FL("Unable to deactivate SAE auth timer"));
+            return;
+        }
+        /* Change timer to reactivate it in future */
+        val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);
+        if (tx_timer_change(&pMac->lim.limTimers.sae_auth_timer,
+            val, 0) != TX_SUCCESS) {
+            limLog(pMac, LOGP, FL("unable to change SAE auth timer"));
+            return;
+        }
+        break;
+
         break;
      default:
             // Invalid timerId. Log error