Commit 104f3e2e authored by Markus Gothe's avatar Markus Gothe 👌 Committed by Rahul Thakur
Browse files

qosmngr: updated broadcom.sh to get the ports from the runner.

When using the runner accelerator we need to check how to
map between ethernet interfaces (i.e eth0) and the internal
names used by the runner (i.e. port/index=lan2). Depending on
the hardware the mapping is not always 1:1 as assumed earlier.

This commit also fixes a minor bug with resetting traffic
shaping for the archer accelerator.
parent d2987573
......@@ -673,17 +673,20 @@ assign_policer_to_port() {
local pindex="$2"
local portorder="$(db -q get hw.board.ethernetPortOrder)"
local wanport="$(db -q get hw.board.ethernetWanPort)"
local runner_lan_ports="$(bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/examine port | grep ': port/index=lan' | sed -e 's#\.##g' | cut -f2 -d' ' | sort -u | xargs)"
local i=1
for port in $portorder; do
if [ "$ifname" == "$port" ]; then
if [ "$wanport" == "$port" ]; then
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=wan0 ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
else
local i="${port: -1}"
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=lan$i ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
local lanport="$(echo -n "$runner_lan_ports" | cut -f${i} -d' ')"
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure $lanport ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
fi
break
fi
i=$((i+1))
done
}
......@@ -747,11 +750,6 @@ config_ingress_rate_limit() {
local in_burst_size=$3
local wanport="$(db -q get hw.board.ethernetWanPort)"
if [ "$ifname" == "$wanport" ]; then
logger -t qosmngr "policing is not support on port $ifname"
return
fi
# Unit in uci file is in bps while that accepted by ethswctl is kbits
if [ $ingress_rate -lt 1000 ]; then
return
......@@ -766,8 +764,8 @@ config_ingress_rate_limit() {
fi
local unitport="$(get_port_number $ifname)"
local unit=$(echo $unitport | cut -d ' ' -f 1)
local port=$(echo $unitport | cut -d ' ' -f 2)
local unit=$(echo $unitport | cut -d ' ' -f 1)
local port=$(echo $unitport | cut -d ' ' -f 2)
ethswctl -c rxratectrl -n $unit -p $port -x $ingress_rate -y $in_burst_size
}
......@@ -864,7 +862,7 @@ configure_policer() {
local port=$(echo $unitport | cut -d ' ' -f 2)
# setting rate and burst size to 0 disables rate limiting
if [ $port != "" -a $unit != "" ]; then
ethswctl -c rxratectrl -n $unit -p $intf -x 0 -y 0
ethswctl -c rxratectrl -n $unit -p $port -x 0 -y 0
fi
done
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment