* [PATCH net 1/5] ice: restore DDP state during PFR recovery
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
@ 2026-11-25 22:44 ` Tony Nguyen
2026-11-25 22:48 ` netdev-bot+sinfo
2026-11-25 22:44 ` [PATCH net 2/5] ice: clear Flow Director entries before reset cleanup Tony Nguyen
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Tony Nguyen @ 2026-11-25 22:44 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Aaron Ma, anthony.l.nguyen, przemyslaw.kitszel,
maciej.machnikowski, grzegorz.nitka, jacob.e.keller,
Aleksandr Loktionov, Simon Horman, Ayush Singh
From: Aaron Ma <aaron.ma@canonical.com>
The firmware package and switch recipes are shared by all PFs of an
adapter. However, each PF rebuilds independently after system resume. The
resulting package downloads and recipe updates can interleave, causing
firmware timeouts and leaving interfaces unusable.
PFR also clears package-derived firmware state on affected devices. The
existing PFR path only rebuilds the driver's block tables, so VLAN recipe
programming can fail after the reset.
The failure is reported as:
ice 0000:04:00.0: Update pkg failed: err -5
ice 0000:04:00.0: package load failed, -12
ice 0000:04:00.0: Rebuild failed, unload and reload driver
This was observed on an Intel E810-XXV-2 adapter (PCI ID 8086:159b,
revision 02) with NVM package 1.0.0.18 and ICE OS Default DDP package
1.3.43.0.
Serialize rebuilds across PFs of the same adapter, while allowing each PFR
to complete independently. Reload the DDP package from its cached copy and
restore the default DVM recipes before rebuilding the remaining PF state.
Abort recovery if either operation fails.
In addition, stop the service task before tearing down resources in
ice_remove() so that an in-flight rebuild completes and cannot dereference
pf->adapter after ice_adapter_put().
Fixes: 462acf6aca85 ("ice: Enable DDP package download")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
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_adapter.c | 2 ++
drivers/net/ethernet/intel/ice/ice_adapter.h | 3 ++
drivers/net/ethernet/intel/ice/ice_main.c | 35 ++++++++++++++-----
.../net/ethernet/intel/ice/ice_vlan_mode.c | 2 +-
.../net/ethernet/intel/ice/ice_vlan_mode.h | 1 +
5 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c b/drivers/net/ethernet/intel/ice/ice_adapter.c
index aa2d8addae5b..01b6d3f751ed 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.c
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
@@ -73,6 +73,7 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev)
for (int i = 0; i < ARRAY_SIZE(adapter->cpi_phy_lock); i++)
mutex_init(&adapter->cpi_phy_lock[i]);
mutex_init(&adapter->cgu_synce_lock);
+ mutex_init(&adapter->rebuild_lock);
refcount_set(&adapter->refcount, 1);
spin_lock_init(&adapter->ports.lock);
@@ -86,6 +87,7 @@ static void ice_adapter_free(struct ice_adapter *adapter)
WARN_ON(!list_empty(&adapter->ports.list));
for (int i = 0; i < ARRAY_SIZE(adapter->cpi_phy_lock); i++)
mutex_destroy(&adapter->cpi_phy_lock[i]);
+ mutex_destroy(&adapter->rebuild_lock);
mutex_destroy(&adapter->cgu_synce_lock);
cleanup_srcu_struct(&adapter->ports.srcu);
diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h b/drivers/net/ethernet/intel/ice/ice_adapter.h
index fd5585005d91..231abb8bbe1f 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.h
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.h
@@ -43,6 +43,7 @@ struct ice_port_list {
* Index 0 = PHY0, index 1 = PHY1. Used on E825C devices.
* @cgu_synce_lock: Mutex serializing changes of the CGU registers R10 and R11,
* which all PFs reach. Used on E825C devices.
+ * @rebuild_lock: serialize PFR recovery across PFs of the same adapter
* @ctrl_pf: Control PF of the adapter
* @ports: Ports list
* @index: 64-bit index cached for collision detection on 32bit systems
@@ -57,6 +58,8 @@ struct ice_adapter {
struct mutex cpi_phy_lock[ICE_E825_MAX_PHYS];
/* Serialize changes of the SyncE CGU registers (E825C only) */
struct mutex cgu_synce_lock;
+ /* Serialize PFR recovery touching shared FW global state */
+ struct mutex rebuild_lock;
struct ice_pf *ctrl_pf;
struct ice_port_list ports;
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 47c6798c97e8..f858473f6f53 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -659,7 +659,9 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
*/
if (reset_type == ICE_RESET_PFR) {
pf->pfr_count++;
+ mutex_lock(&pf->adapter->rebuild_lock);
ice_rebuild(pf, reset_type);
+ mutex_unlock(&pf->adapter->rebuild_lock);
clear_bit(ICE_PREPARED_FOR_RESET, pf->state);
clear_bit(ICE_PFR_REQ, pf->state);
wake_up(&pf->reset_wait_queue);
@@ -704,7 +706,9 @@ static void ice_reset_subtask(struct ice_pf *pf)
} else {
/* done with reset. start rebuild */
pf->hw.reset_ongoing = false;
+ mutex_lock(&pf->adapter->rebuild_lock);
ice_rebuild(pf, reset_type);
+ mutex_unlock(&pf->adapter->rebuild_lock);
/* clear bit to resume normal operations, but
* ICE_NEEDS_RESTART bit is set in case rebuild failed
*/
@@ -5382,6 +5386,8 @@ static void ice_remove(struct pci_dev *pdev)
return;
}
+ ice_service_task_stop(pf);
+
if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) {
set_bit(ICE_VF_RESETS_DISABLED, pf->state);
ice_free_vfs(pf);
@@ -7682,14 +7688,27 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
goto err_init_ctrlq;
}
- /* if DDP was previously loaded successfully */
- if (!ice_is_safe_mode(pf)) {
- /* reload the SW DB of filter tables */
- if (reset_type == ICE_RESET_PFR)
- ice_fill_blk_tbls(hw);
- else
- /* Reload DDP Package after CORER/GLOBR reset */
- ice_load_pkg(NULL, pf);
+ if (!ice_is_safe_mode(pf) && reset_type == ICE_RESET_PFR) {
+ enum ice_ddp_state state;
+
+ state = ice_init_pkg(hw, hw->pkg_copy, hw->pkg_size);
+ ice_log_pkg_init(hw, state);
+ if (!ice_is_init_pkg_successful(state))
+ goto err_init_ctrlq;
+ } else if (!ice_is_safe_mode(pf)) {
+ /* Reload DDP Package after CORER/GLOBR reset */
+ ice_load_pkg(NULL, pf);
+ }
+
+ /* PFR can lose DVM recipes after system suspend. */
+ if (!ice_is_safe_mode(pf) && reset_type == ICE_RESET_PFR &&
+ ice_is_dvm_ena(hw)) {
+ err = ice_dvm_update_dflt_recipes(hw);
+ if (err) {
+ dev_err(dev, "failed to restore default DVM recipes: %d\n",
+ err);
+ goto err_init_ctrlq;
+ }
}
err = ice_clear_pf_cfg(hw);
diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
index 92c6f83a7efe..69dce2997845 100644
--- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
+++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
@@ -240,7 +240,7 @@ static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = {
* ice_dvm_update_dflt_recipes - update default switch recipes in DVM
* @hw: hardware structure used to update the recipes
*/
-static int ice_dvm_update_dflt_recipes(struct ice_hw *hw)
+int ice_dvm_update_dflt_recipes(struct ice_hw *hw)
{
unsigned long i;
diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.h b/drivers/net/ethernet/intel/ice/ice_vlan_mode.h
index a0fb743d08e2..5dc705435f56 100644
--- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.h
+++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.h
@@ -8,6 +8,7 @@ struct ice_hw;
bool ice_is_dvm_ena(struct ice_hw *hw);
int ice_set_vlan_mode(struct ice_hw *hw);
+int ice_dvm_update_dflt_recipes(struct ice_hw *hw);
void ice_post_pkg_dwnld_vlan_mode_cfg(struct ice_hw *hw);
#endif /* _ICE_VLAN_MODE_H */
--
2.47.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net 1/5] ice: restore DDP state during PFR recovery
2026-11-25 22:44 ` [PATCH net 1/5] ice: restore DDP state during PFR recovery Tony Nguyen
@ 2026-11-25 22:48 ` netdev-bot+sinfo
0 siblings, 0 replies; 8+ messages in thread
From: netdev-bot+sinfo @ 2026-11-25 22:48 UTC (permalink / raw)
To: Tony Nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
Aaron Ma, przemyslaw.kitszel, maciej.machnikowski, grzegorz.nitka,
jacob.e.keller, Aleksandr Loktionov, Simon Horman, Ayush Singh
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.
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] 8+ messages in thread
* [PATCH net 2/5] ice: clear Flow Director entries before reset cleanup
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
2026-11-25 22:44 ` [PATCH net 1/5] ice: restore DDP state during PFR recovery Tony Nguyen
@ 2026-11-25 22:44 ` Tony Nguyen
2026-11-25 22:44 ` [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Tony Nguyen @ 2026-11-25 22:44 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Aaron Ma, anthony.l.nguyen, przemyslaw.kitszel,
maciej.machnikowski, grzegorz.nitka, jacob.e.keller,
Aleksandr Loktionov, Simon Horman, Ayush Singh
From: Aaron Ma <aaron.ma@canonical.com>
Flow Director profiles retain handles to generic flow entries. Reset calls
ice_clear_hw_tbls() to free those entries, but leaves the Flow Director
handles unchanged until replay replaces them.
If rebuild fails before replay completes, later driver removal follows a
stale handle and dereferences a freed flow entry in ice_flow_rem_entry().
KASAN reports a wild access to list poison from
ice_fdir_erase_flow_from_hw().
The failure is reported as:
KASAN: maybe wild-memory-access in range [0xdead000000000108-...]
RIP: ice_flow_rem_entry+0xaf/0x170 [ice]
ice_fdir_erase_flow_from_hw+0x1ee/0x420 [ice]
Clear the Flow Director handles while holding hw->fdir_fltr_lock before
the hardware tables free their entries. A successful replay installs new
handles, while a failed rebuild leaves them invalid for later cleanup.
Fixes: 148beb612031 ("ice: Initialize Flow Director resources")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
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.h | 1 +
.../ethernet/intel/ice/ice_ethtool_ntuple.c | 26 +++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_main.c | 2 ++
3 files changed, 29 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 432da05c48c0..865f299a6ac1 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -1032,6 +1032,7 @@ ice_get_fdir_fltr_ids(struct ice_hw *hw, struct ethtool_rxnfc *cmd,
u32 *rule_locs);
void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx);
void ice_fdir_release_flows(struct ice_hw *hw);
+void ice_fdir_clear_flow_handles(struct ice_hw *hw);
void ice_fdir_replay_flows(struct ice_hw *hw);
void ice_fdir_replay_fltrs(struct ice_pf *pf);
int ice_fdir_create_dflt_rules(struct ice_pf *pf);
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
index 8805f0efe977..3b77a3cf6c64 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c
@@ -415,6 +415,32 @@ void ice_fdir_release_flows(struct ice_hw *hw)
ice_fdir_erase_flow_from_hw(hw, ICE_BLK_FD, flow);
}
+/**
+ * ice_fdir_clear_flow_handles - clear handles freed during reset
+ * @hw: pointer to HW instance
+ */
+void ice_fdir_clear_flow_handles(struct ice_hw *hw)
+{
+ int flow;
+
+ if (!hw->fdir_prof)
+ return;
+
+ mutex_lock(&hw->fdir_fltr_lock);
+ for (flow = 0; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+ struct ice_fd_hw_prof *prof = hw->fdir_prof[flow];
+ int tun, i;
+
+ if (!prof)
+ continue;
+
+ for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++)
+ for (i = 0; i < prof->cnt; i++)
+ prof->entry_h[i][tun] = 0;
+ }
+ mutex_unlock(&hw->fdir_fltr_lock);
+}
+
/**
* ice_fdir_replay_flows - replay HW Flow Director filter info
* @hw: pointer to HW instance
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f858473f6f53..706172e149b9 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -601,6 +601,8 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
netif_device_detach(vsi->netdev);
skip:
+ if (hw->fdir_prof)
+ ice_fdir_clear_flow_handles(hw);
/* clear SW filtering DB */
ice_clear_hw_tbls(hw);
/* disable the VSIs and their queues that are not already DOWN */
--
2.47.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
2026-11-25 22:44 ` [PATCH net 1/5] ice: restore DDP state during PFR recovery Tony Nguyen
2026-11-25 22:44 ` [PATCH net 2/5] ice: clear Flow Director entries before reset cleanup Tony Nguyen
@ 2026-11-25 22:44 ` Tony Nguyen
2026-11-26 0:03 ` Jacob Keller
2026-11-25 22:44 ` [PATCH net 4/5] ice: remove redundant cross-timestamp PTP command Tony Nguyen
2026-11-25 22:44 ` [PATCH net 5/5] ice: fix computation of ETF timestamps for E830 Tony Nguyen
4 siblings, 1 reply; 8+ messages in thread
From: Tony Nguyen @ 2026-11-25 22:44 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Maciek Machnikowski, anthony.l.nguyen, przemyslaw.kitszel,
aaron.ma, 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. Since the hardware semaphore is not recursive, split
the phase-sync helper into ice_sync_phy_timer_eth56g_unlocked(), which
assumes the caller already holds the lock, and call it directly from
ice_start_phy_timer_eth56g(). The locking wrapper is removed as it no
longer has any callers.
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 | 48 +++++++++------------
1 file changed, 21 insertions(+), 27 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..16333d4a34cc 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
@@ -2028,7 +2028,7 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,
}
/**
- * ice_sync_phy_timer_eth56g - Synchronize the PHY timer with PHC timer
+ * ice_sync_phy_timer_eth56g_unlocked - Synchronize the PHY timer with PHC timer
* @hw: pointer to the HW struct
* @port: the PHY port to synchronize
*
@@ -2041,22 +2041,18 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,
*
* Return:
* * %0 - success
- * * %-EBUSY- failed to acquire PTP semaphore
* * %other - PHY read/write failed
+ *
+ * The caller must acquire PTP semaphore lock
*/
-static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
+static int ice_sync_phy_timer_eth56g_unlocked(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);
+ err = ice_sync_phy_timer_eth56g_unlocked(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] 8+ messages in thread* Re: [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval
2026-11-25 22:44 ` [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
@ 2026-11-26 0:03 ` Jacob Keller
0 siblings, 0 replies; 8+ messages in thread
From: Jacob Keller @ 2026-11-26 0:03 UTC (permalink / raw)
To: Tony Nguyen, davem, kuba, pabeni, edumazet, andrew+netdev,
willemb, netdev
Cc: Maciek Machnikowski, przemyslaw.kitszel, aaron.ma, grzegorz.nitka,
richardcochran, Marc Neustadter, Sergey Temerkhanov, Milena Olech,
Simon Horman, Aleksandr Loktionov, Ayush Singh
On 11/25/2026 2:44 PM, Tony Nguyen wrote:
> From: Maciek Machnikowski <maciej.machnikowski@intel.com>
> drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 48 +++++++++------------
> 1 file changed, 21 insertions(+), 27 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..16333d4a34cc 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
> @@ -2028,7 +2028,7 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,
> }
>
> /**
> - * ice_sync_phy_timer_eth56g - Synchronize the PHY timer with PHC timer
> + * ice_sync_phy_timer_eth56g_unlocked - Synchronize the PHY timer with PHC timer
> * @hw: pointer to the HW struct
> * @port: the PHY port to synchronize
> *
:\ I don't like to do this, but we agreed on IWL that this rename is
unnecessary since there is no _locked equivalent and it is somewhat
confusing since the context is still locked, just not acquired within
this function.
Strictly, if this merges as is, it isn't the end of the world, but I'd
weakly prefer that we drop this postfix rename.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net 4/5] ice: remove redundant cross-timestamp PTP command
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
` (2 preceding siblings ...)
2026-11-25 22:44 ` [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
@ 2026-11-25 22:44 ` Tony Nguyen
2026-11-25 22:44 ` [PATCH net 5/5] ice: fix computation of ETF timestamps for E830 Tony Nguyen
4 siblings, 0 replies; 8+ messages in thread
From: Tony Nguyen @ 2026-11-25 22:44 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Grzegorz Nitka, anthony.l.nguyen, przemyslaw.kitszel, aaron.ma,
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.
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>
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] 8+ messages in thread* [PATCH net 5/5] ice: fix computation of ETF timestamps for E830
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
` (3 preceding siblings ...)
2026-11-25 22:44 ` [PATCH net 4/5] ice: remove redundant cross-timestamp PTP command Tony Nguyen
@ 2026-11-25 22:44 ` Tony Nguyen
4 siblings, 0 replies; 8+ messages in thread
From: Tony Nguyen @ 2026-11-25 22:44 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Jacob Keller, anthony.l.nguyen, przemyslaw.kitszel, aaron.ma,
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] 8+ messages in thread