DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: dev@dpdk.org
Cc: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix flow tag hash list conversion
Date: Thu, 21 Nov 2019 11:27:57 +0000	[thread overview]
Message-ID: <1574335677-28838-1-git-send-email-matan@mellanox.com> (raw)

When DR is not supported and DV is supported, tag action still can be
used by the metadata feature.

Wrongly, the tag hash list was not created what caused failure in
metadata action creation.

Create the tag hash list for each DV case.

Fixes: 860897d2895a ("net/mlx5: reorganize flow tables with hash list")

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3ca91b2..59ae408 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -866,13 +866,21 @@ struct mlx5_flow_id_pool *
 static int
 mlx5_alloc_shared_dr(struct mlx5_priv *priv)
 {
+	struct mlx5_ibv_shared *sh = priv->sh;
+	char s[MLX5_HLIST_NAMESIZE];
 	int err = mlx5_alloc_table_hash_list(priv);
 
 	if (err)
 		return err;
+	/* Create tags hash list table. */
+	snprintf(s, sizeof(s), "%s_tags", sh->ibdev_name);
+	sh->tag_table = mlx5_hlist_create(s, MLX5_TAGS_HLIST_ARRAY_SIZE);
+	if (!sh->tag_table) {
+		DRV_LOG(ERR, "tags with hash creation failed.\n");
+		err = ENOMEM;
+		goto error;
+	}
 #ifdef HAVE_MLX5DV_DR
-	struct mlx5_ibv_shared *sh = priv->sh;
-	char s[MLX5_HLIST_NAMESIZE];
 	void *domain;
 
 	if (sh->dv_refcnt) {
@@ -912,20 +920,13 @@ struct mlx5_flow_id_pool *
 		sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop();
 	}
 #endif
-	/* create tags hash list table. */
-	snprintf(s, sizeof(s), "%s_tags", priv->sh->ibdev_name);
-	sh->tag_table = mlx5_hlist_create(s, MLX5_TAGS_HLIST_ARRAY_SIZE);
-	if (!sh->flow_tbls) {
-		DRV_LOG(ERR, "tags with hash creation failed.\n");
-		goto error;
-	}
 	sh->pop_vlan_action = mlx5_glue->dr_create_flow_action_pop_vlan();
+#endif /* HAVE_MLX5DV_DR */
 	sh->dv_refcnt++;
 	priv->dr_shared = 1;
 	return 0;
-
 error:
-       /* Rollback the created objects. */
+	/* Rollback the created objects. */
 	if (sh->rx_domain) {
 		mlx5_glue->dr_destroy_domain(sh->rx_domain);
 		sh->rx_domain = NULL;
@@ -946,8 +947,12 @@ struct mlx5_flow_id_pool *
 		mlx5_glue->destroy_flow_action(sh->pop_vlan_action);
 		sh->pop_vlan_action = NULL;
 	}
+	if (sh->tag_table) {
+		/* tags should be destroyed with flow before. */
+		mlx5_hlist_destroy(sh->tag_table, NULL, NULL);
+		sh->tag_table = NULL;
+	}
 	mlx5_free_table_hash_list(priv);
-#endif
 	return err;
 }
 
@@ -960,7 +965,6 @@ struct mlx5_flow_id_pool *
 static void
 mlx5_free_shared_dr(struct mlx5_priv *priv)
 {
-#ifdef HAVE_MLX5DV_DR
 	struct mlx5_ibv_shared *sh;
 
 	if (!priv->dr_shared)
@@ -968,6 +972,7 @@ struct mlx5_flow_id_pool *
 	priv->dr_shared = 0;
 	sh = priv->sh;
 	assert(sh);
+#ifdef HAVE_MLX5DV_DR
 	assert(sh->dv_refcnt);
 	if (sh->dv_refcnt && --sh->dv_refcnt)
 		return;
@@ -989,17 +994,17 @@ struct mlx5_flow_id_pool *
 		sh->esw_drop_action = NULL;
 	}
 #endif
-	if (sh->tag_table) {
-		/* tags should be destroyed with flow before. */
-		mlx5_hlist_destroy(sh->tag_table, NULL, NULL);
-		sh->tag_table = NULL;
-	}
 	if (sh->pop_vlan_action) {
 		mlx5_glue->destroy_flow_action(sh->pop_vlan_action);
 		sh->pop_vlan_action = NULL;
 	}
 	pthread_mutex_destroy(&sh->dv_mutex);
 #endif /* HAVE_MLX5DV_DR */
+	if (sh->tag_table) {
+		/* tags should be destroyed with flow before. */
+		mlx5_hlist_destroy(sh->tag_table, NULL, NULL);
+		sh->tag_table = NULL;
+	}
 	mlx5_free_table_hash_list(priv);
 }
 
-- 
1.8.3.1


             reply	other threads:[~2019-11-21 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 11:27 Matan Azrad [this message]
2019-11-21 13:48 ` 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=1574335677-28838-1-git-send-email-matan@mellanox.com \
    --to=matan@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=viacheslavo@mellanox.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).