ethdev: add per-packet Tx timestamp slot APIs
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC 1/1 ethdev: add per-packet Tx timestamp slot APIs
Add ethdev public and driver-facing APIs for per-packet Tx hardware timestamp slot management.
The existing rte_eth_timesync_read_tx_timestamp() exposes a single shared latch, making it unreliable when multiple Tx timestamps are outstanding concurrently. PMDs with per-packet slot hardware cannot be exploited through this interface.
Introduce a slot lifecycle API:
- rte_eth_timesync_tx_timestamp_slot_alloc(): reserve a hardware slot before transmit
- rte_eth_timesync_tx_timestamp_stamp_mbuf(): embed slot handle into mbuf dynfield for per-packet NIC steering
- rte_eth_timesync_read_tx_timestamp_slot(): poll slot for a captured timestamp; returns -EAGAIN if not ready
- rte_eth_timesync_tx_timestamp_slot_release(): return slot to PMD after readback or timeout
Introduce rte_eth_timesync_dual_domain_timestamp to carry both the adjusted PHC time (adjusted_ns) and free-running cycles-domain time (cycles_ns), each with an individual validity bit in valid_mask.
--- lib/ethdev/ethdev_driver.h | 19 ++++++ lib/ethdev/rte_ethdev.c | 121 +++++++++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 108 +++++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+)
lib/ethdev/ethdev_driver.h +19 -0
@@ -795,6 +795,19 @@ typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,typedef int (*eth_timesync_read_tx_timestamp_t )(struct rte_eth_dev *dev,struct timespec *timestamp); +/** @internal Allocate a per-packet TX timestamp slot handle. */ +typedef int (*eth_timesync_tx_timestamp_slot_alloc_t )(struct rte_eth_dev *dev, +uint16_t tx_queue_id,uint32_t *slot_id); + +/** @internal Read TX timestamp by slot handle. */ +typedef int (*eth_timesync_read_tx_timestamp_slot_t )(struct rte_eth_dev *dev, +uint32_t slot_id, +struct rte_eth_timesync_dual_domain_timestamp *timestamp); + +/** @internal Release a previously allocated TX timestamp slot handle. */ +typedef int (*eth_timesync_tx_timestamp_slot_release_t )(struct rte_eth_dev *dev, +uint32_t slot_id); +/** @internal Function used to adjust the device clock. */ typedef int (*eth_timesync_adjust_time )(struct rte_eth_dev *dev,int64_t );
@@ -1561,6 +1574,12 @@ struct eth_dev_ops {eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;/** Read the IEEE1588/802.1AS Tx timestamp */ eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp; +/** Allocate a TX timestamp slot handle */ +eth_timesync_tx_timestamp_slot_alloc_t timesync_tx_timestamp_slot_alloc; +/** Read a TX timestamp using a slot handle */ +eth_timesync_read_tx_timestamp_slot_t timesync_read_tx_timestamp_slot; +/** Release a TX timestamp slot handle */ +eth_timesync_tx_timestamp_slot_release_t timesync_tx_timestamp_slot_release;/** Adjust the device clock */ eth_timesync_adjust_time timesync_adjust_time;/** Adjust the clock frequency */
lib/ethdev/rte_ethdev.c +121 -0
127 lines not on this page · raw message
lib/ethdev/rte_ethdev.h +108 -0
114 lines not on this page · raw message
Signature · 1 line
2.54.0