ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0052-sdk_dpaa-ceetm-remove-tc-class-reference-counting.patch
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
5
6 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
7 ---
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(-)
11
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
15                 }
16  
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
23                 }
24  
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
31         }
32  }
33  
34 -static unsigned long ceetm_cls_get(struct Qdisc *sch, u32 classid)
35 +static unsigned long ceetm_cls_search(struct Qdisc *sch, u32 handle)
36  {
37 -       struct ceetm_class *cl;
38 -
39 -       pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
40 -                __func__, classid, sch->handle);
41 -       cl = ceetm_find(classid, sch);
42 -
43 -       if (cl)
44 -               cl->refcnt++; /* Will decrement in put() */
45 -       return (unsigned long)cl;
46 -}
47 -
48 -static void ceetm_cls_put(struct Qdisc *sch, unsigned long arg)
49 -{
50 -       struct ceetm_class *cl = (struct ceetm_class *)arg;
51 -
52 -       pr_debug(KBUILD_BASENAME " : %s : classid %X from qdisc %X\n",
53 -                __func__, cl->common.classid, sch->handle);
54 -       cl->refcnt--;
55 -
56 -       if (cl->refcnt == 0)
57 -               ceetm_cls_destroy(sch, cl);
58 +       return (unsigned long)ceetm_find(handle, sch);
59  }
60  
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;
64  
65         cl->common.classid = classid;
66 -       cl->refcnt = 1;
67         cl->parent = sch;
68         cl->root.child = NULL;
69         cl->root.wbfs_grp_a = false;
70 @@ -1696,15 +1673,9 @@ static int ceetm_cls_delete(struct Qdisc
71  
72         sch_tree_lock(sch);
73         qdisc_class_hash_remove(&priv->clhash, &cl->common);
74 -       cl->refcnt--;
75 -
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.
79 -        */
80 -       WARN_ON(cl->refcnt == 0);
81  
82         sch_tree_unlock(sch);
83 +       ceetm_cls_destroy(sch, cl);
84         return 0;
85  }
86  
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 {
100  
101  struct ceetm_class {
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;