[PATCH v2 3/3] net/e1000: initialize PTP to system time

Anatoly Burakov anatoly.burakov at intel.com
Mon Nov 25 12:33:26 CET 2024


Currently, e1000 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 e1000 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 at intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index d3a9181874..c695f44c4c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -4817,6 +4817,9 @@ igb_timesync_enable(struct rte_eth_dev *dev)
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t tsync_ctl;
 	uint32_t tsauxc;
+	struct timespec ts;
+
+	memset(&ts, 0, sizeof(struct timespec));
 
 	/* Stop the timesync system time. */
 	E1000_WRITE_REG(hw, E1000_TIMINCA, 0x0);
@@ -4861,6 +4864,9 @@ igb_timesync_enable(struct rte_eth_dev *dev)
 	tsync_ctl |= E1000_TSYNCTXCTL_ENABLED;
 	E1000_WRITE_REG(hw, E1000_TSYNCTXCTL, tsync_ctl);
 
+	/* e1000 uses zero-based timestamping so only adjust timecounter */
+	igb_timesync_write_time(dev, &ts);
+
 	return 0;
 }
 
-- 
2.43.5



More information about the dev mailing list