netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ward <david.ward@ll.mit.edu>
To: <netdev@vger.kernel.org>
Cc: Bruce Osler <brosler@cisco.com>, Cyril Chemparathy <cyril@ti.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	David Ward <david.ward@ll.mit.edu>
Subject: [PATCH 4/4] net_sched: gred: actually perform idling in WRED mode
Date: Thu, 13 Sep 2012 11:22:35 -0400	[thread overview]
Message-ID: <1347549755-19438-4-git-send-email-david.ward@ll.mit.edu> (raw)
In-Reply-To: <1347549755-19438-1-git-send-email-david.ward@ll.mit.edu>

gred_dequeue() and gred_drop() do not seem to get called when the
queue is empty, meaning that we never start idling while in WRED
mode. And since qidlestart is not stored by gred_store_wred_set(),
we would never stop idling while in WRED mode if we ever started.
This messes up the average queue size calculation that influences
packet marking/dropping behavior.

Now, we start WRED mode idling as we are removing the last packet
from the queue. Also we now actually stop WRED mode idling when we
are enqueuing a packet.

Cc: Bruce Osler <brosler@cisco.com>
Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 net/sched/sch_gred.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index b2570b5..d42234c 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -136,6 +136,7 @@ static inline void gred_store_wred_set(struct gred_sched *table,
 				       struct gred_sched_data *q)
 {
 	table->wred_set.qavg = q->vars.qavg;
+	table->wred_set.qidlestart = q->vars.qidlestart;
 }
 
 static inline int gred_use_ecn(struct gred_sched *t)
@@ -259,16 +260,18 @@ static struct sk_buff *gred_dequeue(struct Qdisc *sch)
 		} else {
 			q->backlog -= qdisc_pkt_len(skb);
 
-			if (!q->backlog && !gred_wred_mode(t))
-				red_start_of_idle_period(&q->vars);
+			if (gred_wred_mode(t)) {
+				if (!sch->qstats.backlog)
+					red_start_of_idle_period(&t->wred_set);
+			} else {
+				if (!q->backlog)
+					red_start_of_idle_period(&q->vars);
+			}
 		}
 
 		return skb;
 	}
 
-	if (gred_wred_mode(t) && !red_is_idling(&t->wred_set))
-		red_start_of_idle_period(&t->wred_set);
-
 	return NULL;
 }
 
@@ -290,19 +293,20 @@ static unsigned int gred_drop(struct Qdisc *sch)
 			q->backlog -= len;
 			q->stats.other++;
 
-			if (!q->backlog && !gred_wred_mode(t))
-				red_start_of_idle_period(&q->vars);
+			if (gred_wred_mode(t)) {
+				if (!sch->qstats.backlog)
+					red_start_of_idle_period(&t->wred_set);
+			} else {
+				if (!q->backlog)
+					red_start_of_idle_period(&q->vars);
+			}
 		}
 
 		qdisc_drop(skb, sch);
 		return len;
 	}
 
-	if (gred_wred_mode(t) && !red_is_idling(&t->wred_set))
-		red_start_of_idle_period(&t->wred_set);
-
 	return 0;
-
 }
 
 static void gred_reset(struct Qdisc *sch)
-- 
1.7.4.1

  parent reply	other threads:[~2012-09-13 15:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 15:22 [PATCH 1/4] net_sched: gred: correct comment about qavg calculation in RIO mode David Ward
2012-09-13 15:22 ` [PATCH 2/4] net_sched: gred: eliminate redundant DP prio comparisons David Ward
2012-09-13 18:00   ` Jamal Hadi Salim
2012-09-13 20:10     ` David Miller
2012-09-13 15:22 ` [PATCH 3/4] net_sched: gred: fix qave reporting via netlink David Ward
2012-09-13 18:01   ` Jamal Hadi Salim
2012-09-13 20:10     ` David Miller
2012-09-13 15:22 ` David Ward [this message]
2012-09-13 18:08   ` [PATCH 4/4] net_sched: gred: actually perform idling in WRED mode Jamal Hadi Salim
2012-09-13 19:38     ` Ward, David - 0663 - MITLL
2012-09-13 20:10       ` David Miller
2012-09-13 20:37       ` Jamal Hadi Salim
2012-09-13 17:59 ` [PATCH 1/4] net_sched: gred: correct comment about qavg calculation in RIO mode Jamal Hadi Salim
2012-09-13 20:10   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347549755-19438-4-git-send-email-david.ward@ll.mit.edu \
    --to=david.ward@ll.mit.edu \
    --cc=brosler@cisco.com \
    --cc=cyril@ti.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).