* [PATCH v2 2/3] net/i40e: initialize PTP to system time
2024-11-25 11:33 ` [PATCH v2 1/3] net/ixgbe: " Anatoly Burakov
@ 2024-11-25 11:33 ` Anatoly Burakov
2024-11-26 15:44 ` Bruce Richardson
2024-11-25 11:33 ` [PATCH v2 3/3] net/e1000: " Anatoly Burakov
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Anatoly Burakov @ 2024-11-25 11:33 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] 12+ messages in thread
* Re: [PATCH v2 2/3] net/i40e: initialize PTP to system time
2024-11-25 11:33 ` [PATCH v2 2/3] net/i40e: " Anatoly Burakov
@ 2024-11-26 15:44 ` Bruce Richardson
0 siblings, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2024-11-26 15:44 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Ian Stokes
On Mon, Nov 25, 2024 at 11:33:25AM +0000, Anatoly Burakov wrote:
> 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>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 3/3] net/e1000: initialize PTP to system time
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-25 11:33 ` 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
` (2 subsequent siblings)
4 siblings, 2 replies; 12+ messages in thread
From: Anatoly Burakov @ 2024-11-25 11:33 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] 12+ messages in thread
* RE: [PATCH v2 3/3] net/e1000: initialize PTP to system time
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
1 sibling, 0 replies; 12+ messages in thread
From: Xu, HailinX @ 2024-11-26 8:30 UTC (permalink / raw)
To: Burakov, Anatoly, dev
> -----Original Message-----
> From: Anatoly Burakov <anatoly.burakov@intel.com>
> Sent: Monday, November 25, 2024 7:33 PM
> To: dev@dpdk.org
> Subject: [PATCH v2 3/3] net/e1000: initialize PTP to system time
>
> 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>
> ---
Tested-by: Hailin Xu <hailinx.xu@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/3] net/e1000: initialize PTP to system time
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
1 sibling, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2024-11-26 15:44 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev
On Mon, Nov 25, 2024 at 11:33:26AM +0000, Anatoly Burakov wrote:
> 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>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2 1/3] net/ixgbe: initialize PTP to system time
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-25 11:33 ` [PATCH v2 3/3] net/e1000: " Anatoly Burakov
@ 2024-11-26 8:30 ` Xu, HailinX
2024-11-26 15:43 ` Bruce Richardson
2024-11-26 16:09 ` Bruce Richardson
4 siblings, 0 replies; 12+ messages in thread
From: Xu, HailinX @ 2024-11-26 8:30 UTC (permalink / raw)
To: Burakov, Anatoly, dev, Medvedkin, Vladimir
> -----Original Message-----
> From: Anatoly Burakov <anatoly.burakov@intel.com>
> Sent: Monday, November 25, 2024 7:33 PM
> To: dev@dpdk.org; Medvedkin, Vladimir <vladimir.medvedkin@intel.com>
> Subject: [PATCH v2 1/3] net/ixgbe: initialize PTP to system time
>
> 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.
>
> Implementation note: in order to get access to clock_gettime on MinGW, we
> have to use rte_os_shim.h header, which provides a wrapper around that
> function. However, what it *also* provides is wrapper macros around various
> other OS-related functions such as read(). Due to one of the mailbox ops in
> base code being called "read", MinGW will misinterpret a call into that op as an
> attempt to call read() the OS function, and produce a compile error. This is
> being worked around by using parentheses around access to the read op.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Tested-by: Hailin Xu <hailinx.xu@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] net/ixgbe: initialize PTP to system time
2024-11-25 11:33 ` [PATCH v2 1/3] net/ixgbe: " Anatoly Burakov
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2024-11-26 15:43 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Mon, Nov 25, 2024 at 11:33:24AM +0000, Anatoly Burakov wrote:
> 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.
>
> Implementation note: in order to get access to clock_gettime on MinGW, we
> have to use rte_os_shim.h header, which provides a wrapper around that
> function. However, what it *also* provides is wrapper macros around various
> other OS-related functions such as read(). Due to one of the mailbox ops
> in base code being called "read", MinGW will misinterpret a call into
> that op as an attempt to call read() the OS function, and produce a
> compile error. This is being worked around by using parentheses around
> access to the read op.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] net/ixgbe: initialize PTP to system time
2024-11-25 11:33 ` [PATCH v2 1/3] net/ixgbe: " Anatoly Burakov
` (3 preceding siblings ...)
2024-11-26 15:43 ` Bruce Richardson
@ 2024-11-26 16:09 ` Bruce Richardson
4 siblings, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2024-11-26 16:09 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Mon, Nov 25, 2024 at 11:33:24AM +0000, Anatoly Burakov wrote:
> 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.
>
> Implementation note: in order to get access to clock_gettime on MinGW, we
> have to use rte_os_shim.h header, which provides a wrapper around that
> function. However, what it *also* provides is wrapper macros around various
> other OS-related functions such as read(). Due to one of the mailbox ops
> in base code being called "read", MinGW will misinterpret a call into
> that op as an attempt to call read() the OS function, and produce a
> compile error. This is being worked around by using parentheses around
> access to the read op.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Series applied to dpdk-next-net-intel.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 12+ messages in thread