summaryrefslogtreecommitdiffstats
path: root/net/sched/sch_netem.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2016-02-25 23:55:00 +0100
committerDavid S. Miller <davem@davemloft.net>2016-02-29 23:02:33 +0100
commit86a7996cc8a078793670d82ed97d5a99bb4e8496 (patch)
tree8e5d26eb9e58b0c362c66f73baa5261793223178 /net/sched/sch_netem.c
parent3c59x: Ensure to apply the expires time (diff)
downloadlinux-86a7996cc8a078793670d82ed97d5a99bb4e8496.tar.xz
linux-86a7996cc8a078793670d82ed97d5a99bb4e8496.zip
net_sched: introduce qdisc_replace() helper
Remove nearly duplicated code and prepare for the following patch. Cc: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r--net/sched/sch_netem.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 5abd1d9de989..0a6ddaf7f561 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -1037,15 +1037,7 @@ static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
{
struct netem_sched_data *q = qdisc_priv(sch);
- sch_tree_lock(sch);
- *old = q->qdisc;
- q->qdisc = new;
- if (*old) {
- qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
- qdisc_reset(*old);
- }
- sch_tree_unlock(sch);
-
+ *old = qdisc_replace(sch, new, &q->qdisc);
return 0;
}