wlan:On HB failure disconnect from AP if beacon receive count is 0.

In case of HB failure from Firmware, Host sends a probe request
and wait for probe response and if probe response is received host
ignores the HB.

If for some reason firmware/host have not received a single beacon
after conection but is getting the probe response on receiving
HB failure, host ignores the HB failure. Also in this case host will
not allow to enter BMPS as it has not received any beacon to get the
TSF and thus draining the battery.

As part of fix to recover from this situation, if number of beacon
received in host is 0 and it receives a HB failure, disconnect from
the AP.

Change-Id: I39f3afd8d0e6e9ba9805ce6aebe47906f2ad3ac6
CRs-fixed: 766976
diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c
index 7fa744a..91ebc51 100644
--- a/CORE/MAC/src/pe/lim/limUtils.c
+++ b/CORE/MAC/src/pe/lim/limUtils.c
@@ -7267,14 +7267,21 @@
             psessionEntry = &pMac->lim.gpSession[i];
             if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
             {
-                limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
-                        psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
+                limLog(pMac, LOGE,
+                        FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
+                        psessionEntry->limSmeState, psessionEntry->limMlmState,
+                        psessionEntry->LimRxedBeaconCntDuringHB,
+                        psessionEntry->currentBssBeaconCnt);
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
                 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
 #endif
                 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
                 {
-                    if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) &&
+                    /* Disconnect even if we have not received a single beacon
+                     * after connection.
+                     */
+                    if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
+                         (0 == psessionEntry->currentBssBeaconCnt)) &&
                         (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
                         (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
                     {