From e8bd92335aee818612b6a4322933f5b7bb907c1e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 30 Jun 2007 02:34:03 +0000 Subject: [PATCH] qos-scripts update: - rewrite the RED qdisc calculations and add some comments this should fix the warnings about bursting (should also fix quirks with various linespeed settings) - reduce the calculated overhead for upstream, while i'm at it... git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7782 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/qos-scripts/Makefile | 2 +- .../qos-scripts/files/usr/lib/qos/generate.sh | 2 +- .../qos-scripts/files/usr/lib/qos/tcrules.awk | 39 ++++++++++++++----- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/package/qos-scripts/Makefile b/package/qos-scripts/Makefile index 676d4dd619..181facd475 100644 --- a/package/qos-scripts/Makefile +++ b/package/qos-scripts/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qos-scripts -PKG_VERSION:=1.1.1 +PKG_VERSION:=1.2.0 PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/qos-scripts/files/usr/lib/qos/generate.sh b/package/qos-scripts/files/usr/lib/qos/generate.sh index 844bd70f9a..a2f7d719c7 100755 --- a/package/qos-scripts/files/usr/lib/qos/generate.sh +++ b/package/qos-scripts/files/usr/lib/qos/generate.sh @@ -261,7 +261,7 @@ start_interface() { for dir in up${halfduplex} ${download:+down}; do case "$dir" in up) - [ "$overhead" = 1 ] && upload=$(($upload * 98 / 100 - (32 * 128 / $upload))) + [ "$overhead" = 1 ] && upload=$(($upload * 98 / 100 - (15 * 128 / $upload))) dev="$device" rate="$upload" dl_mode="" diff --git a/package/qos-scripts/files/usr/lib/qos/tcrules.awk b/package/qos-scripts/files/usr/lib/qos/tcrules.awk index d236b2df93..7bef85b0d0 100644 --- a/package/qos-scripts/files/usr/lib/qos/tcrules.awk +++ b/package/qos-scripts/files/usr/lib/qos/tcrules.awk @@ -77,20 +77,41 @@ END { # leaf qdisc avpkt = 1200 for (i = 1; i <= n; i++) { - ql = int((avgrate[i] + linespeed) * 1024 / (8 * pktsize[i])) printf "tc qdisc add dev "device" parent 1:"class[i]"0 handle "class[i]"00: " + + # RED parameters - also used to determine the queue length for sfq + # calculate min value. for links <= 256 kbit, we use 1500 bytes + # use 50 ms queue length as min threshold for faster links + # max threshold is fixed to 3*min + base_pkt=3000 + base_rate=256 + min_lat=50 + if (maxrate[i] <= base_rate) min = base_pkt + else min = int(maxrate[i] * 1024 / 8 * 0.05) + max = 3 * min + limit = (min + max) * 3 + if (rtm1[i] > 0) { # rt class - use sfq - print "sfq perturb 2 limit " ql + print "sfq perturb 2 limit " limit } else { - # non-rt class - use red - min = int(maxrate[i] * 1024 / 8 * 0.05) - if (min < avpkt) min = avpkt - dqb = 8 * min; - max = int(2.1*min) - rburst = int((2*min + max) / (3 * avpkt)) + # non-rt class - use RED + + avpkt = pktsize[i] + # don't use avpkt values less than 500 bytes + if (avpkt < 500) avpkt = 500 + # if avpkt is too close to min, scale down avpkt to allow proper bursting + if (avpkt > min * 0.70) avpkt *= 0.70 + + + # according to http://www.cs.unc.edu/~jeffay/papers/IEEE-ToN-01.pdf a drop + # probability somewhere between 0.1 and 0.2 should be a good tradeoff + # between link utilization and response time (0.1: response; 0.2: utilization) + prob="0.12" + + rburst=int((2*min + max) / (3 * avpkt)) if (rburst < 2) rburst = 2 - print "red min " min " max " max " burst " rburst " avpkt " avpkt " limit " dqb " probability 0.04 ecn" + print "red min " min " max " max " burst " rburst " avpkt " avpkt " limit " limit " probability " prob " ecn" } }