1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 05:12:29 +02:00

This patch updates qos-scripts to support fair traffic sharing using the

SFQ with external classifiers method.  It also corrects a bug in the 
unsupported ESFQ method already used by qos-scripts.  (ESFQ: 
http://fatooh.org/esfq-2.6/ only updated to 2.6.24, it was switched to 
an SFQ patch after that and not updated since 2008)

A class can be forced to use SFQ, and an external classifier added like 
this:

config class "Normal"
         option avgrate     10
         option priority    30
         option packetdelay 100
         option limitrate   94
#       option qdisc      "sfq perturb 2"
config class "Normal_up"
#       option filter   "protocol all flow hash keys src divisor 1024"
config class "Normal_down"
#       option filter   "protocol all flow hash keys dst divisor 1024"

Using these options, the user needs to load cls_flow before qos-scripts 
starts.

I've got more information here: 
http://oneitguy.com/blogs/netprince/fair-traffic-sharing-esfq-broken-switching-sfqexternal-classifiers

This has been tested on r23914.

Signed-off-by: Ben Pfountz <netprince<>vt_edu>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26622 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2011-04-12 20:33:11 +00:00
parent b518284fa1
commit 691f0d412e
3 changed files with 16 additions and 11 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=qos-scripts PKG_NAME:=qos-scripts
PKG_VERSION:=1.2.1 PKG_VERSION:=1.2.1
PKG_RELEASE:=4 PKG_RELEASE:=5
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View File

@ -315,10 +315,10 @@ start_interface() {
cls_var maxrate "$class" limitrate $dir 100 cls_var maxrate "$class" limitrate $dir 100
cls_var prio "$class" priority $dir 1 cls_var prio "$class" priority $dir 1
cls_var avgrate "$class" avgrate $dir 0 cls_var avgrate "$class" avgrate $dir 0
cls_var qdisc_esfq "$class" qdisc_esfq $dir "" cls_var qdisc "$class" qdisc $dir ""
[ "$qdisc_esfq" != "" ] && add_insmod sch_esfq cls_var filter "$class" filter $dir ""
config_get classnr "$class" classnr config_get classnr "$class" classnr
append cstr "$classnr:$prio:$avgrate:$pktsize:$pktdelay:$maxrate:$qdisc_esfq" "$N" append cstr "$classnr:$prio:$avgrate:$pktsize:$pktdelay:$maxrate:$qdisc:$filter" "$N"
done done
append ${prefix}q "$(tcrules)" "$N" append ${prefix}q "$(tcrules)" "$N"
export dev_${dir}="ifconfig $dev up txqueuelen 5 >&- 2>&- export dev_${dir}="ifconfig $dev up txqueuelen 5 >&- 2>&-

View File

@ -13,7 +13,8 @@ BEGIN {
pktsize[n] = $4 pktsize[n] = $4
delay[n] = $5 delay[n] = $5
maxrate[n] = ($6 * linespeed / 100) maxrate[n] = ($6 * linespeed / 100)
qdisc_esfq[n] = $7 qdisc[n] = $7
filter[n] = $8
} }
END { END {
@ -68,11 +69,7 @@ END {
# main qdisc # main qdisc
for (i = 1; i <= n; i++) { for (i = 1; i <= n; i++) {
printf "tc class add dev "device" parent 1:1 classid 1:"class[i]"0 hfsc" printf "tc class add dev "device" parent 1:1 classid 1:"class[i]"0 hfsc"
if (qdisc_esfq[i] != "") { if (rtm1[i] > 0) {
# user requested esfq
print "esfq " qdisc_esfq[i] " limit " ql
} else if (rtm1[i] > 0) {
# rt class - use sfq
printf " rt m1 " int(rtm1[i]) "kbit d " int(d[i] * 1000) "us m2 " int(rtm2[i])"kbit" printf " rt m1 " int(rtm1[i]) "kbit d " int(d[i] * 1000) "us m2 " int(rtm2[i])"kbit"
} }
printf " ls m1 " int(lsm1[i]) "kbit d " int(d[i] * 1000) "us m2 " int(lsm2[i]) "kbit" printf " ls m1 " int(lsm1[i]) "kbit d " int(d[i] * 1000) "us m2 " int(lsm2[i]) "kbit"
@ -96,7 +93,10 @@ END {
max = 3 * min max = 3 * min
limit = (min + max) * 3 limit = (min + max) * 3
if (rtm1[i] > 0) { if (qdisc[i] != "") {
# user specified qdisc
print qdisc[i] " limit " limit
} else if (rtm1[i] > 0) {
# rt class - use sfq # rt class - use sfq
print "sfq perturb 2 limit " limit print "sfq perturb 2 limit " limit
} else { } else {
@ -123,6 +123,11 @@ END {
# filter rule # filter rule
for (i = 1; i <= n; i++) { for (i = 1; i <= n; i++) {
print "tc filter add dev "device" parent 1: prio "class[i]" protocol ip handle "class[i]" fw flowid 1:"class[i] "0" print "tc filter add dev "device" parent 1: prio "class[i]" protocol ip handle "class[i]" fw flowid 1:"class[i] "0"
filterc=1
if (filter[i] != "") {
print " tc filter add dev "device" parent "class[i]"00: handle "filterc"0 "filter[i]
filterc=filterc+1
}
} }
} }