aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0052-sdk_dpaa-ceetm-remove-tc-class-reference-counting.patch
blob: 473720b41f115afaed7e0f002340b4376d1a25e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From 024d664114310fe103c2c31f2253bed58238951d Mon Sep 17 00:00:00 2001
From: Camelia Groza <camelia.groza@nxp.com>
Date: Wed, 17 Jan 2018 16:47:07 +0200
Subject: [PATCH] sdk_dpaa: ceetm: remove tc class reference counting

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c   | 38 +++-------------------
 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h   |  1 -
 2 files changed, 4 insertions(+), 35 deletions(-)

--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
@@ -774,7 +774,6 @@ static int ceetm_init_prio(struct Qdisc
 		}
 
 		child_cl->common.classid = TC_H_MAKE(sch->handle, (i + 1));
-		child_cl->refcnt = 1;
 		child_cl->parent = sch;
 		child_cl->type = CEETM_PRIO;
 		child_cl->shaped = priv->shaped;
@@ -986,7 +985,6 @@ static int ceetm_init_wbfs(struct Qdisc
 		}
 
 		child_cl->common.classid = TC_H_MAKE(sch->handle, (i + 1));
-		child_cl->refcnt = 1;
 		child_cl->parent = sch;
 		child_cl->type = CEETM_WBFS;
 		child_cl->shaped = priv->shaped;
@@ -1297,29 +1295,9 @@ static void ceetm_attach(struct Qdisc *s
 	}
 }
 
-static unsigned long ceetm_cls_get(struct Qdisc *sch, u32 classid)
+static unsigned long ceetm_cls_search(struct Qdisc *sch, u32 handle)
 {
-	struct ceetm_class *cl;
-
-	pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
-		 __func__, classid, sch->handle);
-	cl = ceetm_find(classid, sch);
-
-	if (cl)
-		cl->refcnt++; /* Will decrement in put() */
-	return (unsigned long)cl;
-}
-
-static void ceetm_cls_put(struct Qdisc *sch, unsigned long arg)
-{
-	struct ceetm_class *cl = (struct ceetm_class *)arg;
-
-	pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
-		 __func__, cl->common.classid, sch->handle);
-	cl->refcnt--;
-
-	if (cl->refcnt == 0)
-		ceetm_cls_destroy(sch, cl);
+	return (unsigned long)ceetm_find(handle, sch);
 }
 
 static int ceetm_cls_change_root(struct ceetm_class *cl,
@@ -1540,7 +1518,6 @@ static int ceetm_cls_change(struct Qdisc
 	cl->root.tbl = copt->tbl;
 
 	cl->common.classid = classid;
-	cl->refcnt = 1;
 	cl->parent = sch;
 	cl->root.child = NULL;
 	cl->root.wbfs_grp_a = false;
@@ -1696,15 +1673,9 @@ static int ceetm_cls_delete(struct Qdisc
 
 	sch_tree_lock(sch);
 	qdisc_class_hash_remove(&priv->clhash, &cl->common);
-	cl->refcnt--;
-
-	/* The refcnt should be at least 1 since we have incremented it in
-	 * get(). Will decrement again in put() where we will call destroy()
-	 * to actually free the memory if it reaches 0.
-	 */
-	WARN_ON(cl->refcnt == 0);
 
 	sch_tree_unlock(sch);
+	ceetm_cls_destroy(sch, cl);
 	return 0;
 }
 
@@ -1824,8 +1795,7 @@ static void ceetm_tcf_unbind(struct Qdis
 const struct Qdisc_class_ops ceetm_cls_ops = {
 	.graft		=	ceetm_cls_graft,
 	.leaf		=	ceetm_cls_leaf,
-	.get		=	ceetm_cls_get,
-	.put		=	ceetm_cls_put,
+	.find		=	ceetm_cls_search,
 	.change		=	ceetm_cls_change,
 	.delete		=	ceetm_cls_delete,
 	.walk		=	ceetm_cls_walk,
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
@@ -191,7 +191,6 @@ struct wbfs_c {
 
 struct ceetm_class {
 	struct Qdisc_class_common common;
-	int refcnt; /* usage count of this class */
 	struct tcf_proto *filter_list; /* class attached filters */
 	struct tcf_block *block;
 	struct Qdisc *parent;