diff mbox series

[v4,15/16] mbuf: add Tx timestamp registration helper

Message ID 20201103122205.183472-16-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove mbuf timestamp | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Nov. 3, 2020, 12:22 p.m. UTC
The function rte_mbuf_dyn_tx_timestamp_register()
can be used to register the required field and flag.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
---
 lib/librte_mbuf/rte_mbuf_dyn.c |  7 +++++++
 lib/librte_mbuf/rte_mbuf_dyn.h | 22 ++++++++++++++++++++++
 lib/librte_mbuf/version.map    |  1 +
 3 files changed, 30 insertions(+)

Comments

Andrew Rybchenko Nov. 3, 2020, 12:42 p.m. UTC | #1
On 11/3/20 3:22 PM, Thomas Monjalon wrote:
> The function rte_mbuf_dyn_tx_timestamp_register()
> can be used to register the required field and flag.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
diff mbox series

Patch

diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c
index 4f50da09f3..101b5bd95f 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.c
+++ b/lib/librte_mbuf/rte_mbuf_dyn.c
@@ -613,3 +613,10 @@  rte_mbuf_dyn_rx_timestamp_register(int *field_offset, uint64_t *rx_flag)
 	return rte_mbuf_dyn_timestamp_register(field_offset, rx_flag,
 			"Rx", RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME);
 }
+
+int
+rte_mbuf_dyn_tx_timestamp_register(int *field_offset, uint64_t *tx_flag)
+{
+	return rte_mbuf_dyn_timestamp_register(field_offset, tx_flag,
+			"Tx", RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME);
+}
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 2e729ddaca..d88e7bacc5 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -304,4 +304,26 @@  int rte_mbuf_dyn_rx_timestamp_register(int *field_offset, uint64_t *rx_flag);
  */
 #define RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME "rte_dynflag_tx_timestamp"
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Register dynamic mbuf field and flag for Tx timestamp.
+ *
+ * @param field_offset
+ *   Pointer to the offset of the registered mbuf field, can be NULL.
+ *   The same field is shared for Rx and Tx timestamp.
+ * @param tx_flag
+ *   Pointer to the mask of the registered offload flag, can be NULL.
+ * @return
+ *   0 on success, -1 otherwise.
+ *   Possible values for rte_errno:
+ *   - EEXIST: already registered with different parameters.
+ *   - EPERM: called from a secondary process.
+ *   - ENOENT: no more field or flag available.
+ *   - ENOMEM: allocation failure.
+ */
+__rte_experimental
+int rte_mbuf_dyn_tx_timestamp_register(int *field_offset, uint64_t *tx_flag);
+
 #endif
diff --git a/lib/librte_mbuf/version.map b/lib/librte_mbuf/version.map
index 0b66668bff..b7d98e7eb1 100644
--- a/lib/librte_mbuf/version.map
+++ b/lib/librte_mbuf/version.map
@@ -43,6 +43,7 @@  EXPERIMENTAL {
 	rte_mbuf_dynflag_register_bitnum;
 	rte_mbuf_dyn_dump;
 	rte_mbuf_dyn_rx_timestamp_register;
+	rte_mbuf_dyn_tx_timestamp_register;
 	rte_pktmbuf_copy;
 	rte_pktmbuf_free_bulk;
 	rte_pktmbuf_pool_create_extbuf;