From b6930a2056b7d87d1e6abfbfd4bf7b07d527eda5 Mon Sep 17 00:00:00 2001 From: Marina Maslova Date: Thu, 30 May 2024 20:03:21 +0400 Subject: [PATCH] qosmngr: airoha: fix bw overwrite in case of reload and shaping --- qosmngr/files/airoha/lib/qos/airoha.sh | 7 +++++++ qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qosmngr/files/airoha/lib/qos/airoha.sh b/qosmngr/files/airoha/lib/qos/airoha.sh index 1492b1186..f086e7029 100755 --- a/qosmngr/files/airoha/lib/qos/airoha.sh +++ b/qosmngr/files/airoha/lib/qos/airoha.sh @@ -190,11 +190,18 @@ hw_commit_all() { ;; esac + rm -f "/tmp/qos/wan_link_shape_rate" + rm -f "/tmp/qos/wan_link_speed" if [ "${glob_alg}" != "" ] ; then /userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \ uplink-bandwidth ${shape_rate:-10000000} \ queuemask "$(((1 << q_count) - 1))" echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag + if [ -n "${shape_rate}" ]; then + echo "${shape_rate}" > "/tmp/qos/wan_link_shape_rate" + else + /usr/sbin/qos-uplink-bandwidth + fi else /userfs/bin/qosrule discpline Enable 0 fi diff --git a/qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth b/qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth index ee3d3940d..5ef1b2167 100755 --- a/qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth +++ b/qosmngr/files/airoha/usr/sbin/qos-uplink-bandwidth @@ -2,8 +2,10 @@ readonly WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)" readonly LINKSPEED_FILE="/tmp/qos/wan_link_speed" +readonly LINKSHAPE_FILE="/tmp/qos/wan_link_shape_rate" -[ "${WANPORT}" = "${PORT}" ] || exit 0 +[ -z "${PORT}" -o "${WANPORT}" = "${PORT}" ] || exit 0 +[ -f "${LINKSHAPE_FILE}" ] && exit 0 LINKSPEED="$(devstatus "${WANPORT}" | jsonfilter -e '@["speed"]' | tr -d 'A-Z')" PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null)