DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ganapati Kundapura <ganapati.kundapura@intel.com>
To: dev@dpdk.org, jay.jayatheerthan@intel.com,
	s.v.naga.harish.k@intel.com, jerinjacobk@gmail.com
Subject: [PATCH v1 1/1] eventdev/eth_tx: use timestamp as dynamic mbuf field
Date: Mon, 27 Jun 2022 05:05:44 -0500	[thread overview]
Message-ID: <20220627100545.2085017-1-ganapati.kundapura@intel.com> (raw)

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


                 reply	other threads:[~2022-06-27 10:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220627100545.2085017-1-ganapati.kundapura@intel.com \
    --to=ganapati.kundapura@intel.com \
    --cc=dev@dpdk.org \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinjacobk@gmail.com \
    --cc=s.v.naga.harish.k@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).