mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
107 lines
3.3 KiB
Diff
107 lines
3.3 KiB
Diff
|
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;
|