wlan: If parsing fails for the beacon after connect, parse TIM IE.

In case AP is sending malformed beacons, the currunt firmware drops
it and thus Host does not receive any beacon after the connection.
Due to this Host could not enter the BMPS and battery is drained.

To avoid this, now the firmware will send the first beacon to host
even if it is marformed but have the TIM IE.
To handle these marformed beacons in the host, even if parsing
fails, try to extract the TIM params and timestamp from the beacon,
required to enter BMPS.

CRs-Fixed: 782493
Change-Id: Iab8717657127314f141ee8f5e77b7a5a71c919a4
diff --git a/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
index 8ce6a02..9b007c4 100644
--- a/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
+++ b/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -79,7 +79,6 @@
     /* here is it required to increment session specific heartBeat beacon counter */  
 
 
-    
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
 
 
@@ -124,10 +123,13 @@
                    FL("Received invalid Beacon in state %d"),
                    psessionEntry->limMlmState);
             limPrintMlmState(pMac, LOGW,  psessionEntry->limMlmState);
+            if ((!psessionEntry->currentBssBeaconCnt) &&
+               (sirCompareMacAddr( psessionEntry->bssId, pHdr->sa)))
+                limParseBeaconForTim(pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry);
+
             vos_mem_free(pBeacon);
             return;
         }
-
         /*during scanning, when any session is active, and beacon/Pr belongs to
           one of the session, fill up the following, TBD - HB couter */
         if ((!psessionEntry->lastBeaconDtimPeriod) &&