[v1,1/1] eventdev/eth_tx: use timestamp as dynamic mbuf field

Message ID 20220627100545.2085017-1-ganapati.kundapura@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Jerin Jacob
Headers
Series [v1,1/1] eventdev/eth_tx: use timestamp as dynamic mbuf field |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Kundapura, Ganapati June 27, 2022, 10:05 a.m. UTC
Added support to register timestamp dynamic field in mbuf.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
  

Patch

diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index c700fb7..23d5df3 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -74,6 +74,10 @@  do {\
 	} \
 } while (0)
 
+/* enable dynamic timestamp field in mbuf */
+uint64_t event_eth_tx_timestamp_dynflag;
+int event_eth_tx_timestamp_dynfield_offset = -1;
+
 /* Tx retry callback structure */
 struct txa_retry {
 	/* Ethernet port id */
@@ -197,7 +201,7 @@  static int
 txa_dev_id_array_init(void)
 {
 	if (txa_dev_id_array == NULL) {
-		int i;
+		int i, ret;
 
 		txa_dev_id_array = txa_memzone_array_get("txa_adapter_array",
 					sizeof(int),
@@ -207,6 +211,16 @@  txa_dev_id_array_init(void)
 
 		for (i = 0; i < RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE; i++)
 			txa_dev_id_array[i] = TXA_INVALID_DEV_ID;
+
+		/* Register mbuf dynamic timestamp field */
+		ret = rte_mbuf_dyn_tx_timestamp_register(
+				&event_eth_tx_timestamp_dynfield_offset,
+				&event_eth_tx_timestamp_dynflag);
+		if (ret != 0) {
+			RTE_EDEV_LOG_ERR("Error registering timestamp "
+					 "field/flag");
+			return -ENOMEM;
+		}
 	}
 
 	return 0;
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h
index 3908c2d..12e80a9 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.h
+++ b/lib/eventdev/rte_event_eth_tx_adapter.h
@@ -77,9 +77,19 @@  extern "C" {
 #include <stdint.h>
 
 #include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
 
 #include "rte_eventdev.h"
 
+extern int event_eth_tx_timestamp_dynfield_offset;
+
+static inline rte_mbuf_timestamp_t *
+rte_event_eth_tx_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf,
+		event_eth_tx_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 /**
  * Adapter configuration structure
  *