All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: <netdev-bot+sashiko@kernel.org>, <anthony.l.nguyen@intel.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@kernel.org>, <andrew+netdev@lunn.ch>,
	<netdev@vger.kernel.org>, <poros@redhat.com>,
	<maciej.machnikowski@intel.com>, <przemyslaw.korba@intel.com>,
	<grzegorz.nitka@intel.com>, <sergey.temerkhanov@intel.com>,
	<arkadiusz.kubalewski@intel.com>, <richardcochran@gmail.com>,
	<horms@kernel.org>
Subject: Re: [PATCH net v3 09/14] ice: E825: clear PHY_TSTAMP memory prior to soft reset
Date: Mon, 19 Oct 2026 16:49:57 -0700	[thread overview]
Message-ID: <5e3e381a-b499-4654-817f-e8a46a2e43df@intel.com> (raw)
In-Reply-To: <179244085178.3135.3380160340565302392@kernel.org>

On 10/19/2026 1:14 PM, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found more severe
> issue(s) in other patches of this series. This mail is only an FYI, in case
> you want to address the nit picks below when you respin.
> 
> Low priority / nit picks for your consideration:
> 
> - [Low] In ice_ptp_phy_soft_reset_eth56g()
>   (drivers/net/ethernet/intel/ice/ice_ptp_hw.c), the patch puts the read…
> - [Low] The concern is that the kernel-doc of ice_ptp_reset_ts_memory()
>   ('Reset timestamp memory for all blocks') no longer matches the code,…
> 
> --
> 
> ice: E825: clear PHY_TSTAMP memory prior to soft reset
> 
> This patch replaces the E825 timestamp memory reset, which wrote
> PHY_REG_TX_MEMORY_STATUS and had no effect, with a sweep that reads every
> PHY_TSTAMP index on the port. The sweep now runs at the start of
> ice_ptp_phy_soft_reset_eth56g(), so the soft reset that follows resets the
> internal counter. ice_ptp_reset_ts_memory() no longer does anything for
> E825.
> 
>> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
>> index 07b55fbb88dde..38d0ded1d0cc0 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
> 
> [ ... ]
> 
>> @@ -2311,6 +2312,8 @@ int ice_ptp_phy_soft_reset_eth56g(struct ice_hw *hw, u8 port)
>>  	u32 global_val;
>>  	int err;
>>  
>> +	ice_ptp_clear_tx_memory_status_eth56g(hw, port);
>> +
>>  	err = ice_read_ptp_reg_eth56g(hw, port, PHY_REG_GLOBAL, &global_val);
>>  	if (err) {
>>  		ice_debug(hw, ICE_DBG_PTP, "Failed to read PHY_REG_GLOBAL for port %d, err %d\n",
> 
> [Severity: Low]
> The sweep runs before any of the PHY_REG_GLOBAL accesses that can fail.
> What happens to the internal counter if one of those later steps fails?
> 
> ice_ptp_clear_tx_memory_status_eth56g() returns void and always reads
> every index. After it runs, ice_ptp_phy_soft_reset_eth56g() can still
> return early. That can happen at the PHY_REG_GLOBAL read or at any of the
> three PHY_REG_GLOBAL writes:
> 
> 	err = ice_read_ptp_reg_eth56g(hw, port, PHY_REG_GLOBAL, &global_val);
> 	if (err) {
> 		...
> 		return err;
> 	}
> 	...
> 	err = ice_write_ptp_reg_eth56g(hw, port, PHY_REG_GLOBAL, global_val);
> 	if (err) {
> 		...
> 		return err;
> 	}
> 
> The commit message says reading a garbage entry after a cold power-on can
> underflow the counter, and only the soft reset sets it back to zero. If
> the reset pulse is never issued, or only partly issued, is the port then
> left in the state that the new kernel-doc of
> ice_ptp_clear_tx_memory_status_eth56g() warns about?
> 
>     this *must* only be called as part of the
>     ice_ptp_phy_soft_reset_eth56g() procedure. Otherwise, the internal
>     counter may become out of sync and prevent new timestamp interrupts.
> 
> ice_ptp_init_phc_e825c() then stops at the first port that fails:
> 
> 	for (int port = 0; port < hw->ptp.num_lports; port++) {
> 		err = ice_ptp_phy_soft_reset_eth56g(hw, port);
> 		if (err) {
> 			...
> 			return err;
> 		}
> 	}
> 
> That port stays swept but not reset, and ice_ptp_init_owner() and
> ice_ptp_rebuild_owner() only return the error. Before this patch, a failed
> soft reset could not cause this desync, because nothing destructive ran
> before it.
> 
> Later in the series, ice_start_phy_timer_eth56g() also calls
> ice_ptp_phy_soft_reset_eth56g() every time the PHY timer starts, so this
> path runs more often.
> 
> Could the PHY_REG_GLOBAL read be done before the sweep? Alternatively,
> could the reset be completed or retried once the sweep has run?
> 

We can't really do the PHY_REG_GLOBAL before the sweep. The sweep could
screw up the counter and we need to do the soft reset in order to fix
any issues the sweep causes. I'm not sure the sweep would do anything if
we did it while the soft reset is in progress either.

In practice, we do not really expect the soft resets to fail at all,
transient sideband failure isnt something we observe in practice, nor do
I believe it is worth effort to try and harden against such failures
when they likely indicate something catastrophic about the device or system.

This really is just part of the fact that register access is indirect
and "technically" the access can fail. But in practice it should not
fail and I don't believe it makes a lot of sense to add a ton of complex
logic to handle such cases.

We already propagate the error up to the PHY restart and log a dev_err
message indicating that the restart failed, and that the user should try
a link reset.

I think thats good enough.

> [ ... ]
> 
>> @@ -5802,8 +5805,9 @@ void ice_ptp_reset_ts_memory(struct ice_hw *hw)
>>  		ice_ptp_reset_ts_memory_e82x(hw);
>>  		break;
>>  	case ICE_MAC_GENERIC_3K_E825:
>> -		ice_ptp_reset_ts_memory_eth56g(hw);
>> -		break;
>> +		/* E825 hardware must only reset timestamp memory as part of
>> +		 * the soft reset procedure.
>> +		 */
>>  	case ICE_MAC_E810:
>>  	default:
>>  		return;
> 
> [Severity: Low]
> This isn't a bug, but the kernel-doc for ice_ptp_reset_ts_memory() still
> reads:
> 
>  * ice_ptp_reset_ts_memory - Reset timestamp memory for all blocks
> 
> E825 is now a no-op here, like the E810 and default (E830) branches. The
> only explanation is the inline comment.
> 
> Could the kernel-doc list which MAC types are skipped? It could also say
> that E825 clears its memory through ice_ptp_phy_soft_reset_eth56g()
> instead.
> 
> This doesn't change how ice_ptp_cfg_phy_interrupt() behaves. Both
> ice_ptp_init_owner() and ice_ptp_rebuild_owner() call ice_ptp_init_phc()
> before it.
> 

I can try to clean this up.


  reply	other threads:[~2026-10-19 23:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 19:10 [PATCH net v3 00/14][pull request] ice: E82x: timestamp processing logic fixes Tony Nguyen
2026-10-15 19:10 ` [PATCH net v3 01/14] ice: fix removal of PTP timestamp tracker during reset Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:14     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 02/14] ice: use reference counting and SRCU for PTP port access Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:16     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 03/14] ice: fix PHY port restart serialization Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:21     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 04/14] ice: set in_use only after preparing Tx timestamp index Tony Nguyen
2026-10-15 19:10 ` [PATCH net v3 05/14] ice: call PTP link change only from link events Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:35     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 06/14] ice: E822: keep Tx timestamps disabled during offset calibration Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:37     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 07/14] ice: E822: cancel offset verification work during reset preparation Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:40     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 08/14] ice: E825: stop clearing PHY_REG_TX_OFFSET_READY Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:42     ` Jacob Keller
2026-10-20  1:53       ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 09/14] ice: E825: clear PHY_TSTAMP memory prior to soft reset Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:49     ` Jacob Keller [this message]
2026-10-15 19:10 ` [PATCH net v3 10/14] ice: E825: perform a soft reset when starting the PHY timer Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:57     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 11/14] ice: wait for in-flight Tx timestamps before removing the tracker Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:05     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 12/14] ice: keep Tx timestamp slots tracked until completion or timeout Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:11     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 13/14] ice: skip reading Tx ready bitmap on ports with no timestamps Tony Nguyen
2026-10-15 19:11 ` [PATCH net v3 14/14] ice: don't clear in_use until HW clears ready bitmap Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:18     ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e3e381a-b499-4654-817f-e8a46a2e43df@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=grzegorz.nitka@intel.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=maciej.machnikowski@intel.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=przemyslaw.korba@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=sergey.temerkhanov@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.