1 From 024d664114310fe103c2c31f2253bed58238951d Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Wed, 17 Jan 2018 16:47:07 +0200
4 Subject: [PATCH] sdk_dpaa: ceetm: remove tc class reference counting
6 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
8 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 38 +++-------------------
9 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 1 -
10 2 files changed, 4 insertions(+), 35 deletions(-)
12 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
13 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
14 @@ -774,7 +774,6 @@ static int ceetm_init_prio(struct Qdisc
17 child_cl->common.classid = TC_H_MAKE(sch->handle, (i + 1));
18 - child_cl->refcnt = 1;
19 child_cl->parent = sch;
20 child_cl->type = CEETM_PRIO;
21 child_cl->shaped = priv->shaped;
22 @@ -986,7 +985,6 @@ static int ceetm_init_wbfs(struct Qdisc
25 child_cl->common.classid = TC_H_MAKE(sch->handle, (i + 1));
26 - child_cl->refcnt = 1;
27 child_cl->parent = sch;
28 child_cl->type = CEETM_WBFS;
29 child_cl->shaped = priv->shaped;
30 @@ -1297,29 +1295,9 @@ static void ceetm_attach(struct Qdisc *s
34 -static unsigned long ceetm_cls_get(struct Qdisc *sch, u32 classid)
35 +static unsigned long ceetm_cls_search(struct Qdisc *sch, u32 handle)
37 - struct ceetm_class *cl;
39 - pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
40 - __func__, classid, sch->handle);
41 - cl = ceetm_find(classid, sch);
44 - cl->refcnt++; /* Will decrement in put() */
45 - return (unsigned long)cl;
48 -static void ceetm_cls_put(struct Qdisc *sch, unsigned long arg)
50 - struct ceetm_class *cl = (struct ceetm_class *)arg;
52 - pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
53 - __func__, cl->common.classid, sch->handle);
56 - if (cl->refcnt == 0)
57 - ceetm_cls_destroy(sch, cl);
58 + return (unsigned long)ceetm_find(handle, sch);
61 static int ceetm_cls_change_root(struct ceetm_class *cl,
62 @@ -1540,7 +1518,6 @@ static int ceetm_cls_change(struct Qdisc
63 cl->root.tbl = copt->tbl;
65 cl->common.classid = classid;
68 cl->root.child = NULL;
69 cl->root.wbfs_grp_a = false;
70 @@ -1696,15 +1673,9 @@ static int ceetm_cls_delete(struct Qdisc
73 qdisc_class_hash_remove(&priv->clhash, &cl->common);
76 - /* The refcnt should be at least 1 since we have incremented it in
77 - * get(). Will decrement again in put() where we will call destroy()
78 - * to actually free the memory if it reaches 0.
80 - WARN_ON(cl->refcnt == 0);
83 + ceetm_cls_destroy(sch, cl);
87 @@ -1824,8 +1795,7 @@ static void ceetm_tcf_unbind(struct Qdis
88 const struct Qdisc_class_ops ceetm_cls_ops = {
89 .graft = ceetm_cls_graft,
90 .leaf = ceetm_cls_leaf,
91 - .get = ceetm_cls_get,
92 - .put = ceetm_cls_put,
93 + .find = ceetm_cls_search,
94 .change = ceetm_cls_change,
95 .delete = ceetm_cls_delete,
96 .walk = ceetm_cls_walk,
97 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
98 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
99 @@ -191,7 +191,6 @@ struct wbfs_c {
102 struct Qdisc_class_common common;
103 - int refcnt; /* usage count of this class */
104 struct tcf_proto *filter_list; /* class attached filters */
105 struct tcf_block *block;
106 struct Qdisc *parent;