diff mbox series

[iwl-net,2/2] ice: remove redundant cross-timestamp PTP command

Message ID 20260925222824.270640-3-grzegorz.nitka@intel.com
State Under Review
Delegated to: Anthony Nguyen
Headers show
Series ice: fix E825 PTP timer race and drop redundant cross-timestamp access | expand

Commit Message

Grzegorz Nitka Sept. 25, 2026, 10:28 p.m. UTC
The cross-timestamp capture path programs GLTSYN_CMD with READ_TIME before
starting the ART/device capture and clears it with NOP afterwards.

It was assumed that this change was needed for E823 devices, which
turned out to be not true. The hardware supported by this driver
does not require it.

Since GLTSYN_CMD is shared with other PTP operations, touching it here
only adds a potential race source.
Remove the redundant source command programming instead of adding another
guard around it.

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>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Simon Horman Sept. 26, 2026, 5:06 p.m. UTC | #1
On Sat, Sep 26, 2026 at 12:28:24AM +0200, Grzegorz Nitka wrote:
> The cross-timestamp capture path programs GLTSYN_CMD with READ_TIME before
> starting the ART/device capture and clears it with NOP afterwards.
> 
> It was assumed that this change was needed for E823 devices, which
> turned out to be not true. The hardware supported by this driver
> does not require it.
> 
> Since GLTSYN_CMD is shared with other PTP operations, touching it here
> only adds a potential race source.
> Remove the redundant source command programming instead of adding another
> guard around it.
> 
> 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>
Loktionov, Aleksandr Sept. 28, 2026, 3:19 p.m. UTC | #2
> -----Original Message-----
> From: Grzegorz Nitka <grzegorz.nitka@intel.com>
> Sent: Saturday, September 26, 2026 12:28 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> richardcochran@gmail.com; andrew+netdev@lunn.ch; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@intel.com>; davem@davemloft.net;
> edumazet@google.com; Nitka, Grzegorz <grzegorz.nitka@intel.com>;
> Temerkhanov, Sergey <sergey.temerkhanov@intel.com>; Olech, Milena
> <milena.olech@intel.com>
> Subject: [PATCH iwl-net 2/2] ice: remove redundant cross-timestamp PTP
> command
> 
> The cross-timestamp capture path programs GLTSYN_CMD with READ_TIME
> before starting the ART/device capture and clears it with NOP
> afterwards.
> 
> It was assumed that this change was needed for E823 devices, which
> turned out to be not true. The hardware supported by this driver does
> not require it.
> 
> Since GLTSYN_CMD is shared with other PTP operations, touching it here
> only adds a potential race source.
> Remove the redundant source command programming instead of adding
> another guard around it.
> 
> 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>
> ---
>  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 fd97190a89a9..23c0a45050d7 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -2229,9 +2229,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;
> @@ -2258,9 +2255,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.39.3

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index fd97190a89a9..23c0a45050d7 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2229,9 +2229,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;
@@ -2258,9 +2255,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;