All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@odin.com>
To: <netdev@vger.kernel.org>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>, <tkhai@ya.ru>
Subject: [PATCH] net_sched: restore "mpu xxx" handling
Date: Wed, 29 Jul 2015 14:24:55 +0300	[thread overview]
Message-ID: <55B8B807.4030102@odin.com> (raw)

commit 56b765b79 ("htb: improved accuracy at high rates")
broke the "mpu xxx" handling.

This patch restores the "mpu xxx" handling for htb:

# tc class add dev eth0 classid 1:2 parent 1: htb rate 1mbit mpu 0
# ping -f -c 1000 10.30.22.52
rtt min/avg/max/mdev = 0.156/1.881/2.454/0.175 ms, ipg/ewma 1.908/1.925 ms

# tc class change dev eth0 classid 1:2 parent 1: htb rate 1mbit mpu 1000
# ping -f -c 1000 10.30.22.52
rtt min/avg/max/mdev = 15.352/22.229/38.646/2.212 ms, pipe 3, ipg/ewma 15.999/22.609 ms

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
CC: Jesper Dangaard Brouer <brouer@redhat.com>
CC: Eric Dumazet <edumazet@google.com>
CC: David S. Miller <davem@davemloft.net>
---
 include/net/sch_generic.h |    1 +
 net/sched/sch_htb.c       |   10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2eab08c..0add26a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -756,6 +756,7 @@ struct psched_ratecfg {
 	u16	overhead;
 	u8	linklayer;
 	u8	shift;
+	u32	mpu;
 };
 
 static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f1acb0f..7b9f283 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -608,6 +608,9 @@ static inline void htb_accnt_tokens(struct htb_class *cl, int bytes, s64 diff)
 {
 	s64 toks = diff + cl->tokens;
 
+	if (bytes < cl->rate.mpu)
+		bytes = cl->rate.mpu;
+
 	if (toks > cl->buffer)
 		toks = cl->buffer;
 	toks -= (s64) psched_l2t_ns(&cl->rate, bytes);
@@ -621,6 +624,9 @@ static inline void htb_accnt_ctokens(struct htb_class *cl, int bytes, s64 diff)
 {
 	s64 toks = diff + cl->ctokens;
 
+	if (bytes < cl->ceil.mpu)
+		bytes = cl->ceil.mpu;
+
 	if (toks > cl->cbuffer)
 		toks = cl->cbuffer;
 	toks -= (s64) psched_l2t_ns(&cl->ceil, bytes);
@@ -1112,8 +1118,10 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
 	memset(&opt, 0, sizeof(opt));
 
 	psched_ratecfg_getrate(&opt.rate, &cl->rate);
+	opt.rate.mpu = cl->rate.mpu;
 	opt.buffer = PSCHED_NS2TICKS(cl->buffer);
 	psched_ratecfg_getrate(&opt.ceil, &cl->ceil);
+	opt.ceil.mpu = cl->ceil.mpu;
 	opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
 	opt.quantum = cl->quantum;
 	opt.prio = cl->prio;
@@ -1484,6 +1492,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
 
 	psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64);
 	psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64);
+	cl->rate.mpu = hopt->rate.mpu;
+	cl->ceil.mpu = hopt->ceil.mpu;
 
 	/* it used to be a nasty bug here, we have to check that node
 	 * is really leaf before changing cl->un.leaf !

             reply	other threads:[~2015-07-29 11:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 11:24 Kirill Tkhai [this message]
2015-07-29 13:04 ` [PATCH] net_sched: restore "mpu xxx" handling Eric Dumazet
2015-07-29 14:39   ` Kirill Tkhai

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=55B8B807.4030102@odin.com \
    --to=ktkhai@odin.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=tkhai@ya.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.