Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aaron Ma" <aaron.ma@canonical.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net v3 1/2] ice: restore DDP state during PFR recovery
Date: Fri, 04 Dec 2026 03:54:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-249069@kernel.org> (raw)
In-Reply-To: <20261203035320.187412-1-aaron.ma@canonical.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ice: missing UDP tunnel replay and DVM restore on non-PFR
  resets in ice_rebuild()
- [Medium] ice: UDP tunnel port table race and desync during PFR package
  reload
--

commit dcc6ec010dfa80086a4a5aaaf02e06aab8b1448c
Author: Aaron Ma <aaron.ma@canonical.com>

ice: restore DDP state during PFR recovery

This commit serializes PF configuration clearing and DDP package reload per
adapter during ice_rebuild(), reloading the cached DDP package, restoring
DVM state and default recipes, and replaying offloaded UDP tunnel ports on
PFR.

> diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c
> index d50c555851fbd..bedb9362d4098 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ddp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c
> @@ -2204,6 +2204,7 @@ enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)
>  	enum ice_ddp_state state;
>  	struct ice_pkg_hdr *pkg;
>  	struct ice_seg *seg;
> +	u16 i;
>  
>  	if (!buf || !len)
>  		return ICE_DDP_PKG_ERR;
> @@ -2234,7 +2235,14 @@ enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)
>  		return state;
>  
>  	/* initialize package hints and then download package */
> -	ice_init_pkg_hints(hw, seg);
> +	if (hw->seg != seg) {
> +		ice_init_pkg_hints(hw, seg);
> +	} else {
> +		mutex_lock(&hw->tnl_lock);
> +		for (i = 0; i < hw->tnl.count; i++)
> +			hw->tnl.tbl[i].port = 0;
> +		mutex_unlock(&hw->tnl_lock);
> +	}
>  	state = ice_download_pkg(hw, pkg, seg);

[Severity: Medium]
Can clearing hw->tnl.tbl[i].port here race with
udp_tunnel_nic_device_sync_work() or leave hw->tnl.tbl[] out of sync if
ice_reload_pkg_pfr() fails?

Because ice does not set UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
udp_tunnel_nic_device_sync_work() can run concurrently under rtnl_lock()
before ice_rebuild() reaches udp_tunnel_nic_reset_ntf():

CPU0                                    CPU1 (kworker)
ice_rebuild()
  ice_reload_pkg_pfr()
    ice_init_pkg()
      mutex_lock(&hw->tnl_lock)
      hw->tnl.tbl[i].port = 0
      mutex_unlock(&hw->tnl_lock)
                                        udp_tunnel_nic_device_sync_work()
                                          ...
                                            ice_udp_tunnel_unset_port()
                                              ice_destroy_tunnel()
                                                WARN_ON(hw->tnl.tbl[index].port != port)
      ice_download_pkg()
  rtnl_lock()
  udp_tunnel_nic_reset_ntf()
  rtnl_unlock()

A concurrent UDP_TUNNEL_NIC_ENTRY_ADD in that window will also run
ice_create_tunnel() -> ice_update_pkg() concurrently with
ice_download_pkg() and ice_dvm_update_dflt_recipes().

In addition, if ice_reload_pkg_pfr() fails after hw->tnl.tbl[i].port is
zeroed, ice_rebuild() skips udp_tunnel_nic_reset_ntf(), so later tunnel
removal or driver unload will hit the same WARN_ON() in
ice_destroy_tunnel() for every active entry.

> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index 9644b25e79355..179516e4c419c 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
[ ... ]
> @@ -7684,21 +7729,28 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
>  		goto err_init_ctrlq;
>  	}
>  
> +	mutex_lock(&pf->adapter->rebuild_lock);
> +	err = ice_clear_pf_cfg(hw);
> +	if (err)
> +		dev_err(dev, "clear PF configuration failed %d\n", err);
> +
>  	/* 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
> +	if (!err && !ice_is_safe_mode(pf)) {
> +		if (reset_type == ICE_RESET_PFR) {
> +			err = ice_reload_pkg_pfr(pf);
> +			if (!err && vsi && vsi->netdev) {
> +				rtnl_lock();
> +				udp_tunnel_nic_reset_ntf(vsi->netdev);
> +				rtnl_unlock();
> +			}
> +		} else {
>  			/* Reload DDP Package after CORER/GLOBR reset */
>  			ice_load_pkg(NULL, pf);
> +		}
>  	}

[Severity: Medium]
Does the non-PFR branch also need udp_tunnel_nic_reset_ntf() and DVM
restoration?

On CORER, GLOBR, or EMPR (including system resume on a bonded interface,
where ice_reset_subtask() promotes ICE_RESET_PFR to ICE_RESET_CORER),
ice_load_pkg(NULL, pf) calls ice_init_pkg(), which zeroes
hw->tnl.tbl[i].port and reloads the package.  Because
udp_tunnel_nic_reset_ntf() and the DVM restore logic in
ice_reload_pkg_pfr() only run for ICE_RESET_PFR, offloaded UDP tunnel ports
and DVM recipes are not restored, and later tunnel removal hits WARN_ON()
and returns -EIO in ice_destroy_tunnel() because hw->tnl.tbl[index].port is
0.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203035320.187412-1-aaron.ma@canonical.com?part=1

      parent reply	other threads:[~2026-12-04  3:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  3:53 [PATCH net v3 1/2] ice: restore DDP state during PFR recovery Aaron Ma
2026-12-03  3:53 ` [PATCH net v3 2/2] ice: clear Flow Director entries before reset cleanup Aaron Ma
2026-12-04  3:54 ` sashiko-bot [this message]

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=sashiko-outbox-249069@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aaron.ma@canonical.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox