mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
48 lines
1.1 KiB
Bash
48 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
|
|
|
generate_queue(){
|
|
section="$1"
|
|
|
|
config_get ifname "$section" "ifname"
|
|
|
|
if [ "$ifname" != "$ethwan" ]; then
|
|
return 0
|
|
fi
|
|
|
|
# guaranteed number of queues
|
|
no_of_q="0 1 2 3"
|
|
|
|
i=0
|
|
local total_q=$((${no_of_q##* } + 1))
|
|
for i in $no_of_q; do
|
|
order=$((total_q - i))
|
|
uci add qos queue
|
|
uci rename qos.@queue[-1]="q_${i}_${ifname}"
|
|
uci set qos.@queue[-1].enable="1"
|
|
uci set qos.@queue[-1].ifname="$ifname"
|
|
uci set qos.@queue[-1].precedence="$order"
|
|
uci set qos.@queue[-1].scheduling="SP"
|
|
uci set qos.@queue[-1].rate="0"
|
|
uci set qos.@queue[-1].burst_size="0"
|
|
uci set qos.@queue[-1].weight="1"
|
|
done
|
|
|
|
uci commit qos
|
|
}
|
|
|
|
if [ -s "/etc/config/qos" ]; then
|
|
if uci -q get qos.@queue[0] >/dev/null; then
|
|
# return if there is any valid content
|
|
exit
|
|
else
|
|
rm -f /etc/config/qos
|
|
fi
|
|
fi
|
|
touch /etc/config/qos
|
|
|
|
config_load ports
|
|
config_foreach generate_queue ethport
|