From 63efd921ed412bab1b256e0c2b5da93d327c44e8 Mon Sep 17 00:00:00 2001 From: subramanian c Date: Wed, 29 Nov 2023 11:58:49 +0000 Subject: [PATCH] qosmngr: Improvements on SP and policer cases --- qosmngr/files/linux/lib/qos/qos.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/qosmngr/files/linux/lib/qos/qos.sh b/qosmngr/files/linux/lib/qos/qos.sh index 1b3acf8ab..e988aa475 100755 --- a/qosmngr/files/linux/lib/qos/qos.sh +++ b/qosmngr/files/linux/lib/qos/qos.sh @@ -171,8 +171,13 @@ handle_queue() { ;; esac + [ -f /etc/board.json ] || return 0 if [ $salg -ne 2 ]; then - priority=`expr $priority - $order` + priority=$order + wan_port=$(jsonfilter -i /etc/board.json -e @.network.wan.device) + if [ "$wan_port" == "$port" ]; then + priority=`expr 7 - $order` + fi fi local ceil_rate=$port_bw @@ -367,15 +372,20 @@ config_ingress_rate_limit() { ingress_rate=$((ingress_rate / 1000)) - if [ $in_burst_size -eq 0 ]; then - in_burst_size=$ingress_rate - else - in_burst_size=$((in_burst_size / 1000)) + local bs=0 + local avg_bs=$(( ingress_rate * 25 )) + config_get b_size "$sid" "burst_size" + if [ "$in_burst_size" > "0" ]; then + bs=`expr $in_burst_size / 1000` + fi + bs=$(( bs * 8 )) + if [ $avg_bs -gt $bs ]; then + bs="$avg_bs" fi tc qdisc add dev $ifname ingress - tc filter add dev $ifname parent ffff: protocol ip prio $pindex u32 match ip src 0.0.0.0/0 police rate ${ingress_rate}kbit burst $in_burst_size drop flowid :$pindex + tc filter add dev $ifname parent ffff: protocol ip prio $pindex u32 match ip src 0.0.0.0/0 police rate ${ingress_rate}kbit burst $bs drop flowid :$pindex }