netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net] sch_choke: drop all packets in queue during reset
@ 2015-07-21 23:52 Cong Wang
  2015-07-25  5:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2015-07-21 23:52 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/sched/sch_choke.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index 93d5742..6a783af 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -385,6 +385,19 @@ static void choke_reset(struct Qdisc *sch)
 {
 	struct choke_sched_data *q = qdisc_priv(sch);
 
+	while (q->head != q->tail) {
+		struct sk_buff *skb = q->tab[q->head];
+
+		q->head = (q->head + 1) & q->tab_mask;
+		if (!skb)
+			continue;
+		qdisc_qstats_backlog_dec(sch, skb);
+		--sch->q.qlen;
+		qdisc_drop(skb, sch);
+	}
+
+	memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *));
+	q->head = q->tail = 0;
 	red_restart(&q->vars);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch net] sch_choke: drop all packets in queue during reset
  2015-07-21 23:52 [Patch net] sch_choke: drop all packets in queue during reset Cong Wang
@ 2015-07-25  5:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-07-25  5:57 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Tue, 21 Jul 2015 16:52:43 -0700

> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-25  5:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 23:52 [Patch net] sch_choke: drop all packets in queue during reset Cong Wang
2015-07-25  5:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).