Commit 80639b19 authored by Erez Shitrit's avatar Erez Shitrit Committed by Saeed Mahameed

net/mlx5e: IPoIB, Enable loopback packets for IPoIB interfaces

Enable loopback of unicast and multicast traffic for IPoIB enhanced
mode.
This will allow interfaces with the same pkey to communicate between
them e.g cloned interfaces that located in different namespaces.
Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
Reviewed-by: default avatarAlex Vesker <valex@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 9102d836
...@@ -1082,7 +1082,8 @@ void mlx5e_destroy_tir(struct mlx5_core_dev *mdev, ...@@ -1082,7 +1082,8 @@ void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,
struct mlx5e_tir *tir); struct mlx5e_tir *tir);
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev); int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev);
void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev); void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev);
int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb); int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb,
bool enable_mc_lb);
/* common netdev helpers */ /* common netdev helpers */
void mlx5e_create_q_counters(struct mlx5e_priv *priv); void mlx5e_create_q_counters(struct mlx5e_priv *priv);
......
...@@ -141,10 +141,12 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev) ...@@ -141,10 +141,12 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev)
memset(res, 0, sizeof(*res)); memset(res, 0, sizeof(*res));
} }
int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb,
bool enable_mc_lb)
{ {
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5e_tir *tir; struct mlx5e_tir *tir;
u8 lb_flags = 0;
int err = 0; int err = 0;
u32 tirn = 0; u32 tirn = 0;
int inlen; int inlen;
...@@ -158,8 +160,13 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) ...@@ -158,8 +160,13 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb)
} }
if (enable_uc_lb) if (enable_uc_lb)
MLX5_SET(modify_tir_in, in, ctx.self_lb_block, lb_flags = MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST;
MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST);
if (enable_mc_lb)
lb_flags |= MLX5_TIRC_SELF_LB_BLOCK_BLOCK_MULTICAST;
if (lb_flags)
MLX5_SET(modify_tir_in, in, ctx.self_lb_block, lb_flags);
MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1); MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1);
......
...@@ -5275,7 +5275,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv) ...@@ -5275,7 +5275,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
int mlx5e_update_nic_rx(struct mlx5e_priv *priv) int mlx5e_update_nic_rx(struct mlx5e_priv *priv)
{ {
return mlx5e_refresh_tirs(priv, false); return mlx5e_refresh_tirs(priv, false, false);
} }
static const struct mlx5e_profile mlx5e_nic_profile = { static const struct mlx5e_profile mlx5e_nic_profile = {
......
...@@ -234,7 +234,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, ...@@ -234,7 +234,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv,
return err; return err;
} }
err = mlx5e_refresh_tirs(priv, true); err = mlx5e_refresh_tirs(priv, true, false);
if (err) if (err)
goto out; goto out;
...@@ -263,7 +263,7 @@ static void mlx5e_test_loopback_cleanup(struct mlx5e_priv *priv, ...@@ -263,7 +263,7 @@ static void mlx5e_test_loopback_cleanup(struct mlx5e_priv *priv,
mlx5_nic_vport_update_local_lb(priv->mdev, false); 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, false);
} }
#define MLX5E_LB_VERIFY_TIMEOUT (msecs_to_jiffies(200)) #define MLX5E_LB_VERIFY_TIMEOUT (msecs_to_jiffies(200))
......
...@@ -262,6 +262,11 @@ void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, u32 qpn) ...@@ -262,6 +262,11 @@ void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, u32 qpn)
mlx5_cmd_exec_in(mdev, destroy_qp, in); mlx5_cmd_exec_in(mdev, destroy_qp, in);
} }
int mlx5i_update_nic_rx(struct mlx5e_priv *priv)
{
return mlx5e_refresh_tirs(priv, true, true);
}
int mlx5i_create_tis(struct mlx5_core_dev *mdev, u32 underlay_qpn, u32 *tisn) int mlx5i_create_tis(struct mlx5_core_dev *mdev, u32 underlay_qpn, u32 *tisn)
{ {
u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {}; u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {};
...@@ -456,7 +461,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = { ...@@ -456,7 +461,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = {
.cleanup_rx = mlx5i_cleanup_rx, .cleanup_rx = mlx5i_cleanup_rx,
.enable = NULL, /* mlx5i_enable */ .enable = NULL, /* mlx5i_enable */
.disable = NULL, /* mlx5i_disable */ .disable = NULL, /* mlx5i_disable */
.update_rx = mlx5e_update_nic_rx, .update_rx = mlx5i_update_nic_rx,
.update_stats = NULL, /* mlx5i_update_stats */ .update_stats = NULL, /* mlx5i_update_stats */
.update_carrier = NULL, /* no HW update in IB link */ .update_carrier = NULL, /* no HW update in IB link */
.rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe,
......
...@@ -92,6 +92,8 @@ int mlx5i_init(struct mlx5_core_dev *mdev, ...@@ -92,6 +92,8 @@ int mlx5i_init(struct mlx5_core_dev *mdev,
void *ppriv); void *ppriv);
void mlx5i_cleanup(struct mlx5e_priv *priv); void mlx5i_cleanup(struct mlx5e_priv *priv);
int mlx5i_update_nic_rx(struct mlx5e_priv *priv);
/* Get child interface nic profile */ /* Get child interface nic profile */
const struct mlx5e_profile *mlx5i_pkey_get_profile(void); const struct mlx5e_profile *mlx5i_pkey_get_profile(void);
......
...@@ -347,7 +347,7 @@ static const struct mlx5e_profile mlx5i_pkey_nic_profile = { ...@@ -347,7 +347,7 @@ static const struct mlx5e_profile mlx5i_pkey_nic_profile = {
.cleanup_rx = mlx5i_pkey_cleanup_rx, .cleanup_rx = mlx5i_pkey_cleanup_rx,
.enable = NULL, .enable = NULL,
.disable = NULL, .disable = NULL,
.update_rx = mlx5e_update_nic_rx, .update_rx = mlx5i_update_nic_rx,
.update_stats = NULL, .update_stats = NULL,
.rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe, .rx_handlers.handle_rx_cqe = mlx5i_handle_rx_cqe,
.rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */ .rx_handlers.handle_rx_cqe_mpwqe = NULL, /* Not supported */
......
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