Quellcode durchsuchen

sqm-scripts/luci-app-sqm: Merge upstream changes.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Toke Høiland-Jørgensen vor 9 Jahren
Ursprung
Commit
49b5c10def

+ 1
- 1
net/luci-app-sqm/Makefile Datei anzeigen

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=luci-app-sqm
11 11
 PKG_VERSION:=3
12
-PKG_RELEASE:=2
12
+PKG_RELEASE:=5
13 13
 PKG_LICENSE:=GPLv2
14 14
 LUCI_DIR:=/usr/lib/lua/luci
15 15
 

+ 27
- 4
net/luci-app-sqm/files/sqm-cbi.lua Datei anzeigen

@@ -36,9 +36,30 @@ s.addremove = true -- set to true to allow adding SQM instances in the GUI
36 36
 s.anonymous = true
37 37
 
38 38
 -- BASIC
39
-e = s:taboption("tab_basic", Flag, "enabled", translate("Enable"))
39
+e = s:taboption("tab_basic", Flag, "enabled", translate("Enable this SQM instance."))
40 40
 e.rmempty = false
41 41
 
42
+-- sm: following jow's advise, be helpful to the user and enable
43
+--     sqm's init script if even a single sm instance/interface
44
+--     is enabled; this is unexpected in that the init script gets
45
+--     enabled as soon as at least one sqm instance is enabled
46
+--     and that state is saved, so it does not require "Save & Apply"
47
+--     to effect the init scripts.
48
+--     the implementation was inpired/lifted from 
49
+--     https://github.com/openwrt/luci/blob/master/applications/luci-app-minidlna/luasrc/model/cbi/minidlna.lua
50
+function e.write(self, section, value)
51
+    if value == "1" then
52
+	luci.sys.init.enable("sqm")
53
+	m.message = translate("The SQM GUI has just enabled the sqm initscript on your behalf. Remember to disable the sqm initscript manually under System Startup menu in case this change was not wished for.")
54
+--	luci.sys.call("/etc/init.d/sqm start >/dev/null")
55
+--    else
56
+--	luci.sys.call("/etc/init.d/sqm stop >/dev/null")
57
+--	luci.sys.init.disable("sqm")
58
+    end
59
+    return Flag.write(self, section, value)
60
+end
61
+-- TODO: inform the user what we just did...
62
+
42 63
 n = s:taboption("tab_basic", ListValue, "interface", translate("Interface name"))
43 64
 -- sm lifted from luci-app-wol, the original implementation failed to show pppoe-ge00 type interface names
44 65
 for _, iface in ipairs(ifaces) do
@@ -71,6 +92,7 @@ c:value("codel")
71 92
 c:value("ns2_codel")
72 93
 c:value("pie")
73 94
 c:value("sfq")
95
+c:value("cake")
74 96
 c.default = "fq_codel"
75 97
 c.rmempty = false
76 98
 
@@ -89,7 +111,7 @@ sc.default = "simple.qos"
89 111
 sc.rmempty = false
90 112
 sc.description = qos_desc
91 113
 
92
-ad = s:taboption("tab_qdisc", Flag, "qdisc_advanced", translate("Show and Use Advanced Configuration"))
114
+ad = s:taboption("tab_qdisc", Flag, "qdisc_advanced", translate("Show and Use Advanced Configuration. Advanced options will only be used as long as this box is checked."))
93 115
 ad.default = false
94 116
 ad.rmempty = true
95 117
 
@@ -121,7 +143,7 @@ eecn.default = "NOECN"
121 143
 eecn.rmempty = true
122 144
 eecn:depends("qdisc_advanced", "1")
123 145
 
124
-ad2 = s:taboption("tab_qdisc", Flag, "qdisc_really_really_advanced", translate("Show and Use Dangerous Configuration"))
146
+ad2 = s:taboption("tab_qdisc", Flag, "qdisc_really_really_advanced", translate("Show and Use Dangerous Configuration. Dangerous options will only be used as long as this box is checked."))
125 147
 ad2.default = false
126 148
 ad2.rmempty = true
127 149
 ad2:depends("qdisc_advanced", "1")
@@ -178,7 +200,7 @@ po:depends("linklayer", "ethernet")
178 200
 po:depends("linklayer", "atm")
179 201
 
180 202
 
181
-adll = s:taboption("tab_linklayer", Flag, "linklayer_advanced", translate("Show Advanced Linklayer Options, (only needed if MTU > 1500)"))
203
+adll = s:taboption("tab_linklayer", Flag, "linklayer_advanced", translate("Show Advanced Linklayer Options, (only needed if MTU > 1500). Advanced options will only be used as long as this box is checked."))
182 204
 adll.rmempty = true
183 205
 adll:depends("linklayer", "ethernet")
184 206
 -- adll:depends("linklayer", "adsl")
@@ -206,6 +228,7 @@ smpu.rmempty = true
206 228
 smpu:depends("linklayer_advanced", "1")
207 229
 
208 230
 lla = s:taboption("tab_linklayer", ListValue, "linklayer_adaptation_mechanism", translate("Which linklayer adaptation mechanism to use; for testing only"))
231
+lla:value("cake")
209 232
 lla:value("htb_private")
210 233
 lla:value("tc_stab", "tc_stab ("..translate("default")..")")
211 234
 lla.default = "tc_stab"

+ 1
- 1
net/sqm-scripts/Makefile Datei anzeigen

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=sqm-scripts
11 11
 PKG_VERSION:=8
12
-PKG_RELEASE:=4
12
+PKG_RELEASE:=7
13 13
 PKG_LICENSE:=GPLv2
14 14
 
15 15
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

+ 1
- 1
net/sqm-scripts/files/etc/config/sqm Datei anzeigen

@@ -8,7 +8,7 @@ config queue 'eth1'
8 8
         option script 'simple.qos'
9 9
         option qdisc_advanced '0'
10 10
         option ingress_ecn 'ECN'
11
-        option egress_ecn 'NOECN'
11
+        option egress_ecn 'ECN'
12 12
         option qdisc_really_really_advanced '0'
13 13
         option itarget 'auto'
14 14
         option etarget 'auto'

+ 18
- 1
net/sqm-scripts/files/usr/lib/sqm/functions.sh Datei anzeigen

@@ -6,7 +6,7 @@
6 6
 
7 7
 #improve the logread output
8 8
 sqm_logger() {
9
-    logger -t SQM -s ${1}
9
+    logger -t SQM -s "${1}"
10 10
 }
11 11
 
12 12
 insmod() {
@@ -139,6 +139,23 @@ get_stab_string() {
139 139
 	echo ${STABSTRING}
140 140
 }
141 141
 
142
+#sm: cake knows how to handle ATM and per packet overhead, so expose and use this...
143
+get_cake_lla_string() {
144
+	STABSTRING=""
145
+	if [ "${LLAM}" = "cake" -a "${LINKLAYER}" != "none" ]; 
146
+	then
147
+		if [ "${LINKLAYER}" = "atm" ];
148
+		then
149
+		    STABSTRING="atm"
150
+		fi
151
+		
152
+		STABSTRING="${STABSTRING} overhead ${OVERHEAD}"
153
+		sqm_logger "cake link layer adjustments: ${STABSTRING}"
154
+	fi
155
+	echo ${STABSTRING}
156
+}
157
+
158
+
142 159
 sqm_stop() {
143 160
 	$TC qdisc del dev $IFACE ingress
144 161
 	$TC qdisc del dev $IFACE root

+ 91
- 64
net/sqm-scripts/files/usr/lib/sqm/simple.qos Datei anzeigen

@@ -7,7 +7,7 @@
7 7
 # it under the terms of the GNU General Public License version 2 as
8 8
 # published by the Free Software Foundation.
9 9
 #
10
-#       Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
10
+#       Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
11 11
 
12 12
 # Compared to the complexity that debloat had become
13 13
 # this cleanly shows a means of going from diffserv marking
@@ -25,13 +25,20 @@ ipt_setup() {
25 25
 
26 26
 ipt -t mangle -N QOS_MARK_${IFACE}
27 27
 
28
-ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING}
29
-# You can go further with classification but...
30
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS1 -j MARK --set-mark 0x3${IPT_MASK_STRING}
31
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS6 -j MARK --set-mark 0x1${IPT_MASK_STRING}
32
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING}
33
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING}
34
-ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING}
28
+case $QDISC in
29
+	cake*) 
30
+	    sqm_logger cake does all the diffserv work - no need for iptables rules 
31
+	    ;;
32
+	*) 
33
+	    ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING} 
34
+	    # You can go further with classification but...
35
+	    ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS1 -j MARK --set-mark 0x3${IPT_MASK_STRING}
36
+	    ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS6 -j MARK --set-mark 0x1${IPT_MASK_STRING}
37
+	    ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING}
38
+	    ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING}
39
+	    ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING}
40
+	    ;;
41
+esac
35 42
 
36 43
 # and it might be a good idea to do it for udp tunnels too
37 44
 
@@ -43,9 +50,11 @@ ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-ma
43 50
 if [ "$SQUASH_DSCP" = "1" ]
44 51
 then
45 52
 sqm_logger "Squashing differentiated services code points (DSCP) from ingress."
53
+CAKE_OPTS=besteffort # someday squash
46 54
 ipt -t mangle -I PREROUTING -i $IFACE -m dscp ! --dscp 0 -j DSCP --set-dscp-class be
47 55
 else
48 56
 sqm_logger "Keeping differentiated services code points (DSCP) from ingress."
57
+CAKE_OPTS=""
49 58
 ipt -t mangle -A PREROUTING -i $IFACE -m mark --mark 0x00${IPT_MASK_STRING} -g QOS_MARK_${IFACE} 
50 59
 fi
51 60
 
@@ -81,47 +90,53 @@ BE_CEIL=`expr $CEIL - 16`  # A little slop at the top
81 90
 LQ="quantum `get_mtu $IFACE $CEIL`"
82 91
 
83 92
 $TC qdisc del dev $IFACE root 2> /dev/null
84
-$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12
85
-$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
86
-$TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
87
-$TC class add dev $IFACE parent 1:1 classid 1:11 htb $LQ rate 128kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
88
-$TC class add dev $IFACE parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
89
-$TC class add dev $IFACE parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
90
-
91
-$TC qdisc add dev $IFACE parent 1:11 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${PRIO_RATE}` ${EQDISC_OPTS}
92
-$TC qdisc add dev $IFACE parent 1:12 handle 120: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BE_RATE}` ${EQDISC_OPTS}
93
-$TC qdisc add dev $IFACE parent 1:13 handle 130: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${EQDISC_OPTS}
94
-
95
-
96
-# Need a catchall rule
97
-
98
-$TC filter add dev $IFACE parent 1:0 protocol all prio 999 u32 \
99
-        match ip protocol 0 0x00 flowid 1:12  
100
-
101
-# FIXME should probably change the filter here to do pre-nat
93
+case $QDISC in
94
+	cake*) 
95
+	    $TC qdisc add dev $IFACE root `get_stab_string` $QDISC bandwidth ${CEIL}kbit `get_cake_lla_string` ${EQDISC_OPTS}
96
+	    ;;
97
+	*) 	
98
+	    $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12
99
+	    $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
100
+	    $TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
101
+	    $TC class add dev $IFACE parent 1:1 classid 1:11 htb $LQ rate 128kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
102
+	    $TC class add dev $IFACE parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
103
+	    $TC class add dev $IFACE parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
104
+
105
+	    $TC qdisc add dev $IFACE parent 1:11 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${PRIO_RATE}` ${EQDISC_OPTS}
106
+	    $TC qdisc add dev $IFACE parent 1:12 handle 120: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BE_RATE}` ${EQDISC_OPTS}
107
+	    $TC qdisc add dev $IFACE parent 1:13 handle 130: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${EQDISC_OPTS}
108
+
109
+	    # Need a catchall rule
110
+
111
+	    $TC filter add dev $IFACE parent 1:0 protocol all prio 999 u32 \
112
+	        match ip protocol 0 0x00 flowid 1:12  
113
+
114
+	    # FIXME should probably change the filter here to do pre-nat
102 115
         
103
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 1 handle 1 fw classid 1:11
104
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 2 handle 2 fw classid 1:12
105
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 3 handle 3 fw classid 1:13
116
+	    $TC filter add dev $IFACE parent 1:0 protocol ip prio 1 handle 1 fw classid 1:11
117
+	    $TC filter add dev $IFACE parent 1:0 protocol ip prio 2 handle 2 fw classid 1:12
118
+	    $TC filter add dev $IFACE parent 1:0 protocol ip prio 3 handle 3 fw classid 1:13
106 119
 
107
-# ipv6 support. Note that the handle indicates the fw mark bucket that is looked for
120
+	    # ipv6 support. Note that the handle indicates the fw mark bucket that is looked for
108 121
 
109
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 4 handle 1 fw classid 1:11
110
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 5 handle 2 fw classid 1:12
111
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 6 handle 3 fw classid 1:13
122
+	    $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 4 handle 1 fw classid 1:11
123
+	    $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 5 handle 2 fw classid 1:12
124
+	    $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 6 handle 3 fw classid 1:13
112 125
 
113
-# Arp traffic
126
+	    # Arp traffic
114 127
 
115
-$TC filter add dev $IFACE parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
128
+	    $TC filter add dev $IFACE parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
116 129
 
117
-# ICMP traffic - Don't impress your friends. Deoptimize to manage ping floods
118
-# better instead
130
+	    # ICMP traffic - Don't impress your friends. Deoptimize to manage ping floods
131
+	    # better instead
119 132
 
120
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 8 \
121
-	 u32 match ip protocol 1 0xff flowid 1:13
133
+	    $TC filter add dev $IFACE parent 1:0 protocol ip prio 8 \
134
+		 u32 match ip protocol 1 0xff flowid 1:13
122 135
 
123
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 9 \
124
-	 u32 match ip protocol 1 0xff flowid 1:13
136
+	    $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 9 \
137
+		 u32 match ip protocol 1 0xff flowid 1:13
138
+	    ;;
139
+esac
125 140
 
126 141
 #diffserv $IFACE
127 142
 
@@ -144,31 +159,43 @@ $TC qdisc del dev $DEV root  2> /dev/null
144 159
 
145 160
 if [ "$SQUASH_INGRESS" = "1" ]
146 161
 then
147
-sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)"
148
-# Revert to no dscp based filtering
149
-$TC qdisc del dev $DEV root 2>/dev/null
150
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
151
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
152
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
153
-$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
162
+	sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)"
163
+	# Revert to no dscp based filtering
164
+	case $QDISC in
165
+		cake*) 
166
+		    $TC qdisc add dev $DEV root `get_stab_string` $QDISC bandwidth ${DOWNLINK}kbit besteffort `get_cake_lla_string` ${IQDISC_OPTS}
167
+		    ;;
168
+		*) 	
169
+		    $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
170
+		    $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
171
+		    $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
172
+		    $TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
173
+		    ;;
174
+	esac
154 175
 
155 176
 else
156
-sqm_logger "Perform DSCP based filtering on ingress. (3-tier classification)"
157
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 12
158
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
159
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
160
-$TC class add dev $DEV parent 1:1 classid 1:11 htb $LQ rate 32kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
161
-$TC class add dev $DEV parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
162
-$TC class add dev $DEV parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
163
-
164
-# I'd prefer to use a pre-nat filter but that causes permutation...
165
-
166
-$TC qdisc add dev $DEV parent 1:11 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 500` `get_flows ${PRIO_RATE}` ${IQDISC_OPTS}
167
-$TC qdisc add dev $DEV parent 1:12 handle 120: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 1500` `get_flows ${BE_RATE}` ${IQDISC_OPTS}
168
-$TC qdisc add dev $DEV parent 1:13 handle 130: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${IQDISC_OPTS}
169
-
170
-diffserv $DEV
171
-
177
+    sqm_logger "Perform DSCP based filtering on ingress. (3-tier classification)"
178
+    case $QDISC in
179
+    	    cake*) 
180
+    		    $TC qdisc add dev $DEV root `get_stab_string` $QDISC bandwidth ${DOWNLINK}kbit `get_cake_lla_string` $CAKE_OPTS ${IQDISC_OPTS}
181
+    		    ;;
182
+	    *) 	
183
+		    $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 12
184
+		    $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
185
+		    $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
186
+		    $TC class add dev $DEV parent 1:1 classid 1:11 htb $LQ rate 32kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
187
+		    $TC class add dev $DEV parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
188
+		    $TC class add dev $DEV parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
189
+
190
+		    # I'd prefer to use a pre-nat filter but that causes permutation...
191
+
192
+		    $TC qdisc add dev $DEV parent 1:11 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 500` `get_flows ${PRIO_RATE}` ${IQDISC_OPTS}
193
+		    $TC qdisc add dev $DEV parent 1:12 handle 120: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 1500` `get_flows ${BE_RATE}` ${IQDISC_OPTS}
194
+		    $TC qdisc add dev $DEV parent 1:13 handle 130: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${IQDISC_OPTS}
195
+
196
+		    diffserv $DEV
197
+		    ;;
198
+    esac
172 199
 fi
173 200
 
174 201
 ifconfig $DEV up

+ 29
- 15
net/sqm-scripts/files/usr/lib/sqm/simplest.qos Datei anzeigen

@@ -7,7 +7,7 @@
7 7
 # it under the terms of the GNU General Public License version 2 as
8 8
 # published by the Free Software Foundation.
9 9
 #
10
-#       Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
10
+#       Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
11 11
 
12 12
 . /usr/lib/sqm/functions.sh
13 13
 sqm_logger "Starting simplest.qos"
@@ -17,10 +17,17 @@ egress() {
17 17
 LQ="quantum `get_mtu $IFACE ${UPLINK}`"
18 18
 
19 19
 $TC qdisc del dev $IFACE root 2>/dev/null
20
-$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10
21
-$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string`
22
-$TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit prio 0 `get_htb_adsll_string`
23
-$TC qdisc add dev $IFACE parent 1:10 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_flows ${UPLINK}` ${EQDISC_OPTS}
20
+case $QDISC in
21
+	cake*) 
22
+	    $TC qdisc add dev $IFACE root `get_stab_string` cake bandwidth ${UPLINK}kbit besteffort `get_cake_lla_string` ${EQDISC_OPTS}
23
+	    ;;
24
+	*)
25
+	    $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10
26
+	    $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string`
27
+	    $TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit prio 0 `get_htb_adsll_string`
28
+	    $TC qdisc add dev $IFACE parent 1:10 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_flows ${UPLINK}` ${EQDISC_OPTS}
29
+	    ;;
30
+esac
24 31
 
25 32
 }
26 33
 
@@ -33,16 +40,23 @@ $TC qdisc add dev $IFACE handle ffff: ingress
33 40
 LQ="quantum `get_mtu $IFACE ${DOWNLINK}`"
34 41
  
35 42
 $TC qdisc del dev $DEV root 2>/dev/null
36
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
37
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
38
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
39
-
40
-# FIXME: I'd prefer to use a pre-nat filter but we need to detect if nat is on this interface
41
-# AND we need to permute by a random number which we can't do from userspace filters
42
-
43
-# Most high rate flows are REALLY close. This stomps on those harder, but hurts on high rate long distance
44
-#$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC limit $LIMIT $ECN interval 20ms target 3ms `get_flows ${DOWNLINK}`
45
-$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
43
+case $QDISC in
44
+	cake*) 
45
+	    $TC qdisc add dev $DEV root `get_stab_string` cake bandwidth ${DOWNLINK}kbit besteffort `get_cake_lla_string` ${IQDISC_OPTS}
46
+	    ;;
47
+	*)
48
+	    $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
49
+	    $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
50
+	    $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
51
+
52
+	    # FIXME: I'd prefer to use a pre-nat filter but we need to detect if nat is on this interface
53
+	    # AND we need to permute by a random number which we can't do from userspace filters
54
+
55
+	    # Most high rate flows are REALLY close. This stomps on those harder, but hurts on high rate long distance
56
+	    #$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC limit $LIMIT $ECN interval 20ms target 3ms `get_flows ${DOWNLINK}`
57
+	    $TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
58
+	    ;;
59
+esac
46 60
 
47 61
 ifconfig $DEV up
48 62