Skip to content

Commit 2c43c5a

Browse files
Huy Nguyendledford
authored andcommitted
net/mlx5e: Enable local loopback in loopback selftest
Before running the ethtool's loopback selftest, we need to make sure that the local loopback is enabled. Signed-off-by: Huy Nguyen <huyn@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent c85023e commit 2c43c5a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct mlx5e_lbt_priv {
189189
struct packet_type pt;
190190
struct completion comp;
191191
bool loopback_ok;
192+
bool local_lb;
192193
};
193194

194195
static int
@@ -236,6 +237,13 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
236237
{
237238
int err = 0;
238239

240+
/* Temporarily enable local_lb */
241+
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
242+
mlx5_nic_vport_query_local_lb(priv->mdev, &lbtp->local_lb);
243+
if (!lbtp->local_lb)
244+
mlx5_nic_vport_update_local_lb(priv->mdev, true);
245+
}
246+
239247
err = mlx5e_refresh_tirs(priv, true);
240248
if (err)
241249
return err;
@@ -254,6 +262,11 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
254262
static void mlx5e_test_loopback_cleanup(struct mlx5e_priv *priv,
255263
struct mlx5e_lbt_priv *lbtp)
256264
{
265+
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
266+
if (!lbtp->local_lb)
267+
mlx5_nic_vport_update_local_lb(priv->mdev, false);
268+
}
269+
257270
dev_remove_pack(&lbtp->pt);
258271
mlx5e_refresh_tirs(priv, false);
259272
}

0 commit comments

Comments
 (0)