netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: netdev@vger.kernel.org
Cc: xiaosuo <xiaosuo@gmail.com>
Subject: [PATCH] HTB updates class's bstats in one place
Date: Wed, 29 Oct 2008 16:54:11 +0800	[thread overview]
Message-ID: <490824B3.20100@gmail.com> (raw)

This patch make HTB update class's bstats in one place when dequeuing
packets instead of updating the leaf's when enqueuing and updating the
other's when dequeuing. It also fixes a statistics bug, the statistics
data of leaf class will exceeds its parent classes's due to packets are
dropped by its inner qdisc.

Signed-off-by: Changli Gao <xiaosuo@gmail.com <mailto:xiaosuo@gmail.com>>
---
sch_htb.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

--- net/sched/sch_htb.c.orig	2008-10-29 16:18:13.000000000 +0800
+++ net/sched/sch_htb.c	2008-10-29 16:19:54.000000000 +0800
@@ -579,9 +579,6 @@
 		}
 		return ret;
 	} else {
-		cl->bstats.packets +=
-			skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
-		cl->bstats.bytes += qdisc_pkt_len(skb);
 		htb_activate(q, cl);
 	}
 
@@ -679,12 +676,10 @@
 				htb_add_to_wait_tree(q, cl, diff);
 		}
 
-		/* update byte stats except for leaves which are already updated */
-		if (cl->level) {
-			cl->bstats.bytes += bytes;
-			cl->bstats.packets += skb_is_gso(skb)?
-					skb_shinfo(skb)->gso_segs:1;
-		}
+		cl->bstats.bytes += bytes;
+		cl->bstats.packets += skb_is_gso(skb)?
+				skb_shinfo(skb)->gso_segs:1;
+
 		cl = cl->parent;
 	}
 }



             reply	other threads:[~2008-10-29  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29  8:54 Changli Gao [this message]
2008-10-29  9:01 ` [PATCH] HTB updates class's bstats in one place Patrick McHardy
2008-10-29  9:09   ` Changli Gao
2008-10-29  9:19     ` Patrick McHardy
2008-10-29 10:23       ` Jarek Poplawski
2008-10-29 10:33         ` Patrick McHardy
2008-10-29 18:22           ` David Miller
2008-10-30  1:03           ` Changli Gao
2008-10-30  7:11             ` Patrick McHardy
2008-10-30  9:11               ` Changli Gao
2008-10-30  9:21                 ` Patrick McHardy

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=490824B3.20100@gmail.com \
    --to=xiaosuo@gmail.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).