mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 11:05:02 +08:00
Compare commits
1 Commits
netmode_de
...
qos_dscp_c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07f501a845 |
@@ -346,6 +346,14 @@ broute_append_rule() {
|
||||
echo "ebtables -t broute -A qos $BR_RULE" >> /tmp/qos/classify.ebtables
|
||||
}
|
||||
|
||||
broute_rule_enable_qosmap() {
|
||||
if [ -n "$1" -a -n "$2" ]; then
|
||||
BR_RULE="$BR_RULE -i $1 -j QOSMAP --dscp2pbit 1 --dscp2q 1 --proto $2"
|
||||
else
|
||||
BR_RULE="$BR_RULE -j QOSMAP --dscp2pbit 1 --dscp2q 1 --proto $1"
|
||||
fi
|
||||
}
|
||||
|
||||
handle_ebtables_rules() {
|
||||
sid=$1
|
||||
local is_l2_rule=0
|
||||
@@ -367,6 +375,7 @@ handle_ebtables_rules() {
|
||||
config_get dst_clid "$sid" "dst_client_id" # dhcp option 61
|
||||
config_get src_ucid "$sid" "src_user_class_id" # dhcp option 77
|
||||
config_get dst_ucid "$sid" "dst_user_class_id" # dhcp option 77
|
||||
config_get dscp_filter "$sid" "dscp_filter"
|
||||
|
||||
config_get traffic_class "$sid" "traffic_class"
|
||||
|
||||
@@ -469,6 +478,57 @@ 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 "IPV4"
|
||||
broute_append_rule
|
||||
init_broute_rule
|
||||
broute_rule_enable_qosmap $src_if "IPV6"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user