From e28995fa4e36563573bb615b9ff64f53e30d5342 Mon Sep 17 00:00:00 2001 From: Maxim Menshikov Date: Tue, 31 Jan 2023 08:29:44 +0000 Subject: [PATCH] qosmngr/airoha: enable eight queue PQ/WRR --- .../etc/uci-defaults/60-qos_config_generate | 4 +- qosmngr/files/airoha/lib/qos/airoha.sh | 37 ++++++++++++------- .../airoha/lib/qos/common/chains.ebtables.sh | 4 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate b/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate index 508a1b521..6570ab457 100644 --- a/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate +++ b/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate @@ -5,7 +5,7 @@ ethwan="$(db -q get hw.board.ethernetWanPort)" populate_no_of_queue(){ - queue_num=4 + queue_num=8 # writing no. of queue per port into file and read on classify generate if [ ! -d "/tmp/qos" ]; then @@ -26,7 +26,7 @@ generate_queue(){ fi # guaranteed number of queues - no_of_q="0 1 2 3" + no_of_q="0 1 2 3 4 5 6 7" i=0 local total_q=$((${no_of_q##* } + 1)) diff --git a/qosmngr/files/airoha/lib/qos/airoha.sh b/qosmngr/files/airoha/lib/qos/airoha.sh index a8a8873f3..b7f05a11b 100755 --- a/qosmngr/files/airoha/lib/qos/airoha.sh +++ b/qosmngr/files/airoha/lib/qos/airoha.sh @@ -27,7 +27,6 @@ hw_intf_init() { # Initialize the hardware setup library hw_init_all() { export TMP_HW_QUEUE_LIST="" - export TMP_HW_QUEUE_MASK="0" return 0 } @@ -58,7 +57,10 @@ hw_queue_set() { export TMP_HW_QUEUE_${order}_rate="${rate}" export TMP_HW_QUEUE_${order}_burstsize="${burstsize}" export TMP_HW_QUEUE_LIST="${TMP_HW_QUEUE_LIST} ${order}" - export TMP_HW_QUEUE_MASK="$((TMP_HW_QUEUE_MASK | 1 << index))" + + if [ "${rate}" != "" ] && [ $(($rate != 0)) ] ; then + errmsg "Per-queue shape rate is not implemented" + fi return 0 } @@ -146,8 +148,8 @@ hw_commit_all() { local weight_list="" local glob_alg="" local shape_rate="$TMP_HW_SHAPE_RATE" - local queue_mask="$TMP_HW_QUEUE_MASK" local q_count="0" + local mac_qos_flag="" # Reorder queues for q in ${sorted_list} ; do @@ -163,27 +165,36 @@ hw_commit_all() { case "${sc_alg}" in WRR) - if [ $(($q_count >= 4)) != 0 ] ; then + 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)) ;; esac + + q_count=$((q_count + 1)) done - if [ "${glob_alg}" == "WRR" ] ; then - while [ $((q_count < 4)) != 0 ] ; do - weight_list="$weight_list 1" - q_count=$((q_count + 1)) - done - fi + case "${glob_alg}" in + WRR) + mac_qos_flag="8QWRR" + while [ $((q_count < 8)) != 0 ] ; do + weight_list="$weight_list 1" + q_count=$((q_count + 1)) + done + ;; + SP) + mac_qos_flag="8QPQ" + q_count="8" + ;; + esac if [ "${glob_alg}" != "" ] ; then /userfs/bin/qosrule discpline $(hw_sc_alg2str ${glob_alg}) ${weight_list} \ - uplink-bandwidth ${shape_rate:-0} \ - queuemask $queue_mask + uplink-bandwidth ${shape_rate:-10000000} \ + queuemask "$(((1 << q_count) - 1))" + echo ${mac_qos_flag} > /proc/qdma_wan/mac_qos_flag else /userfs/bin/qosrule discpline Enable 0 fi diff --git a/qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh b/qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh index e5c9ed540..d9a8f6125 100755 --- a/qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh +++ b/qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh @@ -117,9 +117,9 @@ broute_filter_on_vid() { } broute_rule_set_traffic_class() { - BR_RULE="$BR_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT" + BR_RULE="$BR_RULE -j mark --mark-or 0x${1}0 --mark-target ACCEPT" if [ -n "$BR6_RULE" ]; then - BR6_RULE="$BR6_RULE -j mark --mark-or 0x$1 --mark-target ACCEPT" + BR6_RULE="$BR6_RULE -j mark --mark-or 0x${1}0 --mark-target ACCEPT" fi }