qosmngr: resolve dscp to q mapping in L2 scenarios

This commit is contained in:
Rahul 2021-12-27 17:12:56 +05:30
parent 626e1241d6
commit 0730c65372
2 changed files with 18 additions and 1 deletions

View file

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qosmngr
PKG_VERSION:=1.0.2
PKG_VERSION:=1.0.3
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -327,6 +327,15 @@ broute_filter_on_ether_type() {
BR_RULE="$BR_RULE --proto $1"
}
broute_filter_on_dscp() {
# The broadcom option --ip-dscp-extend actually accepts tos
# 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_filter_on_vid() {
case "$BR_RULE" in
*proto*)
@ -357,6 +366,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"
@ -395,6 +405,13 @@ handle_ebtables_rules() {
is_l2_rule=1
fi
if [ -n "$dscp_filter" ]; then
# filter on ethertype and proto is same thing
broute_filter_on_ether_type IPv4
broute_filter_on_dscp $dscp_filter
is_l2_rule=1
fi
if [ -n "$eth_type" ]; then
broute_filter_on_ether_type $eth_type
is_l2_rule=1