Commit 63f3c1d0 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: mlxsw: RED: Test RED ECN nodrop offload

Extend RED testsuite to cover the new nodrop mode of RED-ECN. This test is
really similar to ECN test, diverging only in the last step, where UDP
traffic should go to backlog instead of being dropped. Thus extract a
common helper, ecn_test_common(), make do_ecn_test() into a relatively
simple wrapper, and add another one, do_ecn_nodrop_test().
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 058e56ac
......@@ -389,17 +389,14 @@ check_marking()
((pct $cond))
}
do_ecn_test()
ecn_test_common()
{
local name=$1; shift
local vlan=$1; shift
local limit=$1; shift
local backlog
local pct
# Main stream.
start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
$h3_mac tos=0x01
# Build the below-the-limit backlog using UDP. We could use TCP just
# fine, but this way we get a proof that UDP is accepted when queue
# length is below the limit. The main stream is using TCP, and if the
......@@ -409,7 +406,7 @@ do_ecn_test()
check_err $? "Could not build the requested backlog"
pct=$(check_marking $vlan "== 0")
check_err $? "backlog $backlog / $limit Got $pct% marked packets, expected == 0."
log_test "TC $((vlan - 10)): ECN backlog < limit"
log_test "TC $((vlan - 10)): $name backlog < limit"
# Now push TCP, because non-TCP traffic would be early-dropped after the
# backlog crosses the limit, and we want to make sure that the backlog
......@@ -419,7 +416,20 @@ do_ecn_test()
check_err $? "Could not build the requested backlog"
pct=$(check_marking $vlan ">= 95")
check_err $? "backlog $backlog / $limit Got $pct% marked packets, expected >= 95."
log_test "TC $((vlan - 10)): ECN backlog > limit"
log_test "TC $((vlan - 10)): $name backlog > limit"
}
do_ecn_test()
{
local vlan=$1; shift
local limit=$1; shift
local name=ECN
start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
$h3_mac tos=0x01
sleep 1
ecn_test_common "$name" $vlan $limit
# Up there we saw that UDP gets accepted when backlog is below the
# limit. Now that it is above, it should all get dropped, and backlog
......@@ -427,7 +437,31 @@ do_ecn_test()
RET=0
build_backlog $vlan $((2 * limit)) udp >/dev/null
check_fail $? "UDP traffic went into backlog instead of being early-dropped"
log_test "TC $((vlan - 10)): ECN backlog > limit: UDP early-dropped"
log_test "TC $((vlan - 10)): $name backlog > limit: UDP early-dropped"
stop_traffic
sleep 1
}
do_ecn_nodrop_test()
{
local vlan=$1; shift
local limit=$1; shift
local name="ECN nodrop"
start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
$h3_mac tos=0x01
sleep 1
ecn_test_common "$name" $vlan $limit
# Up there we saw that UDP gets accepted when backlog is below the
# limit. Now that it is above, in nodrop mode, make sure it goes to
# backlog as well.
RET=0
build_backlog $vlan $((2 * limit)) udp >/dev/null
check_err $? "UDP traffic was early-dropped instead of getting into backlog"
log_test "TC $((vlan - 10)): $name backlog > limit: UDP not dropped"
stop_traffic
sleep 1
......
......@@ -4,6 +4,7 @@
ALL_TESTS="
ping_ipv4
ecn_test
ecn_nodrop_test
red_test
mc_backlog_test
"
......@@ -50,6 +51,16 @@ ecn_test()
uninstall_qdisc
}
ecn_nodrop_test()
{
install_qdisc ecn nodrop
do_ecn_nodrop_test 10 $BACKLOG1
do_ecn_nodrop_test 11 $BACKLOG2
uninstall_qdisc
}
red_test()
{
install_qdisc
......
......@@ -4,6 +4,7 @@
ALL_TESTS="
ping_ipv4
ecn_test
ecn_nodrop_test
red_test
mc_backlog_test
"
......@@ -33,6 +34,13 @@ ecn_test()
uninstall_qdisc
}
ecn_nodrop_test()
{
install_qdisc ecn nodrop
do_ecn_nodrop_test 10 $BACKLOG
uninstall_qdisc
}
red_test()
{
install_qdisc
......
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