wlan: In case of link-lost send Deauth to AP before reconnection.

If last disconnection is due to DEL STA CONTEXT, send deauth to the
AP/GO, before proceeding with the connection, to clear the
previous connetion on Peer.

This logic is already added for HB failure.

CRs-Fixed: 676505

Change-Id: I4c481f78a6706cc80aa9ac5683fb808205468bf4
diff --git a/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
index 43a525d..1ccfd34 100644
--- a/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
+++ b/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
@@ -165,6 +165,21 @@
                     PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) "),
                                 pMsg->staId, pMsg->assocId);)
 
+                    if( pMac->roam.configParam.sendDeauthBeforeCon )
+                    {
+                       tANI_U8 apCount = pMac->lim.gLimHeartBeatApMacIndex;
+
+                       if(pMac->lim.gLimHeartBeatApMacIndex)
+                          pMac->lim.gLimHeartBeatApMacIndex = 0;
+                       else
+                          pMac->lim.gLimHeartBeatApMacIndex = 1;
+
+                       limLog(pMac, LOG1, FL("lim Delete Station Context for MAC "
+                                          MAC_ADDRESS_STR" Store it on Index %d"),
+                                          MAC_ADDR_ARRAY(pStaDs->staAddr),apCount);
+
+                       sirCopyMacAddr(pMac->lim.gLimHeartBeatApMac[apCount],pStaDs->staAddr);
+                    }
                     pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
                     pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;