From: Petr Oros <poros@redhat.com>
To: netdev@vger.kernel.org
Cc: Petr Oros <poros@redhat.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Simon Horman <horms@kernel.org>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Grzegorz Nitka <grzegorz.nitka@intel.com>,
Paul Menzel <pmenzel@molgen.mpg.de>,
Wojciech Drewek <wojciech.drewek@intel.com>,
Marcin Szycik <marcin.szycik@linux.intel.com>,
Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>,
Ivan Vecera <ivecera@redhat.com>,
Alice Michael <alice.michael@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jesse Brandeburg <jbrandeb@kernel.org>,
Patryk Holda <patryk.holda@intel.com>,
Rinitha S <sx.rinitha@intel.com>,
Aaron Ma <aaron.ma@canonical.com>,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v5 3/4] ice: resync uplink filters after a switchdev session
Date: Fri, 27 Nov 2026 09:57:08 +0100 [thread overview]
Message-ID: <20261127085714.1207361-4-poros@redhat.com> (raw)
In-Reply-To: <20261127085714.1207361-1-poros@redhat.com>
A switchdev session leaves the uplink filters out of sync with its
netdev. ice_eswitch_setup_env() removes the multicast promisc rules and
the address filters, and ice_eswitch_release_env() removes the default
VSI (DFLT) Rx rule that a promiscuous uplink needs. ice_set_rx_mode()
ignores the uplink during the session and nothing syncs it when the
session ends, so these are not installed again, and flag changes made
meanwhile are lost.
Let the eswitch own the uplink promisc configuration during a session.
While the new ICE_VSI_ESWITCH_UPLINK bit is set, ice_vsi_sync_fltr()
leaves it alone. When the session ends, after is_running is cleared,
ice_eswitch_resync_uplink() clears the bit and queues a full filter
sync, which programs the uplink from the netdev flags. Also subscribe a
promiscuous VSI to multicast when it already holds the DFLT rule, and
enable VLAN pruning on every promisc off, because it can be off without
our DFLT rule after a session or with LAG.
This does not restore the uplink VLAN filters that
ice_eswitch_setup_env() removes, a separate problem that now also shows
when promisc is cleared after a promiscuous session.
Found by AI code review, starting with the Sashiko review of v4, and
reproduced on an E810-C (FW 8.1.1, ICE COMMS package 1.3.55.0) without
kernel changes:
ip link set $PF promisc on
devlink dev eswitch set pci/$BDF mode switchdev
echo 1 > /sys/class/net/$PF/device/sriov_numvfs
echo 0 > /sys/class/net/$PF/device/sriov_numvfs
after which unknown unicast no longer reaches the PF, and with this
patch it does again. Also tested on that E810-C with promisc changed
before, during and after sessions, allmulti across a session, and PF
resets and driver removal during sessions. LAG and switchdev setup
errors were not tested. No kernel selftests cover this.
Fixes: 1a1c40df2e80 ("ice: set and release switchdev environment")
Fixes: 2571a3fa6251 ("ice: Prohibit rx mode change in switchdev mode")
Fixes: 5c07be96d8b3 ("ice: Avoid setting default Rx VSI twice in switchdev setup")
Fixes: 776fe19953b0 ("ice: block default rule setting on LAG interface")
Signed-off-by: Petr Oros <poros@redhat.com>
---
v5:
- Reworked after the Sashiko review of the v4 pull. Instead of keeping
the Rx DFLT rule on release, the eswitch now owns the uplink promisc
configuration during a session, and the uplink filters are resynced
from the netdev flags when the session ends.
- A new VSI state bit keeps filter syncs away from the uplink promisc
configuration during a session. The sync queued at the end of a
session relies on patch 1 when the PF goes away.
- A promiscuous VSI that already holds the DFLT rule is subscribed to
multicast, and VLAN pruning is re-enabled on every promisc off.
- New title, was "ice: preserve uplink DFLT Rx rule on switchdev
release". Moved before the multicast patch.
- Added Fixes tags for 1a1c40df2e80, 2571a3fa6251 and 776fe19953b0.
- Dropped the Reviewed-by and Tested-by tags because of the rework.
v4: https://lore.kernel.org/all/20260708125755.706263-3-poros@redhat.com/
v3: https://lore.kernel.org/all/20260701133601.2118382-3-poros@redhat.com/
v2: https://lore.kernel.org/all/20260622113428.2565255-3-poros@redhat.com/
v1: https://lore.kernel.org/all/deef5756e534ef06c12d910c5305d3fd205d30a0.1781786935.git.poros@redhat.com/
---
drivers/net/ethernet/intel/ice/ice.h | 1 +
drivers/net/ethernet/intel/ice/ice_eswitch.c | 40 ++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_main.c | 17 +++++++--
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 432da05c48c08a..a1b373e04bab30 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -321,6 +321,7 @@ enum ice_vsi_state {
ICE_VSI_MMAC_FLTR_CHANGED,
ICE_VSI_PROMISC_CHANGED,
ICE_VSI_REBUILD_PENDING,
+ ICE_VSI_ESWITCH_UPLINK, /* eswitch owns the promisc config */
ICE_VSI_STATE_NBITS /* must be last */
};
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
index c96b201901f48c..d55c70edb7f7f6 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
@@ -10,6 +10,34 @@
#include "devlink/devlink.h"
#include "ice_tc_lib.h"
+/**
+ * ice_eswitch_resync_uplink - hand the uplink filters back after switchdev
+ * @uplink_vsi: the uplink VSI
+ */
+static void ice_eswitch_resync_uplink(struct ice_vsi *uplink_vsi)
+{
+ struct ice_pf *pf = uplink_vsi->back;
+
+ while (test_and_set_bit(ICE_CFG_BUSY, uplink_vsi->state))
+ usleep_range(1000, 2000);
+
+ /* VLAN changes during the session may have added these */
+ ice_fltr_clear_vlan_vsi_promisc(&pf->hw, uplink_vsi,
+ ICE_MCAST_VLAN_PROMISC_BITS);
+ ice_fltr_clear_vsi_promisc(&pf->hw, uplink_vsi->idx,
+ ICE_MCAST_PROMISC_BITS, 0);
+ uplink_vsi->current_netdev_flags &= ~IFF_ALLMULTI;
+
+ clear_bit(ICE_VSI_ESWITCH_UPLINK, uplink_vsi->state);
+ set_bit(ICE_VSI_PROMISC_CHANGED, uplink_vsi->state);
+ set_bit(ICE_VSI_UMAC_FLTR_CHANGED, uplink_vsi->state);
+ set_bit(ICE_VSI_MMAC_FLTR_CHANGED, uplink_vsi->state);
+ clear_bit_unlock(ICE_CFG_BUSY, uplink_vsi->state);
+
+ set_bit(ICE_FLAG_FLTR_SYNC, pf->flags);
+ ice_service_task_schedule(pf);
+}
+
/**
* ice_eswitch_setup_env - configure eswitch HW filters
* @pf: pointer to PF struct
@@ -28,6 +56,12 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
if (ice_down(uplink_vsi))
return -ENODEV;
+ /* the eswitch owns the uplink promisc config until the resync */
+ while (test_and_set_bit(ICE_CFG_BUSY, uplink_vsi->state))
+ usleep_range(1000, 2000);
+ set_bit(ICE_VSI_ESWITCH_UPLINK, uplink_vsi->state);
+ clear_bit_unlock(ICE_CFG_BUSY, uplink_vsi->state);
+
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
ice_vsi_cfg_sw_lldp(uplink_vsi, true, false);
@@ -77,6 +111,8 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
if (if_running)
ice_up(uplink_vsi);
+ ice_eswitch_resync_uplink(uplink_vsi);
+
return -ENODEV;
}
@@ -318,6 +354,7 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
err_br_offloads:
ice_eswitch_release_env(pf);
+ ice_eswitch_resync_uplink(uplink_vsi);
return -ENODEV;
}
@@ -331,6 +368,9 @@ static void ice_eswitch_disable_switchdev(struct ice_pf *pf)
ice_eswitch_release_env(pf);
pf->eswitch.is_running = false;
+
+ /* after is_running is cleared, so no rx mode change is lost */
+ ice_eswitch_resync_uplink(pf->eswitch.uplink_vsi);
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 6dede87b78944f..2ce2b7138f6682 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -394,6 +394,10 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
}
}
err = 0;
+ /* the eswitch owns the uplink promisc config during a session */
+ if (test_bit(ICE_VSI_ESWITCH_UPLINK, vsi->state))
+ goto exit;
+
/* check for changes in promiscuous modes */
if (changed_flags & IFF_ALLMULTI) {
if (vsi->current_netdev_flags & IFF_ALLMULTI) {
@@ -438,6 +442,12 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
ICE_MCAST_PROMISC_BITS);
if (err)
goto out_promisc;
+ } else if (ice_is_vsi_dflt_vsi(vsi)) {
+ /* still the default VSI, so subscribe it */
+ err = ice_set_promisc(vsi,
+ ICE_MCAST_PROMISC_BITS);
+ if (err)
+ goto out_promisc;
}
} else {
/* Clear Rx filter to remove traffic from wire */
@@ -450,11 +460,12 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
IFF_PROMISC;
goto out_promisc;
}
- if (vsi->netdev->features &
- NETIF_F_HW_VLAN_CTAG_FILTER)
- vlan_ops->ena_rx_filtering(vsi);
}
+ /* pruning can be off even without our DFLT rule */
+ if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
+ vlan_ops->ena_rx_filtering(vsi);
+
/* disable allmulti here, but only if allmulti is not
* still enabled for the netdev
*/
--
2.56.1
next prev parent reply other threads:[~2026-11-27 8:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 8:57 [PATCH net v5 0/4] ice: fix DFLT Rx rule handling for promisc and switchdev Petr Oros
2026-11-27 8:57 ` [PATCH net v5 1/4] ice: stop the service task before the PF is unloaded Petr Oros
2026-11-27 8:57 ` [PATCH net v5 2/4] ice: do not leave switchdev mode while representors exist Petr Oros
2026-11-27 8:57 ` Petr Oros [this message]
2026-11-27 8:57 ` [PATCH net v5 4/4] ice: use a VLAN agnostic multicast promisc rule pair for PF VSIs Petr Oros
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=20261127085714.1207361-4-poros@redhat.com \
--to=poros@redhat.com \
--cc=aaron.ma@canonical.com \
--cc=aleksandr.loktionov@intel.com \
--cc=alice.michael@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=grzegorz.nitka@intel.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=ivecera@redhat.com \
--cc=jacob.e.keller@intel.com \
--cc=jbrandeb@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.szycik@linux.intel.com \
--cc=martyna.szapar-mudlaw@linux.intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patryk.holda@intel.com \
--cc=pmenzel@molgen.mpg.de \
--cc=przemyslaw.kitszel@intel.com \
--cc=sx.rinitha@intel.com \
--cc=wojciech.drewek@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
all inboxes | Powered by JetHome®