* [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
2024-11-22 15:18 ` [PATCH v1 3/3] net/e1000: " Anatoly Burakov
0 siblings, 2 replies; 3+ 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] 3+ messages in thread
* [PATCH v1 2/3] net/i40e: initialize PTP to system time
2024-11-22 15:18 [PATCH v1 1/3] net/ixgbe: initialize PTP to system time Anatoly Burakov
@ 2024-11-22 15:18 ` Anatoly Burakov
2024-11-22 15:18 ` [PATCH v1 3/3] net/e1000: " Anatoly Burakov
1 sibling, 0 replies; 3+ messages in thread
From: Anatoly Burakov @ 2024-11-22 15:18 UTC (permalink / raw)
To: dev, Ian Stokes, Bruce Richardson
Currently, i40e 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 i40e 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/i40e/i40e_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ca128c7556..30dcdc68a8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10556,6 +10556,9 @@ i40e_timesync_enable(struct rte_eth_dev *dev)
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t tsync_ctl_l;
uint32_t tsync_ctl_h;
+ struct timespec ts;
+
+ memset(&ts, 0, sizeof(struct timespec));
/* Stop the timesync system time. */
I40E_WRITE_REG(hw, I40E_PRTTSYN_INC_L, 0x0);
@@ -10585,6 +10588,9 @@ i40e_timesync_enable(struct rte_eth_dev *dev)
I40E_WRITE_REG(hw, I40E_PRTTSYN_CTL0, tsync_ctl_l);
I40E_WRITE_REG(hw, I40E_PRTTSYN_CTL1, tsync_ctl_h);
+ /* i40e uses zero-based timestamping so only adjust timecounter */
+ i40e_timesync_write_time(dev, &ts);
+
return 0;
}
--
2.43.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1 3/3] net/e1000: initialize PTP to system time
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 ` Anatoly Burakov
1 sibling, 0 replies; 3+ messages in thread
From: Anatoly Burakov @ 2024-11-22 15:18 UTC (permalink / raw)
To: dev
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@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-22 15:19 UTC | newest]
Thread overview: 3+ 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
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).