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>
This commit is contained in:

committed by
David S. Miller

parent
f12d33f4d8
commit
86a7996cc8
@@ -1163,14 +1163,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
|
||||
cl->common.classid)) == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
sch_tree_lock(sch);
|
||||
*old = cl->un.leaf.q;
|
||||
cl->un.leaf.q = new;
|
||||
if (*old != NULL) {
|
||||
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
|
||||
qdisc_reset(*old);
|
||||
}
|
||||
sch_tree_unlock(sch);
|
||||
*old = qdisc_replace(sch, new, &cl->un.leaf.q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user