wlan: TDLS Integration from Dev32Sta
Support for TDLS discovery, setup and teardown.
Exit BMPS while in active TDLS link and enable back afterwards.
Change-Id: Ic653c5369cb0b61e04e9a8be5e7f625ab7160365
CR-Fixed: 426223
(cherry picked from commit 698ba2a565d4ccf0d6a570eab18f79e1dea10a1d)
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index 280be96..614e4e7 100644
--- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -554,11 +554,58 @@
/*Send disassociation message again*/
//Dinesh need one more arguement.
//limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
+ //TODO: verify this
#if defined WLAN_FEATURE_P2P
//This could be a public action frame.
if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
#endif
+
+#ifdef FEATURE_WLAN_TDLS
+ {
+ tpSirMacDataHdr3a pMacHdr;
+ pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
+
+ if (limIsGroupAddr(pMacHdr->addr2))
+ {
+ PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:\n"));
+ limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
+
+ return;
+ }
+ /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
+ and also checking if SystemRole == STA */
+ if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
+ {
+ /* ADD handling of Public Action Frame */
+ LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
+ ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x\n"),pMacHdr->fc.type, pMacHdr->fc.subType));
+ switch (pMacHdr->fc.type)
+ {
+ case SIR_MAC_MGMT_FRAME:
+ {
+ switch (pMacHdr->fc.subType)
+ {
+ case SIR_MAC_MGMT_ACTION:
+ {
+ limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
+ break ;
+ }
+ default:
+ {
+ break ;
+ }
+ }
+ }
+ default:
+ {
+ break ;
+ }
+ }
+ }
+ }
+#endif
+
#endif
return;
@@ -951,9 +998,30 @@
}
break;
-#ifdef FEATURE_WLAN_CCX
case SIR_MAC_DATA_FRAME:
{
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+ /*
+ * if we reach here, following cases are possible.
+ * Possible cases: a) if frame translation is disabled.
+ * b) Some frame with ADRR2 filter enabled may come
+ * here.
+ */
+ tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
+ tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
+ tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+ ("TDLS frame with 80211 Header\n")) ;
+ if(ETH_TYPE_89_0d == ethType)
+ {
+ tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
+ if(PAYLOAD_TYPE_TDLS == payloadType)
+ {
+ limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
+ }
+ }
+#endif
+#ifdef FEATURE_WLAN_CCX
/* We accept data frame (IAPP frame) only if Session is
* present and ccx connection is established on that
* session
@@ -961,9 +1029,9 @@
if (psessionEntry && psessionEntry->isCCXconnection) {
limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
}
+#endif
}
break;
-#endif
default:
// Received frame of type 'reserved'
break;
@@ -1262,6 +1330,9 @@
vos_pkt_t *pVosPkt;
VOS_STATUS vosStatus;
tSirMsgQ limMsgNew;
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+ tANI_U32 *pBD = NULL ;
+#endif
/* The original limMsg which we were deferring have the
* bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
@@ -1281,6 +1352,24 @@
break;
}
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+ /*
+ * TDLS frames comes as translated frames as well as
+ * MAC 802.11 data frames..
+ */
+ limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
+ if(0 != WDA_GET_RX_FT_DONE(pBD))
+ {
+ /*
+ * TODO: check for scanning state and set deferMesg flag
+ * accordingly..
+ */
+ deferMsg = false ;
+
+ limProcessTdlsFrame(pMac, pBD) ;
+ }
+ else
+#endif
limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
if ( deferMsg == true )
@@ -1325,6 +1414,16 @@
#ifdef FEATURE_OEM_DATA_SUPPORT
case eWNI_SME_OEM_DATA_REQ:
#endif
+#ifdef FEATURE_WLAN_TDLS
+ case eWNI_SME_TDLS_SEND_MGMT_REQ:
+ case eWNI_SME_TDLS_ADD_STA_REQ:
+ case eWNI_SME_TDLS_DEL_STA_REQ:
+#endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+ case eWNI_SME_TDLS_DISCOVERY_START_REQ:
+ case eWNI_SME_TDLS_LINK_START_REQ:
+ case eWNI_SME_TDLS_TEARDOWN_REQ:
+#endif
// These messages are from HDD
limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
break;
@@ -1802,6 +1901,92 @@
#endif
+#ifdef FEATURE_WLAN_TDLS_INTERNAL
+ /*
+ * Here discovery timer expires, now we can go ahead and collect all
+ * the dicovery responses PE has process till now and send this
+ * responses to SME..
+ */
+ case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
+ {
+ //fetch the sessionEntry based on the sessionId
+ tpPESession psessionEntry = peFindSessionBySessionId(pMac,
+ pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
+ if(NULL == psessionEntry)
+ {
+ limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d\n"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
+ return;
+ }
+
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ ("Discovery Rsp timer expires \n")) ;
+#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
+ /* restore RXP filters */
+ limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
+ psessionEntry->bssId) ;
+#endif
+ limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
+ eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
+ break ;
+ }
+
+ /*
+ * we initiated link setup and did not receive TDLS setup rsp
+ * from TDLS peer STA, send failure RSP to SME.
+ */
+ case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
+ {
+ tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
+ tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+ ("TDLS setup rsp timer expires \n")) ;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ ("TDLS setup rsp timer expires for peer:\n")) ;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
+ peerMac[0],
+ peerMac[1],
+ peerMac[2],
+ peerMac[3],
+ peerMac[4],
+ peerMac[5]);
+
+ limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+ if(NULL != setupPeer)
+ {
+ limTdlsDelLinkPeer( pMac, peerMac) ;
+ }
+
+ limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
+ eWNI_SME_TDLS_LINK_START_RSP) ;
+ break ;
+ }
+ case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
+ {
+ tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
+ tLimTdlsLinkSetupPeer *setupPeer = NULL ;
+
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
+ ("TDLS setup CNF timer expires \n")) ;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ ("TDLS setup CNF timer expires for peer:\n")) ;
+ VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
+ ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
+ peerMac[0],
+ peerMac[1],
+ peerMac[2],
+ peerMac[3],
+ peerMac[4],
+ peerMac[5]);
+ limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
+ if(NULL != setupPeer)
+ {
+ limTdlsDelLinkPeer( pMac, peerMac) ;
+ }
+ break ;
+ }
+#endif /* FEATURE_WLAN_TDLS TIMER */
case WDA_ADD_BSS_RSP:
limProcessMlmAddBssRsp( pMac, limMsg );
break;