qosmngr: airoha: Fix uplink bandwidth calculation.

For lower speeds we need to adjust the bandwidth
calculation for QoS to work on AN7581 (but not on EN7523).

Also make sure we clear old HW NAT entries if the uplink
bandwidth changes for QoS to take effect immediaty.
This commit is contained in:
Markus Gothe 2025-09-17 14:51:15 +02:00
parent 04b74dca49
commit dd637db803

View file

@ -14,11 +14,13 @@ PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null)
[ -z "${PREV_LINKSPEED}" ] && PREV_LINKSPEED=0
if [ $((LINKSPEED)) -ne $((PREV_LINKSPEED)) -a $((LINKSPEED)) -ne 0 ]; then
if [ $((LINKSPEED)) -ge 10000 ]; then
if [ $((LINKSPEED)) -ge 100 ]; then
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000*999/1000))
else
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000))
/userfs/bin/qosrule discpline Rate uplink-bandwidth $((LINKSPEED*1000*990/1000))
fi
mkdir -p "/tmp/qos"
echo ${LINKSPEED} > ${LINKSPEED_FILE}
fi
hw_nat -! > /dev/null 2>&1