netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pkt_sched: fix bandwidth's accuracy of software device with htb
@ 2013-07-31  2:39 Yang Yingliang
  2013-07-31  3:08 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2013-07-31  2:39 UTC (permalink / raw)
  To: Jamal Hadi Salim, David S. Miller, netdev

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



.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-31  3:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  2:39 [PATCH] pkt_sched: fix bandwidth's accuracy of software device with htb Yang Yingliang
2013-07-31  3:08 ` Eric Dumazet

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).