From mboxrd@z Thu Jan 1 00:00:00 1970 From: dE Date: Sun, 12 May 2013 14:15:50 +0000 Subject: pfifo_fast behavior. Message-Id: <518FA146.2070900@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org Hello everyone! I was trying to do some traffic shaping to make http pages more responsive while torrenting. So I decided to modify TOS value of packets to have an affect on the default pfifo_fast qdisc. I've the following iptable rules -- #DNS request iptables -t mangle -A OUTPUT -o eth1 -p udp -m multiport --dports 53 -j TOS --set-tos 0x10 #DNS response iptables -t mangle -A PREROUTING -i eth1 -p udp -m multiport --sports 53 -j TOS --set-tos 0x10 #Incoming torrent connections iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --dports 2000 -j TOS --set-tos 0x2 iptables -t mangle -A PREROUTING -i eth1 -p udp -m multiport --dports 2000,1900,2001 -j TOS --set-tos 0x2 #Mail server iptables -t mangle -A OUTPUT -o eth1 -p tcp -d imap.googlemail.com -m multiport --dports 993 -j TOS --set-tos 0x10 #HTTP(S) iptables -t mangle -A OUTPUT -o eth1 -p tcp -m multiport --dports 80,443 -j TOS --set-tos 0x14 #iptables -t mangle -A OUTPUT -o eth1 -p tcp -m multiport --dports 80,443 -j TOS --set-tos 0x10 iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --sport 80,443 -j TOS --set-tos 0x14 #iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --sport 80,443 -j TOS --set-tos 0x10 There is an improvement, but it's so little that it feels like placebo, making me doubt the above action. So are the actions correct? man tc-prio has a table -- TOS Bits Means Linux Priority Band ------------------------------------------------------------ 0x0 0 Normal Service 0 Best Effort 1 0x2 1 Minimize Monetary Cost 1 Filler 2 0x4 2 Maximize Reliability 0 Best Effort 1 0x6 3 mmc+mr 0 Best Effort 1 0x8 4 Maximize Throughput 2 Bulk 2 0xa 5 mmc+mt 2 Bulk 2 0xc 6 mr+mt 2 Bulk 2 0xe 7 mmc+mr+mt 2 Bulk 2 0x10 8 Minimize Delay 6 Interactive 0 0x12 9 mmc+md 6 Interactive 0 0x14 10 mr+md 6 Interactive 0 0x16 11 mmc+mr+md 6 Interactive 0 0x18 12 mt+md 4 Int. Bulk 1 0x1a 13 mmc+mt+md 4 Int. Bulk 1 0x1c 14 mr+mt+md 4 Int. Bulk 1 0x1e 15 mmc+mr+mt+md 4 Int. Bulk 1 But is there a difference between all TOS values which fall in a single band? I mean, does the behavior of pfifo_fast change if I change from 0x12 to 0x16? Cause I thought the qdisc to be simple, and a different behavior for all of the above TOS values means pfifo_fast does a lot more than just placing packets in 3 different queues. Another question -- how do you get these TOS values? and what does -j TOS --set-tos do? Does it modify the 4 bits or the whole 8 bit TOS value in the header, or does something completely different? I'm running a custom kernel with Gentoo OS.