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
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user