Re: [Intel-wired-lan] [PATCH iwl-net v4 2/2] ice: preserve uplink DFLT Rx rule on switchdev release
"Holda, Patryk" <[email protected]>
| Newsgroups | org.osuosl.intel-wired-lan,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <IA3PR11MB930195835FBE12644A2B38808ADB2@IA3PR11MB9301.namprd11.prod.outlook.com> |
> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf Of > Petr Oros > Sent: Wednesday, July 8, 2026 2:58 PM > To: [email protected] > Cc: Vecera, Ivan <[email protected]>; Martyna Szapar-Mudlaw > <[email protected]>; Alice Michael > <[email protected]>; Kitszel, Przemyslaw > <[email protected]>; Eric Dumazet <[email protected]>; > [email protected]; Loktionov, Aleksandr > <[email protected]>; Andrew Lunn <[email protected]>; > Marcin Szycik <[email protected]>; Nguyen, Anthony L > <[email protected]>; Simon Horman <[email protected]>; intel- > [email protected]; Keller, Jacob E <[email protected]>; Jakub > Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. > Miller <[email protected]> > Subject: [Intel-wired-lan] [PATCH iwl-net v4 2/2] ice: preserve uplink DFLT Rx > rule on switchdev release > Importance: High > > When the uplink PF is promiscuous, ice_vsi_sync_fltr() installs an > ICE_SW_LKUP_DFLT catch-all Rx rule on the uplink VSI. Entering switchdev re- > affirms it through the idempotent ice_set_dflt_vsi(), but > ice_eswitch_release_env() removed both the Rx and Tx DFLT rules > unconditionally on teardown. That clobbered a promisc-owned Rx rule: it > disappeared while IFF_PROMISC was still set and the sync path was not > retriggered, leaving the uplink without the catch-all the netdev requested. > > Skip the Rx DFLT removal when the uplink is promiscuous, both in > ice_eswitch_release_env() and the err_def_tx unwind of > ice_eswitch_setup_env(); the Tx leg, owned by switchdev, is still removed. > Test the live netdev->flags, the same value ena_rx_filtering() -> > ice_cfg_vlan_pruning() above already keys on, so the preserved rule and the > pruning state stay consistent, including for a promisc change made while > switchdev ran (which never reached the gated filter sync). > > Fixes: 5c07be96d8b3 ("ice: Avoid setting default Rx VSI twice in switchdev > setup") > Reviewed-by: Marcin Szycik <[email protected]> > Reviewed-by: Aleksandr Loktionov <[email protected]> > Signed-off-by: Petr Oros <[email protected]> > --- > v4: > - No code change, added Marcin's and Aleksandr's Reviewed-by. > > v3: https://lore.kernel.org/all/20260701133601.2118382-3- > [email protected]/ > v2: https://lore.kernel.org/all/20260622113428.2565255-3- > [email protected]/ > v1: > https://lore.kernel.org/all/deef5756e534ef06c12d910c5305d3fd205d30a0. > [email protected]/ > --- > drivers/net/ethernet/intel/ice/ice_eswitch.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c > b/drivers/net/ethernet/intel/ice/ice_eswitch.c > index c30e27bbfe6e25..07e2016fb9481f 100644 > --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c > +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c > @@ -66,8 +66,10 @@ static int ice_eswitch_setup_env(struct ice_pf *pf) > ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false, > ICE_FLTR_TX); > err_def_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 (see release_env) > */ > + if (!(uplink_vsi->netdev->flags & IFF_PROMISC)) > + ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, > + false, ICE_FLTR_RX); > err_def_rx: > ice_vsi_del_vlan_zero(uplink_vsi); > err_vlan_zero: > @@ -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. > + */ > + if (!(uplink_vsi->netdev->flags & IFF_PROMISC)) > + ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, > + false, ICE_FLTR_RX); > + > ice_fltr_add_mac_and_broadcast(uplink_vsi, > uplink_vsi->port_info->mac.perm_addr, > ICE_FWD_TO_VSI); > -- > 2.54.0 Tested-by: Patryk Holda <[email protected]>