wlan: Fix roaming delay and roaming count in TSM report

Even though there exists a interface between firmware and driver
firmware does not fill roaming delay and count information.
In the original CCX code, these information are updated in
host driver.

Roaming Count:
Roaming count is incremented whenever ASSOC_RSP is received and
the same variable is used to update the TSM Stats before sending
it to supplicant.

Roaming Delay:
Right after association, CCX enabled STA computes roaming delay
as a part of sending Adjacent AP Report. Fix is added to update
roaming delay global variable here.

Change-Id: I80cef3c96bc123f7e933fce87fc015c3a2201d1c
CRs-Fixed: 567792
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index 2ef073a..5dd3859 100644
--- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -2527,6 +2527,8 @@
     }
 
     pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
+    pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->ccxContext.tsm.tsmMetrics.RoamingCount;
+    pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->ccxContext.tsm.tsmMetrics.RoamingDly;
 
     mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
     mmhMsg.bodyptr = pStats;
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index 3801414..f48bd73 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -9026,15 +9026,30 @@
 {
     tANI_U32 roamTS2 = 0;
     tCsrRoamInfo roamInfo;
+    tpPESession pSessionEntry = NULL;
+    tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
 
     if (NULL == pSession)
     {
+        smsLog(pMac, LOGE, FL("pSession is NULL"));
         return;
     }
 
     roamTS2 = vos_timer_get_system_time();
     roamInfo.tsmRoamDelay = roamTS2 - pSession->roamTS1;
+    smsLog(pMac, LOG1, "Bssid(%02X:%02X:%02X:%02X:%02X:%02X) Roaming Delay(%u ms)",
+           pSession->connectedProfile.bssid[0], pSession->connectedProfile.bssid[1],
+           pSession->connectedProfile.bssid[2], pSession->connectedProfile.bssid[3],
+           pSession->connectedProfile.bssid[4], pSession->connectedProfile.bssid[5],
+           roamInfo.tsmRoamDelay);
 
+    pSessionEntry = peFindSessionByBssid(pMac, pSession->connectedProfile.bssid, &sessionId);
+    if (NULL == pSessionEntry)
+    {
+        smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
+        return;
+    }
+    pSessionEntry->ccxContext.tsm.tsmMetrics.RoamingDly = roamInfo.tsmRoamDelay;
     csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo,
                         0, eCSR_ROAM_CCX_ADJ_AP_REPORT_IND, 0);
 }