summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2018-11-01 09:11:04 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-05 15:01:25 +0100
commit65c9d24170c9ec1db59d3472b7c4af3fd087d621 (patch)
treead1728a519531b19111a2113473f4343d5a1d69f /drivers/net/mlx5
parentc513f05cdedbf0e63de1c7ed4dc744e599e58d2c (diff)
downloaddpdk-65c9d24170c9ec1db59d3472b7c4af3fd087d621.zip
dpdk-65c9d24170c9ec1db59d3472b7c4af3fd087d621.tar.gz
dpdk-65c9d24170c9ec1db59d3472b7c4af3fd087d621.tar.xz
net/mlx5: enable loopback by configured mode
Enable NIC loopback mode based on rte_eth_conf.lpbk_mode configuration. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5')
-rw-r--r--drivers/net/mlx5/mlx5_rxq.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 7db3f68..6df8997 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1764,6 +1764,8 @@ mlx5_ind_table_ibv_verify(struct rte_eth_dev *dev)
* first queue index will be taken for the indirection table.
* @param queues_n
* Number of queues.
+ * @param tunnel
+ * Tunnel type.
*
* @return
* The Verbs object initialised, NULL otherwise and rte_errno is set.
@@ -1779,6 +1781,9 @@ mlx5_hrxq_new(struct rte_eth_dev *dev,
struct mlx5_hrxq *hrxq;
struct mlx5_ind_table_ibv *ind_tbl;
struct ibv_qp *qp;
+#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
+ struct mlx5dv_qp_init_attr qp_init_attr = {0};
+#endif
int err;
queues_n = hash_fields ? queues_n : 1;
@@ -1794,6 +1799,20 @@ mlx5_hrxq_new(struct rte_eth_dev *dev,
rss_key = rss_hash_default_key;
}
#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
+ if (tunnel) {
+ qp_init_attr.comp_mask =
+ MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS;
+ qp_init_attr.create_flags = MLX5DV_QP_CREATE_TUNNEL_OFFLOADS;
+ }
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ if (dev->data->dev_conf.lpbk_mode) {
+ /* Allow packet sent from NIC loop back w/o source MAC check. */
+ qp_init_attr.comp_mask |=
+ MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS;
+ qp_init_attr.create_flags |=
+ MLX5DV_QP_CREATE_TIR_ALLOW_SELF_LOOPBACK_UC;
+ }
+#endif
qp = mlx5_glue->dv_create_qp
(priv->ctx,
&(struct ibv_qp_init_attr_ex){
@@ -1814,11 +1833,7 @@ mlx5_hrxq_new(struct rte_eth_dev *dev,
.rwq_ind_tbl = ind_tbl->ind_table,
.pd = priv->pd,
},
- &(struct mlx5dv_qp_init_attr){
- .comp_mask = tunnel ?
- MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS : 0,
- .create_flags = MLX5DV_QP_CREATE_TUNNEL_OFFLOADS,
- });
+ &qp_init_attr);
#else
qp = mlx5_glue->create_qp_ex
(priv->ctx,