* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
__rte_experimental
void rte_mbuf_dyn_dump(FILE *out);
-/* Placeholder for dynamic fields and flags declarations. */
+/*
+ * Placeholder for dynamic fields and flags declarations.
+ * This is centralizing point to gather all field names
+ * and parameters together.
+ */
+
+/*
+ * The metadata dynamic field provides some extra packet information
+ * to interact with RTE Flow engine. The metadata in sent mbufs can be
+ * used to match on some Flows. The metadata in received mbufs can
+ * provide some feedback from the Flows. The metadata flag tells
+ * whether the field contains actual value to send, or received one.
+ */
+#define RTE_MBUF_DYNFIELD_METADATA_NAME "rte_flow_dynfield_metadata"
+#define RTE_MBUF_DYNFLAG_METADATA_NAME "rte_flow_dynflag_metadata"
+
+/**
+ * The timestamp dynamic field provides some timing information, the
+ * units and time references (initial phase) are not explicitly defined
+ * but are maintained always the same for a given port. Some devices allow
+ * to query rte_eth_read_clock() that will return the current device
+ * timestamp. The dynamic Tx timestamp flag tells whether the field contains
+ * actual timestamp value for the packets being sent, this value can be
+ * used by PMD to schedule packet sending.
+ */
+#define RTE_MBUF_DYNFIELD_TIMESTAMP_NAME "rte_dynfield_timestamp"
+typedef uint64_t rte_mbuf_timestamp_t;
+
+/**
+ * Indicate that the timestamp field in the mbuf was filled by the driver.
+ */
+#define RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME "rte_dynflag_rx_timestamp"
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Register dynamic mbuf field and flag for Rx 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 rx_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_rx_timestamp_register(int *field_offset, uint64_t *rx_flag);
+
+/**
+ * When PMD sees the RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME flag set on the
+ * packet being sent it tries to synchronize the time of packet appearing
+ * on the wire with the specified packet timestamp. If the specified one
+ * is in the past it should be ignored, if one is in the distant future
+ * it should be capped with some reasonable value (in range of seconds).
+ *
+ * There is no any packet reordering according to timestamps is supposed,
+ * neither for packet within the burst, nor for the whole bursts, it is
+ * an entirely application responsibility to generate packets and its
+ * timestamps in desired order. The timestamps might be put only in
+ * the first packet in the burst providing the entire burst scheduling.
+ */
+#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