Blob Blame History Raw
From db6d49db1b50825fc1d5efde0d113fea05ab412a Mon Sep 17 00:00:00 2001
From: Alaa Hleihel <ahleihel@redhat.com>
Date: Mon, 1 Jun 2020 15:40:38 -0400
Subject: [PATCH 285/312] [netdrv] net/mlx5: Fix cleaning unmanaged flow tables

Message-id: <20200601154102.25980-16-ahleihel@redhat.com>
Patchwork-id: 315720
Patchwork-instance: patchwork
O-Subject: [RHEL8.3 BZ 1842258 15/39] net/mlx5: Fix cleaning unmanaged flow tables
Bugzilla: 1842258 1840408
RH-Acked-by: Honggang Li <honli@redhat.com>
RH-Acked-by: Kamal Heib <kheib@redhat.com>
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>

Bugzilla: http://bugzilla.redhat.com/1842258
Bugzilla: http://bugzilla.redhat.com/1840408
Upstream: v5.7-rc7

commit aee37f3d940ca732df71c3df49347bccaafc0b24
Author: Roi Dayan <roid@mellanox.com>
Date:   Mon May 11 16:32:09 2020 +0300

    net/mlx5: Fix cleaning unmanaged flow tables

    Unmanaged flow tables doesn't have a parent and tree_put_node()
    assume there is always a parent if cleaning is needed. fix that.

    Fixes: 5281a0c90919 ("net/mlx5: fs_core: Introduce unmanaged flow tables")
    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>

Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index f44e366ecfa8..6927d9a1c910 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -323,14 +323,13 @@ static void tree_put_node(struct fs_node *node, bool locked)
 		if (node->del_hw_func)
 			node->del_hw_func(node);
 		if (parent_node) {
-			/* Only root namespace doesn't have parent and we just
-			 * need to free its 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);
 		}
@@ -447,8 +446,10 @@ static void del_sw_flow_table(struct fs_node *node)
 	fs_get_obj(ft, node);
 
 	rhltable_destroy(&ft->fgs_hash);
-	fs_get_obj(prio, ft->node.parent);
-	prio->num_ft--;
+	if (ft->node.parent) {
+		fs_get_obj(prio, ft->node.parent);
+		prio->num_ft--;
+	}
 	kfree(ft);
 }
 
-- 
2.13.6