Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: 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, michal.swiatkowski@linux.intel.com,
	poros@redhat.com, david.m.ertman@intel.com, pengpeng@iscas.ac.cn,
	przemyslaw.kitszel@intel.com, vinicius.gomes@intel.com,
	sridhar.samudrala@intel.com, aleksandr.loktionov@intel.com,
	horms@kernel.org, alexander.nowlin@intel.com
Subject: Re: [PATCH net 3/6] ice: preserve uplink DFLT Rx rule on switchdev release
Date: Tue, 17 Nov 2026 23:54:33 +0000	[thread overview]
Message-ID: <179495967304.3136.16113490698897758196@kernel.org> (raw)
In-Reply-To: <20261113231225.1864810-4-anthony.l.nguyen@intel.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 3 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] ice_eswitch_release_env() (and the err_def_tx unwind in
  ice_eswitch_setup_env()) now keeps or removes the Rx DFLT rule based…
- [Medium] The fix leaves the uplink's promiscuous configuration only
  half restored after a switchdev session.
- [Medium] ice_eswitch_release_env() makes its keep/remove decision for
  the Rx DFLT rule from one unlocked snapshot of…
- [Medium] The new comment in ice_eswitch_release_env() says that testing
  the live netdev->flags keeps 'the preserved DFLT rule and the pruning…

--

ice: preserve uplink DFLT Rx rule on switchdev release

This commit stops ice_eswitch_release_env() and the err_def_tx unwind in
ice_eswitch_setup_env() from removing the uplink's ICE_SW_LKUP_DFLT Rx
rule when the uplink netdev has IFF_PROMISC set. The Tx DFLT rule is
still removed. The decision is based on the live netdev->flags.

> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index 6e7bba4738989..c32d6b201369b 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c

[ ... ]

> @@ -276,8 +278,16 @@ static void ice_eswitch_release_env(struct ice_pf *pf)
>  	vlan_ops->ena_rx_filtering(uplink_vsi);
>  	ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
>  			 ICE_FLTR_TX);
> -	ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
> -			 ICE_FLTR_RX);
> +
> +	/* Keep the Rx DFLT rule if the uplink is promiscuous; it must outlive
> +	 * the session. Test the live netdev->flags, the same value
> +	 * ena_rx_filtering() -> ice_cfg_vlan_pruning() above keys its decision
> +	 * on, so the preserved DFLT rule and the pruning state stay consistent.
> +	 */

[Severity: Medium]
Does the "same value" claim in this comment still hold if promisc changes
concurrently?

ice_cfg_vlan_pruning() does its own plain load of the flags:

drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c:ice_cfg_vlan_pruning() {
    ...
	if (vsi->netdev && vsi->netdev->flags & IFF_PROMISC && ena)
		return 0;
    ...
}

The new check below is a second, separate load. It runs after the
ice_cfg_dflt_vsi(..., ICE_FLTR_TX) admin queue command, and neither read
is done under RTNL.

If IFF_PROMISC flips between the two reads, ice_set_rx_mode() returns
early because pf->eswitch.is_running is still true. Nothing corrects the
state later.

Could that leave VLAN pruning disabled with the DFLT rule removed and
promisc off? Or pruning enabled with the catch-all kept and promisc on?

If the flag were read once into a local (or under RTNL) and used for both
decisions, the comment would be accurate.

> +	if (!(uplink_vsi->netdev->flags & IFF_PROMISC))
> +		ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx,
> +				 false, ICE_FLTR_RX);

[Severity: High]
Does this leave vsi->current_netdev_flags out of sync with the hardware
filter state?

The keep/remove decision uses the live netdev->flags. Nothing here updates
vsi->current_netdev_flags or sets ICE_VSI_PROMISC_CHANGED or
ICE_FLAG_FLTR_SYNC.

While switchdev is running, ice_set_rx_mode() drops every rx_mode event:

drivers/net/ethernet/intel/ice/ice_main.c:ice_set_rx_mode() {
    ...
	if (!vsi || ice_is_switchdev_running(vsi->back))
		return;
    ...
}

So a promisc change made during the session is never recorded. After
teardown, ice_vsi_sync_fltr() computes changed_flags against that stale
value:

	changed_flags = vsi->current_netdev_flags ^ vsi->netdev->flags;
	vsi->current_netdev_flags = vsi->netdev->flags;
	...
	if (((changed_flags & IFF_PROMISC) || promisc_forced_on) ||
	    test_bit(ICE_VSI_PROMISC_CHANGED, vsi->state)) {

Take the case where promisc is off before switchdev and is turned on
during the session (for example by tcpdump on the PF):

- This code keeps the DFLT Rx rule that switchdev installed.
- ice_cfg_vlan_pruning() also leaves pruning off.
- When promisc is turned off after teardown, changed_flags has no
  IFF_PROMISC, so ice_vsi_exit_dflt_promisc() is never called.

Would the uplink then stay the port's default VSI, with VLAN pruning
disabled while IFF_PROMISC is clear? Other VSIs would then see
ice_is_dflt_vsi_in_use() return true.

The reverse case also looks reachable:

- Promisc is on before switchdev and is turned off during the session.
- This code removes the DFLT rule.
- When promisc is turned back on after teardown, changed_flags again has
  no IFF_PROMISC, so ice_set_dflt_vsi() and dis_rx_filtering() are
  skipped.

Isn't that IFF_PROMISC set with no catch-all, the same symptom the commit
message describes? The commit message says:

    including for a promisc change made while switchdev ran (which never
    reached the gated filter sync).

Would retriggering the sync handle these cases instead of special-casing
the Rx rule? That could mean setting ICE_VSI_PROMISC_CHANGED and
ICE_FLAG_FLTR_SYNC, or reconciling vsi->current_netdev_flags.

The err_def_tx unwind in ice_eswitch_setup_env() has the same check and
looks like it has the same problem.

[Severity: Medium]
Can a concurrent promisc change be lost between this check and the point
where is_running is cleared?

ice_eswitch_release_env() is reached from ice_eswitch_detach() without
RTNL. It cannot hold RTNL there, because repr->ops.rem() calls
unregister_netdev():

drivers/net/ethernet/intel/ice/ice_eswitch.c:ice_eswitch_detach() {
    ...
	repr->ops.rem(repr);

	xa_erase(&pf->eswitch.reprs, repr->id);

	if (xa_empty(&pf->eswitch.reprs))
		ice_eswitch_disable_switchdev(pf);
    ...
}

is_running is cleared only after release_env returns:

drivers/net/ethernet/intel/ice/ice_eswitch.c:ice_eswitch_disable_switchdev() {
	ice_eswitch_br_offloads_deinit(pf);
	ice_eswitch_release_env(pf);

	pf->eswitch.is_running = false;
}

release_env also issues more admin queue commands after this check:
ice_fltr_add_mac_and_broadcast() and ice_vsi_cfg_sw_lldp().

Suppose "ip link set promisc on|off" runs __dev_change_flags() under RTNL
in that window. ice_set_rx_mode() returns early because is_running is
still true, and no ICE_FLAG_FLTR_SYNC is left pending.

Could that leave IFF_PROMISC set without the Rx DFLT rule, or a leftover
catch-all with promisc off, until some unrelated rx_mode event?

The err_def_tx unwind in ice_eswitch_setup_env() uses the same unlocked
read.

> +
>  	ice_fltr_add_mac_and_broadcast(uplink_vsi,
>  				       uplink_vsi->port_info->mac.perm_addr,
>  				       ICE_FWD_TO_VSI);

[Severity: Medium]
Does the uplink still lose its multicast promisc subscription after the
session?

On entry, ice_eswitch_setup_env() calls ice_remove_vsi_fltr():

drivers/net/ethernet/intel/ice/ice_switch.c:ice_remove_vsi_fltr() {
    ...
	ice_remove_vsi_lkup_fltr(hw, vsi_handle, ICE_SW_LKUP_PROMISC);
    ...
	ice_remove_vsi_lkup_fltr(hw, vsi_handle, ICE_SW_LKUP_DFLT);
    ...
	ice_remove_vsi_lkup_fltr(hw, vsi_handle, ICE_SW_LKUP_PROMISC_VLAN);
}

The PROMISC and PROMISC_VLAN rules are removed through
ice_remove_promisc(). ICE_SW_LKUP_DFLT falls into the unsupported lookup
type default, which is why only the DFLT rule survives.

That means the ICE_MCAST_PROMISC_BITS rule that ice_vsi_sync_fltr()
installed with ice_set_promisc() is gone after entry.

On teardown, release_env keeps the DFLT Rx rule and re-adds only the perm
MAC and broadcast filters. It does not set ICE_VSI_PROMISC_CHANGED, the
UMAC/MMAC_FLTR_CHANGED bits or ICE_FLAG_FLTR_SYNC.

If promisc did not change during the session, vsi->current_netdev_flags
equals netdev->flags. ice_vsi_sync_fltr() then never enters this block
again:

			/* Promiscuous mode implies allmulticast. Subscribe
			 * the VSI to all multicast even when the default VSI
			 * rule is already in use and the block above is
			 * skipped (it may be owned by another VSI, or
			 * preserved across a switchdev session); the unicast
			 * catch-all does not cover the multicast subscription.
			 */
			err = ice_set_promisc(vsi, ICE_MCAST_PROMISC_BITS);

Wouldn't the uplink then stay in unicast promisc with no multicast
subscription until promisc is toggled?

The commit message gives the cause as "the sync path was not
retriggered". Would retriggering the sync here restore both the DFLT
rule and the multicast rule?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113231225.1864810-1-anthony.l.nguyen%40intel.com

  reply	other threads:[~2026-11-17 23:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 23:12 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-11-13 (ice) Tony Nguyen
2026-11-13 23:12 ` [PATCH net 1/6] ice: use global queue index in TC to-queue offload Tony Nguyen
2026-11-17 23:54   ` netdev-bot+sashiko
2026-11-13 23:12 ` [PATCH net 2/6] ice: skip per-VLAN promisc rules when default VSI Rx rule is set Tony Nguyen
2026-11-17 23:54   ` netdev-bot+sashiko
2026-11-13 23:12 ` [PATCH net 3/6] ice: preserve uplink DFLT Rx rule on switchdev release Tony Nguyen
2026-11-17 23:54   ` netdev-bot+sashiko [this message]
2026-11-13 23:12 ` [PATCH net 4/6] ice: Fix incorrect LLDP filter assumptions Tony Nguyen
2026-11-17 23:54   ` netdev-bot+sashiko
2026-11-13 23:12 ` [PATCH net 5/6] ice: propagate ETH56G deskew poll failures Tony Nguyen
2026-11-17 23:54   ` netdev-bot+sashiko
2026-11-13 23:12 ` [PATCH net 6/6] ice: allow reading the last byte of the NVM and Shadow RAM regions Tony Nguyen
2026-11-13 23:18 ` [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-11-13 (ice) netdev-bot+sinfo

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=179495967304.3136.16113490698897758196@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=alexander.nowlin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=david.m.ertman@intel.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pengpeng@iscas.ac.cn \
    --cc=poros@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=vinicius.gomes@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox