Skip to content

Commit 5fb091e

Browse files
roidayanSaeed Mahameed
authored andcommitted
net/mlx5e: Use hint to resolve route when in HW multipath mode
As part of creating the tunnel headers while offloading TC encap rules, we resolve the route and neighbour in order to get the source / destination mac. Since the way we offload multipath route is by having two HW rules, one per uplink port, doing naive route lookup might get us a "wrong" routing path which goes through the peer uplink and this will get us eventually to create a wrong L2 header for the tunnel. To avoid that, we use a device hint to get the correct route. Signed-off-by: Roi Dayan <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 316d5f7 commit 5fb091e

File tree

1 file changed

+12
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+12
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,24 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
5454
struct neighbour *n = NULL;
5555

5656
#if IS_ENABLED(CONFIG_INET)
57+
struct mlx5_core_dev *mdev = priv->mdev;
58+
struct net_device *uplink_dev;
5759
int ret;
5860

61+
if (mlx5_lag_is_multipath(mdev)) {
62+
struct mlx5_eswitch *esw = mdev->priv.eswitch;
63+
64+
uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
65+
fl4->flowi4_oif = uplink_dev->ifindex;
66+
}
67+
5968
rt = ip_route_output_key(dev_net(mirred_dev), fl4);
6069
ret = PTR_ERR_OR_ZERO(rt);
6170
if (ret)
6271
return ret;
72+
73+
if (mlx5_lag_is_multipath(mdev) && !rt->rt_gateway)
74+
return -ENETUNREACH;
6375
#else
6476
return -EOPNOTSUPP;
6577
#endif

0 commit comments

Comments
 (0)