diff --git a/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate b/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate deleted file mode 100644 index 6570ab457..000000000 --- a/qosmngr/files/airoha/etc/uci-defaults/60-qos_config_generate +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh - -ethwan="$(db -q get hw.board.ethernetWanPort)" - -populate_no_of_queue(){ - queue_num=8 - - # writing no. of queue per port into file and read on classify generate - if [ ! -d "/tmp/qos" ]; then - mkdir -p "/tmp/qos" - fi - no_queue_file="/tmp/qos/no_queue_per_port" - touch "$no_queue_file" - echo $queue_num >"$no_queue_file" -} - -generate_queue(){ - section="$1" - - config_get ifname "$section" "ifname" - - if [ "$ifname" != "$ethwan" ]; then - return 0 - fi - - # guaranteed number of queues - no_of_q="0 1 2 3 4 5 6 7" - - i=0 - local total_q=$((${no_of_q##* } + 1)) - for i in $no_of_q; do - order=$((total_q - i)) - uci add qos queue - uci rename qos.@queue[-1]="q_${i}_${ifname}" - uci set qos.@queue[-1].enable="1" - uci set qos.@queue[-1].ifname="$ifname" - uci set qos.@queue[-1].precedence="$order" - uci set qos.@queue[-1].scheduling="SP" - uci set qos.@queue[-1].rate="0" - uci set qos.@queue[-1].burst_size="0" - uci set qos.@queue[-1].weight="1" - done - - uci commit qos -} - -populate_no_of_queue - -if [ -s "/etc/config/qos" ]; then - if uci -q get qos.@queue[0] >/dev/null; then - # return if there is any valid content - exit - else - rm -f /etc/config/qos - fi -fi -touch /etc/config/qos - -# generate qos queue config -config_load ports -config_foreach generate_queue ethport - diff --git a/qosmngr/files/airoha/lib/qos/qos.sh b/qosmngr/files/airoha/lib/qos/qos.sh index 5daa6f1a9..bddfe6540 100755 --- a/qosmngr/files/airoha/lib/qos/qos.sh +++ b/qosmngr/files/airoha/lib/qos/qos.sh @@ -14,6 +14,14 @@ include /lib/ethernet . /lib/qos/common/shaper.sh . /lib/qos/airoha.sh +get_rate_per_queue() { + echo "0" +} + +get_burst_size_per_queue() { + echo "0" +} + configure_qos() { # queue configuration is being done after shaper configuration, # If port shapingrate configuration on DISC device is called after queue configuration then diff --git a/qosmngr/files/broadcom/lib/qos/qos.sh b/qosmngr/files/broadcom/lib/qos/qos.sh index 15d59c679..1c26d2cce 100755 --- a/qosmngr/files/broadcom/lib/qos/qos.sh +++ b/qosmngr/files/broadcom/lib/qos/qos.sh @@ -15,6 +15,14 @@ SP_Q_PRIO=7 cfg_name="" cfg_type="" +get_rate_per_queue() { + echo "0" +} + +get_burst_size_per_queue() { + echo "0" +} + # Function to handle a queue order and # update total number of queues handle_q_order() { diff --git a/qosmngr/files/broadcom/etc/uci-defaults/60-qos_config_generate b/qosmngr/files/common/etc/uci-defaults/60-qos_config_generate similarity index 72% rename from qosmngr/files/broadcom/etc/uci-defaults/60-qos_config_generate rename to qosmngr/files/common/etc/uci-defaults/60-qos_config_generate index d0995e47f..5e7d60977 100644 --- a/qosmngr/files/broadcom/etc/uci-defaults/60-qos_config_generate +++ b/qosmngr/files/common/etc/uci-defaults/60-qos_config_generate @@ -1,27 +1,19 @@ #!/bin/sh -. /lib/functions.sh +. /lib/qos/qos.sh ethwan="$(db -q get hw.board.ethernetWanPort)" -cpu_model="$(cat /proc/socinfo | grep 'SoC Name' | cut -d':' -f2)" queue_num=8 populate_no_of_queue(){ - case $cpu_model in - BCM68[3,4,5]*) queue_num=4 ;; - esac - if grep -qE '[0-9]+ archer$' /proc/devices; then - queue_num=4 - fi - # writing no. of queue per port into file and read on classify generate if [ ! -d "/tmp/qos" ]; then mkdir -p "/tmp/qos" fi no_queue_file="/tmp/qos/no_queue_per_port" touch "$no_queue_file" - echo $queue_num >"$no_queue_file" + echo $1 >"$no_queue_file" } generate_queue(){ @@ -30,13 +22,16 @@ generate_queue(){ config_get ifname "$section" "ifname" local is_lan=0 + queue_num=$(qosmngr -q $ifname) + if [ "$ifname" != "$ethwan" ]; then is_lan=1 + populate_no_of_queue $queue_num fi local no_of_q="0 1 2 3 4 5 6 7" - if [ $is_lan -eq 1 ] -a [ $queue_num -eq 4 ]; then + if [ $is_lan -eq 1 ] && [ $queue_num -eq 4 ]; then no_of_q="0 1 2 3" fi @@ -50,16 +45,14 @@ generate_queue(){ uci set qos.@queue[-1].ifname="$ifname" uci set qos.@queue[-1].precedence="$order" uci set qos.@queue[-1].scheduling="SP" - uci set qos.@queue[-1].rate="0" - uci set qos.@queue[-1].burst_size="0" + uci set qos.@queue[-1].rate=$(get_rate_per_queue) + uci set qos.@queue[-1].burst_size=$(get_burst_size_per_queue) uci set qos.@queue[-1].weight="1" done uci commit qos } -populate_no_of_queue - if [ -s "/etc/config/qos" ]; then if uci -q get qos.@queue[0] >/dev/null; then exit diff --git a/qosmngr/files/common/etc/uci-defaults/61-qos_classify_generate b/qosmngr/files/common/etc/uci-defaults/61-qos_classify_generate index c6c5a618d..839221218 100644 --- a/qosmngr/files/common/etc/uci-defaults/61-qos_classify_generate +++ b/qosmngr/files/common/etc/uci-defaults/61-qos_classify_generate @@ -60,7 +60,6 @@ generate_icmp_rule(){ generate_classify(){ - no_queue_file="/tmp/qos/no_queue_per_port" queue_num=$(cat "$no_queue_file") rm -f "$no_queue_file" diff --git a/qosmngr/files/linux/etc/uci-defaults/60-qos_config_generate b/qosmngr/files/linux/etc/uci-defaults/60-qos_config_generate deleted file mode 100644 index 32e3cb727..000000000 --- a/qosmngr/files/linux/etc/uci-defaults/60-qos_config_generate +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh - -ethwan="$(db -q get hw.board.ethernetWanPort)" - -populate_no_of_queue(){ - queue_num=8 - - # writing no. of queue per port into file and read on classify generate - if [ ! -d "/tmp/qos" ]; then - mkdir -p "/tmp/qos" - fi - no_queue_file="/tmp/qos/no_queue_per_port" - touch "$no_queue_file" - echo $queue_num >"$no_queue_file" -} - -generate_queue(){ - section="$1" - - config_get ifname "$section" "ifname" - - local no_of_q="0 1 2 3 4 5 6 7" - - i=0 - local total_q=$((${no_of_q##* } + 1)) - for i in $no_of_q; do - order=$((total_q - i)) - uci add qos queue - uci rename qos.@queue[-1]="q_${i}_${ifname}" - uci set qos.@queue[-1].enable="1" - uci set qos.@queue[-1].ifname="$ifname" - uci set qos.@queue[-1].precedence="$order" - uci set qos.@queue[-1].scheduling="SP" - uci set qos.@queue[-1].rate="1000000" - uci set qos.@queue[-1].burst_size="1500" - uci set qos.@queue[-1].weight="1" - done - - uci commit qos -} - -populate_no_of_queue - -if [ -s "/etc/config/qos" ]; then - if uci -q get qos.@queue[0] >/dev/null; then - # return if there is any valid content - exit - else - rm -f /etc/config/qos - fi -fi -touch /etc/config/qos - -config_load ports -config_foreach generate_queue ethport diff --git a/qosmngr/files/linux/lib/qos/qos.sh b/qosmngr/files/linux/lib/qos/qos.sh index 3cda4d097..77dae1c43 100755 --- a/qosmngr/files/linux/lib/qos/qos.sh +++ b/qosmngr/files/linux/lib/qos/qos.sh @@ -14,6 +14,14 @@ POLICER_COUNT=0 Q_COUNT=0 SP_Q_PRIO=7 +get_rate_per_queue() { + echo "1000000" +} + +get_burst_size_per_queue() { + echo "1500" +} + # Function to handle a queue order and # update total number of queues handle_q_order() {