qosmngr: introduce enable in queue and shaper section

Introduce enable in the queue and shaper section in qos config, if
disabled, configuration not done for that instance.

Fixed some bugs in the broadcom.sh script.

Note: The broadcom.sh script has not been updated to take into account
the fact that the board 6846 does not have enough queues available.
This script is kept so for the same of flexibility. The number of queues
per port can be controlled from the uci file now which easily available
and configurable.
This commit is contained in:
Rahul 2020-04-09 14:23:07 +05:30
parent d7936fd7d1
commit 71ee9e3311
2 changed files with 47 additions and 20 deletions

View file

@ -2,20 +2,34 @@
. /lib/functions.sh
ethwan="$(db -q get hw.board.ethernetWanPort)"
is_l2="$(db -q get hw.board.layer2)"
generate_queue(){
section="$1"
config_get ifname "$section" "ifname"
local is_lan=0
if [ "$ifname" != "$ethwan" ]; then
is_lan=1
fi
local no_of_q="0 1 2 3 4 5 6 7"
if [ $is_l2 -eq 1 -a $is_lan -eq 1 ]; then
no_of_q="0 1 2 3"
fi
i=0
for i in 0 1 2 3 4 5 6 7; do
for i in $no_of_q; do
uci add qos queue
uci rename qos.@queue[-1]="q${i}_${ifname}"
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="$i"
uci set qos.@queue[-1].scheduling="WRR"
uci set qos.@queue[-1].rate=0
uci set qos.@queue[-1].burst_size=-1
uci set qos.@queue[-1].traffic_class="$i"
uci set qos.@queue[-1].weight=1
uci set qos.@queue[-1].scheduling="SP"
uci set qos.@queue[-1].rate="0"
uci set qos.@queue[-1].burst_size="-1"
uci set qos.@queue[-1].weight="1"
done
uci commit qos

View file

@ -11,22 +11,22 @@ handle_queue() {
local wgt
local rate
local bs
config_get ifname "$qid" "ifname"
config_get is_enable "$qid" "enable"
# no need to configure disabled queues
if [ $is_enable == '0' ]; then
return
fi
config_get ifname "$qid" "ifname"
# if ifname is empty that is good enough to break
if [ -z "$ifname" ];then
break
return
fi
# lower the value, lower the priority of queue on this chip
config_get order "$qid" "precedence"
# on this chip, 8 queues per port exist so values larger than this
# cannot be supported
if [ $order -gt 7 ]; then
continue
fi
config_get tc "$qid" "traffic_class"
config_get sc_alg "$qid" "scheduling"
config_get wgt "$qid" "weight"
@ -35,10 +35,6 @@ handle_queue() {
salg=1
# if [ $sc_alg == 'WRR' ]; then
# salg=2
# fi
case "$sc_alg" in
"SP") salg=1
;;
@ -54,6 +50,14 @@ handle_queue() {
# Call tmctl which is a broadcomm command to configure queues on a port.
tmctl setqcfg --devtype 0 --if $ifname --qid $order --priority $order --weight $wgt --schedmode $salg --shapingrate $rate --burstsize $bs
else
if [ $sc_alg == 'WRR' ]; then
return
fi
if [ -z "$tc" ]; then
return
fi
# Now the mapping of p bit to a queue happens
IFS=,
for word in $tc; do
@ -69,11 +73,20 @@ handle_shaper() {
local rate
local bs
sid="$1" #queue section ID
config_get is_enable "$sid" "enable"
# no need to configure disabled queues
if [ $is_enable == '0' ]; then
return
fi
config_get ifname "$sid" "ifname"
# if ifname is empty that is good enough to break
if [ -z "$ifname" ];then
break
return
fi
config_get rate "$sid" "rate"
config_get bs "$sid" "burst_size"
tmctl setportshaper --devtype 0 --if $ifname --shapingrate $rate --burstsize $bs