* [PATCH v1 1/1] eventdev/eth_tx: use timestamp as dynamic mbuf field
@ 2022-06-27 10:05 Ganapati Kundapura
0 siblings, 0 replies; only message in thread
From: Ganapati Kundapura @ 2022-06-27 10:05 UTC (permalink / raw)
To: dev, jay.jayatheerthan, s.v.naga.harish.k, jerinjacobk
Added support to register timestamp dynamic field in mbuf.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
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
*
--
2.6.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-27 10:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 10:05 [PATCH v1 1/1] eventdev/eth_tx: use timestamp as dynamic mbuf field Ganapati Kundapura
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).