qosmngr: handle single lan port devices

update logic to read board ports to also handle devices with
single lan port
This commit is contained in:
Rahul Thakur 2024-03-19 16:34:23 +05:30
parent 8644a80d80
commit 025533f734
6 changed files with 14 additions and 14 deletions

View file

@ -101,7 +101,7 @@ handle_policer() {
# Configure policer based on UCI subtree 'qos.policer'
configure_policer() {
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
if [ -n "${intf}" ] ; then
hw_policer_set_ingress_rate "$intf" 0 0
fi

View file

@ -8,7 +8,7 @@ pre_configure_queue() {
# Delete queues
hw_queue_init_all
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
hw_intf_init "${intf}"
done
}

View file

@ -35,7 +35,7 @@ handle_shaper() {
# Configure shaper based on options saved to UCI tree 'qos.shaper'
configure_shaper() {
# Delete existing shaper
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
hw_shaper_set "$intf" del
done

View file

@ -80,7 +80,7 @@ sort_q_by_precedence() {
}
sort_by_precedence() {
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
sort_q_by_precedence $interf
done
}
@ -335,7 +335,7 @@ handle_shaper() {
assign_policer_to_port() {
local ifname="$1"
local pindex="$2"
local portorder="$(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs)"
local portorder="$(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs)"
for port in $portorder; do
if [ "$ifname" == "$port" ]; then
@ -421,7 +421,7 @@ config_ingress_rate_limit() {
configure_shaper() {
# Delete existing shaper
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
tmctl setportshaper --devtype 0 --if $intf --shapingrate 0 --burstsize -1
done
# Load UCI file
@ -432,7 +432,7 @@ configure_shaper() {
pre_configure_queue() {
# Delete queues
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
rm -rf /tmp/qos/$intf
mkdir -p /tmp/qos/$intf
@ -452,7 +452,7 @@ pre_configure_queue() {
configure_queue_shaping_rate() {
# Load UCI file
config_load qos
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
Q_COUNT=0
config_foreach handle_queue_shapingrate queue $interf
done
@ -463,7 +463,7 @@ configure_queue() {
config_load qos
config_foreach handle_q_order queue
sort_by_precedence
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
Q_COUNT=0
# sp queue have max priority value = no. of queue configured on the port
# hence read and update SP_Q_PRIO here
@ -476,7 +476,7 @@ configure_queue() {
configure_policer() {
# The policer object is not available on non BCM968* chips, just clean up
# the old config if any and return
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
local unitport="$(get_port_number $intf)"
local unit=$(echo $unitport | cut -d ' ' -f 1)
local port=$(echo $unitport | cut -d ' ' -f 2)

View file

@ -242,7 +242,7 @@ handle_ebtables_rules() {
if [ "$all_interfaces" == "1" ]; then
is_l2_rule=1
elif [ -n "$src_if" ]; then
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
if [ "$src_if" == "$interf" ]; then
src_if="$src_if+"
broute_filter_on_src_if "$src_if"

View file

@ -82,7 +82,7 @@ sort_q_by_precedence() {
}
sort_by_precedence() {
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
sort_q_by_precedence $interf
done
}
@ -384,7 +384,7 @@ config_ingress_rate_limit() {
pre_configure_queue() {
# Delete queues
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for intf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
rm -rf /tmp/qos/$intf
mkdir -p /tmp/qos/$intf
@ -463,7 +463,7 @@ configure_queue() {
bs=$(( bs / 1000 ))
}
local wanport="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.wan.device | xargs); do
for interf in $(jsonfilter -i /etc/board.json -e @.network.lan.ports[*] -e @.network.lan.device -e @.network.wan.device | xargs); do
Q_COUNT=0
rate=0
# sp queue have max priority value = no. of queue configured on the port