Skip to contentSkip to conversation

htb overrate with 2.6.16

LARTC Yanko Kaneti 3 participants 14 messages Apr 15, 2006 – Apr 18, 2006

lore
Share & tools
lore
#0 lore raw

Hi

Here is something that worked with with 2.6.10-1.771_FC2smp and stopped working when I upgraded to 2.6.16-1.2069_FC4smp.
These are fedora kernels and the network controller is an Intel Gbit (e1000) running a 100 Mbps Full Duplex.
Don't know how or if this matters but the 2.6.10 kernel has CONFIG_X86_HZ00 and the 2.6.16 has CONFIG_HZ%0

The idea is to just shape to , say 2Mbit, a certain kind of traffic everything else should goes unshaped.

# tc qdisc add dev eth0 root handle 1: htb default 20
# tc class add dev eth0 parent 1: classid 1:2 htb rate 2Mbit
# tc qdisc add dev eth0 parent 1:2 sfq perturb 10
# tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 50 fw flowid 1:2

This was working as expected with 2.6.10
I've tried creating a proper 1:1 100Mbit parent to be the default but it didn't help. And it was working fine without it on 2.6.10

With the 2.6.16 kernel I get results like

# tc -s -d class show dev eth0
class htb 1:2 root leaf 800b: prio 0 quantum 25000 rate 2000Kbit ceil 2000Kbit burst 2600b/8 mpu 0b overhead 0b cburst 2600b/8 mpu 0b overhead 0b level 0
 Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
 rate 3484Kbit 45pps backlog 0b 0p requeues 0
 lended: 20627 borrowed: 0 giants: 30926
 tokens: -9768 ctokens: -9768

As you can see the correctly calculated rate is way above the ceiling and I've seen it go as fast as this certain type of traffic can go (something like 8-10Mbits), i.e. the class doesn't seem to shape at all. No drops or overlimits.

FWIW the cbq in 2.6.10 kernel was working fine as well until the controller changed from a 100Mbit it a Gbit one and thats why I switched to htb. The cbq in 2.6.16 is still similarly broken (in a different than htb way)

Thanks in advance for any insight on this.
Yanko

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#1 lore raw
Quoted 9 lines · Yanko Kaneti

Hi

Here is something that worked with with 2.6.10-1.771_FC2smp and stopped working when I upgraded to 2.6.16-1.2069_FC4smp.
These are fedora kernels and the network controller is an Intel Gbit (e1000) running a 100 Mbps Full Duplex.
Don't know how or if this matters but the 2.6.10 kernel has CONFIG_X86_HZ00 and the 2.6.16 has CONFIG_HZ%0

Quoted 4 lines

The idea is to just shape to , say 2Mbit, a certain kind of traffic everything else should goes unshaped.

# tc qdisc add dev eth0 root handle 1: htb default 20

Why default 20 - if you don't have 1:20 it would be better to use default 0 which is unshaped and is the default - so ommitting default is the same - unclassifed traffic goes through unshaped.

Quoted 8 lines
# tc class add dev eth0 parent 1: classid 1:2 htb rate 2Mbit
# tc qdisc add dev eth0 parent 1:2 sfq perturb 10
# tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 50 fw flowid 1:2

This was working as expected with 2.6.10
I've tried creating a proper 1:1 100Mbit parent to be the default but it didn't help. And it was working fine without it on 2.6.10

Quoted 7 lines

With the 2.6.16 kernel I get results like

# tc -s -d class show dev eth0
class htb 1:2 root leaf 800b: prio 0 quantum 25000 rate 2000Kbit ceil 2000Kbit burst 2600b/8 mpu 0b overhead 0b cburst 2600b/8 mpu 0b overhead 0b level 0
 Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
 rate 3484Kbit 45pps backlog 0b 0p requeues 0
 lended: 20627 borrowed: 0 giants: 30926

The giants are the problem - if you specify mtu XXXXX on 1:2 class it should work.

Or you could consider setting mtu on nic to 1500 if that is practical for you ie. this traffic is headed somewhere that is going to frag it down to 1500 anyway.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#2 lore raw
In reply to Yanko Kaneti
Quoted 10 lines · Andy Furniss
Quoted 9 lines · Yanko Kaneti

Hi

Here is something that worked with with 2.6.10-1.771_FC2smp and stopped working when I upgraded to 2.6.16-1.2069_FC4smp.
These are fedora kernels and the network controller is an Intel Gbit (e1000) running a 100 Mbps Full Duplex.
Don't know how or if this matters but the 2.6.10 kernel has CONFIG_X86_HZ00 and the 2.6.16 has CONFIG_HZ%0

Quoted 8 lines
Quoted 4 lines

The idea is to just shape to , say 2Mbit, a certain kind of traffic everything else should goes unshaped.

# tc qdisc add dev eth0 root handle 1: htb default 20

Why default 20 - if you don't have 1:20 it would be better to use default 0 which is unshaped and is the default - so ommitting default is the same - unclassifed traffic goes through unshaped.

No reason. I obviously missed the explanation for the 0 class. Will omit default in the future.

Quoted 16 lines
Quoted 8 lines
# tc class add dev eth0 parent 1: classid 1:2 htb rate 2Mbit
# tc qdisc add dev eth0 parent 1:2 sfq perturb 10
# tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 50 fw flowid 1:2

This was working as expected with 2.6.10
I've tried creating a proper 1:1 100Mbit parent to be the default but it didn't help. And it was working fine without it on 2.6.10

Quoted 7 lines

With the 2.6.16 kernel I get results like

# tc -s -d class show dev eth0
class htb 1:2 root leaf 800b: prio 0 quantum 25000 rate 2000Kbit ceil 2000Kbit burst 2600b/8 mpu 0b overhead 0b cburst 2600b/8 mpu 0b overhead 0b level 0
 Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
 rate 3484Kbit 45pps backlog 0b 0p requeues 0
 lended: 20627 borrowed: 0 giants: 30926
Quoted 6 lines

The giants are the problem - if you specify mtu XXXXX on 1:2 class it should work.

Or you could consider setting mtu on nic to 1500 if that is practical for you ie. this traffic is headed somewhere that is going to frag it down to 1500 anyway.

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Thanks
Yanko

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#3 lore raw
In reply to Yanko Kaneti
Quoted 4 lines · Yanko Kaneti

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Hmm I didn't expect that - maybe there is some problem with the nic drivers not obeying kernel - is there any tso offload etc. at work here ?

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#4 lore raw
In reply to Yanko Kaneti
Quoted 9 lines · Andy Furniss
Quoted 4 lines · Yanko Kaneti

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Hmm I didn't expect that - maybe there is some problem with the nic drivers not obeying kernel - is there any tso offload etc. at work here ?

Yes and its on by default. The interface mtu still says 1500. I've tried deleting and attaching the qdisc+class (without explicit large mtu) with both tso on (ethtool -K eth0 tso on) and tso off , it doesnt seem to matter - giants appear in both cases.
With large mtu for the class no giants with both tso on and off.

Yanko

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#5 lore raw
In reply to Yanko Kaneti
Quoted 14 lines · Yanko Kaneti
Quoted 10 lines · Andy Furniss
Quoted 4 lines · Yanko Kaneti

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Hmm I didn't expect that - maybe there is some problem with the nic drivers not obeying kernel - is there any tso offload etc. at work here ?

Quoted 9 lines

Yes and its on by default. The interface mtu still says 1500. I've tried deleting and attaching the qdisc+class (without explicit large mtu) with both tso on (ethtool -K eth0 tso on) and tso off , it doesnt seem to matter - giants appear in both cases.
With large mtu for the class no giants with both tso on and off.

Yanko

I think you need to ask fedora or intel driver maintainer about this. AIUI tso is not in vanilla kernels and the patches are quite invasive.

Andy.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#6 lore raw
In reply to Yanko Kaneti
Quoted 22 lines · Andy Furniss
Quoted 14 lines · Yanko Kaneti
Quoted 10 lines · Andy Furniss
Quoted 4 lines · Yanko Kaneti

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Hmm I didn't expect that - maybe there is some problem with the nic drivers not obeying kernel - is there any tso offload etc. at work here ?

Quoted 6 lines

Yes and its on by default. The interface mtu still says 1500. I've tried deleting and attaching the qdisc+class (without explicit large mtu) with both tso on (ethtool -K eth0 tso on) and tso off , it doesnt seem to matter - giants appear in both cases.
With large mtu for the class no giants with both tso on and off.

Quoted 2 lines

I think you need to ask fedora or intel driver maintainer about this. AIUI tso is not in vanilla kernels and the patches are quite invasive.

Well, as much as google tells me TSO has been in the kernel and enabled since 2.5.33 and e1000 was the first driver to support it. The FC4 2.6.16 kernel doesn't have any tso related patches as can be seen here http://cvs.fedora.redhat.com/viewcvs/rpms/kernel/FC-4/

Since my immediate problem was solved with the mtu param I plan on forgetting about htb and traffic control in general for the time being :) Thanks again.

Cheers
Yanko

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#7 lore raw
In reply to Yanko Kaneti
Quoted 8 lines · Yanko Kaneti
Quoted 2 lines

I think you need to ask fedora or intel driver maintainer about this. AIUI tso is not in vanilla kernels and the patches are quite invasive.

Well, as much as google tells me TSO has been in the kernel and enabled since 2.5.33 and e1000 was the first driver to support it. The FC4 2.6.16 kernel doesn't have any tso related patches as can be seen here http://cvs.fedora.redhat.com/viewcvs/rpms/kernel/FC-4/

Ahh OK I must have been thinking of another card.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#8 lore raw
In reply to Yanko Kaneti
Quoted 31 lines · Yanko Kaneti
Quoted 25 lines · Andy Furniss
Quoted 16 lines · Yanko Kaneti
Quoted 11 lines · Andy Furniss
Quoted 4 lines · Yanko Kaneti

Setting mtu 16500 for the class fixed it. But I wonder where did these giants come from in the first place? The mtu of the interface is and was 1500. Or so ifconfig and ip link tell me. Or this is some other mtu we are talking about...

Hmm I didn't expect that - maybe there is some problem with the nic drivers not obeying kernel - is there any tso offload etc. at work here ?

Quoted 6 lines

Yes and its on by default. The interface mtu still says 1500. I've tried deleting and attaching the qdisc+class (without explicit large mtu) with both tso on (ethtool -K eth0 tso on) and tso off , it doesnt seem to matter - giants appear in both cases.
With large mtu for the class no giants with both tso on and off.

Quoted 2 lines

I think you need to ask fedora or intel driver maintainer about this. AIUI tso is not in vanilla kernels and the patches are quite invasive.

Quoted 8 lines

Well, as much as google tells me TSO has been in the kernel and enabled since 2.5.33 and e1000 was the first driver to support it. The FC4 2.6.16 kernel doesn't have any tso related patches as can be seen here http://cvs.fedora.redhat.com/viewcvs/rpms/kernel/FC-4/

Since my immediate problem was solved with the mtu param I plan on forgetting about htb and traffic control in general for the time being :) Thanks again.

One more thing I just thought - sfq sets its quantum from the dev mtu.

While I always thought that the "must be >=mtu" comment in the source was a bit OTT, it still "should" be >= mtu for the drr to be 0(1) for cpu work.

You can set it explicitly by adding quantum=X on the sfq line.

For ethernet X is mtu + 14.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#9 lore raw
In reply to Yanko Kaneti
Quoted 11 lines · Andy Furniss
Quoted 8 lines

Well, as much as google tells me TSO has been in the kernel and enabled since 2.5.33 and e1000 was the first driver to support it. The FC4 2.6.16 kernel doesn't have any tso related patches as can be seen here http://cvs.fedora.redhat.com/viewcvs/rpms/kernel/FC-4/

Since my immediate problem was solved with the mtu param I plan on forgetting about htb and traffic control in general for the time being :) Thanks again.

One more thing I just thought - sfq sets its quantum from the dev mtu.

One more possibility: current kernels support UDP fragmentation offload (UFO), which has similar effects as TSO. The in-tree e1000 driver doesn't support it, but maybe the fedora one does.

Changes in the fragmentation behaviour of conntrack in 2.6.16 could also be responsible (if you're using it). Can you please post your NAT and marking rules, routing rules etc?
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#10 lore raw
In reply to Yanko Kaneti
Quoted 6 lines · Patrick McHardy
Quoted 5 lines · Andy Furniss
Quoted 5 lines

Well, as much as google tells me TSO has been in the kernel and enabled since 2.5.33 and e1000 was the first driver to support it. The FC4 2.6.16 kernel doesn't have any tso related patches as can be seen here http://cvs.fedora.redhat.com/viewcvs/rpms/kernel/FC-4/

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Since my immediate problem was solved with the mtu param I plan on forgetting about htb and traffic control in general for the time being :) Thanks again.

One more thing I just thought - sfq sets its quantum from the dev mtu.

Riiight. I should have tried without the sfq earlier. Without it this works as expected without explicit mtu setting for the htb class. And no giants.

# tc qdisc add dev eth0 root handle 1: htb
# tc class add dev eth0 parent 1: classid 1:2 htb rate 2Mbit
# tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 50 fw flowid 1:2
Quoted 3 lines

One more possibility: current kernels support UDP fragmentation offload (UFO), which has similar effects as TSO. The in-tree e1000 driver doesn't support it, but maybe the fedora one does.

No mention of ufo or e1000 in any of the patches that can be found in the url above.

Quoted 3 lines

Changes in the fragmentation behaviour of conntrack in 2.6.16 could also be responsible (if you're using it). Can you please post your NAT and marking rules, routing rules etc?

Here are the "interesting" rules where the packets in question pass. Have no rules other than the ones in the mangle table

mangle
OUTPUT

    -m owner --uid-owner shaped -j userchain
  userchain
    ....
    -m length --length 512:65535 -j MARK --set-mark 0x32   -> the fw filter

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#11 lore raw
In reply to Yanko Kaneti
Quoted 10 lines · Yanko Kaneti
Quoted 1 line
Quoted 1 line

One more thing I just thought - sfq sets its quantum from the dev mtu.

Riiight. I should have tried without the sfq earlier. Without it this works as expected without explicit mtu setting for the htb class. And no giants.

# tc qdisc add dev eth0 root handle 1: htb
# tc class add dev eth0 parent 1: classid 1:2 htb rate 2Mbit
# tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 50 fw flowid 1:2

I wouldn't have expected that to make any difference to the giants.

Looking again at your stats -

Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
rate 3484Kbit 45pps backlog 0b 0p requeues 0
lended: 20627 borrowed: 0 giants: 30926
tokens: -9768 ctokens: -9768

The giants count is higher than the packet count so now I am really confused.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#12 lore raw
In reply to Yanko Kaneti
Quoted 9 lines · Andy Furniss

Looking again at your stats -

Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
rate 3484Kbit 45pps backlog 0b 0p requeues 0
lended: 20627 borrowed: 0 giants: 30926
tokens: -9768 ctokens: -9768

The giants count is higher than the packet count so now I am really confused.

Doh - I suppose thats just the way HTB counts so you add them together.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#13 lore raw
In reply to Yanko Kaneti
Quoted 9 lines · Andy Furniss
Quoted 7 lines · Andy Furniss

Looking again at your stats -

Sent 189796883 bytes 20626 pkt (dropped 0, overlimits 0 requeues 0)
rate 3484Kbit 45pps backlog 0b 0p requeues 0
lended: 20627 borrowed: 0 giants: 30926
tokens: -9768 ctokens: -9768

Quoted 5 lines
Quoted 2 lines

The giants count is higher than the packet count so now I am really confused.

Doh - I suppose thats just the way HTB counts so you add them together.

LOL - Third try, testing on lo which is confusing and maybe misleading but it looks like the giants count gets doubled up but the packet count doesn't.

Andy.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc