Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice)
@ 2026-12-01  0:52 Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 1/3] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tony Nguyen @ 2026-12-01  0:52 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, andrew+netdev, netdev
  Cc: Tony Nguyen, przemyslaw.kitszel, maciej.machnikowski,
	grzegorz.nitka, jacob.e.keller

Maciek Machnikowski stops E825 PHY/PHC clock drift by holding the PTP
semaphore throughout PHY timer startup; protecting shared register
access from concurrent clock adjustments.

Grzegorz Nitka removes redundant PTP command programming to prevent
potential races with other PTP operations.

Jake Keller fixes E830 ETF timestamp calculation by converting the full
ktime value to nanoseconds to scheduled transmit times match the packet
timestamps.
---
v2:
- Drop first 2 patches
Patch 1:
- Revert 'unlocked' name change from function (ice_sync_phy_timer_eth56g)
- Fix documentation ordering
Patch 2:
- Add more details to commit message

v1: https://lore.kernel.org/netdev/20261125224428.4126195-1-anthony.l.nguyen@intel.com/

The following are changes since commit 76fca30e8d34eb151fcf4f363b51c21b7e8c4709:
  MAINTAINERS: don't CC netdev on netfilter patches
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE

Grzegorz Nitka (1):
  ice: remove redundant cross-timestamp PTP command

Jacob Keller (1):
  ice: fix computation of ETF timestamps for E830

Maciek Machnikowski (1):
  ice: ptp: serialize E825 PHY timer start with PTP lock and incval

 drivers/net/ethernet/intel/ice/ice_ptp.c    |  6 ---
 drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 42 +++++++++------------
 drivers/net/ethernet/intel/ice/ice_txrx.c   |  9 ++---
 3 files changed, 22 insertions(+), 35 deletions(-)

-- 
2.47.1


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

* [PATCH net v2 1/3] ice: ptp: serialize E825 PHY timer start with PTP lock and incval
  2026-12-01  0:52 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
@ 2026-12-01  0:52 ` Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 2/3] ice: remove redundant cross-timestamp PTP command Tony Nguyen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2026-12-01  0:52 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, andrew+netdev, netdev
  Cc: Maciek Machnikowski, anthony.l.nguyen, przemyslaw.kitszel,
	grzegorz.nitka, jacob.e.keller, richardcochran, Marc Neustadter,
	Sergey Temerkhanov, Milena Olech, Simon Horman,
	Aleksandr Loktionov, Ayush Singh

From: Maciek Machnikowski <maciej.machnikowski@intel.com>

ice_start_phy_timer_eth56g() programmed the PHY increment value and
performed the PHY-to-PHC phase synchronization in two separate PTP
semaphore critical sections, and touched the shared source command
register (GLTSYN_CMD via ice_ptp_src_cmd()) and read the source incval
before acquiring the semaphore at all.

Because GLTSYN_CMD is a single global register latched for the source
timer and all PHY ports by GLTSYN_CMD_SYNC, a concurrent adjtime (small
offset, <= S32_MAX) or adjfine could clobber the source command between
the incval-init and the phase-sync steps. In the worst case the source
timer command written by ice_ptp_adj_clock() (ICE_PTP_ADJ_TIME) was
overwritten by the unlocked ICE_PTP_NOP from ice_start_phy_timer_eth56g(),
so the adjustment was applied to the PHY ports but not to the PHC. This
left the E825 PHY clock permanently offset from the PHC, showing up as an
intermittent clock drift.

Hold the PTP semaphore across the entire start sequence: acquire it before
the first shared-register access (ice_ptp_src_cmd()), keep it held through
the incval read, PHY incval init, and the phase synchronization, then
release it once. Modify the ice_sync_phy_timer_eth66g() to assume the PTP
semaphore is held, instead of trying to acquire the lock itself.

Fixes: 781ff8f2d575 ("ice: ptp: serialize E825 PHY timer start with PTP lock")
Signed-off-by: Maciek Machnikowski <maciej.machnikowski@intel.com>
Co-developed-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Suggested-by: Marc Neustadter <marc.neustadter@intel.com>
Reviewed-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
Reviewed-by: Milena Olech <milena.olech@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Ayush Singh <ayush1x.singh@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 42 +++++++++------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
index 3a41c711e751..c5a86ae66130 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
@@ -2039,9 +2039,10 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,
  * to the PHY timer in order to ensure it reads the same value as the
  * primary PHC timer.
  *
+ * Context: The caller must acquire the PTP semaphore lock.
+ *
  * Return:
  * * %0     - success
- * * %-EBUSY- failed to acquire PTP semaphore
  * * %other - PHY read/write failed
  */
 static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
@@ -2049,14 +2050,9 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	u64 phc_time, phy_time, difference;
 	int err;
 
-	if (!ice_ptp_lock(hw)) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to acquire PTP semaphore\n");
-		return -EBUSY;
-	}
-
 	err = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time, &phc_time);
 	if (err)
-		goto err_unlock;
+		return err;
 
 	/* Calculate the amount required to add to the port time in order for
 	 * it to match the PHC time.
@@ -2072,11 +2068,11 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 
 	err = ice_ptp_prep_port_adj_eth56g(hw, port, (s64)difference);
 	if (err)
-		goto err_unlock;
+		return err;
 
 	err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_ADJ_TIME);
 	if (err)
-		goto err_unlock;
+		return err;
 
 	/* Issue the sync to activate the time adjustment */
 	ice_ptp_exec_tmr_cmd(hw);
@@ -2086,15 +2082,13 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	 */
 	err = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time, &phc_time);
 	if (err)
-		goto err_unlock;
+		return err;
 
 	dev_info(ice_hw_to_dev(hw),
 		 "Port %u PHY time synced to PHC: 0x%016llX, 0x%016llX\n",
 		 port, phy_time, phc_time);
 
-err_unlock:
-	ice_ptp_unlock(hw);
-	return err;
+	return 0;
 }
 
 /**
@@ -2155,19 +2149,24 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	if (err)
 		return err;
 
+	if (!ice_ptp_lock(hw)) {
+		dev_err(ice_hw_to_dev(hw), "Failed to acquire PTP semaphore\n");
+		return -EBUSY;
+	}
+
 	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 
 	err = ice_phy_cfg_parpcs_eth56g(hw, port);
 	if (err)
-		return err;
+		goto err_ptp_unlock;
 
 	err = ice_phy_cfg_ptp_1step_eth56g(hw, port);
 	if (err)
-		return err;
+		goto err_ptp_unlock;
 
 	err = ice_phy_cfg_mac_eth56g(hw, port);
 	if (err)
-		return err;
+		goto err_ptp_unlock;
 
 	if (ice_is_primary(hw)) {
 		lo = rd32(hw, GLTSYN_INCVAL_L(tmr_idx));
@@ -2178,11 +2177,6 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	}
 	incval = (u64)hi << 32 | lo;
 
-	if (!ice_ptp_lock(hw)) {
-		dev_err(ice_hw_to_dev(hw), "Failed to acquire PTP semaphore\n");
-		return -EBUSY;
-	}
-
 	err = ice_write_40b_ptp_reg_eth56g(hw, port, PHY_REG_TIMETUS_L, incval);
 	if (err)
 		goto err_ptp_unlock;
@@ -2193,11 +2187,11 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 
 	ice_ptp_exec_tmr_cmd(hw);
 
-	ice_ptp_unlock(hw);
-
 	err = ice_sync_phy_timer_eth56g(hw, port);
 	if (err)
-		return err;
+		goto err_ptp_unlock;
+
+	ice_ptp_unlock(hw);
 
 	err = ice_write_ptp_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 1);
 	if (err)
-- 
2.47.1


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

* [PATCH net v2 2/3] ice: remove redundant cross-timestamp PTP command
  2026-12-01  0:52 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 1/3] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
@ 2026-12-01  0:52 ` Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 3/3] ice: fix computation of ETF timestamps for E830 Tony Nguyen
  2026-12-01  0:58 ` [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) netdev-bot+sinfo
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2026-12-01  0:52 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, andrew+netdev, netdev
  Cc: Grzegorz Nitka, anthony.l.nguyen, przemyslaw.kitszel,
	maciej.machnikowski, jacob.e.keller, richardcochran,
	Sergey Temerkhanov, Milena Olech, Simon Horman,
	Aleksandr Loktionov, Ayush Singh

From: Grzegorz Nitka <grzegorz.nitka@intel.com>

The cross-timestamp capture path programs GLTSYN_CMD with READ_TIME before
starting the ART/device capture and clears it with NOP afterwards.

Since GLTSYN_CMD is shared with other PTP operations, concurrent executions
will race and cause desync across PHY timers causing PHY timestamps to be
incorrect and resulting in faulty PTP behavior. Remove the redundant source
command programming instead of adding another guard around it.

This was found on an early pre-production stepping of a device, and it was
assumed that it would be required for all E823 devices. We discovered that
this isn't actually required on E823 production devices as originally
believed. The only device SKUs that actually require this are
pre-production and have device IDs which aren't supported by the driver.
We tested this across a wide array of E823 silicon steppings.

Testing hints:
Verify crosstimestamp path, for example with phc2sys tool, on
E822/E823/E825/E830 devices. Please note that the phc2sys tool performs
cross-timestamping by default when supported by the hardware. This can
be observed when the reported delay is 0, indicating that the system
time and PHC time were latched simultaneously.

Fixes: 88c360e49f51 ("ice: Support cross-timestamping for E823 devices")
Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Reviewed-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
Reviewed-by: Milena Olech <milena.olech@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Ayush Singh <ayush1x.singh@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 8908b4f3db35..db1d0e42ae52 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2183,9 +2183,6 @@ static int ice_capture_crosststamp(ktime_t *device,
 	/* Snapshot system time for historic interpolation */
 	ktime_get_snapshot_id(ctx->snapshot_clock_id, &ctx->snapshot);
 
-	/* Program cmd to master timer */
-	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
-
 	/* Start the ART and device clock sync sequence */
 	ctl = rd32(hw, cfg->ctl_reg);
 	ctl |= cfg->ctl_active;
@@ -2212,9 +2209,6 @@ static int ice_capture_crosststamp(ktime_t *device,
 	*device = ns_to_ktime(ts);
 
 err_timeout:
-	/* Clear the master timer */
-	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
-
 	/* Release HW lock */
 	lock = rd32(hw, cfg->lock_reg);
 	lock &= ~cfg->lock_busy;
-- 
2.47.1


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

* [PATCH net v2 3/3] ice: fix computation of ETF timestamps for E830
  2026-12-01  0:52 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 1/3] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
  2026-12-01  0:52 ` [PATCH net v2 2/3] ice: remove redundant cross-timestamp PTP command Tony Nguyen
@ 2026-12-01  0:52 ` Tony Nguyen
  2026-12-01  0:58 ` [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) netdev-bot+sinfo
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2026-12-01  0:52 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, andrew+netdev, netdev
  Cc: Jacob Keller, anthony.l.nguyen, przemyslaw.kitszel,
	maciej.machnikowski, grzegorz.nitka, paul.greenwalt,
	maciej.fijalkowski, richardcochran, Aleksandr Loktionov

From: Jacob Keller <jacob.e.keller@intel.com>

When Earliest TxTime First offload is enabled, the ice_tx_map() function
computes the appropriate timestamps for the timestamp ring used to set the
transmit times for each packet.

It computes this by converting the skb->tstamp into a timespec and then
taking the sub-second portion from tv_nsec and dividing it by the timestamp
resolution. This value is then inserted into the timestamp descriptor using
ice_build_tstamp_desc().

At first glance this may seem reasonable. After all, the Tx timestamp
descriptor field has a mask defined by ICE_TXTIME_STAMP_M which is
GENMASK(31,13). This is a 19-bit wide field. With a unit size of 128
nanoseconds, the maximum representable time is only ~67 milliseconds, far
below the size of the tv_nsec field (just shy of one second).

The E830 device time is represented as a single 64-bit nanosecond value as
seen by ice_ptp_read_src_clk_reg() using a simple rd64 on the GLTSYN_TIME_L
register.

According to the data sheet, the hardware uses the following flow to
determine when to transmit the next packet in the paced queue:

  half_window = window_size / 2
  if (ts <= timer) {
    if (timer - ts < half_window) {
      // timestamp expired
      pass
    } else {
      // wait before sending
      stall
    }
  } else {
    // Handle possible rollover case
    if (ts - timer < half_window) {
      // wait before sending
      stall
    } else {
      // timestamp expired
      pass
    }
  }

Here, window_size is the maximum value that fix in the 19 bit sized
timestamp field, ts is the next packet timestamp waiting in the queue, and
timer is the 19 bits of the GLTSYN_TIME MAC timer. The configured timestamp
"resolution" determines at which bit position to capture from the
GLTSYN_TIME registers. This logic does not perform any computation to
divide out seconds or to handle anything like a timespec. The timestamp and
timer values are compared directly with logic to account for handling
rollover.

Because of the faulty logic, all of the timestamps computed and placed in
the ring will result in the transmit time not matching the desired time per
the skb. Consider a timestamp exactly on a second boundary. The computed
timestamp will be 0, while the actual value should be (1,000,000,000 / 128)
mod 2^19 or 472,468 (0x73594).

Fix this by directly converting the ktime to nanoseconds rather than
converting to a timespec64.

Fixes: ccde82e90946 ("ice: add E830 Earliest TxTime First Offload support")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_txrx.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index 35a480a1e172..ca98394caa04 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -1522,10 +1522,9 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first,
 
 	if (ice_is_txtime_cfg(tx_ring)) {
 		struct ice_tstamp_ring *tstamp_ring;
-		u32 tstamp_count, j;
 		struct ice_ts_desc *ts_desc;
-		struct timespec64 ts;
-		u32 tstamp;
+		u32 tstamp_count, j;
+		u64 tstamp;
 
 		smp_rmb();	/* order flag read before pointer read */
 		tstamp_ring = READ_ONCE(tx_ring->tstamp_ring);
@@ -1535,8 +1534,8 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first,
 		tstamp_count = tstamp_ring->count;
 		j = tstamp_ring->next_to_use;
 
-		ts = ktime_to_timespec64(first->skb->tstamp);
-		tstamp = ts.tv_nsec >> ICE_TXTIME_CTX_RESOLUTION_128NS;
+		tstamp = ktime_to_ns(first->skb->tstamp);
+		tstamp >>= ICE_TXTIME_CTX_RESOLUTION_128NS;
 
 		ts_desc = ICE_TS_DESC(tstamp_ring, j);
 		ts_desc->tx_desc_idx_tstamp = ice_build_tstamp_desc(i, tstamp);
-- 
2.47.1


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

* Re: [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice)
  2026-12-01  0:52 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
                   ` (2 preceding siblings ...)
  2026-12-01  0:52 ` [PATCH net v2 3/3] ice: fix computation of ETF timestamps for E830 Tony Nguyen
@ 2026-12-01  0:58 ` netdev-bot+sinfo
  3 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sinfo @ 2026-12-01  0:58 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, andrew+netdev, netdev,
	przemyslaw.kitszel, maciej.machnikowski, grzegorz.nitka,
	jacob.e.keller

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

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

end of thread, other threads:[~2026-12-01  0:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  0:52 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
2026-12-01  0:52 ` [PATCH net v2 1/3] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
2026-12-01  0:52 ` [PATCH net v2 2/3] ice: remove redundant cross-timestamp PTP command Tony Nguyen
2026-12-01  0:52 ` [PATCH net v2 3/3] ice: fix computation of ETF timestamps for E830 Tony Nguyen
2026-12-01  0:58 ` [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox