From d30c1615caa4e3227eb492cfd421fcd56c41e375 Mon Sep 17 00:00:00 2001 From: subramanian c Date: Thu, 20 Apr 2023 05:36:26 +0000 Subject: [PATCH] qosmngr: qos q map based on traffic class --- .../files/airoha/lib/qos/{common => }/chains.ebtables.sh | 0 qosmngr/files/airoha/lib/qos/chains.iptables.sh | 6 ++++++ qosmngr/files/airoha/lib/qos/{common => }/policer.sh | 0 qosmngr/files/airoha/lib/qos/qos.sh | 9 +++++---- qosmngr/files/airoha/lib/qos/{common => }/queue.sh | 0 qosmngr/files/airoha/lib/qos/{common => }/shaper.sh | 0 qosmngr/files/broadcom/lib/qos/qos.sh | 4 ++++ qosmngr/files/common/lib/qos/iptables.sh | 4 ---- qosmngr/files/linux/lib/qos/qos.sh | 4 ++++ 9 files changed, 19 insertions(+), 8 deletions(-) rename qosmngr/files/airoha/lib/qos/{common => }/chains.ebtables.sh (100%) create mode 100755 qosmngr/files/airoha/lib/qos/chains.iptables.sh rename qosmngr/files/airoha/lib/qos/{common => }/policer.sh (100%) rename qosmngr/files/airoha/lib/qos/{common => }/queue.sh (100%) rename qosmngr/files/airoha/lib/qos/{common => }/shaper.sh (100%) diff --git a/qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh b/qosmngr/files/airoha/lib/qos/chains.ebtables.sh similarity index 100% rename from qosmngr/files/airoha/lib/qos/common/chains.ebtables.sh rename to qosmngr/files/airoha/lib/qos/chains.ebtables.sh diff --git a/qosmngr/files/airoha/lib/qos/chains.iptables.sh b/qosmngr/files/airoha/lib/qos/chains.iptables.sh new file mode 100755 index 000000000..d9ade22a0 --- /dev/null +++ b/qosmngr/files/airoha/lib/qos/chains.iptables.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Install iptables rules + +iptables_set_traffic_class() { + IP_RULE="$IP_RULE -j MARK --set-xmark 0x${1}0/0xF0" +} diff --git a/qosmngr/files/airoha/lib/qos/common/policer.sh b/qosmngr/files/airoha/lib/qos/policer.sh similarity index 100% rename from qosmngr/files/airoha/lib/qos/common/policer.sh rename to qosmngr/files/airoha/lib/qos/policer.sh diff --git a/qosmngr/files/airoha/lib/qos/qos.sh b/qosmngr/files/airoha/lib/qos/qos.sh index bddfe6540..9e58e032a 100755 --- a/qosmngr/files/airoha/lib/qos/qos.sh +++ b/qosmngr/files/airoha/lib/qos/qos.sh @@ -5,13 +5,14 @@ include /lib/ethernet . /lib/qos/iptables.sh -. /lib/qos/common/chains.ebtables.sh +. /lib/qos/chains.ebtables.sh +. /lib/qos/chains.iptables.sh . /lib/qos/ebtables.sh . /lib/qos/ip_rule.sh . /lib/qos/classify.sh -. /lib/qos/common/policer.sh -. /lib/qos/common/queue.sh -. /lib/qos/common/shaper.sh +. /lib/qos/policer.sh +. /lib/qos/queue.sh +. /lib/qos/shaper.sh . /lib/qos/airoha.sh get_rate_per_queue() { diff --git a/qosmngr/files/airoha/lib/qos/common/queue.sh b/qosmngr/files/airoha/lib/qos/queue.sh similarity index 100% rename from qosmngr/files/airoha/lib/qos/common/queue.sh rename to qosmngr/files/airoha/lib/qos/queue.sh diff --git a/qosmngr/files/airoha/lib/qos/common/shaper.sh b/qosmngr/files/airoha/lib/qos/shaper.sh similarity index 100% rename from qosmngr/files/airoha/lib/qos/common/shaper.sh rename to qosmngr/files/airoha/lib/qos/shaper.sh diff --git a/qosmngr/files/broadcom/lib/qos/qos.sh b/qosmngr/files/broadcom/lib/qos/qos.sh index 1c26d2cce..6f03667f1 100755 --- a/qosmngr/files/broadcom/lib/qos/qos.sh +++ b/qosmngr/files/broadcom/lib/qos/qos.sh @@ -176,6 +176,10 @@ handle_queue() { Q_COUNT=$((Q_COUNT + 1)) } +iptables_set_traffic_class() { + IP_RULE="$IP_RULE -j MARK --set-xmark 0x$1/0x$1" +} + ebt_match_ipv6_dscp() { #when ethertype is not configured by user then both proto rules of ipv4 #and ipv6 to be installed so update BR6_RULE string as well otherwise diff --git a/qosmngr/files/common/lib/qos/iptables.sh b/qosmngr/files/common/lib/qos/iptables.sh index 0418ac8b0..ad8535a33 100755 --- a/qosmngr/files/common/lib/qos/iptables.sh +++ b/qosmngr/files/common/lib/qos/iptables.sh @@ -55,10 +55,6 @@ iptables_set_dscp_mark() { IP_RULE="$IP_RULE -j DSCP --set-dscp $1" } -iptables_set_traffic_class() { - IP_RULE="$IP_RULE -j MARK --set-xmark 0x${1}0/0xF0" -} - append_rule_to_mangle_table() { if [ "$2" == 4 ]; then echo "iptables -w -t mangle -A $1 $IP_RULE" >> /tmp/qos/classify.iptables diff --git a/qosmngr/files/linux/lib/qos/qos.sh b/qosmngr/files/linux/lib/qos/qos.sh index 77dae1c43..b55fe18a9 100755 --- a/qosmngr/files/linux/lib/qos/qos.sh +++ b/qosmngr/files/linux/lib/qos/qos.sh @@ -151,6 +151,10 @@ handle_queue() { Q_COUNT=$((Q_COUNT + 1)) } +iptables_set_traffic_class() { + IP_RULE="$IP_RULE -j MARK --set-mark $1" +} + ebt_match_ipv6_dscp() { #when ethertype is not configured by user then both proto rules of ipv4 #and ipv6 to be installed so update BR6_RULE string as well otherwise