lixuewei / rt-n56u

Automatically exported from code.google.com/p/rt-n56u
0 stars 0 forks source link

Traffic shaping doesn't work with IPoE #1031

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set WAN connection type to IPoE (automatic)
2. Use tc to add qdisc and class to dev eth2.2 with rate limit

What is the expected output? What do you see instead?
tc -s class show dev eth2.2
shows the wrong rates. During an upload the rate is way too low, and the rate 
limit does not apply.

Also, /sys/class/net/eth2.2/statistics/tx_bytes is wrong.

It seems there are some packet/byte counter bugs in the kernel with VLANs.
Maybe this is related: https://bugzilla.redhat.com/show_bug.cgi?id=579858

What version of the product are you using? On what operating system?
RT-N65U (3.0.94, custom firmware 3.0.3.6-068 with IMQ enabled)

Original issue reported on code.google.com by xno...@gmail.com on 15 Oct 2013 at 4:03

GoogleCodeExporter commented 9 years ago
Some additional details.

Test iptables rule: iptables -t mangle -A POSTROUTING -o eth2.2 -j ACCEPT

After upload of 1 MB over HTTP ifconfig eth2.2 shows an increase of TX bytes: 
over 1000000.
That's OK, but: iptables -nxvL -t mangle shows 9 packets with a total size of 
about 1000 bytes.

Original comment by xno...@gmail.com on 15 Oct 2013 at 7:03

GoogleCodeExporter commented 9 years ago
I have a feeling that internet traffic from other machines on the LAN doesn't 
go through netfilter. Is that possible? Could the switch send traffic directly 
to/from the modem without going through eth2.2?

Original comment by xno...@gmail.com on 16 Oct 2013 at 8:54

GoogleCodeExporter commented 9 years ago
1) iptables -t mangle -A PREROUTING -i eth2.2 -j ACCEPT
2) Download a 20 MB file from the internet from a computer in the LAN.
3) iptables -nxvL -t mangle
shows: 99 packets with a total size of 44781 bytes!

Doing the same but now downloading directly on the router using wget, 3) shows:
over 14000 packets with over 21,500,000 bytes.

Original comment by xno...@gmail.com on 16 Oct 2013 at 11:42

GoogleCodeExporter commented 9 years ago
I found out what caused the problem. 

I had to disable "Hardware offload NAT/Routing IPv4" which was previously set 
to "Offload TCP for LAN".

Please explain why this happens, thank you.

Original comment by xno...@gmail.com on 17 Oct 2013 at 1:00

GoogleCodeExporter commented 9 years ago
This is not BUG!

PPE (HW_NAT) routed IPoE and PPPoE traffic directly between WAN and LAN 
interfaces and this packets not forwarded to CPU (only session related 
packets). 

For software QoS/Shaper environment, you MUST turn off HW_NAT. This is hardware 
feature.

Original comment by andy.pad...@gmail.com on 17 Oct 2013 at 2:07

GoogleCodeExporter commented 9 years ago
So if I understand this right, if the option "Offload TCP for LAN" is set, the 
eth2 routing table entries and S/D-NAT rules will be loaded into some hardware 
chip that will process all TCP packets except for NEW connections (so I guess 
this chip has a conntrack module similar to iptables)?

Can't this chip do its work but still send all packets to the CPU/kernel?

Original comment by xno...@gmail.com on 17 Oct 2013 at 3:55

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/rt-n56u/issues/detail?id=1031#c5

Original comment by Dr.Sydorenko.O on 28 Oct 2013 at 9:15