Skip to content

Commit

Permalink
selftests: forwarding: Move DSCP capture to lib.sh
Browse files Browse the repository at this point in the history
dscp_capture_install() and dscp_capture_uninstall() are going to be
useful for a test added by a following patch, move them therefore to
lib.sh together with related helpers.

While doing so, change the rule preference from mere DSCP value to
DSCP+100 in order to support adding captures of packets with DSCP of 0.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
pmachata authored and davem330 committed Aug 1, 2018
1 parent 989133b commit cf60869
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
42 changes: 0 additions & 42 deletions tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,6 @@ lib_dir=$(dirname $0)/../../../net/forwarding
NUM_NETIFS=4
source $lib_dir/lib.sh

__dscp_capture_add_del()
{
local add_del=$1; shift
local dev=$1; shift
local base=$1; shift
local dscp;

for prio in {0..7}; do
dscp=$((base + prio))
__icmp_capture_add_del $add_del $dscp "" $dev \
"ip_tos $((dscp << 2))"
done
}

dscp_capture_install()
{
local dev=$1; shift
local base=$1; shift

__dscp_capture_add_del add $dev $base
}

dscp_capture_uninstall()
{
local dev=$1; shift
local base=$1; shift

__dscp_capture_add_del del $dev $base
}

h1_create()
{
local dscp;
Expand Down Expand Up @@ -155,18 +125,6 @@ cleanup()
vrf_cleanup
}

dscp_fetch_stats()
{
local dev=$1; shift
local base=$1; shift

for prio in {0..7}; do
local dscp=$((base + prio))
local t=$(tc_rule_stats_get $dev $dscp)
echo "[$dscp]=$t "
done
}

ping_ipv4()
{
ping_test $h1 192.0.2.2
Expand Down
42 changes: 42 additions & 0 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,48 @@ vlan_capture_uninstall()
__vlan_capture_add_del del 100 "$@"
}

__dscp_capture_add_del()
{
local add_del=$1; shift
local dev=$1; shift
local base=$1; shift
local dscp;

for prio in {0..7}; do
dscp=$((base + prio))
__icmp_capture_add_del $add_del $((dscp + 100)) "" $dev \
"skip_hw ip_tos $((dscp << 2))"
done
}

dscp_capture_install()
{
local dev=$1; shift
local base=$1; shift

__dscp_capture_add_del add $dev $base
}

dscp_capture_uninstall()
{
local dev=$1; shift
local base=$1; shift

__dscp_capture_add_del del $dev $base
}

dscp_fetch_stats()
{
local dev=$1; shift
local base=$1; shift

for prio in {0..7}; do
local dscp=$((base + prio))
local t=$(tc_rule_stats_get $dev $((dscp + 100)))
echo "[$dscp]=$t "
done
}

matchall_sink_create()
{
local dev=$1; shift
Expand Down

0 comments on commit cf60869

Please sign in to comment.