mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
qosmngr: handing to get number of queue
This commit is contained in:
parent
67e43d1fd7
commit
7a7719d10e
7 changed files with 32 additions and 137 deletions
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
@ -14,6 +14,14 @@ include /lib/ethernet
|
||||||
. /lib/qos/common/shaper.sh
|
. /lib/qos/common/shaper.sh
|
||||||
. /lib/qos/airoha.sh
|
. /lib/qos/airoha.sh
|
||||||
|
|
||||||
|
get_rate_per_queue() {
|
||||||
|
echo "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_burst_size_per_queue() {
|
||||||
|
echo "0"
|
||||||
|
}
|
||||||
|
|
||||||
configure_qos() {
|
configure_qos() {
|
||||||
# queue configuration is being done after shaper configuration,
|
# queue configuration is being done after shaper configuration,
|
||||||
# If port shapingrate configuration on DISC device is called after queue configuration then
|
# If port shapingrate configuration on DISC device is called after queue configuration then
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,14 @@ SP_Q_PRIO=7
|
||||||
cfg_name=""
|
cfg_name=""
|
||||||
cfg_type=""
|
cfg_type=""
|
||||||
|
|
||||||
|
get_rate_per_queue() {
|
||||||
|
echo "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_burst_size_per_queue() {
|
||||||
|
echo "0"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to handle a queue order and
|
# Function to handle a queue order and
|
||||||
# update total number of queues
|
# update total number of queues
|
||||||
handle_q_order() {
|
handle_q_order() {
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,19 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/qos/qos.sh
|
||||||
|
|
||||||
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
ethwan="$(db -q get hw.board.ethernetWanPort)"
|
||||||
cpu_model="$(cat /proc/socinfo | grep 'SoC Name' | cut -d':' -f2)"
|
|
||||||
|
|
||||||
queue_num=8
|
queue_num=8
|
||||||
|
|
||||||
populate_no_of_queue(){
|
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
|
# writing no. of queue per port into file and read on classify generate
|
||||||
if [ ! -d "/tmp/qos" ]; then
|
if [ ! -d "/tmp/qos" ]; then
|
||||||
mkdir -p "/tmp/qos"
|
mkdir -p "/tmp/qos"
|
||||||
fi
|
fi
|
||||||
no_queue_file="/tmp/qos/no_queue_per_port"
|
no_queue_file="/tmp/qos/no_queue_per_port"
|
||||||
touch "$no_queue_file"
|
touch "$no_queue_file"
|
||||||
echo $queue_num >"$no_queue_file"
|
echo $1 >"$no_queue_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_queue(){
|
generate_queue(){
|
||||||
|
|
@ -30,13 +22,16 @@ generate_queue(){
|
||||||
config_get ifname "$section" "ifname"
|
config_get ifname "$section" "ifname"
|
||||||
|
|
||||||
local is_lan=0
|
local is_lan=0
|
||||||
|
queue_num=$(qosmngr -q $ifname)
|
||||||
|
|
||||||
if [ "$ifname" != "$ethwan" ]; then
|
if [ "$ifname" != "$ethwan" ]; then
|
||||||
is_lan=1
|
is_lan=1
|
||||||
|
populate_no_of_queue $queue_num
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local no_of_q="0 1 2 3 4 5 6 7"
|
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"
|
no_of_q="0 1 2 3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -50,16 +45,14 @@ generate_queue(){
|
||||||
uci set qos.@queue[-1].ifname="$ifname"
|
uci set qos.@queue[-1].ifname="$ifname"
|
||||||
uci set qos.@queue[-1].precedence="$order"
|
uci set qos.@queue[-1].precedence="$order"
|
||||||
uci set qos.@queue[-1].scheduling="SP"
|
uci set qos.@queue[-1].scheduling="SP"
|
||||||
uci set qos.@queue[-1].rate="0"
|
uci set qos.@queue[-1].rate=$(get_rate_per_queue)
|
||||||
uci set qos.@queue[-1].burst_size="0"
|
uci set qos.@queue[-1].burst_size=$(get_burst_size_per_queue)
|
||||||
uci set qos.@queue[-1].weight="1"
|
uci set qos.@queue[-1].weight="1"
|
||||||
done
|
done
|
||||||
|
|
||||||
uci commit qos
|
uci commit qos
|
||||||
}
|
}
|
||||||
|
|
||||||
populate_no_of_queue
|
|
||||||
|
|
||||||
if [ -s "/etc/config/qos" ]; then
|
if [ -s "/etc/config/qos" ]; then
|
||||||
if uci -q get qos.@queue[0] >/dev/null; then
|
if uci -q get qos.@queue[0] >/dev/null; then
|
||||||
exit
|
exit
|
||||||
|
|
@ -60,7 +60,6 @@ generate_icmp_rule(){
|
||||||
|
|
||||||
generate_classify(){
|
generate_classify(){
|
||||||
|
|
||||||
|
|
||||||
no_queue_file="/tmp/qos/no_queue_per_port"
|
no_queue_file="/tmp/qos/no_queue_per_port"
|
||||||
queue_num=$(cat "$no_queue_file")
|
queue_num=$(cat "$no_queue_file")
|
||||||
rm -f "$no_queue_file"
|
rm -f "$no_queue_file"
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -14,6 +14,14 @@ POLICER_COUNT=0
|
||||||
Q_COUNT=0
|
Q_COUNT=0
|
||||||
SP_Q_PRIO=7
|
SP_Q_PRIO=7
|
||||||
|
|
||||||
|
get_rate_per_queue() {
|
||||||
|
echo "1000000"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_burst_size_per_queue() {
|
||||||
|
echo "1500"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to handle a queue order and
|
# Function to handle a queue order and
|
||||||
# update total number of queues
|
# update total number of queues
|
||||||
handle_q_order() {
|
handle_q_order() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue