DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@nvidia.com>
To: dev@dpdk.org
Cc: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [dpdk-dev] [PATCH 4/4] net/mlx5/linux: fix Tx queue operations decision
Date: Thu, 15 Oct 2020 06:38:13 +0000	[thread overview]
Message-ID: <1602743893-345348-4-git-send-email-matan@nvidia.com> (raw)
In-Reply-To: <1602743893-345348-1-git-send-email-matan@nvidia.com>

One of the conditions to create Tx queue object by DevX is to be sure
that the DPDK mlx5 driver is not going to be the E-Switch manager of
the device. The issue is with the default FDB flows managed by the
kernel driver, which are not created by the kernel when the Tx queues
are created by DevX.

The current decision is to create the Tx queues by Verbs when E-Switch
is enabled while the current behavior uses an opposite condition to
create them by DevX.

Create the Tx queues by Verbs when E-Switch is enabled.

Fixes: 86d259cec852 ("net/mlx5: separate Tx queue object creations")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 53 +++++++++++++---------------------------
 1 file changed, 17 insertions(+), 36 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 09d0944..d177b4f 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -526,26 +526,16 @@
 mlx5_os_txq_obj_new(struct rte_eth_dev *dev, uint16_t idx)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	struct mlx5_dev_config *config = &priv->config;
 	struct mlx5_txq_data *txq_data = (*priv->txqs)[idx];
 	struct mlx5_txq_ctrl *txq_ctrl =
 			container_of(txq_data, struct mlx5_txq_ctrl, txq);
 
-	/*
-	 * When DevX is supported and DV flow is enable, and dest tir is enable,
-	 * hairpin functions use DevX API.
-	 * When, in addition, DV E-Switch is enable and DevX uar offset is
-	 * supported, all Tx functions also use DevX API.
-	 * Otherwise, all Tx functions use Verbs API.
-	 */
-	if (config->devx && config->dv_flow_en && config->dest_tir) {
-		if (txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN)
-			return mlx5_txq_devx_obj_new(dev, idx);
+	if (txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN)
+		return mlx5_txq_devx_obj_new(dev, idx);
 #ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET
-		if (config->dv_esw_en)
-			return mlx5_txq_devx_obj_new(dev, idx);
+	if (!priv->config.dv_esw_en)
+		return mlx5_txq_devx_obj_new(dev, idx);
 #endif
-	}
 	return mlx5_txq_ibv_obj_new(dev, idx);
 }
 
@@ -558,20 +548,16 @@
 static void
 mlx5_os_txq_obj_release(struct mlx5_txq_obj *txq_obj)
 {
-	struct mlx5_dev_config *config = &txq_obj->txq_ctrl->priv->config;
-
-	if (config->devx && config->dv_flow_en && config->dest_tir) {
+	if (txq_obj->txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN) {
+		mlx5_txq_devx_obj_release(txq_obj);
+		return;
+	}
 #ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET
-		if (config->dv_esw_en) {
-			mlx5_txq_devx_obj_release(txq_obj);
-			return;
-		}
-#endif
-		if (txq_obj->txq_ctrl->type == MLX5_TXQ_TYPE_HAIRPIN) {
-			mlx5_txq_devx_obj_release(txq_obj);
-			return;
-		}
+	if (!txq_obj->txq_ctrl->priv->config.dv_esw_en) {
+		mlx5_txq_devx_obj_release(txq_obj);
+		return;
 	}
+#endif
 	mlx5_txq_ibv_obj_release(txq_obj);
 }
 
@@ -1377,12 +1363,6 @@
 			goto error;
 		}
 	}
-	/*
-	 * Initialize the dev_ops structure with DevX/Verbs function pointers.
-	 * When DevX is supported and both DV flow and dest tir are enabled, all
-	 * Rx functions use DevX API (except for drop that has not yet been
-	 * implemented in DevX).
-	 */
 	if (config->devx && config->dv_flow_en && config->dest_tir) {
 		priv->obj_ops = devx_obj_ops;
 		priv->obj_ops.drop_action_create =
@@ -1392,16 +1372,17 @@
 #ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET
 		priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;
 #else
-		if (!config->dv_esw_en)
+		if (config->dv_esw_en)
 			priv->obj_ops.txq_obj_modify =
 						ibv_obj_ops.txq_obj_modify;
 #endif
+		/* Use specific wrappers for Tx object. */
+		priv->obj_ops.txq_obj_new = mlx5_os_txq_obj_new;
+		priv->obj_ops.txq_obj_release = mlx5_os_txq_obj_release;
+
 	} else {
 		priv->obj_ops = ibv_obj_ops;
 	}
-	/* The Tx objects are managed by a specific linux wrapper functions. */
-	priv->obj_ops.txq_obj_new = mlx5_os_txq_obj_new;
-	priv->obj_ops.txq_obj_release = mlx5_os_txq_obj_release;
 	/* Supported Verbs flow priority number detection. */
 	err = mlx5_flow_discover_priorities(eth_dev);
 	if (err < 0) {
-- 
1.8.3.1


  parent reply	other threads:[~2020-10-15  6:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15  6:38 [dpdk-dev] [PATCH 1/4] net/mlx5: fix Rx queue release Matan Azrad
2020-10-15  6:38 ` [dpdk-dev] [PATCH 2/4] net/mlx5: fix Tx " Matan Azrad
2020-10-15  6:38 ` [dpdk-dev] [PATCH 3/4] net/mlx5: fix event queue number query Matan Azrad
2020-10-15  6:38 ` Matan Azrad [this message]
2020-10-18 11:58 ` [dpdk-dev] [PATCH 1/4] net/mlx5: fix Rx queue release Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1602743893-345348-4-git-send-email-matan@nvidia.com \
    --to=matan@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).