Skip to content

Commit 776fe19

Browse files
Michal Swiatkowskidavem330
authored andcommitted
ice: block default rule setting on LAG interface
When one of the LAG interfaces is in switchdev mode, setting default rule can't be done. The interface on which switchdev is running has ice_set_rx_mode() blocked to avoid default rule adding (and other rules). The other interfaces (without switchdev running but connected via bond with interface that runs switchdev) can't follow the same scheme, because rx filtering needs to be disabled when failover happens. Notification for bridge to set promisc mode seems like good place to do that. Fixes: bb52f42 ("ice: Add driver support for firmware changes for LAG") Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 66cf743 commit 776fe19

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

drivers/net/ethernet/intel/ice/ice_lag.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,3 +2093,35 @@ void ice_lag_rebuild(struct ice_pf *pf)
20932093
}
20942094
mutex_unlock(&pf->lag_mutex);
20952095
}
2096+
2097+
/**
2098+
* ice_lag_is_switchdev_running
2099+
* @pf: pointer to PF structure
2100+
*
2101+
* Check if switchdev is running on any of the interfaces connected to lag.
2102+
*/
2103+
bool ice_lag_is_switchdev_running(struct ice_pf *pf)
2104+
{
2105+
struct ice_lag *lag = pf->lag;
2106+
struct net_device *tmp_nd;
2107+
2108+
if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) || !lag)
2109+
return false;
2110+
2111+
rcu_read_lock();
2112+
for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
2113+
struct ice_netdev_priv *priv = netdev_priv(tmp_nd);
2114+
2115+
if (!netif_is_ice(tmp_nd) || !priv || !priv->vsi ||
2116+
!priv->vsi->back)
2117+
continue;
2118+
2119+
if (ice_is_switchdev_running(priv->vsi->back)) {
2120+
rcu_read_unlock();
2121+
return true;
2122+
}
2123+
}
2124+
rcu_read_unlock();
2125+
2126+
return false;
2127+
}

drivers/net/ethernet/intel/ice/ice_lag.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,5 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf);
6262
int ice_init_lag(struct ice_pf *pf);
6363
void ice_deinit_lag(struct ice_pf *pf);
6464
void ice_lag_rebuild(struct ice_pf *pf);
65+
bool ice_lag_is_switchdev_running(struct ice_pf *pf);
6566
#endif /* _ICE_LAG_H_ */

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,12 @@ int ice_set_dflt_vsi(struct ice_vsi *vsi)
35753575

35763576
dev = ice_pf_to_dev(vsi->back);
35773577

3578+
if (ice_lag_is_switchdev_running(vsi->back)) {
3579+
dev_dbg(dev, "VSI %d passed is a part of LAG containing interfaces in switchdev mode, nothing to do\n",
3580+
vsi->vsi_num);
3581+
return 0;
3582+
}
3583+
35783584
/* the VSI passed in is already the default VSI */
35793585
if (ice_is_vsi_dflt_vsi(vsi)) {
35803586
dev_dbg(dev, "VSI %d passed in is already the default forwarding VSI, nothing to do\n",

0 commit comments

Comments
 (0)