[PATCH v1 4/4] net/ice: round Tx time launch to timestamp resolution
Soumyadeep Hore
soumyadeep.hore at intel.com
Wed Dec 2 13:56:23 CET 2026
The launch time was truncated to the 128 ns timestamp resolution, so
every packet was launched up to 127 ns early, 64 ns on average.
Round to the nearest timestamp unit instead, which centers the launch
error around zero and bounds it to half a unit.
Signed-off-by: Soumyadeep Hore <soumyadeep.hore at intel.com>
---
drivers/net/intel/ice/ice_rxtx.c | 3 ++-
drivers/net/intel/ice/ice_rxtx.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index 488af38678..3ab75a77c3 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -3139,7 +3139,8 @@ ice_write_ts_desc(struct ci_tx_queue *txq,
if (txtime > txq->tsq->now + ICE_TXTIME_HORIZON_NS)
txtime = txq->tsq->now + ICE_TXTIME_HORIZON_NS;
/* The hardware compares against the free running PHC, not ns in second */
- tstamp = (uint32_t)(txtime >> ICE_TXTIME_CTX_RESOLUTION_128NS);
+ tstamp = (uint32_t)((txtime + ICE_TXTIME_ROUND_NS) >>
+ ICE_TXTIME_CTX_RESOLUTION_128NS);
tstamp &= ICE_TXTIME_STAMP_M >> rte_bsf32(ICE_TXTIME_STAMP_M);
if (tstamp == 0)
tstamp = 1;
diff --git a/drivers/net/intel/ice/ice_rxtx.h b/drivers/net/intel/ice/ice_rxtx.h
index e4746e0193..ef169e50af 100644
--- a/drivers/net/intel/ice/ice_rxtx.h
+++ b/drivers/net/intel/ice/ice_rxtx.h
@@ -42,6 +42,7 @@
#define ICE_TXTIME_DRAIN_POLL_US 100
/* Furthest launch time accepted, inside the ~33.5 ms future half of the window */
#define ICE_TXTIME_HORIZON_NS 30000000ULL
+#define ICE_TXTIME_ROUND_NS (1 << (ICE_TXTIME_CTX_RESOLUTION_128NS - 1))
#define ICE_REQ_DESC_MULTIPLE 32
#define ICE_RX_MAX_BURST CI_RX_MAX_BURST
--
2.43.0
More information about the stable
mailing list