DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 1/3] net/ixgbe: initialize PTP to system time
@ 2024-11-22 15:18 Anatoly Burakov
  2024-11-22 15:18 ` [PATCH v1 2/3] net/i40e: " Anatoly Burakov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Anatoly Burakov @ 2024-11-22 15:18 UTC (permalink / raw)
  To: dev, Vladimir Medvedkin

Currently, ixgbe driver initializes PTP timestamp to 0. This is different
from what kernel driver does (which initializes it to system time).

Align the DPDK driver to kernel driver by setting PTP timestamp to system
time when enabling PTP.

Note that ixgbe driver always uses zero-based timestamps for PTP, so we
would only ever update the internal timecounter and not the actual NIC
registers.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d02d1e43a3..8bc706f97b 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -6924,6 +6924,12 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t tsync_ctl;
 	uint32_t tsauxc;
+	struct timespec ts;
+
+	memset(&ts, 0, sizeof(struct timespec));
+
+	/* get current system time */
+	clock_gettime(CLOCK_REALTIME, &ts);
 
 	/* Stop the timesync system time. */
 	IXGBE_WRITE_REG(hw, IXGBE_TIMINCA, 0x0);
@@ -6956,6 +6962,9 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev)
 
 	IXGBE_WRITE_FLUSH(hw);
 
+	/* ixgbe uses zero-based timestamping so only adjust timecounter */
+	ixgbe_timesync_write_time(dev, &ts);
+
 	return 0;
 }
 
-- 
2.43.5


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-11-26 16:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-22 15:18 [PATCH v1 1/3] net/ixgbe: initialize PTP to system time Anatoly Burakov
2024-11-22 15:18 ` [PATCH v1 2/3] net/i40e: " Anatoly Burakov
2024-11-22 15:18 ` [PATCH v1 3/3] net/e1000: " Anatoly Burakov
2024-11-25 11:33 ` [PATCH v2 1/3] net/ixgbe: " Anatoly Burakov
2024-11-25 11:33   ` [PATCH v2 2/3] net/i40e: " Anatoly Burakov
2024-11-26 15:44     ` Bruce Richardson
2024-11-25 11:33   ` [PATCH v2 3/3] net/e1000: " Anatoly Burakov
2024-11-26  8:30     ` Xu, HailinX
2024-11-26 15:44     ` Bruce Richardson
2024-11-26  8:30   ` [PATCH v2 1/3] net/ixgbe: " Xu, HailinX
2024-11-26 15:43   ` Bruce Richardson
2024-11-26 16:09   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).