The hardware compares the Tx time descriptor timestamp with the free
running PHC shifted by the timestamp resolution, but the driver
encoded the nanoseconds within the current second. Both values drift
apart by a different amount every second, so launch times were off by
up to the whole 67 ms window, the intervals jumped by milliseconds at
every second boundary and packets could be held or sent early.

Encode the launch time from the PHC nanoseconds directly.

Fixes: 0b6ff09a1f19 ("net/intel: support Tx packet pacing for E830")
Cc: [email protected]

Signed-off-by: Soumyadeep Hore <[email protected]>
---
 drivers/net/intel/ice/ice_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index 8a3c644b44..488af38678 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -3138,7 +3138,8 @@ ice_write_ts_desc(struct ci_tx_queue *txq,
                /* Further ahead the timestamp would read as expired */
                if (txtime > txq->tsq->now + ICE_TXTIME_HORIZON_NS)
                        txtime = txq->tsq->now + ICE_TXTIME_HORIZON_NS;
-               tstamp = (uint32_t)(txtime % NS_PER_S) >> 
ICE_TXTIME_CTX_RESOLUTION_128NS;
+               /* The hardware compares against the free running PHC, not ns 
in second */
+               tstamp = (uint32_t)(txtime >> ICE_TXTIME_CTX_RESOLUTION_128NS);
                tstamp &= ICE_TXTIME_STAMP_M >> rte_bsf32(ICE_TXTIME_STAMP_M);
                if (tstamp == 0)
                        tstamp = 1;
-- 
2.43.0

Reply via email to