[SQM/luci-app-sqm] Wire up link layer dandling for cake

The cake traffic-shaper qdisc omne stop solution knows how to handle
link layer adjustments for ATM and can account for per packet overhead.
This commit adds cake as link layer adjustment mechanism in the GUI and
passes numerically specified overhead as well as the ATM linklayer
keywords on to cake. This change also passes the "advanced option strings"
from the Queue Discipline tab to cake. But as before no error checking.
This needs testing, as I have no working cake qdisc available so
caveat emptor...

Signed-off-by: Sebastian Moeller <moeller0@gmx.de>
This commit is contained in:
Sebastian Moeller 2015-06-18 21:08:01 +02:00 committed by Toke Høiland-Jørgensen
parent e7bab97599
commit 2ba6a3f9ab
6 changed files with 93 additions and 64 deletions

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-sqm PKG_NAME:=luci-app-sqm
PKG_VERSION:=3 PKG_VERSION:=3
PKG_RELEASE:=4 PKG_RELEASE:=5
PKG_LICENSE:=GPLv2 PKG_LICENSE:=GPLv2
LUCI_DIR:=/usr/lib/lua/luci LUCI_DIR:=/usr/lib/lua/luci

View file

@ -228,6 +228,7 @@ smpu.rmempty = true
smpu:depends("linklayer_advanced", "1") smpu:depends("linklayer_advanced", "1")
lla = s:taboption("tab_linklayer", ListValue, "linklayer_adaptation_mechanism", translate("Which linklayer adaptation mechanism to use; for testing only")) lla = s:taboption("tab_linklayer", ListValue, "linklayer_adaptation_mechanism", translate("Which linklayer adaptation mechanism to use; for testing only"))
lla:value("cake")
lla:value("htb_private") lla:value("htb_private")
lla:value("tc_stab", "tc_stab ("..translate("default")..")") lla:value("tc_stab", "tc_stab ("..translate("default")..")")
lla.default = "tc_stab" lla.default = "tc_stab"

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=sqm-scripts PKG_NAME:=sqm-scripts
PKG_VERSION:=8 PKG_VERSION:=8
PKG_RELEASE:=5 PKG_RELEASE:=6
PKG_LICENSE:=GPLv2 PKG_LICENSE:=GPLv2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View file

@ -139,6 +139,23 @@ get_stab_string() {
echo ${STABSTRING} echo ${STABSTRING}
} }
#sm: cake knows how to handle ATM and per packet overhead, so expose and use this...
get_cake_lla_string() {
STABSTRING=""
if [ "${LLAM}" = "cake" -a "${LINKLAYER}" != "none" ];
then
if [ "${LINKLAYER}" = "atm" ];
then
STABSTRING="atm"
fi
STABSTRING="${STABSTRING} overhead ${OVERHEAD}"
sqm_logger "cake link layer adjustments: ${STABSTRING}"
fi
echo ${STABSTRING}
}
sqm_stop() { sqm_stop() {
$TC qdisc del dev $IFACE ingress $TC qdisc del dev $IFACE ingress
$TC qdisc del dev $IFACE root $TC qdisc del dev $IFACE root

View file

@ -7,7 +7,7 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
# #
# Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller # Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
# Compared to the complexity that debloat had become # Compared to the complexity that debloat had become
# this cleanly shows a means of going from diffserv marking # this cleanly shows a means of going from diffserv marking
@ -26,7 +26,9 @@ ipt_setup() {
ipt -t mangle -N QOS_MARK_${IFACE} ipt -t mangle -N QOS_MARK_${IFACE}
case $QDISC in case $QDISC in
cake*) sqm_logger cake does all the diffserv work - no need for iptables rules ;; cake*)
sqm_logger cake does all the diffserv work - no need for iptables rules
;;
*) *)
ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING} ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING}
# You can go further with classification but... # You can go further with classification but...
@ -35,6 +37,7 @@ ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS6 -j MARK --set-mark 0
ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING} ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING}
ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING} ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING}
ipt -t mangle -A QOS_MARK_${IFACE} -m tos --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING} ipt -t mangle -A QOS_MARK_${IFACE} -m tos --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING}
;;
esac esac
# and it might be a good idea to do it for udp tunnels too # and it might be a good idea to do it for udp tunnels too
@ -88,7 +91,9 @@ LQ="quantum `get_mtu $IFACE $CEIL`"
$TC qdisc del dev $IFACE root 2> /dev/null $TC qdisc del dev $IFACE root 2> /dev/null
case $QDISC in case $QDISC in
cake*) $TC qdisc add dev $IFACE root $QDISC bandwidth ${CEIL}kbit ;; cake*)
$TC qdisc add dev $IFACE root $QDISC bandwidth ${CEIL}kbit get_cake_lla_string ${EQDISC_OPTS}
;;
*) *)
$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12 $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12
$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string` $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
@ -157,7 +162,9 @@ then
sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)" sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)"
# Revert to no dscp based filtering # Revert to no dscp based filtering
case $QDISC in case $QDISC in
cake*) $TC qdisc add dev $DEV root $QDISC bandwidth ${DOWNLINK}kbit besteffort ;; cake*)
$TC qdisc add dev $DEV root $QDISC bandwidth ${DOWNLINK}kbit besteffort get_cake_lla_string ${IQDISC_OPTS}
;;
*) *)
$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10 $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string` $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`

View file

@ -7,7 +7,7 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
# #
# Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller # Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
. /usr/lib/sqm/functions.sh . /usr/lib/sqm/functions.sh
sqm_logger "Starting simplest.qos" sqm_logger "Starting simplest.qos"
@ -18,7 +18,9 @@ LQ="quantum `get_mtu $IFACE ${UPLINK}`"
$TC qdisc del dev $IFACE root 2>/dev/null $TC qdisc del dev $IFACE root 2>/dev/null
case $QDISC in case $QDISC in
cake*) $TC qdisc add dev $IFACE root cake bandwidth ${UPLINK}kbit besteffort ;; cake*)
$TC qdisc add dev $IFACE root cake bandwidth ${UPLINK}kbit besteffort get_cake_lla_string ${EQDISC_OPTS}
;;
*) *)
$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10 $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10
$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string` $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string`
@ -39,7 +41,9 @@ LQ="quantum `get_mtu $IFACE ${DOWNLINK}`"
$TC qdisc del dev $DEV root 2>/dev/null $TC qdisc del dev $DEV root 2>/dev/null
case $QDISC in case $QDISC in
cake*) $TC qdisc add dev $DEV root cake bandwidth ${DOWNLINK}kbit besteffort ;; cake*)
$TC qdisc add dev $DEV root cake bandwidth ${DOWNLINK}kbit besteffort get_cake_lla_string ${IQDISC_OPTS}
;;
*) *)
$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10 $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string` $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`