On Mon, 2007-04-09 at 15:04 -0700, Tom Eastep wrote:
> Donovan Baarda wrote:
>
> >
> > I've now figured it out; a Doh! moment. The difference between nfs reads
> > and writes is one is outgoing traffic, the other is incoming traffic...
> > the problem was the ingress stuff.
>
> I hadn't responded to your post yet in the hope that you would realize that
> ;-)
[...]
Any idea why the shorewall ingress setup for 100mbit in-bandwidth would
hurt so bad?
> > I don't know if anyone is interested in my mods
> > to /usr/share/shorewall/compiler. The "no default" change allows me to
> > set the eth0 device at 512kbit and only classify the ADSL traffic. All
> > unclassified local traffic bypasses the TC stuff and goes a full 100mbit
> > speed.
>
> > The fixes to 1000/1024 mbit/kbit conversions should probably go
> > upstream. The r2q calculation that makes the quantum warning go away is
> > probably only a niceness.
> >
>
> If you want to throw you changes over the fence, I'll take a look at them.
Patch attached. The calculation for r2q is pretty basic... the (kbits /
200) is a compromise to try and get decent quantum values for rates
between 1mbit and 100mbit. This gives quantum ~25,000 for speed "full",
and ~2500 for speeds "full/10". For rates < 1mbit I limit the minimum
r2q to 5 and rely on the fact that the minimum quantum is limited to the
device mtu. You can change the /200 to /400 to give quantum ~50,000 for
"full", and by my calcs you should still stay under the 60,000 max, but
I get the impression that high quantum's are a bad idea.
Note at one stage I had also changed the calculate_quantum() function to
limit the output to 60000. However, this function is not used for the
device root class, so it didn't fix the "quantum warning". With the r2q
calc's you should never exceed 60,000 anyway...
The most useful addition IMHO is the ability to not define a default
class, and have all unclassified traffic bypass TC.
--
Donovan Baarda <[EMAIL PROTECTED]>
http://minkirri.apana.org.au/~abo/
--- compiler.orig 2007-04-08 16:42:47.000000000 +0100
+++ compiler 2007-04-09 23:46:28.000000000 +0100
@@ -1908,8 +1908,7 @@
#
setup_traffic_shaping()
{
- local mtu r2q tc_all_devices device mark rate ceil prio options devfile=$(find_file tcdevices) classfile=$(find_file tcclasses) devnum=1 last_device=
- r2q=10
+ local mtu tc_all_devices device mark rate ceil prio options devfile=$(find_file tcdevices) classfile=$(find_file tcclasses) devnum=1 last_device=
rate_to_kbit() {
local rateunit rate
@@ -1922,25 +1921,31 @@
rate=$rate
;;
mbit|Mbit)
- rate=$(expr $rate \* 1024)
+ rate=$(expr $rate \* 1000)
;;
mbps|Mbps)
- rate=$(expr $rate \* 8192)
+ rate=$(expr $rate \* 8000)
;;
kbps|Kbps)
rate=$(expr $rate \* 8)
;;
*)
[ -n "$rateunit" ] && fatal_error "Invalid Rate ($1)"
- rate=$(expr $rate / 128)
+ rate=$(expr $rate / 125)
;;
esac
echo $rate
}
- calculate_quantum() {
+ calculate_quantum() { # $1 = rate, $2 = r2q
local rate=$(rate_to_kbit $1)
- echo $(( $rate * ( 128 / $r2q ) ))
+ echo $(( $rate * 125 / $2 ))
+ }
+
+ calculate_r2q() {
+ local rate=$(rate_to_kbit $1)
+ local r2q=$(( $rate / 200 ))
+ [ $r2q -le 5 ] && echo 5 || echo $r2q
}
# get given outbandwidth for device
@@ -1986,7 +1991,7 @@
fi
done < $TMP_DIR/tcclasses
- return 1
+ echo 0
}
check_defmark_for_dev() {
@@ -2046,9 +2051,10 @@
}
add_root_tc() {
- local defmark dev indent
+ local r2q defmark dev indent
dev=$(chain_base $device)
+ r2q=$(calculate_r2q $outband)
save_command "if qt ip link ls dev $device; then"
indent="$INDENT"
@@ -2058,8 +2064,9 @@
save_command qt tc qdisc del dev $device ingress
defmark=$(get_defmark_for_dev $device)
+ [ $defmark -ne 0 ] && defmark=1$defmark
- run_tc qdisc add dev $device root handle $devnum: htb default 1$defmark
+ run_tc qdisc add dev $device root handle $devnum: htb default $defmark r2q $r2q
save_command "${dev}_mtu=\$(get_device_mtu $device)"
run_tc "class add dev $device parent $devnum: classid $devnum:1 htb rate $outband mtu \$${dev}_mtu"
@@ -2086,7 +2093,7 @@
}
add_tc_class() {
- local full classid tospair tosmask quantum indent
+ local r2q full classid tospair tosmask quantum indent
dev=$(chain_base $device)
@@ -2095,6 +2102,7 @@
INDENT="$INDENT "
full=$(get_outband_for_dev $device)
+ r2q=$(calculate_r2q $full)
full=$(rate_to_kbit $full)
if [ -z "$prio" ] ; then
@@ -2125,7 +2133,7 @@
[ -n "$devnum" ] || fatal_error "Device $device not defined in $devfile"
- quantum=$(calculate_quantum $rate)
+ quantum=$(calculate_quantum $rate $r2q)
save_command "[ \$${dev}_mtu -gt $quantum ] && quantum=\$${dev}_mtu || quantum=$quantum"
run_tc "class add dev $device parent $devnum:1 classid $classid htb rate $rate ceil $ceil prio $prio mtu \$${dev}_mtu quantum \$quantum"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users