Commit 164f0de3 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-Test-coverage-for-DSCP-leftover-fix'

Petr Machata says:

====================
mlxsw: Test coverage for DSCP leftover fix

This patch set fixes some global scope pollution issues in the DSCP tests
(in patch #1), and then proceeds (in patch #2) to add a new test for
checking whether, after DSCP prioritization rules are removed from a port,
DSCP rewrites consistently to zero, instead of the last removed rule still
staying in effect.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 70841488 d11786bb
...@@ -36,8 +36,6 @@ source $lib_dir/lib.sh ...@@ -36,8 +36,6 @@ source $lib_dir/lib.sh
h1_create() h1_create()
{ {
local dscp;
simple_if_init $h1 192.0.2.1/28 simple_if_init $h1 192.0.2.1/28
tc qdisc add dev $h1 clsact tc qdisc add dev $h1 clsact
dscp_capture_install $h1 10 dscp_capture_install $h1 10
...@@ -67,6 +65,7 @@ h2_destroy() ...@@ -67,6 +65,7 @@ h2_destroy()
dscp_map() dscp_map()
{ {
local base=$1; shift local base=$1; shift
local prio
for prio in {0..7}; do for prio in {0..7}; do
echo app=$prio,5,$((base + prio)) echo app=$prio,5,$((base + prio))
...@@ -138,6 +137,7 @@ dscp_ping_test() ...@@ -138,6 +137,7 @@ dscp_ping_test()
local prio=$1; shift local prio=$1; shift
local dev_10=$1; shift local dev_10=$1; shift
local dev_20=$1; shift local dev_20=$1; shift
local key
local dscp_10=$(((prio + 10) << 2)) local dscp_10=$(((prio + 10) << 2))
local dscp_20=$(((prio + 20) << 2)) local dscp_20=$(((prio + 20) << 2))
...@@ -175,6 +175,8 @@ dscp_ping_test() ...@@ -175,6 +175,8 @@ dscp_ping_test()
test_dscp() test_dscp()
{ {
local prio
for prio in {0..7}; do for prio in {0..7}; do
dscp_ping_test v$h1 192.0.2.1 192.0.2.2 $prio $h1 $h2 dscp_ping_test v$h1 192.0.2.1 192.0.2.2 $prio $h1 $h2
done done
......
...@@ -31,6 +31,7 @@ ALL_TESTS=" ...@@ -31,6 +31,7 @@ ALL_TESTS="
ping_ipv4 ping_ipv4
test_update test_update
test_no_update test_no_update
test_dscp_leftover
" "
lib_dir=$(dirname $0)/../../../net/forwarding lib_dir=$(dirname $0)/../../../net/forwarding
...@@ -50,10 +51,13 @@ reprioritize() ...@@ -50,10 +51,13 @@ reprioritize()
echo ${reprio[$in]} echo ${reprio[$in]}
} }
h1_create() zero()
{ {
local dscp; echo 0
}
h1_create()
{
simple_if_init $h1 192.0.2.1/28 simple_if_init $h1 192.0.2.1/28
tc qdisc add dev $h1 clsact tc qdisc add dev $h1 clsact
dscp_capture_install $h1 0 dscp_capture_install $h1 0
...@@ -87,6 +91,7 @@ h2_destroy() ...@@ -87,6 +91,7 @@ h2_destroy()
dscp_map() dscp_map()
{ {
local base=$1; shift local base=$1; shift
local prio
for prio in {0..7}; do for prio in {0..7}; do
echo app=$prio,5,$((base + prio)) echo app=$prio,5,$((base + prio))
...@@ -156,6 +161,7 @@ dscp_ping_test() ...@@ -156,6 +161,7 @@ dscp_ping_test()
local reprio=$1; shift local reprio=$1; shift
local dev1=$1; shift local dev1=$1; shift
local dev2=$1; shift local dev2=$1; shift
local i
local prio2=$($reprio $prio) # ICMP Request egress prio local prio2=$($reprio $prio) # ICMP Request egress prio
local prio3=$($reprio $prio2) # ICMP Response egress prio local prio3=$($reprio $prio2) # ICMP Response egress prio
...@@ -205,6 +211,7 @@ __test_update() ...@@ -205,6 +211,7 @@ __test_update()
{ {
local update=$1; shift local update=$1; shift
local reprio=$1; shift local reprio=$1; shift
local prio
sysctl_restore net.ipv4.ip_forward_update_priority sysctl_restore net.ipv4.ip_forward_update_priority
sysctl_set net.ipv4.ip_forward_update_priority $update sysctl_set net.ipv4.ip_forward_update_priority $update
...@@ -224,6 +231,19 @@ test_no_update() ...@@ -224,6 +231,19 @@ test_no_update()
__test_update 0 echo __test_update 0 echo
} }
# Test that when the last APP rule is removed, the prio->DSCP map is properly
# set to zeroes, and that the last APP rule does not stay active in the ASIC.
test_dscp_leftover()
{
lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null
lldpad_app_wait_del
__test_update 0 zero
lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null
lldpad_app_wait_set $swp2
}
trap cleanup EXIT trap cleanup EXIT
setup_prepare setup_prepare
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment