qosmngr: Fix filtering on TOS field for non-Broadcom platforms.

This commit is contained in:
Markus Gothe 2024-04-18 19:32:44 +02:00 committed by Erik Karlsson
parent 0787af4769
commit 5ec644e052
2 changed files with 17 additions and 8 deletions

View file

@ -16,6 +16,10 @@ broute_rule_set_traffic_class() {
fi fi
} }
broute_filter_on_dscp() {
BR_RULE="$BR_RULE --ip-tos $1"
}
broute_ipv4_rule_options() broute_ipv4_rule_options()
{ {
local cid="$1" local cid="$1"
@ -25,7 +29,12 @@ broute_ipv4_rule_options()
set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip set_ip_addr "$cid" ebt_match_src_ip ebt_match_dst_ip
if [ -n "$dscp_filter" ]; then if [ -n "$dscp_filter" ]; then
echo "DSCP filter is not supporter" local tos_val
local tos_hex
tos_val=$((dscp_filter<<2))
tos_hex=$(printf "%x" $tos_val)
broute_filter_on_dscp "$tos_hex"
fi fi
if [ -n "$protocol" ]; then if [ -n "$protocol" ]; then

View file

@ -220,12 +220,7 @@ ebt_match_ipv6_dscp() {
} }
broute_filter_on_dscp() { broute_filter_on_dscp() {
# The broadcom option --ip-dscp-extend actually accepts tos BR_RULE="$BR_RULE --ip-tos $1"
# and not dscp and that too in hex, hence, perform the conversion
# from dscp in uci to tos first and then convert to hex
tos_val=$(($1<<2))
tos_hex=$(printf "%x" $tos_val)
BR_RULE="$BR_RULE --ip-dscp-extend $tos_hex"
} }
broute_ipv4_rule_options() broute_ipv4_rule_options()
@ -237,7 +232,12 @@ broute_ipv4_rule_options()
set_ip_addr $cid ebt_match_src_ip ebt_match_dst_ip set_ip_addr $cid ebt_match_src_ip ebt_match_dst_ip
if [ ! -z $dscp_filter ]; then if [ ! -z $dscp_filter ]; then
broute_filter_on_dscp "$dscp_filter" local tos_val
local tos_hex
tos_val=$((dscp_filter<<2))
tos_hex=$(printf "%x" $tos_val)
broute_filter_on_dscp "$tos_hex"
fi fi
if [ ! -z $protocol ]; then if [ ! -z $protocol ]; then