qosmngr: airoha: fix bw overwrite in case of reload and shaping

This commit is contained in:
Marina Maslova 2024-05-30 20:03:21 +04:00 committed by Rahul Thakur
parent 1821af8963
commit b6930a2056
2 changed files with 10 additions and 1 deletions

View file

@ -190,11 +190,18 @@ hw_commit_all() {
;; ;;
esac esac
rm -f "/tmp/qos/wan_link_shape_rate"
rm -f "/tmp/qos/wan_link_speed"
if [ "${glob_alg}" != "" ] ; then if [ "${glob_alg}" != "" ] ; then
/userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \ /userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \
uplink-bandwidth ${shape_rate:-10000000} \ uplink-bandwidth ${shape_rate:-10000000} \
queuemask "$(((1 << q_count) - 1))" queuemask "$(((1 << q_count) - 1))"
echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag 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 else
/userfs/bin/qosrule discpline Enable 0 /userfs/bin/qosrule discpline Enable 0
fi fi

View file

@ -2,8 +2,10 @@
readonly WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)" readonly WANPORT="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
readonly LINKSPEED_FILE="/tmp/qos/wan_link_speed" 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')" LINKSPEED="$(devstatus "${WANPORT}" | jsonfilter -e '@["speed"]' | tr -d 'A-Z')"
PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null) PREV_LINKSPEED=$(cat ${LINKSPEED_FILE} 2>/dev/null)