mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
qosmngr: Airoha: Implement SP+WRR mixed mode.
This commit is contained in:
parent
4dba311804
commit
ff63eb262c
1 changed files with 42 additions and 36 deletions
|
|
@ -322,28 +322,9 @@ hw_shaper_set() {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Convert shaper in UCI terms to Econet terms
|
||||
hw_sc_alg2str() {
|
||||
local sc_alg="$1"
|
||||
|
||||
case "${sc_alg}" in
|
||||
SP)
|
||||
echo "PQ"
|
||||
;;
|
||||
WRR)
|
||||
echo "WRR"
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
return 1
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Commit all options preserved during
|
||||
hw_commit_all() {
|
||||
local sorted_list="$(echo $TMP_HW_QUEUE_LIST | tr ' ' '\n' | sort | xargs)"
|
||||
local sorted_list="$(echo $TMP_HW_QUEUE_LIST | tr ' ' '\n' | sort -u | xargs)"
|
||||
local weight_list=""
|
||||
local glob_alg=""
|
||||
local shape_rate="$TMP_HW_SHAPE_RATE"
|
||||
|
|
@ -355,24 +336,36 @@ hw_commit_all() {
|
|||
# Reorder queues
|
||||
for q in ${sorted_list} ; do
|
||||
local sc_alg="$(get_var TMP_HW_QUEUE_${q}_sc_alg)"
|
||||
local wgt="$(get_var TMP_HW_QUEUE_${q}_wgt)"
|
||||
|
||||
if [ "$glob_alg" != "" ] && [ "$sc_alg" != "$glob_alg" ] ; then
|
||||
errmsg "Not matching scheduling algorithm: $sc_alg vs $glob_alg"
|
||||
return 1
|
||||
if [ "$glob_alg" = "SPWRR" -a "$sc_alg" = "WRR" ] || [ "$sc_alg" = "WRR" -a "$glob_alg" = "SP" ]; then
|
||||
sc_alg="SPWRR"
|
||||
else
|
||||
errmsg "Not matching scheduling algorithm: $sc_alg vs $glob_alg"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
glob_alg="$sc_alg"
|
||||
done
|
||||
|
||||
case "${sc_alg}" in
|
||||
WRR)
|
||||
if [ $(($q_count >= 8)) != 0 ] ; then
|
||||
errmsg "Too many queues, next queues will be ignored"
|
||||
else
|
||||
weight_list="$weight_list $wgt"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
for q in ${sorted_list} ; do
|
||||
local sc_alg="$(get_var TMP_HW_QUEUE_${q}_sc_alg)"
|
||||
local wgt="$(get_var TMP_HW_QUEUE_${q}_wgt)"
|
||||
|
||||
if [ "${sc_alg}" = "SP" -o $((wgt)) -lt 0 ]; then
|
||||
wgt=0
|
||||
fi
|
||||
|
||||
if [ "${glob_alg}" = "SPWRR" -a "${sc_alg}" = "WRR" -a $((wgt)) -eq 0 ]; then # 0 is valid for WRR but not for SP+WRR.
|
||||
wgt=1
|
||||
fi
|
||||
|
||||
if [ $(($q_count >= 8)) != 0 ] ; then
|
||||
errmsg "Too many queues, next queues will be ignored"
|
||||
else
|
||||
weight_list="$weight_list $wgt"
|
||||
fi
|
||||
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
|
|
@ -388,12 +381,25 @@ hw_commit_all() {
|
|||
echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag
|
||||
echo "1 ${weight_list}" > /proc/qdma_wan/mac_qos
|
||||
;;
|
||||
SP)
|
||||
mac_qos_flag="8QPQ"
|
||||
q_count="8"
|
||||
SPWRR)
|
||||
mac_qos_flag="HW8QPQWRR"
|
||||
while [ $((q_count < 8)) != 0 ] ; do
|
||||
weight_list="$weight_list 1"
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
|
||||
echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag
|
||||
echo "0 0 0 0 0 0 0 0 0" > /proc/qdma_wan/mac_qos
|
||||
echo "2 ${weight_list}" > /proc/qdma_wan/mac_qos
|
||||
;;
|
||||
*)
|
||||
mac_qos_flag="8QPQ"
|
||||
while [ $((q_count < 8)) != 0 ] ; do
|
||||
weight_list="$weight_list 0"
|
||||
q_count=$((q_count + 1))
|
||||
done
|
||||
|
||||
echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag
|
||||
echo "0 ${weight_list}" > /proc/qdma_wan/mac_qos
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue