netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>, kuba@kernel.org
Cc: netdev@vger.kernel.org, Roi Dayan <roid@mellanox.com>,
	Mark Bloch <markb@mellanox.com>, Paul Blakey <paulb@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 09/13] net/mlx5: Don't maintain a case of del_sw_func being null
Date: Fri, 22 May 2020 17:40:45 -0700	[thread overview]
Message-ID: <20200523004049.34832-10-saeedm@mellanox.com> (raw)
In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com>

From: Roi Dayan <roid@mellanox.com>

Add del_sw_func cb for root ns. Now there is no need to
maintain a case of del_sw_func being null when freeing the node.

Fixes: 2cc43b494a6c ("net/mlx5_core: Managing root flow table")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/fs_core.c   | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 8f62bfcf57af..02d0f94eaaad 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -346,14 +346,10 @@ static void tree_put_node(struct fs_node *node, bool locked)
 		if (parent_node) {
 			down_write_ref_node(parent_node, locked);
 			list_del_init(&node->list);
-			if (node->del_sw_func)
-				node->del_sw_func(node);
-			up_write_ref_node(parent_node, locked);
-		} else if (node->del_sw_func) {
-			node->del_sw_func(node);
-		} else {
-			kfree(node);
 		}
+		node->del_sw_func(node);
+		if (parent_node)
+			up_write_ref_node(parent_node, locked);
 		node = NULL;
 	}
 	if (!node && parent_node)
@@ -2352,6 +2348,11 @@ static int init_root_tree(struct mlx5_flow_steering *steering,
 	return 0;
 }
 
+static void del_sw_root_ns(struct fs_node *node)
+{
+	kfree(node);
+}
+
 static struct mlx5_flow_root_namespace
 *create_root_ns(struct mlx5_flow_steering *steering,
 		enum fs_flow_table_type table_type)
@@ -2378,7 +2379,7 @@ static struct mlx5_flow_root_namespace
 	ns = &root_ns->ns;
 	fs_init_namespace(ns);
 	mutex_init(&root_ns->chain_lock);
-	tree_init_node(&ns->node, NULL, NULL);
+	tree_init_node(&ns->node, NULL, del_sw_root_ns);
 	tree_add_node(&ns->node, NULL);
 
 	return root_ns;
-- 
2.25.4


  parent reply	other threads:[~2020-05-23  0:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23  0:40 [pull request][net 00/13] mlx5 fixes 2020-05-22 Saeed Mahameed
2020-05-23  0:40 ` [net 01/13] net/mlx5: Add command entry handling completion Saeed Mahameed
2020-05-23  0:40 ` [net 02/13] net/mlx5: Fix a race when moving command interface to events mode Saeed Mahameed
2020-05-23  0:40 ` [net 03/13] net/mlx5: Avoid processing commands before cmdif is ready Saeed Mahameed
2020-05-23  0:40 ` [net 04/13] net/mlx5e: Fix allowed tc redirect merged eswitch offload cases Saeed Mahameed
2020-05-23  0:40 ` [net 05/13] net/mlx5e: kTLS, Destroy key object after destroying the TIS Saeed Mahameed
2020-05-23  0:40 ` [net 06/13] net/mlx5e: Fix inner tirs handling Saeed Mahameed
2020-05-23  0:40 ` [net 07/13] net/mlx5: Fix memory leak in mlx5_events_init Saeed Mahameed
2020-05-23  0:40 ` [net 08/13] net/mlx5: Fix cleaning unmanaged flow tables Saeed Mahameed
2020-05-23  0:40 ` Saeed Mahameed [this message]
2020-05-23  0:40 ` [net 10/13] net/mlx5: Annotate mutex destroy for root ns Saeed Mahameed
2020-05-23  0:40 ` [net 11/13] net/mlx5e: Update netdev txq on completions during closure Saeed Mahameed
2020-05-23  0:40 ` [net 12/13] net/mlx5e: CT: Correctly get flow rule Saeed Mahameed
2020-05-23  0:40 ` [net 13/13] net/mlx5: Fix error flow in case of function_setup failure Saeed Mahameed
2020-05-23 23:47 ` [pull request][net 00/13] mlx5 fixes 2020-05-22 David Miller

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=20200523004049.34832-10-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=markb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulb@mellanox.com \
    --cc=roid@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).