mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-28 15:19:43 +08:00
Compare commits
42 Commits
ex53
...
release-5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc1bb38882 | ||
|
|
9a622d41c0 | ||
|
|
f274eda7f5 | ||
|
|
7c404c8a1e | ||
|
|
af615cc65f | ||
|
|
e63f8f36ec | ||
|
|
76c4db8bfa | ||
|
|
b5721853dd | ||
|
|
9cff7aa8a4 | ||
|
|
ef3e5adc4c | ||
|
|
cb4c41944b | ||
|
|
e5a018e3c0 | ||
|
|
a435938a5c | ||
|
|
f3584337fe | ||
|
|
4bf5c782f6 | ||
|
|
6836f6a597 | ||
|
|
972c07e63f | ||
|
|
637e508106 | ||
|
|
76a7832d48 | ||
|
|
1416e4f0c5 | ||
|
|
00f74031bb | ||
|
|
f3bc9cd9de | ||
|
|
9d60fa591a | ||
|
|
749f88ad66 | ||
|
|
cf868b2631 | ||
|
|
0b7b82bbcb | ||
|
|
8b79c93b70 | ||
|
|
41a2b33024 | ||
|
|
42130215f4 | ||
|
|
9cab9f983e | ||
|
|
a651b4af52 | ||
|
|
1c6d940543 | ||
|
|
0824a450fb | ||
|
|
3111194de3 | ||
|
|
a4a366d4fb | ||
|
|
77ac04fbba | ||
|
|
50250670d3 | ||
|
|
8fe1d9bae8 | ||
|
|
e206909e61 | ||
|
|
5123f6cdd2 | ||
|
|
f153266bbd | ||
|
|
6b69a35d00 |
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=2.6-2020-11-13
|
||||
PKG_VERSION:=3.9-2021-02-26
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=192a2f48b0d066e182e2bbe193a826487c90f11f
|
||||
PKG_SOURCE_VERSION:=0ddc89bda0a9ad254f6d41992cfb1b827e8c62c7
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=5.3.15
|
||||
PKG_VERSION:=5.3.17
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a2289131c5d1f602568a2e8cac1295442504827f
|
||||
PKG_SOURCE_VERSION:=ecb53194e101cadecfc158eb459db4539dfecd7f
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.3
|
||||
PKG_SOURCE_VERSION:=34ae1996beda98691d779e49f231bd662fc87cda
|
||||
PKG_SOURCE_VERSION:=0a2b7dd6f58eb0dc5255fee4ee3d776524b64fe9
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=5.0-2020-10-13
|
||||
PKG_VERSION:=5.0-2020-11-26
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=85ffabf799f769f9100068e887ed4f5ca8286620
|
||||
PKG_SOURCE_VERSION:=772cafc55b332555ab1c73180ccd420054823df5
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_VERSION:=2.1.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5b712be46aadc0b54cdb72464150ab58892e9c3f
|
||||
PKG_SOURCE_VERSION:=a0bcdb6eb791f5bebff4dc9024b99f51d00ed53b
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
endif
|
||||
|
||||
@@ -53,7 +53,6 @@ CONFIG_PACKAGE_libreswan=m
|
||||
CONFIG_PACKAGE_libwifi=y
|
||||
CONFIG_PACKAGE_lscpu=y
|
||||
CONFIG_PACKAGE_map=y
|
||||
CONFIG_PACKAGE_miniupnpc=y
|
||||
CONFIG_PACKAGE_miniupnpd=y
|
||||
CONFIG_PACKAGE_mwan3=y
|
||||
CONFIG_PACKAGE_nand-utils=y
|
||||
|
||||
95
iop/scripts/taas.sh
Normal file
95
iop/scripts/taas.sh
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
# Shorthand command for doing a HIL runtime smoketest on the
|
||||
# latest built image. Does the image boot up correctly?
|
||||
# More info here:
|
||||
# https://dev.iopsys.eu/iopsys/iopsys-taas
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
function taas-init() {
|
||||
local f
|
||||
|
||||
# Path to TaaS binarys. Try some likely ones.
|
||||
if ! which taas-smoketest >/dev/null; then
|
||||
PATH="${PATH}:${PWD}/../iopsys-taas/bin"
|
||||
PATH="${PATH}:${PWD}/../taas/bin"
|
||||
PATH="${PATH}:${HOME}/iopsys-taas/bin"
|
||||
PATH="${PATH}:${HOME}/taas/bin"
|
||||
PATH="${PATH}:${HOME}/bin"
|
||||
PATH="${PATH}:/opt/iopsys-taas/bin"
|
||||
PATH="${PATH}:/opt/taas/bin"
|
||||
fi
|
||||
|
||||
if ! which taas-smoketest >/dev/null; then
|
||||
echo "Error; TaaS is missing! Install it with:"
|
||||
echo "git clone git@dev.iopsys.eu:iopsys/iopsys-taas.git ../iopsys-taas"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NAND erase block size.
|
||||
nandBlkSz=$(grep CONFIG_TARGET_NAND_BLOCKSZ .config | \
|
||||
tr -s "=\"" " " | cut -d " " -f 2)
|
||||
nandBlkSz=$((nandBlkSz / 1024))
|
||||
|
||||
# Create a list of all images which might be of use.
|
||||
for f in ${PWD}/bin/targets/iopsys-*/generic/last.* \
|
||||
${PWD}/build_dir/target-arm*/bcmkernel/bcm963xx/targets/9*/bcm*_linux_raw_image_${nandBlkSz}.bin; do
|
||||
[[ -s "$f" ]] && images+=("$f")
|
||||
done
|
||||
|
||||
# Convert Iopsys target name to the TaaS product name format
|
||||
# according to what is available in the remote lab for HIL.
|
||||
# Also find a suitable image.
|
||||
product=$(grep CONFIG_TARGET_PROFILE .config | \
|
||||
tr -s "=\"" " " | cut -d " " -f 2) || exit
|
||||
case "$product" in
|
||||
smarthub3)
|
||||
export product="SmartHub3a"
|
||||
;;
|
||||
dg400prime|eg400|ex600)
|
||||
export product=$(echo -n "$product" | tr [[:lower:]] [[:upper:]])
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported target; skipping!"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${#images[@]} -eq 0 ]]; then
|
||||
echo "No image found"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
function taas-smoketest {
|
||||
declare -a images
|
||||
|
||||
taas-init || return
|
||||
echo "Testing a $product with ${images[@]}..."
|
||||
command taas-smoketest "${images[@]}" "$product" "$@"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
function taas-bootstrap {
|
||||
declare -a images
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
taas-init || return
|
||||
echo "Flashing $1..."
|
||||
command taas-bootstrap "${images[@]}" "$@"
|
||||
else
|
||||
echo "Usage: ./iop taas-bootstrap dutX"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
register_command "taas-bootstrap" "Write image to a remote lab device."
|
||||
register_command "taas-smoketest" "Write image to a remote lab device and test it."
|
||||
|
||||
@@ -253,7 +253,11 @@ config_mcast_proxy_interface() {
|
||||
echo "${p1}-proxy-interfaces $proxdevs" >> $CONFFILE
|
||||
fi
|
||||
|
||||
[ -n "$proxdevs" ] && echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
|
||||
if [ -n "$proxdevs" ]; then
|
||||
echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
|
||||
else
|
||||
echo "${p1}-mcast-interfaces $ethwan" >> $CONFFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configure_mcpd_snooping() {
|
||||
@@ -261,7 +265,7 @@ configure_mcpd_snooping() {
|
||||
local exceptions
|
||||
local filter_ip=""
|
||||
local fast_leave=0
|
||||
|
||||
|
||||
# Configure snooping related params
|
||||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_s_version $igmp_s_robustness $igmp_s_mode
|
||||
@@ -415,6 +419,22 @@ config_global_params() {
|
||||
setup_mcast_mode() {
|
||||
# set the mode at chip to allow both tagged and untagged multicast forwarding
|
||||
bs /b/c iptv lookup_method=group_ip_src_ip
|
||||
|
||||
# redirect igmp and mld traffic to host so that mcpd is the only actor on it,
|
||||
# linux snooping does not participate
|
||||
local portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||
local wanport="$(db -q get hw.board.ethernetWanPort)"
|
||||
local i=0
|
||||
for port in $portorder; do
|
||||
if [ "$wanport" == "$port" ]; then
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=wan0 ingress_filter[igmp]={enabled=yes,action=host}
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=wan0 ingress_filter[mld]={enabled=yes,action=host}
|
||||
else
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=lan$i ingress_filter[igmp]={enabled=yes,action=host}
|
||||
bdmf_shell -c `cat /var/bdmf_sh_id` -cmd /b/configure port/index=lan$i ingress_filter[mld]={enabled=yes,action=host}
|
||||
i=$(($i + 1))
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
configure_mcast() {
|
||||
|
||||
@@ -13,7 +13,7 @@ include /lib/qos
|
||||
|
||||
start_service() {
|
||||
if [ -f "/etc/config/qos" ]; then
|
||||
ubus -S call qos reload
|
||||
reload_qos
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -24,15 +24,17 @@ generate_queue(){
|
||||
fi
|
||||
|
||||
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="$i"
|
||||
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="-1"
|
||||
uci set qos.@queue[-1].burst_size="0"
|
||||
uci set qos.@queue[-1].weight="1"
|
||||
done
|
||||
|
||||
|
||||
@@ -6,27 +6,141 @@ BR_RULE=""
|
||||
is_bcm968=0
|
||||
|
||||
POLICER_COUNT=0
|
||||
INTF_NAME=""
|
||||
Q_COUNT=0
|
||||
ITER=0
|
||||
PREV_ORDER=""
|
||||
CURR_ORDER=""
|
||||
MAX_ORDER=""
|
||||
|
||||
#function to handle a queue section
|
||||
handle_queue() {
|
||||
# Function to handle a queue order and
|
||||
# update total number of queues
|
||||
handle_q_order() {
|
||||
qid="$1" #queue section ID
|
||||
|
||||
config_get is_enable "$qid" "enable"
|
||||
|
||||
#no need to configure disabled queues
|
||||
# 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 ifname is empty that is good enough to break
|
||||
if [ -z "$ifname" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
# Create precedence file containing queue order per
|
||||
# interface.
|
||||
local precedence_file="/tmp/qos/$ifname/q_order"
|
||||
local q_no=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
#lower the value, lower the priority of queue on this chip
|
||||
config_get order "$qid" "precedence"
|
||||
|
||||
config_get precedence "$qid" "precedence"
|
||||
value=${precedence}_q${q_no}
|
||||
echo $value >> $precedence_file
|
||||
|
||||
# Update the number of queues per interface.
|
||||
q_no=$((q_no + 1))
|
||||
echo $q_no > /tmp/qos/queue_stats/$ifname/q_idx
|
||||
}
|
||||
|
||||
# Function to check if values are greater than (total number
|
||||
# of queue -1) and map them to corresponding value.
|
||||
configure_precedence_to_file() {
|
||||
order="$1"
|
||||
line="$2"
|
||||
order_file="$3"
|
||||
|
||||
if [ $order == $PREV_ORDER ]; then
|
||||
queue_id=${line#*_}
|
||||
val=${CURR_ORDER}_${queue_id}
|
||||
echo $val >> $order_file
|
||||
else
|
||||
PREV_ORDER=$order
|
||||
queue_id=${line#*_}
|
||||
val=${MAX_ORDER}_${queue_id}
|
||||
echo $val >> $order_file
|
||||
CURR_ORDER=$MAX_ORDER
|
||||
MAX_ORDER=$((MAX_ORDER - 1))
|
||||
fi
|
||||
}
|
||||
|
||||
# Fucntion to map queue precedence per interface
|
||||
# ranging from 1-X to 0-(no of queues -1)
|
||||
map_queue_precedence() {
|
||||
ifname="$1"
|
||||
total_q=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
q_no=`expr $total_q - 1`
|
||||
|
||||
MAX_ORDER=$q_no
|
||||
|
||||
local precedence_file="/tmp/qos/$ifname/q_precedence"
|
||||
local order_file="/tmp/qos/$ifname/q_order"
|
||||
|
||||
sort -n -r -k1 $order_file >> $precedence_file
|
||||
rm $order_file
|
||||
|
||||
while read line
|
||||
do
|
||||
order=${line%_*}
|
||||
if [ $order -gt $q_no ]; then
|
||||
ITER=$((ITER + 1))
|
||||
configure_precedence_to_file $order $line $order_file
|
||||
else
|
||||
if [ $ITER == '0' ]; then
|
||||
echo $line >> $order_file
|
||||
else
|
||||
configure_precedence_to_file $order $line $order_file
|
||||
fi
|
||||
fi
|
||||
|
||||
done < $precedence_file
|
||||
}
|
||||
|
||||
map_precedence() {
|
||||
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||
map_queue_precedence $interf
|
||||
done
|
||||
}
|
||||
|
||||
# function to handle a queue section
|
||||
handle_queue() {
|
||||
qid="$1" #queue section ID
|
||||
|
||||
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
|
||||
return
|
||||
fi
|
||||
|
||||
# This is to get the qid per interface.
|
||||
if [ $INTF_NAME == $ifname ]; then
|
||||
Q_COUNT=$((Q_COUNT + 1))
|
||||
else
|
||||
Q_COUNT='0'
|
||||
fi
|
||||
|
||||
INTF_NAME=$ifname
|
||||
|
||||
local total_q=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
q_no=`expr $total_q - 1` local
|
||||
precedence_file="/tmp/qos/$ifname/q_order"
|
||||
|
||||
# TR181 suggests lower the precedence value higher the priority
|
||||
# but in the chip its the opposite ie lower the value, lower
|
||||
# the priority of queue on this chip. So we need to reverse the
|
||||
# precedence value.
|
||||
precedence="$(grep -i q${Q_COUNT} $precedence_file)"
|
||||
precedence=${precedence%_*}
|
||||
order=`expr $q_no - $precedence`
|
||||
|
||||
config_get sc_alg "$qid" "scheduling"
|
||||
config_get wgt "$qid" "weight"
|
||||
@@ -47,12 +161,17 @@ handle_queue() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# ignore precedence value in case of WRR
|
||||
if [ $salg -eq 2 ]; then
|
||||
order=0
|
||||
fi
|
||||
|
||||
# Call tmctl which is a broadcomm command to configure queues on a port.
|
||||
tmctl setqcfg --devtype 0 --if $ifname --qid $q_no --priority $order --qsize $qsize --weight $wgt --schedmode $salg --shapingrate $rate --burstsize $bs
|
||||
tmctl setqcfg --devtype 0 --if $ifname --qid $Q_COUNT --priority $order --qsize $qsize --weight $wgt --schedmode $salg --shapingrate $rate --burstsize $bs
|
||||
|
||||
# In BCM968 chips, the counters for queues are read, on other model, its read and reset. So, to maintain counter
|
||||
# value and uniform behaviour, we are storing counter value for each queue in files
|
||||
local d_name="/tmp/qos/queue_stats/${ifname}/q_${q_no}"
|
||||
local d_name="/tmp/qos/queue_stats/${ifname}/q_${Q_COUNT}"
|
||||
mkdir $d_name
|
||||
local f_name="$d_name/txPackets"
|
||||
touch $f_name
|
||||
@@ -67,8 +186,6 @@ handle_queue() {
|
||||
touch $f_name
|
||||
echo 0 > $f_name
|
||||
|
||||
q_no=$((q_no + 1))
|
||||
echo $q_no > /tmp/qos/queue_stats/$ifname/q_idx
|
||||
}
|
||||
|
||||
#function to handle a policer section
|
||||
@@ -201,6 +318,14 @@ broute_append_rule() {
|
||||
echo "ebtables -t broute -A qos $BR_RULE" >> /tmp/qos/classify.ebtables
|
||||
}
|
||||
|
||||
broute_rule_enable_qosmap() {
|
||||
if [ -n "$1" ]; then
|
||||
BR_RULE="$BR_RULE -i $1 -j QOSMAP --dscp2q 1"
|
||||
else
|
||||
BR_RULE="$BR_RULE -j QOSMAP --dscp2q 1"
|
||||
fi
|
||||
}
|
||||
|
||||
handle_ebtables_rules() {
|
||||
sid=$1
|
||||
local is_l2_rule=0
|
||||
@@ -212,6 +337,7 @@ handle_ebtables_rules() {
|
||||
config_get src_if "$sid" "ifname"
|
||||
config_get src_mac "$sid" "src_mac"
|
||||
config_get dst_mac "$sid" "dst_mac"
|
||||
config_get dscp_filter "$sid" "dscp_filter"
|
||||
config_get pcp_check "$sid" "pcp_check"
|
||||
config_get eth_type "$sid" "ethertype"
|
||||
config_get vid "$sid" "vid_check"
|
||||
@@ -250,6 +376,10 @@ handle_ebtables_rules() {
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$sdcp_filter" ]; then
|
||||
is_l2_rule=1
|
||||
fi
|
||||
|
||||
if [ -n "$eth_type" ]; then
|
||||
broute_filter_on_ether_type $eth_type
|
||||
is_l2_rule=1
|
||||
@@ -324,10 +454,59 @@ handle_ebtables_rules() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$dscp_filter" -a -n "$traffic_class" ]; then
|
||||
# The parameter is called pbit but broadcom internally seems to
|
||||
# treat this as traffic class, so not to be cofused with pbit in
|
||||
# vlan header here, that is tackled by the dscp2pbit vlanctl
|
||||
# which is part of the network config
|
||||
tmctl setdscptopbit --dscp "$dscp_filter" --pbit "$traffic_class"
|
||||
|
||||
# If the target in the ebtables is mark, then, then mark value
|
||||
# is the traffic class and there seems to be 1-o-1 mapping between
|
||||
# traffic class and qid, for example, if packet is marked 3, then
|
||||
# it is mapped to qid 3, following the same scheme here.
|
||||
tmctl setpbittoq --pbit "$traffic_class" --qid "$traffic_class"
|
||||
local wanport="$(db -q get hw.board.ethernetWanPort)"
|
||||
local portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||
|
||||
if [ -n "$src_if" ]; then
|
||||
# enable dscp2q mapping only for specified interfaces
|
||||
if [ "$wanport+" == "$src_if" ]; then
|
||||
# handling dowstream traffic scenario, src_if is
|
||||
# always source interface in case of qos
|
||||
for intf in $portorder; do
|
||||
if [ "$wanport" == "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
tmctl setpbittoq --devtype 0 --if "$intf"
|
||||
done
|
||||
else
|
||||
# upstream traffic scenario
|
||||
tmctl setpbittoq --devtype 0 --if "$wanport"
|
||||
fi
|
||||
else
|
||||
# enable dscp to q mapping for all ports
|
||||
for intf in $portorder; do
|
||||
tmctl setpbittoq --devtype 0 --if "$intf"
|
||||
done
|
||||
fi
|
||||
|
||||
init_broute_rule
|
||||
broute_rule_enable_qosmap $src_if
|
||||
broute_append_rule
|
||||
# dscp to traffic class mapping rule should not be used in tandem
|
||||
# with other classification criteria, seprate rules should be added
|
||||
# for each classification rule, hence we return from here in case
|
||||
# the rules is a dscp to traffic class mapping rule
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $is_l2_rule -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Check and configure dscp to queue mapping
|
||||
[ -n "$traffic_class" ] && broute_rule_set_traffic_class $traffic_class
|
||||
|
||||
[ -n "$BR_RULE" ] && broute_append_rule
|
||||
@@ -529,17 +708,16 @@ assign_policer_to_port() {
|
||||
local portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||
local wanport="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
local i=0
|
||||
for port in $portorder; do
|
||||
if [ "$ifname" == "$port" ]; then
|
||||
if [ "$wanport" == "$port" ]; then
|
||||
bs /b/configure port/index=wan0 ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
|
||||
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
|
||||
bs /b/configure port/index=lan$i ingress_rate_limit={traffic_types=8,policer={policer/dir=us,index=$pindex}}
|
||||
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}}
|
||||
fi
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
}
|
||||
|
||||
@@ -650,6 +828,28 @@ configure_shaper() {
|
||||
config_foreach handle_shaper shaper
|
||||
}
|
||||
|
||||
deconfig_dscp_to_q_mapping() {
|
||||
# reset dscp to pbit (read traffic class) map
|
||||
i=0
|
||||
while :
|
||||
do
|
||||
if [ $i -eq 64 ]; then
|
||||
break
|
||||
fi
|
||||
# by default all are mapped to pbit (read traffic class) are mapped
|
||||
# to 0
|
||||
tmctl setdscptopbit --dscp "$i" --pbit 0
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
# reset pbittoq map
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
# by default all are mapped to q 0
|
||||
tmctl setpbittoq --pbit "$i" --qid 0
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
configure_classify() {
|
||||
#processing classify section
|
||||
# First remove old files
|
||||
@@ -666,6 +866,8 @@ configure_classify() {
|
||||
#add flush chain rules
|
||||
flush_chains
|
||||
|
||||
deconfig_dscp_to_q_mapping
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_classify classify
|
||||
@@ -685,6 +887,8 @@ configure_queue() {
|
||||
rm -rf /tmp/qos/queue_stats
|
||||
|
||||
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||
rm -rf /tmp/qos/$intf
|
||||
|
||||
mkdir -p /tmp/qos/queue_stats/$intf
|
||||
touch /tmp/qos/queue_stats/$intf/q_idx
|
||||
echo 0 > /tmp/qos/queue_stats/$intf/q_idx
|
||||
@@ -692,10 +896,16 @@ configure_queue() {
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
tmctl delqcfg --devtype 0 --if $intf --qid $i &>/dev/null
|
||||
done
|
||||
|
||||
mkdir -p /tmp/qos/$intf
|
||||
touch /tmp/qos/$intf/q_order
|
||||
touch /tmp/qos/$intf/q_precedence
|
||||
done
|
||||
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_q_order queue
|
||||
map_precedence
|
||||
config_foreach handle_queue queue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user