aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-21 01:33:27 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-02-21 01:33:27 +0000
commitfca74c3a44ec734916a39e979e8f0286accbe7d0 (patch)
treebd4867ccb249f3ed7a604e4249f07124c05bd7fd /package
parentc0f0316109911b01fff6e4acf82c38bb3d6d4081 (diff)
downloadupstream-fca74c3a44ec734916a39e979e8f0286accbe7d0.tar.gz
upstream-fca74c3a44ec734916a39e979e8f0286accbe7d0.tar.bz2
upstream-fca74c3a44ec734916a39e979e8f0286accbe7d0.zip
qos-scripts: drop the use of IMQ, use ifb and act_connmark instead
SVN-Revision: 25640
Diffstat (limited to 'package')
-rw-r--r--package/qos-scripts/Makefile2
-rwxr-xr-xpackage/qos-scripts/files/usr/bin/qos-stat18
-rwxr-xr-xpackage/qos-scripts/files/usr/bin/qos-stop5
-rwxr-xr-xpackage/qos-scripts/files/usr/lib/qos/generate.sh39
4 files changed, 40 insertions, 24 deletions
diff --git a/package/qos-scripts/Makefile b/package/qos-scripts/Makefile
index c999e7e679..b721765ab0 100644
--- a/package/qos-scripts/Makefile
+++ b/package/qos-scripts/Makefile
@@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/qos-scripts
SECTION:=utils
CATEGORY:=Base system
- DEPENDS:=+tc +kmod-sched +iptables +iptables-mod-filter +iptables-mod-ipopt +iptables-mod-conntrack-extra +iptables-mod-imq
+ DEPENDS:=+tc +kmod-sched +iptables +iptables-mod-filter +iptables-mod-ipopt +iptables-mod-conntrack-extra
TITLE:=QoS scripts
PKGARCH:=all
endef
diff --git a/package/qos-scripts/files/usr/bin/qos-stat b/package/qos-scripts/files/usr/bin/qos-stat
index d7858d7a11..8a39df0847 100755
--- a/package/qos-scripts/files/usr/bin/qos-stat
+++ b/package/qos-scripts/files/usr/bin/qos-stat
@@ -33,26 +33,34 @@ print_comments() {
echo ''
}
+get_device() {
+ ( config_load network; scan_interfaces; config_get "$1" ifname )
+}
+
interface_stats() {
local interface="$1"
local device
- config_get device "$interface" device
+ device="$(get_device "$interface")"
+ [ -z "$device" ] && config_get device "$interface" device
config_get_bool enabled "$interface" enabled 1
[ -z "$device" -o 1 -ne "$enabled" ] && {
return 1
}
- config_get_bool halfduplex "$interface" halfduplex
+ config_get_bool halfduplex "$interface" halfduplex 0
- [ 1 -ne "$halfduplex" ] && {
+ if [ 1 -ne "$halfduplex" ]; then
unset halfduplex
print_comments "$interface" "Egress" "Start"
tc -s class show dev "$device"
print_comments "$interface" "Egress" "End"
- }
+ id="root"
+ else
+ id=""
+ fi
print_comments "$interface" "Ingress${halfduplex:+/Egress}" "Start"
- tc -s class show dev "$(iptables -v -L PREROUTING -t mangle | awk '/IMQ: todev .*$/ && $6 ~ /'$device'/ {print "imq"$12}')"
+ tc -s class show dev "$(tc filter show dev $device $id | grep mirred | sed -e 's,.*\(ifb.*\)).*,\1,')"
print_comments "$interface" "Ingress${halfduplex:+/Egress}" "End"
}
diff --git a/package/qos-scripts/files/usr/bin/qos-stop b/package/qos-scripts/files/usr/bin/qos-stop
index 2275ea12dc..d0243bea13 100755
--- a/package/qos-scripts/files/usr/bin/qos-stop
+++ b/package/qos-scripts/files/usr/bin/qos-stop
@@ -1,6 +1,7 @@
#!/bin/sh
-for iface in $(tc qdisc show | grep hfsc | awk '{print $5}'); do
- tc qdisc del dev "$iface" root
+for iface in $(tc qdisc show | grep -E '(hfsc|ingress)' | awk '{print $5}'); do
+ tc qdisc del dev "$iface" ingress 2>&- >&-
+ tc qdisc del dev "$iface" root 2>&- >&-
done
iptables -t mangle -F
iptables -t mangle -X
diff --git a/package/qos-scripts/files/usr/lib/qos/generate.sh b/package/qos-scripts/files/usr/lib/qos/generate.sh
index 6b5db3d7dc..9bd3b47850 100755
--- a/package/qos-scripts/files/usr/lib/qos/generate.sh
+++ b/package/qos-scripts/files/usr/lib/qos/generate.sh
@@ -210,7 +210,7 @@ config_cb() {
config_get_bool enabled "$CONFIG_SECTION" enabled 1
[ 1 -eq "$enabled" ] || return 0
config_get classgroup "$CONFIG_SECTION" classgroup
- config_set "$CONFIG_SECTION" imqdev "$C"
+ config_set "$CONFIG_SECTION" ifbdev "$C"
C=$(($C+1))
append INTERFACES "$CONFIG_SECTION"
config_set "$classgroup" enabled 1
@@ -274,7 +274,7 @@ tcrules() {
start_interface() {
local iface="$1"
- local num_imq="$2"
+ local num_ifb="$2"
config_get device "$iface" device
config_get_bool enabled "$iface" enabled 1
[ -z "$device" -o 1 -ne "$enabled" ] && {
@@ -298,10 +298,10 @@ start_interface() {
prefix="cls"
;;
down)
- [ "$(ls -d /proc/sys/net/ipv4/conf/imq* 2>&- | wc -l)" -ne "$num_imq" ] && add_insmod imq numdevs="$num_imq"
- config_get imqdev "$iface" imqdev
+ [ "$(ls -d /proc/sys/net/ipv4/conf/ifb* 2>&- | wc -l)" -ne "$num_ifb" ] && add_insmod ifb numifbs="$num_ifb"
+ config_get ifbdev "$iface" ifbdev
[ "$overhead" = 1 ] && download=$(($download * 98 / 100 - (80 * 1024 / $download)))
- dev="imq$imqdev"
+ dev="ifb$ifbdev"
rate="$download"
dl_mode=1
prefix="d_cls"
@@ -326,6 +326,22 @@ tc qdisc del dev $dev root >&- 2>&-
tc qdisc add dev $dev root handle 1: hfsc default ${class_default}0
tc class add dev $dev parent 1: classid 1:1 hfsc sc rate ${rate}kbit ul rate ${rate}kbit"
done
+ [ -n "$download" ] && {
+ add_insmod cls_u32
+ add_insmod em_u32
+ add_insmod act_connmark
+ add_insmod act_mirred
+ add_insmod sch_ingress
+ }
+ if [ -n "$halfduplex" ]; then
+ export dev_up="tc qdisc del dev $device root >&- 2>&-
+tc qdisc add dev $device root handle 1: hfsc
+tc filter add dev $device parent 1: protocol ip prio 10 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb$ifbdev"
+ elif [ -n "$download" ]; then
+ append dev_${dir} "tc qdisc del dev $device ingress >&- 2>&-
+tc qdisc add dev $device ingress
+tc filter add dev $device parent ffff: protocol ip prio 1 u32 match u32 0 0 flowid 1:1 action connmark action mirred egress redirect dev ifb$ifbdev" "$N"
+ fi
add_insmod cls_fw
add_insmod sch_hfsc
add_insmod sch_sfq
@@ -334,7 +350,7 @@ tc class add dev $dev parent 1: classid 1:1 hfsc sc rate ${rate}kbit ul rate ${r
cat <<EOF
${INSMOD:+$INSMOD$N}${dev_up:+$dev_up
$clsq
-}${imqdev:+$dev_down
+}${ifbdev:+$dev_down
$d_clsq
$d_clsl
$d_clsf
@@ -395,22 +411,13 @@ start_cg() {
for iface in $INTERFACES; do
config_get classgroup "$iface" classgroup
config_get device "$iface" device
- config_get imqdev "$iface" imqdev
+ config_get ifbdev "$iface" ifbdev
config_get upload "$iface" upload
config_get download "$iface" download
config_get halfduplex "$iface" halfduplex
download="${download:-${halfduplex:+$upload}}"
- add_insmod ipt_IMQ
append up "iptables -t mangle -A OUTPUT -o $device -j ${cg}" "$N"
append up "iptables -t mangle -A FORWARD -o $device -j ${cg}" "$N"
- [ -z "$download" ] || {
- append down "iptables -t mangle -A POSTROUTING -o $device -j ${cg}" "$N"
- [ -z "$halfduplex" ] || {
- append down "iptables -t mangle -A POSTROUTING -o $device -j IMQ --todev $imqdev" "$N"
- }
- append down "iptables -t mangle -A PREROUTING -i $device -j ${cg}" "$N"
- append down "iptables -t mangle -A PREROUTING -i $device -j IMQ --todev $imqdev" "$N"
- }
done
cat <<EOF
$INSMOD