AQM: Use CAKE as default qdisc where appropriate instead of fq_codel

This script configures CAKE as default qdisc where appropriate:

* It is not suitable to use any queue management on bridges/GRE/VTI/tun
  interfaces.
* On Internet-facing interfaces, CAKE is configured in "internet" mode
  whereas on any zones except RED, it is configured in "metro" mode

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Michael Tremer
2021-12-02 12:37:41 +00:00
committed by Arne Fitzenreiter
parent 14aa983025
commit cfa5f916ea

View File

@@ -21,9 +21,9 @@
# #
############################################################################
LOG_FACILITY="codel"
LOG_FACILITY="aqm"
function log() {
log() {
logger -t "${LOG_FACILITY}" $@
}
@@ -32,19 +32,58 @@ if [ -z "${INTERFACE}" ]; then
exit 1
fi
# Do nothing for the loopback device.
[ "${INTERFACE}" = "lo" ] && exit 0
case "${ACTION}" in
add|register)
# Change root qdisc to use fq_codel.
/sbin/tc qdisc add root dev ${INTERFACE} fq_codel
ret=$?
TYPE="$(</sys/class/net/${INTERFACE}/type)"
if [ ${ret} -eq 0 ]; then
log "Codel AQM has been enabled on '${INTERFACE}'."
else
log "Codel AQM could not be enabled on '${INTERFACE}'. Error code: ${ret}"
# Detect bridges
if [ -d "/sys/class/net/${INTERFACE}/bridge" ]; then
TYPE="bridge"
fi
args=()
# Configure some useful defaults depending on the interface
case "${INTERFACE},${TYPE}" in
# Ignore loopback
lo,*)
exit 0
;;
# Ignore tun
tun*)
exit 0
;;
# Ignore GRE/VTI
*,778|*,768)
exit 0
;;
# Ignore bridges
*,bridge)
exit 0
;;
# Handle RED PPPoE (default to VDSL2)
ppp*,512)
args+=( "cake" "internet" "pppoe-ptm" "ack-filter" )
;;
# Treat any other interfaces as "Ethernet"
red*,*)
args+=( "cake" "internet" "ethernet" )
;;
# All other interfaces are locally connected
*)
args+=( "cake" "ethernet" "metro" )
;;
esac
# Change root qdisc to use cake
if ! tc qdisc replace root dev "${INTERFACE}" "${args[@]}"; then
log "Could not configure qdisc on ${INTERFACE} with parameters ${args[@]}"
exit ${ret}
fi
;;