Skip to content

Commit 9d146a5

Browse files
committed
Merge branch 'intel-wired-lan-driver-updates-2026-04-20-ice'
Jacob Keller says: ==================== Intel Wired LAN Driver Updates 2026-04-20 (ice) Since this is a set of related fixes for just the ice driver, Jake provides the following description for the series: We recently ran into a nasty corner case issue with a customer operating E825C cards seeing some strange behavior with missing Tx timestamps. During the course of debugging. This series contains a few fixes found during this debugging process. The primary issue discovered in the investigation is a misconfiguration of the E825C PHY timestamp interrupt register, PHY_REG_TS_INT_CONFIG. This register is responsible for programming the Tx timestamp behavior of a PHY port. The driver programs two values here: a threshold for when to interrupt and whether the interrupt is enabled. The threshold value is used by hardware to determine when to trigger a Tx timestamp interrupt. The interrupt cause for the port is raised when the number of outstanding timestamps in the PHY port timestamp memory meets the threshold. The interrupt cause is not cleared until the number of outstanding timestamps drops *below* the threshold. It is considered a misconfiguration if the threshold is programmed to 0. If the interrupt is enabled while the threshold is zero, hardware will raise the interrupt cause at the next time it checks. Once raised, the interrupt cause for the port will never lower, since you cannot have fewer than zero outstanding timestamps. Worse, the timestamp status for the port will remain high even if the PHY_REG_TS_INT_CONFIG is reprogrammed with a new threshold. The PHY is a separate hardware block from the MAC, and thus the interrupt status for the port will remain high even if you reset the device MAC with a PF reset, CORE reset, or GLOBAL reset. PHY ports are connected together into quads. Each quad muxes the PHY interrupt status for the 4 ports on the quad together before connecting that to the MACs miscellaneous interrupt vector. As a result, if a single PHY port in the quad is stuck, no timestamp interrupts will be generated for any timestamp on any port on that quad. The ice driver never directly writes a value of 0 for the threshold. Indeed, the desired behavior is to set the threshold to 1, so that interrupts are generated as soon as a single timestamp is captured. Unfortunately, it turns out that for the E825C PHY, programming the threshold and enable bit in the same write may cause a race in the PHY timestamp block. The PHY may "see" the interrupt as enabled first before it sees the threshold value. If the previous threshold value is zero (such as when the register is initialized to zero at a cold power on), the hardware may race with programming the threshold and set the PHY interrupt status to high as described above. The first patch in this series corrects that programming order, ensuring that the threshold is always written first in a separate transaction from enabling the interrupt bit. Additionally, an explicit check against writing a 0 is added to make it clear to future readers that writing 0 to the threshold while enabling the interrupt is not safe. The PHY timestamp block does not reset with the MAC, and seems to only reset during cold power on. This makes recovery from the faulty configuration difficult. To address this, perform an explicit reset of the PHY PTP block during initialization. This is achieved by writing the PHY_REG_GLOBAL register. This performs a PHY soft reset, which completely resets the timestamp block. This includes clearing the timestamp memory, the PHY timestamp interrupt status, and the PHY PTP counter. A soft reset of all ports on the device is done as part of ice_ptp_init_phc() during early initialization of the PTP functionality by the PTP clock owner, prior to programming each PHY. The ice_ptp_init_phc() function is called at driver init and during reinitialization after all forms of device reset. This ensures that the driver begins operation at a clean slate, rather than carrying over the stale and potentially buggy configuration of a previous driver. While attempting to root cause the issue with the PHY timestamp interrupt, we also discovered that the driver incorrectly assumes that it is operating on E822 hardware when reading the PHY timestamp memory status registers in a few places. This includes the check at the end of the interrupt handler, as well as the check done inside the PTP auxiliary function. This prevented the driver from detecting waiting timestamps on ports other than the first two. Finally, the ice_ptp_read_tx_hwstamp_status_eth56g() function was discovered to only read the timestamp interrupt status value from the first quad due to mistaking the port index for a PHY quad index. This resulted in reporting the timestamp status for the second quad as identical to the first quad instead of properly reporting its value. This is a minor fix since the function currently is only used for diagnostic purposes and does not impact driver decision logic. ==================== Link: https://patch.msgid.link/20260420-jk-iwl-net-2026-04-20-ptp-e825c-phy-interrupt-fixes-v1-0-bc2240f42251@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents c88eb7e + 1f75dbc commit 9d146a5

3 files changed

Lines changed: 269 additions & 33 deletions

File tree

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,7 @@ static bool ice_any_port_has_timestamps(struct ice_pf *pf)
27102710
bool ice_ptp_tx_tstamps_pending(struct ice_pf *pf)
27112711
{
27122712
struct ice_hw *hw = &pf->hw;
2713-
unsigned int i;
2713+
int ret;
27142714

27152715
/* Check software indicator */
27162716
switch (pf->ptp.tx_interrupt_mode) {
@@ -2731,16 +2731,19 @@ bool ice_ptp_tx_tstamps_pending(struct ice_pf *pf)
27312731
}
27322732

27332733
/* Check hardware indicator */
2734-
for (i = 0; i < ICE_GET_QUAD_NUM(hw->ptp.num_lports); i++) {
2735-
u64 tstamp_ready = 0;
2736-
int err;
2737-
2738-
err = ice_get_phy_tx_tstamp_ready(&pf->hw, i, &tstamp_ready);
2739-
if (err || tstamp_ready)
2740-
return true;
2734+
ret = ice_check_phy_tx_tstamp_ready(hw);
2735+
if (ret < 0) {
2736+
dev_dbg(ice_pf_to_dev(pf), "Unable to read PHY Tx timestamp ready bitmap, err %d\n",
2737+
ret);
2738+
/* Stop triggering IRQs if we're unable to read PHY */
2739+
return false;
27412740
}
27422741

2743-
return false;
2742+
/* ice_check_phy_tx_tstamp_ready() returns 1 if there are timestamps
2743+
* available, 0 if there are no waiting timestamps, and a negative
2744+
* value if there was an error (which we checked for above).
2745+
*/
2746+
return ret > 0;
27442747
}
27452748

27462749
/**
@@ -2824,30 +2827,19 @@ static void ice_ptp_maybe_trigger_tx_interrupt(struct ice_pf *pf)
28242827
{
28252828
struct device *dev = ice_pf_to_dev(pf);
28262829
struct ice_hw *hw = &pf->hw;
2827-
bool trigger_oicr = false;
2828-
unsigned int i;
2830+
int ret;
28292831

28302832
if (!pf->ptp.port.tx.has_ready_bitmap)
28312833
return;
28322834

28332835
if (!ice_pf_src_tmr_owned(pf))
28342836
return;
28352837

2836-
for (i = 0; i < ICE_GET_QUAD_NUM(hw->ptp.num_lports); i++) {
2837-
u64 tstamp_ready;
2838-
int err;
2839-
2840-
err = ice_get_phy_tx_tstamp_ready(&pf->hw, i, &tstamp_ready);
2841-
if (!err && tstamp_ready) {
2842-
trigger_oicr = true;
2843-
break;
2844-
}
2845-
}
2846-
2847-
if (trigger_oicr) {
2848-
/* Trigger a software interrupt, to ensure this data
2849-
* gets processed.
2850-
*/
2838+
ret = ice_check_phy_tx_tstamp_ready(hw);
2839+
if (ret < 0) {
2840+
dev_dbg(dev, "PTP periodic task unable to read PHY timestamp ready bitmap, err %d\n",
2841+
ret);
2842+
} else if (ret) {
28512843
dev_dbg(dev, "PTP periodic task detected waiting timestamps. Triggering Tx timestamp interrupt now.\n");
28522844

28532845
wr32(hw, PFINT_OICR, PFINT_OICR_TSYN_TX_M);

0 commit comments

Comments
 (0)