netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
	"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: [PATCH] pkt_sched: fix bandwidth's accuracy of software device with htb
Date: Wed, 31 Jul 2013 10:39:34 +0800	[thread overview]
Message-ID: <51F878E6.1070806@huawei.com> (raw)

When we set bandwidth on the software devices with htb,
it's not precise.

With htb, sch->limit is set from devices TX queue's
length that is not 0. Because software devices TX
queue is 0, sch->limit is set to default value 1.

Because the length of skb_buff queue is bigger than
sch->limit whose value is 1, some packets are dropped.
This leads to software devices can't make full use of
the bandwidth and influence the accuracy.

To fix this issue, set the default value of sch->limit
to 1000 that is the value of eth device's tx_queueu_len.

Example:
tc qdisc add dev bond0 root handle 1: htb default 1
tc class add dev bond0 parent 1:0 classid 1:1 htb rate 1Gbit ceil 1Gbit
iperf -c host -t 30 -i 10

With old sch->limit:
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   579 MBytes   486 Mbits/sec
[  3] 10.0-20.0 sec   604 MBytes   507 Mbits/sec
[  3] 20.0-30.0 sec   551 MBytes   462 Mbits/sec
[  3]  0.0-30.0 sec  1.69 GBytes   485 Mbits/sec

With new sch->limit:
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.11 GBytes   955 Mbits/sec
[  3] 10.0-20.0 sec  1.11 GBytes   955 Mbits/sec
[  3] 20.0-30.0 sec  1.11 GBytes   955 Mbits/sec
[  3]  0.0-30.0 sec  3.33 GBytes   955 Mbits/sec

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 net/sched/sch_fifo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index e15a9eb..8dd27ec 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -54,7 +54,7 @@ static int fifo_init(struct Qdisc *sch, struct nlattr *opt)
 	bool is_bfifo = sch->ops == &bfifo_qdisc_ops;
 
 	if (opt == NULL) {
-		u32 limit = qdisc_dev(sch)->tx_queue_len ? : 1;
+		u32 limit = qdisc_dev(sch)->tx_queue_len ? : 1000;
 
 		if (is_bfifo)
 			limit *= psched_mtu(qdisc_dev(sch));
-- 
1.7.12



.

             reply	other threads:[~2013-07-31  2:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31  2:39 Yang Yingliang [this message]
2013-07-31  3:08 ` [PATCH] pkt_sched: fix bandwidth's accuracy of software device with htb Eric Dumazet

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=51F878E6.1070806@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=davem@davemloft.net \
    --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).