* [dpdk-dev] [PATCH] net/mlx5: enable loopback by configured mode
@ 2018-10-31 12:00 Dekel Peled
2018-11-01 7:11 ` [dpdk-dev] [PATCH v2] " Dekel Peled
0 siblings, 1 reply; 3+ messages in thread
From: Dekel Peled @ 2018-10-31 12:00 UTC (permalink / raw)
To: yskoh, shahafs; +Cc: dev, orika
Enable NIC loopback mode based on rte_eth_conf.lpbk_mode
configuration.
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
drivers/net/mlx5/mlx5_rxq.c | 27 +++++++++++++++++++++------
drivers/net/mlx5/mlx5_rxtx.h | 2 +-
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 7db3f68..242e332 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1764,6 +1764,8 @@ struct mlx5_ind_table_ibv *
* 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.
@@ -1773,12 +1775,15 @@ struct mlx5_hrxq *
const uint8_t *rss_key, uint32_t rss_key_len,
uint64_t hash_fields,
const uint16_t *queues, uint32_t queues_n,
- int tunnel __rte_unused)
+ uint32_t tunnel)
{
struct priv *priv = dev->data->dev_private;
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 @@ struct mlx5_hrxq *
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 @@ struct mlx5_hrxq *
.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,
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 1db468c..a3564e4 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -284,7 +284,7 @@ struct mlx5_hrxq *mlx5_hrxq_new(struct rte_eth_dev *dev,
const uint8_t *rss_key, uint32_t rss_key_len,
uint64_t hash_fields,
const uint16_t *queues, uint32_t queues_n,
- int tunnel __rte_unused);
+ uint32_t tunnel);
struct mlx5_hrxq *mlx5_hrxq_get(struct rte_eth_dev *dev,
const uint8_t *rss_key, uint32_t rss_key_len,
uint64_t hash_fields,
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx5: enable loopback by configured mode
2018-10-31 12:00 [dpdk-dev] [PATCH] net/mlx5: enable loopback by configured mode Dekel Peled
@ 2018-11-01 7:11 ` Dekel Peled
2018-11-01 12:51 ` Shahaf Shuler
0 siblings, 1 reply; 3+ messages in thread
From: Dekel Peled @ 2018-11-01 7:11 UTC (permalink / raw)
To: yskoh, shahafs; +Cc: dev, orika
Enable NIC loopback mode based on rte_eth_conf.lpbk_mode
configuration.
---
v2:
* Undo parameter type change to prevent compilation issue.
---
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
drivers/net/mlx5/mlx5_rxq.c | 25 ++++++++++++++++++++-----
1 file 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 @@ struct mlx5_ind_table_ibv *
* 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 @@ struct mlx5_hrxq *
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 @@ struct mlx5_hrxq *
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 @@ struct mlx5_hrxq *
.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,
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: enable loopback by configured mode
2018-11-01 7:11 ` [dpdk-dev] [PATCH v2] " Dekel Peled
@ 2018-11-01 12:51 ` Shahaf Shuler
0 siblings, 0 replies; 3+ messages in thread
From: Shahaf Shuler @ 2018-11-01 12:51 UTC (permalink / raw)
To: Dekel Peled, Yongseok Koh; +Cc: dev, Ori Kam
Thursday, November 1, 2018 9:11 AM, Dekel Peled:
> Subject: [PATCH v2] net/mlx5: enable loopback by configured mode
>
> Enable NIC loopback mode based on rte_eth_conf.lpbk_mode configuration.
>
Added signed off-by
Applied to next-net-mlx, thanks.
> ---
> v2:
> * Undo parameter type change to prevent compilation issue.
> ---
>
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-01 12:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 12:00 [dpdk-dev] [PATCH] net/mlx5: enable loopback by configured mode Dekel Peled
2018-11-01 7:11 ` [dpdk-dev] [PATCH v2] " Dekel Peled
2018-11-01 12:51 ` Shahaf Shuler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).