wlan: Add data path support for STA + Mon SCC
In the current design, frames are redirected to monitor adapter when con_mode is VOS_MONITOR_MODE.
But in STA + Mon mode, as we get frames for both adapters, only the frames with dest addr other
than STA adapter and having sta-id: 253/254/255 are to be re-directed to monitor adapter.
To achieve this, add check for data frame type and valid sta-id in WLANTL_RxFrames() before
invoke of monitor mode rx call-back in STA + Mon SCC.
Change-Id: I61afa816d9816f89f2822f899029015657c835c0
CRs-Fixed: 2160382
diff --git a/CORE/TL/src/wlan_qct_tl.c b/CORE/TL/src/wlan_qct_tl.c
index 5596cad..dd995b6 100644
--- a/CORE/TL/src/wlan_qct_tl.c
+++ b/CORE/TL/src/wlan_qct_tl.c
@@ -6159,6 +6159,58 @@
}
}
+/**
+ * WLANTL_StaMonRX - Send packets to monitor mode
+ * @pTLCb: TL context pointer
+ * @pFrame: Rx buffer pointer
+ * @pBDHeader: RX Meta data pointer
+ * @sta_id: Station ID
+ *
+ * Return: true if RX monitor mode or false otherwise
+ */
+static bool WLANTL_StaMonRX(WLANTL_CbType* pTLCb, vos_pkt_t *pFrame,
+ WDI_DS_RxMetaInfoType *pRxMetadata,
+ uint8_t sta_id)
+{
+ WLANTL_STAClientType *pClientSTA = NULL;
+ tpSirMacMgmtHdr pHdr = NULL;
+ v_MACADDR_t *peerMacAddr = NULL;
+ uint8_t i = 0;
+
+ if (vos_check_monitor_state() == false || WLANTL_STA_ID_MONIFACE(sta_id) == 0)
+ return false;
+
+ pHdr = (tpSirMacMgmtHdr)pRxMetadata->mpduHeaderPtr;
+
+ if (WLANTL_IS_MGMT_FRAME(WDA_GET_RX_TYPE_SUBTYPE(pRxMetadata))) {
+
+ if (pRxMetadata->bcast)
+ return false;
+
+ for (i = 0; i < WLAN_MAX_STA_COUNT; i++) {
+ if (NULL == pTLCb->atlSTAClients[i])
+ continue;
+ if (0 == pTLCb->atlSTAClients[i]->ucExists)
+ continue;
+ if (WLANTL_STA_AUTHENTICATED == pTLCb->atlSTAClients[i]->tlState)
+ break;
+ }
+
+ if (i == WLAN_MAX_STA_COUNT)
+ return false;
+
+ pClientSTA = pTLCb->atlSTAClients[i];
+ peerMacAddr = (v_MACADDR_t *)pHdr->da;
+
+ if (vos_is_macaddr_equal(peerMacAddr,
+ &pClientSTA->wSTADesc.vSelfMACAddress) ||
+ vos_is_macaddr_equal(peerMacAddr, &pTLCb->spoofMacAddr.spoofMac))
+ return false;
+ }
+
+ return true;
+}
+
/*==========================================================================
FUNCTION WLANTL_RxFrames
@@ -6227,6 +6279,7 @@
uint16_t seq_no;
u64 pn_num;
uint16_t usEtherType = 0;
+ bool sta_mon_data = false;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
@@ -6271,16 +6324,6 @@
vos_pkt_walk_packet_chain( vosDataBuff, &vosDataBuff, 1/*true*/ );
- if( vos_get_conparam() == VOS_MONITOR_MODE )
- {
- if( pTLCb->isConversionReq )
- WLANTL_MonTranslate80211To8023Header(vosTempBuff, pTLCb);
-
- pTLCb->pfnMonRx(pvosGCtx, vosTempBuff, pTLCb->isConversionReq);
- vosTempBuff = vosDataBuff;
- continue;
- }
-
/*---------------------------------------------------------------------
Peek at BD header - do not remove
!!! Optimize me: only part of header is needed; not entire one
@@ -6298,6 +6341,25 @@
}
/*---------------------------------------------------------------------
+ Check if frame is for monitor interface
+ ---------------------------------------------------------------------*/
+ ucSTAId = (v_U8_t)WDA_GET_RX_STAID(pvBDHeader);
+
+ sta_mon_data = WLANTL_StaMonRX(pTLCb, vosTempBuff, pvBDHeader, ucSTAId);
+
+ if (vos_get_conparam() == VOS_MONITOR_MODE || sta_mon_data)
+ {
+ sta_mon_data = false;
+
+ if( pTLCb->isConversionReq )
+ WLANTL_MonTranslate80211To8023Header(vosTempBuff, pTLCb);
+
+ pTLCb->pfnMonRx(pvosGCtx, vosTempBuff, pTLCb->isConversionReq);
+ vosTempBuff = vosDataBuff;
+ continue;
+ }
+
+ /*---------------------------------------------------------------------
Check if FC frame reported from FW
---------------------------------------------------------------------*/
if(WDA_IS_RX_FC(pvBDHeader))
diff --git a/CORE/TL/src/wlan_qct_tli.h b/CORE/TL/src/wlan_qct_tli.h
index 4314c37..15204b5 100644
--- a/CORE/TL/src/wlan_qct_tli.h
+++ b/CORE/TL/src/wlan_qct_tli.h
@@ -200,6 +200,9 @@
/*-------------------------------------------------------------------------
Helper macros
---------------------------------------------------------------------------*/
+ /*Checks STAID for MONITOR interface*/
+#define WLANTL_STA_ID_MONIFACE( _staid )( _staid == 253 || _staid == 254 || _staid == 255 )
+
/*Checks STA index validity*/
#define WLANTL_STA_ID_INVALID( _staid )( _staid >= WLAN_MAX_STA_COUNT )