From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 8FF503B2A3 for ; Fri, 17 Mar 2017 17:15:05 -0400 (EDT) Received: by mail-pf0-x230.google.com with SMTP id o126so42471385pfb.3 for ; Fri, 17 Mar 2017 14:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=5GSog0GduVhchDYd3kJnOJGTMNSvzyf95zqCQrfffiw=; b=FJGHY/UjwoeEOnNji7FnmRSqLH4bDBaEqLTspKpPS3ULXXvI8USWxeswdZ84836mL5 SPKEmTqjQmmFrU7q9GFefzETD9/QspLZjdh7pAf9S1AR3jgDPg/P58iAlU16D+pflfAl 80Y3/OGHW9f/sUenuX7Hj2kYcoLAJp27pxbOIih9G6TzgVUTV6pbbBN7+npF3NA9FO90 f01bZD2j7MIK5xLakcXYjO2ISa5bcpZfiQ/zbp/dWRyW0CpM+IruuuK6U908pCTpoFts 0ZQ0bvrOM8OBa/LvlYsDN/Ztd/sXQ7S3tRj8bJBo19RNGjL0LnJfUTqB+FuOHE3Cdjlb zZ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=5GSog0GduVhchDYd3kJnOJGTMNSvzyf95zqCQrfffiw=; b=O7Ns8gO1Hji2wid23xReSx2GyBIOQWm5qljcE5XupK3NfW8hFLP+IQprKDVHLX8AAK yylsCdhvnrIY+XfdRHE759wLIvpB68d1QGAgvlWFYtx7wXB9lvnR4EECsN2uFzq9tXzJ dF1x+PVstv7IAx1V4pCz7mBKc7bf4WFg8nhX8hclnDjFYxdwiRUzST+4nbRTyoI6jmih 9Zm1NXKVWy/VY+zeWN6Qak5ejp9pbSn7ZZ08Wi9Ar34v+hhO3WZMIHQyvvupWZMI4mSn 8WbbGZRwhc4ozV36aYwzOowPfAEPE2PZ9GMzyVH94ESwCm+uFEk0LYYDqETTqY9Gfvkx 2Q4g== X-Gm-Message-State: AFeK/H356yZaYNvteByIcUNcyzT57xFJJKYASik9MOHH8bt6ARJAmMMgHRDWA0AA8KnAqw== X-Received: by 10.99.156.2 with SMTP id f2mr18752663pge.189.1489785304729; Fri, 17 Mar 2017 14:15:04 -0700 (PDT) Received: from ?IPv6:2620:0:1000:1704:9c83:e4d8:150c:3d17? ([2620:0:1000:1704:9c83:e4d8:150c:3d17]) by smtp.googlemail.com with ESMTPSA id x21sm18541806pfa.71.2017.03.17.14.15.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2017 14:15:03 -0700 (PDT) Message-ID: <1489785303.28631.318.camel@edumazet-glaptop3.roam.corp.google.com> From: Eric Dumazet To: xnor Cc: bloat@lists.bufferbloat.net Date: Fri, 17 Mar 2017 14:15:03 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Bloat] Inaccurate rates with HTB/HFSC+fq_codel on router due to VLAN? X-BeenThere: bloat@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: General list for discussing Bufferbloat List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Mar 2017 21:15:05 -0000 On Thu, 2017-03-16 at 22:14 +0000, xnor wrote: > Hello, > > I have a tl-wdr3600 router with openwrt (linux 3.18, config at [1]) and > want to shape ingress traffic. > > The WAN port, interface eth0.2, is connected to a cable modem. > I use the following script: > > tc qdisc add dev eth0.2 handle ffff: ingress > ifconfig ifb0 up txqueuelen 1000 > tc qdisc add dev ifb0 root handle 1: htb default 10 > tc class add dev ifb0 parent 1: classid 1:1 htb rate 18000kbit > tc class add dev ifb0 parent 1:1 classid 1:10 htb rate 18000kbit ceil > 18000kbit > tc filter add dev eth0.2 parent ffff: protocol all prio 1 u32 match u32 > 0 0 action mirred egress redirect dev ifb0 > tc qdisc add dev ifb0 parent 1:10 handle 100: fq_codel limit 1000 > quantum 1514 noecn > > Now the problem is that it is very inaccurate, and this inaccuracy > increases with number of TCP download connections. > With HTB (it's worse with HFSC) and 20 connections (rates calculated > with /sys/class/net/eth0.2/statistics/rx_bytes over 5 seconds each): > 19012.610 kbit > 19266.877 kbit > 19303.923 kbit Sure, but you shape on ifb0, so the rate you observe on the ingress interface is before any rate limit... This could be 77.77 Mbit, and the tc scripts have no say about that. > > With a single connection and HTB, I only get about 17.2 Mbit. Curiously, > /sys/class/net/ifb0/statistics show about 18.1 +/- 0.1 Mbit > > So I did a tcpdump of eth0.2 and ifb0: > eth0.2's largest frames are 1514 bytes ethernet type IP. > ifb0's are 1518 bytes (including the VLAN tag I guess) with some unknown > type. > > > What do I need to change to make shaping with ifb accurate? Ideally with > both HTB and HFSC. > Have you checked your syslog ? It seems you would need 'quantum 8000' or something like that. tc class add dev ifb0 parent 1: classid 1:1 htb rate 18000kbit \ quantum 8000 tc class add dev ifb0 parent 1:1 classid 1:10 htb rate 18000kbit \ ceil 18000kbit quantum 8000