mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-20 01:20:35 +08:00
Compare commits
1 Commits
sysmngr_co
...
dscp2q_dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01e23e6155 |
@@ -318,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
|
||||
@@ -329,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"
|
||||
@@ -367,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
|
||||
@@ -441,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
|
||||
@@ -767,6 +829,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
|
||||
@@ -783,6 +867,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
|
||||
|
||||
Reference in New Issue
Block a user