Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] ice: ice_vsi_sync_fltr() re-adds uplink MAC filters during switchdev --
commit edb8f55bf97ab7c6c15ad8258647b17f2ec38996 Author: Petr Oros <[email protected]> ice: resync uplink filters after a switchdev session This commit adds ICE_VSI_ESWITCH_UPLINK to keep ice_vsi_sync_fltr() from modifying the uplink promiscuous configuration during a switchdev session, and schedules a filter resync when the session ends. > diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c > b/drivers/net/ethernet/intel/ice/ice_eswitch.c > index c96b201901f48..d55c70edb7f7f 100644 > --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c > +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c [ ... ] > @@ -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); [ ... ] > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c > b/drivers/net/ethernet/intel/ice/ice_main.c > index 6dede87b78944..2ce2b7138f668 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) { [Severity: High] Does checking ICE_VSI_ESWITCH_UPLINK after the MAC filter sync block allow ice_vsi_sync_fltr() to re-install the uplink's unicast and multicast MAC filters during a switchdev session? When ice_eswitch_enable_switchdev() calls ice_eswitch_setup_env() while the uplink netdev is up, pf->eswitch.is_running is still false. At the end of ice_eswitch_setup_env(), ice_up(uplink_vsi) calls ice_vsi_cfg_lan() -> ice_set_rx_mode(), which sees ice_is_switchdev_running() == false and schedules a filter sync with ICE_VSI_UMAC_FLTR_CHANGED and ICE_VSI_MMAC_FLTR_CHANGED set. When ice_vsi_sync_fltr() runs for uplink_vsi, it executes __dev_uc_sync(), __dev_mc_sync() and ice_fltr_add_mac_list() before reaching the ICE_VSI_ESWITCH_UPLINK check, re-adding all the MAC filters that ice_eswitch_setup_env() just removed and unsynced. Because pf->eswitch.is_running is then set to true, later address removals on the uplink are ignored by ice_set_rx_mode(), leaving stale MAC rules in hardware for the rest of the session (with multicast MAC rules also overriding the lower-priority switchdev default Tx rule). It also updates vsi->current_netdev_flags = vsi->netdev->flags before the check, and in ice_eswitch_setup_env() releasing ICE_CFG_BUSY before ice_remove_vsi_fltr() and __dev_uc_unsync()/__dev_mc_unsync() lets an already-queued ice_vsi_sync_fltr() race with filter removal. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
