General list for discussing Bufferbloat
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: "Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Mike Frysinger" <vapier@gentoo.org>,
	"Jiri Benc" <jbenc@redhat.com>, "Jiri Pirko" <jpirko@redhat.com>,
	netdev@vger.kernel.org, "Patrick McHardy" <kaber@trash.net>,
	"Steven Barth" <cyrus@openwrt.org>,
	bloat@lists.bufferbloat.net, "David Miller" <davem@redhat.com>,
	"Jussi Kivilinna" <jussi.kivilinna@mbnet.fi>,
	"Felix Fietkau" <nbd@nbd.name>, "Michal Soltys" <soltys@ziu.info>
Subject: Re: [Bloat] tc linklayer ADSL calc broken after commit 56b765b79 (htb: improved accuracy at high rates)
Date: Sun, 02 Jun 2013 14:15:55 -0700	[thread overview]
Message-ID: <1370207755.24311.81.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130529151330.22c5c89e@redhat.com>

On Wed, 2013-05-29 at 15:13 +0200, Jesper Dangaard Brouer wrote:
> I recently discovered that the (traffic control) tc linklayer
> calculations for ATM/ADSL have been broken by:
>  commit 56b765b79 (htb: improved accuracy at high rates).
> 
> Thus, people shaping on ADSL links, using e.g.:
>  tc class add ... htb rate X ceil Y linklayer atm overhead 10
> 

It seems the "overhead 10" was never reported back by 
"tc -s class show dev ... "

Also, the "linklayer atm" changes the data[] part, and this one is not
matched in qdisc_get_rtab()

So two different rate specifications, but sharing same struct
tc_ratespec could be shared... Oh well.

It seems following fix would be needed anyway ?

[PATCH] net_sched: qdisc_get_rtab() must check data[] array

qdisc_get_rtab() should check not only the keys in struct tc_ratespec,
but also the full data[] array.

"tc ... linklayer atm " only perturbs values in the 256 slots array.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/sched/sch_api.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 2b935e7..281c1bd 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -291,17 +291,18 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta
 {
 	struct qdisc_rate_table *rtab;
 
+	if (tab == NULL || r->rate == 0 || r->cell_log == 0 ||
+	    nla_len(tab) != TC_RTAB_SIZE)
+		return NULL;
+
 	for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) {
-		if (memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) == 0) {
+		if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) &&
+		    !memcmp(&rtab->data, nla_data(tab), 1024)) {
 			rtab->refcnt++;
 			return rtab;
 		}
 	}
 
-	if (tab == NULL || r->rate == 0 || r->cell_log == 0 ||
-	    nla_len(tab) != TC_RTAB_SIZE)
-		return NULL;
-
 	rtab = kmalloc(sizeof(*rtab), GFP_KERNEL);
 	if (rtab) {
 		rtab->rate = *r;



  parent reply	other threads:[~2013-06-02 21:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 13:13 Jesper Dangaard Brouer
2013-05-29 15:52 ` Eric Dumazet
2013-05-29 22:50   ` Stephen Hemminger
2013-05-29 23:18     ` Eric Dumazet
2013-05-30  9:15       ` Jesper Dangaard Brouer
2013-05-30  9:52         ` Steinar H. Gunderson
2013-05-30  0:34     ` Dave Taht
2013-05-30  8:09     ` Jesper Dangaard Brouer
2013-05-30  7:51   ` Jesper Dangaard Brouer
2013-05-30 14:39     ` Eric Dumazet
2013-05-30 15:55       ` Jesper Dangaard Brouer
2013-06-02 21:15 ` Eric Dumazet [this message]
2013-06-04 12:13 ` [Bloat] Bad shaping at low rates, " Jesper Dangaard Brouer
2013-06-04 15:18   ` Eric Dumazet
2013-06-04 15:55     ` Eric Dumazet
2013-06-04 16:02       ` Eric Dumazet
2013-06-04 17:11         ` [Bloat] [PATCH] net_sched: htb: do not mix 1ns and 64ns time units Eric Dumazet
2013-06-04 20:21           ` Jesper Dangaard Brouer
2013-06-04 20:26             ` Dave Taht
2013-06-04 21:02               ` Eric Dumazet
2013-06-04 20:50             ` Eric Dumazet
2013-06-05  0:44           ` David Miller
2013-06-06 13:55 ` [Bloat] RFC: Proposed fix for tc linklayer calc broken after commit 56b765b79 (htb: improved accuracy at high rates) Jesper Dangaard Brouer
2013-06-06 14:28   ` Eric Dumazet
2013-05-30  4:20 [Bloat] tc linklayer ADSL " Hagen Paul Pfeifer

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

  List information: https://lists.bufferbloat.net/postorius/lists/bloat.lists.bufferbloat.net/

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

  git send-email \
    --in-reply-to=1370207755.24311.81.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=bloat@lists.bufferbloat.net \
    --cc=brouer@redhat.com \
    --cc=cyrus@openwrt.org \
    --cc=davem@redhat.com \
    --cc=jbenc@redhat.com \
    --cc=jpirko@redhat.com \
    --cc=jussi.kivilinna@mbnet.fi \
    --cc=kaber@trash.net \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=soltys@ziu.info \
    --cc=toke@toke.dk \
    --cc=vapier@gentoo.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