From: Petr Machata Date: Thu, 12 Mar 2020 23:11:00 +0000 (+0200) Subject: selftests: mlxsw: RED: Test RED ECN nodrop offload X-Git-Tag: v5.15~4200^2~167^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63f3c1d06f2597de5d68715a53f00900233ed0bd;p=platform%2Fkernel%2Flinux-starfive.git 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: Petr Machata Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh index 8f83367..0d347d4 100644 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh @@ -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 diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh index af83efe..1c36c57 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh @@ -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 diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh index b221749..558667ea 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh @@ -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