Skip to content

Commit f9d196b

Browse files
DmytroLinkinSaeed Mahameed
authored andcommitted
net/mlx5e: Use correct eswitch for stack devices with lag
If link aggregation is used within stack devices driver rejects encap rules if PF of the VF tunnel device is down. This happens because route resolved for other PF and its eswitch instance is used to determine correct vport. To fix that use devcom feature to retrieve other eswitch instance if failed to find vport for the 1st eswitch and LAG is active. Fixes: 10742ef ("net/mlx5e: VF tunnel TX traffic offloading") Signed-off-by: Dmytro Linkin <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent ca6891f commit f9d196b

File tree

1 file changed

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

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ bool mlx5e_tc_is_vf_tunnel(struct net_device *out_dev, struct net_device *route_
13381338
int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *route_dev, u16 *vport)
13391339
{
13401340
struct mlx5e_priv *out_priv, *route_priv;
1341+
struct mlx5_devcom *devcom = NULL;
13411342
struct mlx5_core_dev *route_mdev;
13421343
struct mlx5_eswitch *esw;
13431344
u16 vhca_id;
@@ -1349,7 +1350,24 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
13491350
route_mdev = route_priv->mdev;
13501351

13511352
vhca_id = MLX5_CAP_GEN(route_mdev, vhca_id);
1353+
if (mlx5_lag_is_active(out_priv->mdev)) {
1354+
/* In lag case we may get devices from different eswitch instances.
1355+
* If we failed to get vport num, it means, mostly, that we on the wrong
1356+
* eswitch.
1357+
*/
1358+
err = mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
1359+
if (err != -ENOENT)
1360+
return err;
1361+
1362+
devcom = out_priv->mdev->priv.devcom;
1363+
esw = mlx5_devcom_get_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
1364+
if (!esw)
1365+
return -ENODEV;
1366+
}
1367+
13521368
err = mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
1369+
if (devcom)
1370+
mlx5_devcom_release_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
13531371
return err;
13541372
}
13551373

0 commit comments

Comments
 (0)