All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, idosch@mellanox.com,
	mlxsw@mellanox.com, shuah@kernel.org
Subject: [patch net-next 14/16] selftests: mlxsw: Reduce running time using offload indication
Date: Thu, 27 Feb 2020 08:50:19 +0100	[thread overview]
Message-ID: <20200227075021.3472-15-jiri@resnulli.us> (raw)
In-Reply-To: <20200227075021.3472-1-jiri@resnulli.us>

From: Danielle Ratson <danieller@mellanox.com>

After adding a given number of flower rules for different IPv6
addresses, the test generates traffic and ensures that each packet is
received, which is time-consuming.

Instead, test the offload indication of the tc flower rules and reduce
the running time by half.

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 .../drivers/net/mlxsw/tc_flower_scale.sh      | 31 +++++++------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh
index a6d733d2a4b4..cc0f07e72cf2 100644
--- a/tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh
@@ -2,9 +2,9 @@
 # SPDX-License-Identifier: GPL-2.0
 
 # Test for resource limit of offloaded flower rules. The test adds a given
-# number of flower matches for different IPv6 addresses, then generates traffic,
-# and ensures each was hit exactly once. This file contains functions to set up
-# a testing topology and run the test, and is meant to be sourced from a test
+# number of flower matches for different IPv6 addresses, then check the offload
+# indication for all of the tc flower rules. This file contains functions to set
+# up a testing topology and run the test, and is meant to be sourced from a test
 # script that calls the testing routine with a given number of rules.
 
 TC_FLOWER_NUM_NETIFS=2
@@ -94,22 +94,15 @@ __tc_flower_test()
 
 	tc_flower_rules_create $count $should_fail
 
-	for ((i = 0; i < count; ++i)); do
-		$MZ $h1 -q -c 1 -t ip -p 20 -b bc -6 \
-			-A 2001:db8:2::1 \
-			-B $(tc_flower_addr $i)
-	done
-
-	MISMATCHES=$(
-		tc -j -s filter show dev $h2 ingress |
-		jq -r '[ .[] | select(.kind == "flower") | .options |
-		         values as $rule | .actions[].stats.packets |
-		         select(. != 1) | "\(.) on \($rule.keys.dst_ip)" ] |
-		       join(", ")'
-	)
-
-	test -z "$MISMATCHES"
-	check_err $? "Expected to capture 1 packet for each IP, but got $MISMATCHES"
+	offload_count=$(tc -j -s filter show dev $h2 ingress    |
+			jq -r '[ .[] | select(.kind == "flower") |
+			.options | .in_hw ]' | jq .[] | wc -l)
+	[[ $((offload_count - 1)) -eq $count ]]
+	if [[ $should_fail -eq 0 ]]; then
+		check_err $? "Offload mismatch"
+	else
+		check_err_fail $should_fail $? "Offload more than expacted"
+	fi
 }
 
 tc_flower_test()
-- 
2.21.1


  parent reply	other threads:[~2020-02-27  7:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27  7:50 [patch net-next 00/16] selftests: updates for mlxsw driver test Jiri Pirko
2020-02-27  7:50 ` [patch net-next 01/16] selftests: forwarding: lib.sh: Add start_tcp_traffic Jiri Pirko
2020-02-27  7:50 ` [patch net-next 02/16] selftests: mlxsw: Add a RED selftest Jiri Pirko
2020-02-27  7:50 ` [patch net-next 03/16] selftests: add egress redirect test to mlxsw tc flower restrictions Jiri Pirko
2020-02-27  7:50 ` [patch net-next 04/16] selftests: add a mirror " Jiri Pirko
2020-02-27  7:50 ` [patch net-next 05/16] selftests: devlink_trap_l3_drops: Avoid race condition Jiri Pirko
2020-02-27  7:50 ` [patch net-next 06/16] selftests: mlxsw: Use busywait helper in blackhole routes test Jiri Pirko
2020-02-27  7:50 ` [patch net-next 07/16] selftests: mlxsw: Use busywait helper in vxlan test Jiri Pirko
2020-02-27  7:50 ` [patch net-next 08/16] selftests: mlxsw: Use busywait helper in rtnetlink test Jiri Pirko
2020-02-27  7:50 ` [patch net-next 09/16] selftests: mlxsw: Add shared buffer configuration test Jiri Pirko
2020-02-27  7:50 ` [patch net-next 10/16] selftests: devlink_lib: Check devlink info command is supported Jiri Pirko
2020-02-27  7:50 ` [patch net-next 11/16] selftests: devlink_lib: Add devlink port helpers Jiri Pirko
2020-02-27  7:50 ` [patch net-next 12/16] selftests: mlxsw: Add mlxsw lib Jiri Pirko
2020-02-27  7:50 ` [patch net-next 13/16] selftests: mlxsw: Add shared buffer traffic test Jiri Pirko
2020-02-27  7:50 ` Jiri Pirko [this message]
2020-02-27  7:50 ` [patch net-next 15/16] selftests: mlxsw: Reduce router scale running time using offload indication Jiri Pirko
2020-02-27  7:50 ` [patch net-next 16/16] selftests: mlxsw: resource_scale: Invoke for Spectrum-3 Jiri Pirko
2020-02-27 19:11 ` [patch net-next 00/16] selftests: updates for mlxsw driver test David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200227075021.3472-15-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.