aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2016-02-25 17:55:00 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-29 17:02:33 -0500
commit86a7996cc8a078793670d82ed97d5a99bb4e8496 (patch)
tree8e5d26eb9e58b0c362c66f73baa5261793223178 /include/net/sch_generic.h
parentf12d33f4d83c6837d176e1aef337914089c77957 (diff)
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 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 636a362a0e03..8fdad9f7a2fb 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -707,6 +707,23 @@ static inline void qdisc_reset_queue(struct Qdisc *sch)
707 sch->qstats.backlog = 0; 707 sch->qstats.backlog = 0;
708} 708}
709 709
710static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
711 struct Qdisc **pold)
712{
713 struct Qdisc *old;
714
715 sch_tree_lock(sch);
716 old = *pold;
717 *pold = new;
718 if (old != NULL) {
719 qdisc_tree_decrease_qlen(old, old->q.qlen);
720 qdisc_reset(old);
721 }
722 sch_tree_unlock(sch);
723
724 return old;
725}
726
710static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, 727static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
711 struct sk_buff_head *list) 728 struct sk_buff_head *list)
712{ 729{