wlan: Don't send RSO START-REASON_CONNECT when FW already has one

This issue can happen on a build which has 11r, CCX and LFR enabled
and runtime enable/disable feature is available for the same.
Initially, DUT supports CCX and LFR, init_ft_flag is set to TRUE by
both CCX and LFR case, if this flag is set Roam Scan Offload
command START-REASON_CONNECT is sent down to FW.
Now disable LFR at run time, SETROAMMODE 1 sends STOP command to FW
and make the DUT to roam, but roaming fails and disconnected.
Next time DUT automatically connects to AP and now init_ft_flag
is set to TRUE by CCX and again START-REASON_CONNECT is sent to FW.

Now when the user enables LFR, SETROAMMODE 0, START-REASON_CONNECT
is again sent to FW, FW does not expect START-REASON_CONNECT followed
by another START-REASON_CONNECT and hence crash.

The fix for this issue is in host to make sure, not to send
START-REASON_CONNECT again when already one is sent to FW.

Another change part of this gerrit is to avoid sending STOP followed
by START for LookUp RSSI threshold change; instead send command
ROAM_SCAN_OFFLOAD_UPDATE_CFG with reason REASON_LOOKUP_THRESH_CHANGED.

Change-Id: I706330c736fa4b21252f2debe4074c3223953357
CRs-Fixed:  529290
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index 028e36d..995289f 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -113,6 +113,10 @@
 #define RSSI_HACK_BMPS (-40)
 #define MAX_CB_VALUE_IN_INI (2)
 
+#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
+static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE;
+#endif
+
 /*-------------------------------------------------------------------------- 
   Static Type declarations
   ------------------------------------------------------------------------*/
@@ -14872,9 +14876,15 @@
 
    if (0 == csrRoamIsRoamOffloadScanEnabled(pMac))
    {
-      smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set \n");
+      smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set");
       return eHAL_STATUS_FAILURE;
    }
+
+   if ((VOS_TRUE == bRoamScanOffloadStarted) && (ROAM_SCAN_OFFLOAD_START == command))
+   {
+        smsLog( pMac, LOGE,"Roam Scan Offload is already started");
+        return eHAL_STATUS_FAILURE;
+   }
    status = csrRoamGetSessionIdFromBSSID(pMac,
                             (tCsrBssid *)pNeighborRoamInfo->currAPbssid,
                                         &sessionId);
@@ -15076,10 +15086,17 @@
    msg.bodyptr  = pRequestBuf;
    if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
    {
-           VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__);
-           vos_mem_free(pRequestBuf);
-           return eHAL_STATUS_FAILURE;
+       VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__);
+       vos_mem_free(pRequestBuf);
+       return eHAL_STATUS_FAILURE;
    }
+   else
+   {
+        if (ROAM_SCAN_OFFLOAD_START == command)
+            bRoamScanOffloadStarted = VOS_TRUE;
+        else if (ROAM_SCAN_OFFLOAD_STOP == command)
+            bRoamScanOffloadStarted = VOS_FALSE;
+    }
 
    VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason);
    return status;