Skip to content

Commit

Permalink
net_sched: use qdisc_reset() in qdisc_destroy()
Browse files Browse the repository at this point in the history
qdisc_destroy() calls ops->reset() and cleans up qdisc->gso_skb
and qdisc->skb_bad_txq, these are nearly same with qdisc_reset(),
so just call it directly, and cosolidate the code for the next
patch.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Cong Wang authored and David S. Miller committed May 27, 2020
1 parent b3037ac commit 4909dab
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions net/sched/sch_generic.c
Original file line number Diff line number Diff line change
@@ -949,32 +949,22 @@ static void qdisc_free_cb(struct rcu_head *head)
static void qdisc_destroy(struct Qdisc *qdisc)
{
const struct Qdisc_ops *ops = qdisc->ops;
struct sk_buff *skb, *tmp;

#ifdef CONFIG_NET_SCHED
qdisc_hash_del(qdisc);

qdisc_put_stab(rtnl_dereference(qdisc->stab));
#endif
gen_kill_estimator(&qdisc->rate_est);
if (ops->reset)
ops->reset(qdisc);

qdisc_reset(qdisc);

if (ops->destroy)
ops->destroy(qdisc);

module_put(ops->owner);
dev_put(qdisc_dev(qdisc));

skb_queue_walk_safe(&qdisc->gso_skb, skb, tmp) {
__skb_unlink(skb, &qdisc->gso_skb);
kfree_skb_list(skb);
}

skb_queue_walk_safe(&qdisc->skb_bad_txq, skb, tmp) {
__skb_unlink(skb, &qdisc->skb_bad_txq);
kfree_skb_list(skb);
}

call_rcu(&qdisc->rcu, qdisc_free_cb);
}

0 comments on commit 4909dab

Please sign in to comment.