wlan: Process roam disable after roam completion

Currently roam disable is allowed using SETROAMMODE even if roaming
is in progress. This can cause mess in state machine as driver falls
back to LFR-1.0 and can result in crash. Add pending_roam_disable to
mark pending of roam disable when roaming is in progress and allow
preauth/reassoc to go if preauth/reassoc in progress.

With this fix, driver takes following actions.
1. If pending_roam_disable is pending after preauth failure,
   driver does not proceed for further preauth and disables roaming.
2. If pending_roam_disable is pending after reassoc completion,
   driver updates CSR with new AP information and disables roaming.

Change-Id: I9cfcbd21db046d399c2cdc78b1678d3773aea2cd
CRs-Fixed: 2045775
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index 09a507b..3934fd9 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -1067,6 +1067,7 @@
     tANI_BOOLEAN   isWESModeEnabled;
 #endif
     tANI_U32 deauthRspStatus;
+    tANI_BOOLEAN pending_roam_disable;
 }tCsrRoamStruct;
 
 
diff --git a/CORE/SME/src/csr/csrNeighborRoam.c b/CORE/SME/src/csr/csrNeighborRoam.c
index c9d6d42..72aec69 100644
--- a/CORE/SME/src/csr/csrNeighborRoam.c
+++ b/CORE/SME/src/csr/csrNeighborRoam.c
@@ -1253,6 +1253,17 @@
            goto abort_preauth;
         }
 
+        if (pMac->roam.pending_roam_disable)
+        {
+            smsLog(pMac, LOG1, FL("process pending roam disable"));
+            pMac->roam.configParam.isFastRoamIniFeatureEnabled = FALSE;
+            pMac->roam.pending_roam_disable = FALSE;
+            csrNeighborRoamUpdateFastRoamingEnabled(pMac, FALSE);
+            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(
+                                   eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
+            goto DEQ_PREAUTH;
+        }
+
         /* Issue preauth request for the same/next entry */
         if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
         goto DEQ_PREAUTH; 
@@ -4691,6 +4702,13 @@
                             
 #endif
 
+            if (pMac->roam.pending_roam_disable)
+            {
+                smsLog(pMac, LOG1, FL("process pending roam disable"));
+                pMac->roam.configParam.isFastRoamIniFeatureEnabled = FALSE;
+                pMac->roam.pending_roam_disable = FALSE;
+            }
+
 #ifdef FEATURE_WLAN_LFR
             // If "Legacy Fast Roaming" is enabled 
             if (csrRoamIsFastRoamEnabled(pMac, sessionId))
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 9f836d3..91fd687 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -10425,6 +10425,16 @@
                       isFastRoamIniFeatureEnabled);
       return eHAL_STATUS_SUCCESS;
   }
+  if (smeNeighborMiddleOfRoaming(hHal))
+  {
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                "%s: In middle of roaming isFastRoamIniFeatureEnabled %d",
+                __func__, isFastRoamIniFeatureEnabled);
+      if (!isFastRoamIniFeatureEnabled)
+          pMac->roam.pending_roam_disable = TRUE;
+
+      return eHAL_STATUS_SUCCESS;
+  }
 
   VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
                      "%s: FastRoamEnabled is changed from %d to %d", __func__,