Skip to content

Commit 3213484

Browse files
maordSaeed Mahameed
authored andcommitted
net/mlx5e: Fix allowed tc redirect merged eswitch offload cases
After changing the parent_id to be the same for both NICs of same The cited commit wrongly allow offload of tc redirect flows from VF to uplink and vice versa when devcies are on different eswitch, these cases aren't supported by HW. Disallow the above offloads when devcies are on different eswitch and VF LAG is not configured. Fixes: f6dc126 ("net/mlx5e: Disallow tc redirect offload cases we don't support") Signed-off-by: Maor Dickman <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent f7936dd commit 3213484

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,13 +1484,9 @@ bool mlx5e_eswitch_uplink_rep(struct net_device *netdev)
14841484
return netdev->netdev_ops == &mlx5e_netdev_ops_uplink_rep;
14851485
}
14861486

1487-
bool mlx5e_eswitch_rep(struct net_device *netdev)
1487+
bool mlx5e_eswitch_vf_rep(struct net_device *netdev)
14881488
{
1489-
if (netdev->netdev_ops == &mlx5e_netdev_ops_rep ||
1490-
netdev->netdev_ops == &mlx5e_netdev_ops_uplink_rep)
1491-
return true;
1492-
1493-
return false;
1489+
return netdev->netdev_ops == &mlx5e_netdev_ops_rep;
14941490
}
14951491

14961492
static void mlx5e_build_rep_params(struct net_device *netdev)

drivers/net/ethernet/mellanox/mlx5/core/en_rep.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,13 @@ void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv,
210210

211211
void mlx5e_rep_queue_neigh_stats_work(struct mlx5e_priv *priv);
212212

213-
bool mlx5e_eswitch_rep(struct net_device *netdev);
213+
bool mlx5e_eswitch_vf_rep(struct net_device *netdev);
214214
bool mlx5e_eswitch_uplink_rep(struct net_device *netdev);
215+
static inline bool mlx5e_eswitch_rep(struct net_device *netdev)
216+
{
217+
return mlx5e_eswitch_vf_rep(netdev) ||
218+
mlx5e_eswitch_uplink_rep(netdev);
219+
}
215220

216221
#else /* CONFIG_MLX5_ESWITCH */
217222
static inline bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv) { return false; }

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,6 +3073,11 @@ static bool actions_match_supported(struct mlx5e_priv *priv,
30733073
return true;
30743074
}
30753075

3076+
static bool same_port_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
3077+
{
3078+
return priv->mdev == peer_priv->mdev;
3079+
}
3080+
30763081
static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
30773082
{
30783083
struct mlx5_core_dev *fmdev, *pmdev;
@@ -3291,21 +3296,19 @@ static inline int hash_encap_info(struct encap_key *key)
32913296
}
32923297

32933298

3294-
static bool is_merged_eswitch_dev(struct mlx5e_priv *priv,
3299+
static bool is_merged_eswitch_vfs(struct mlx5e_priv *priv,
32953300
struct net_device *peer_netdev)
32963301
{
32973302
struct mlx5e_priv *peer_priv;
32983303

32993304
peer_priv = netdev_priv(peer_netdev);
33003305

33013306
return (MLX5_CAP_ESW(priv->mdev, merged_eswitch) &&
3302-
mlx5e_eswitch_rep(priv->netdev) &&
3303-
mlx5e_eswitch_rep(peer_netdev) &&
3307+
mlx5e_eswitch_vf_rep(priv->netdev) &&
3308+
mlx5e_eswitch_vf_rep(peer_netdev) &&
33043309
same_hw_devs(priv, peer_priv));
33053310
}
33063311

3307-
3308-
33093312
bool mlx5e_encap_take(struct mlx5e_encap_entry *e)
33103313
{
33113314
return refcount_inc_not_zero(&e->refcnt);
@@ -3575,14 +3578,37 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv,
35753578
return err;
35763579
}
35773580

3581+
static bool same_hw_reps(struct mlx5e_priv *priv,
3582+
struct net_device *peer_netdev)
3583+
{
3584+
struct mlx5e_priv *peer_priv;
3585+
3586+
peer_priv = netdev_priv(peer_netdev);
3587+
3588+
return mlx5e_eswitch_rep(priv->netdev) &&
3589+
mlx5e_eswitch_rep(peer_netdev) &&
3590+
same_hw_devs(priv, peer_priv);
3591+
}
3592+
3593+
static bool is_lag_dev(struct mlx5e_priv *priv,
3594+
struct net_device *peer_netdev)
3595+
{
3596+
return ((mlx5_lag_is_sriov(priv->mdev) ||
3597+
mlx5_lag_is_multipath(priv->mdev)) &&
3598+
same_hw_reps(priv, peer_netdev));
3599+
}
3600+
35783601
bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv,
35793602
struct net_device *out_dev)
35803603
{
3581-
if (is_merged_eswitch_dev(priv, out_dev))
3604+
if (is_merged_eswitch_vfs(priv, out_dev))
3605+
return true;
3606+
3607+
if (is_lag_dev(priv, out_dev))
35823608
return true;
35833609

35843610
return mlx5e_eswitch_rep(out_dev) &&
3585-
same_hw_devs(priv, netdev_priv(out_dev));
3611+
same_port_devs(priv, netdev_priv(out_dev));
35863612
}
35873613

35883614
static bool is_duplicated_output_device(struct net_device *dev,

0 commit comments

Comments
 (0)