Commit 0af3613d authored by Mark Bloch's avatar Mark Bloch Committed by Saeed Mahameed

net/mlx5e: en_tc, re-factor query route port

query for peer esw outside of if scope.
This is preparation for query route port over multiple peers.
Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent ed7a8fe7
......@@ -1666,8 +1666,10 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
{
struct mlx5e_priv *out_priv, *route_priv;
struct mlx5_core_dev *route_mdev;
struct mlx5_devcom *devcom;
struct mlx5_eswitch *esw;
u16 vhca_id;
int err;
out_priv = netdev_priv(out_dev);
esw = out_priv->mdev->priv.eswitch;
......@@ -1675,16 +1677,11 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
route_mdev = route_priv->mdev;
vhca_id = MLX5_CAP_GEN(route_mdev, vhca_id);
if (mlx5_lag_is_active(out_priv->mdev)) {
struct mlx5_devcom *devcom;
int err;
/* In lag case we may get devices from different eswitch instances.
* If we failed to get vport num, it means, mostly, that we on the wrong
* eswitch.
*/
err = mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
if (err != -ENOENT)
if (!err)
return err;
if (!mlx5_lag_is_active(out_priv->mdev))
return err;
rcu_read_lock();
......@@ -1694,9 +1691,6 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
rcu_read_unlock();
return err;
}
return mlx5_eswitch_vhca_id_to_vport(esw, vhca_id, vport);
}
static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment