提交 2c43c5a0 编写于 作者: H Huy Nguyen 提交者: Doug Ledford

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: NHuy Nguyen <huyn@mellanox.com>
Reviewed-by: NDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: NLeon Romanovsky <leon@kernel.org>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 c85023e1
...@@ -189,6 +189,7 @@ struct mlx5e_lbt_priv { ...@@ -189,6 +189,7 @@ struct mlx5e_lbt_priv {
struct packet_type pt; struct packet_type pt;
struct completion comp; struct completion comp;
bool loopback_ok; bool loopback_ok;
bool local_lb;
}; };
static int static int
...@@ -236,6 +237,13 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, ...@@ -236,6 +237,13 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
{ {
int err = 0; int err = 0;
/* Temporarily enable local_lb */
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
mlx5_nic_vport_query_local_lb(priv->mdev, &lbtp->local_lb);
if (!lbtp->local_lb)
mlx5_nic_vport_update_local_lb(priv->mdev, true);
}
err = mlx5e_refresh_tirs(priv, true); err = mlx5e_refresh_tirs(priv, true);
if (err) if (err)
return err; return err;
...@@ -254,6 +262,11 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, ...@@ -254,6 +262,11 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
static void mlx5e_test_loopback_cleanup(struct mlx5e_priv *priv, static void mlx5e_test_loopback_cleanup(struct mlx5e_priv *priv,
struct mlx5e_lbt_priv *lbtp) struct mlx5e_lbt_priv *lbtp)
{ {
if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) {
if (!lbtp->local_lb)
mlx5_nic_vport_update_local_lb(priv->mdev, false);
}
dev_remove_pack(&lbtp->pt); dev_remove_pack(&lbtp->pt);
mlx5e_refresh_tirs(priv, false); mlx5e_refresh_tirs(priv, false);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册