Fix for teardown of link on wrong session in Activmode offload context

In Active mode offload context when both P2P and STA links are present,
the heartbeatfailure on one session results in link loss on the other
session.handle missed beacon indication using the bssIdx passed by
firmware

Change-Id: Ie3208b18dc35685cae6499eba081195d7d4d4fea
CRs-fixed: 457247,454235
diff --git a/CORE/MAC/src/pe/lim/limSession.c b/CORE/MAC/src/pe/lim/limSession.c
index 9bfe281..35015f2 100644
--- a/CORE/MAC/src/pe/lim/limSession.c
+++ b/CORE/MAC/src/pe/lim/limSession.c
@@ -237,6 +237,30 @@
 }
 
 
+/*--------------------------------------------------------------------------
+  \brief peFindSessionByBssIdx() - looks up the PE session given the bssIdx.
+
+  This function returns the session context  if the session
+  corresponding to the given bssIdx is found in the PE session table.
+  \param pMac                   - pointer to global adapter context
+  \param bssIdx                   - bss index of the session
+  \return tpPESession          - pointer to the session context or NULL if session is not found.
+  \sa
+  --------------------------------------------------------------------------*/
+tpPESession peFindSessionByBssIdx(tpAniSirGlobal pMac,  tANI_U8 bssIdx)
+{
+    tANI_U8 i;
+    for (i = 0; i < pMac->lim.maxBssId; i++)
+    {
+        /* If BSSID matches return corresponding tables address*/
+        if ( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].bssIdx == bssIdx))
+        {
+            return &pMac->lim.gpSession[i];
+        }
+    }
+    limLog(pMac, LOG4, FL("Session lookup fails for bssIdx: %d"), bssIdx);
+    return NULL;
+}
 
 /*--------------------------------------------------------------------------
   \brief peFindSessionBySessionId() - looks up the PE session given the session ID.