dslmngr: airoha: Fix QoS uplink bandwidth monitor.

This commit is contained in:
Markus Gothe 2025-09-17 19:33:30 +02:00
parent f7d845beaa
commit 27bd279333

View file

@ -5,6 +5,8 @@ source "/lib/functions/network.sh"
source "/lib/functions/system.sh"
PREVLINK=""
LINK=""
LINKSPEED=""
PREVWANMODE=""
WANMODE=""
CONFIGURED=0
@ -150,6 +152,12 @@ while [ true ]; do
if [ "$LINK" != "$PREVLINK" -a \( "$LINK" = "down" -o "$LINK" = "up" \) ]; then
if [ "$LINK" = "down" ]; then
if [ ! -s /tmp/qos/wan_link_shape_rate ]; then
rm -rf /tmp/qos/wan_link_shape_rate
rm -rf /tmp/qos/wan_link_speed
/usr/sbin/qos-uplink-bandwidth
fi
[ "$CONFIGURED" -eq 0 ] && configure_lines # Needs to be done once the slave SoC is in down state and we've not been able to auto-sync.
if [ -n "$WANMODE" ]; then
if [ "$WANMODE" = "PTM" ]; then
@ -226,6 +234,26 @@ while [ true ]; do
call_wan_hotplug "up" "$WANPORT"
PREVWANMODE="$WANMODE"
if [ ! -s /tmp/qos/wan_link_shape_rate ]; then
LINKSPEED="$(awk '/far-end interleaved channel bit rate/{print $6}' /proc/tc3162/adsl_stats)"
LINKSPEED=$((LINKSPEED))
if [ "$LINKSPEED" -eq 0 ]; then
LINKSPEED="$(awk '/far-end fast channel bit rate/{print $6}' /proc/tc3162/adsl_stats)"
LINKSPEED=$((LINKSPEED))
fi
if [ "$LINKSPEED" -ne 0 ]; then
mkdir -p /tmp/qos
touch /tmp/qos/wan_link_shape_rate
/userfs/bin/qosrule discpline Rate uplink-bandwidth ${LINKSPEED}
hw_nat -! > /dev/null 2>&1
else
rm -rf /tmp/qos/wan_link_speed
/usr/sbin/qos-uplink-bandwidth
fi
fi
fi
# Toggle link state