File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,11 @@ int DpdkCore::getRxTimestampOffset()
352352 return m_rxTimestampOffset;
353353}
354354
355+ int DpdkCore::getRxTimestampDynflag ()
356+ {
357+ return RTE_BIT64 (rte_mbuf_dynflag_lookup (RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL ));
358+ }
359+
355360DpdkReader::DpdkReader ()
356361 : m_dpdkCore(DpdkCore::getInstance())
357362{
@@ -370,6 +375,7 @@ void DpdkReader::init(const char* params)
370375 m_rxQueueId = m_dpdkCore.getRxQueueId ();
371376 m_portId = m_dpdkCore.parser .port_num ();
372377 m_rxTimestampOffset = m_dpdkCore.getRxTimestampOffset ();
378+ m_rxTimestampDynflag = m_dpdkCore.getRxTimestampDynflag ();
373379 m_useHwRxTimestamp = m_dpdkCore.isNfbDpdkDriver ();
374380
375381 createRteMempool (m_dpdkCore.parser .pkt_mempool_size ());
@@ -420,7 +426,7 @@ void DpdkReader::setupRxQueue()
420426struct timeval DpdkReader::getTimestamp (rte_mbuf* mbuf)
421427{
422428 struct timeval tv;
423- if (m_useHwRxTimestamp) {
429+ if (m_useHwRxTimestamp && (mbuf-> ol_flags & m_rxTimestampDynflag) ) {
424430 static constexpr time_t nanosecInSec = 1000000000 ;
425431 static constexpr time_t nsecInUsec = 1000 ;
426432
Original file line number Diff line number Diff line change @@ -136,6 +136,13 @@ class DpdkCore {
136136
137137 int getRxTimestampOffset ();
138138
139+ /* *
140+ * @brief Get the Rx Timestamp mbuf Dynflag for RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME
141+ *
142+ * @return int RTE_BIT64 value
143+ */
144+ int getRxTimestampDynflag ();
145+
139146 bool isNfbDpdkDriver ();
140147
141148 /* *
@@ -214,6 +221,7 @@ class DpdkReader : public InputPlugin {
214221 uint16_t m_rxQueueId;
215222 uint16_t m_portId;
216223 int m_rxTimestampOffset;
224+ uint64_t m_rxTimestampDynflag;
217225
218226 bool m_useHwRxTimestamp;
219227
You can’t perform that action at this time.
0 commit comments