All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: add large ecmp group nexthop tests
@ 2020-05-27 16:41 Stephen Worley
  2020-05-27 16:52 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Worley @ 2020-05-27 16:41 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, davem, sworley1995, Stephen Worley

Add a couple large ecmp group nexthop selftests to cover
the remnant fixed by d69100b8eee27c2d60ee52df76e0b80a8d492d34.

The tests create 100 x32 ecmp groups of ipv4 and ipv6 and then
dump them. On kernels without the fix, they will fail due
to data remnant during the dump.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
---
 tools/testing/selftests/net/fib_nexthops.sh | 84 ++++++++++++++++++++-
 1 file changed, 82 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
index 51f8e9afe6ae..1e2f61262e4e 100755
--- a/tools/testing/selftests/net/fib_nexthops.sh
+++ b/tools/testing/selftests/net/fib_nexthops.sh
@@ -19,8 +19,8 @@ ret=0
 ksft_skip=4
 
 # all tests in this script. Can be overridden with -t option
-IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_compat_mode ipv4_fdb_grp_fcnal"
-IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_compat_mode ipv6_fdb_grp_fcnal"
+IPV4_TESTS="ipv4_fcnal ipv4_grp_fcnal ipv4_withv6_fcnal ipv4_fcnal_runtime ipv4_large_grp ipv4_compat_mode ipv4_fdb_grp_fcnal"
+IPV6_TESTS="ipv6_fcnal ipv6_grp_fcnal ipv6_fcnal_runtime ipv6_large_grp ipv6_compat_mode ipv6_fdb_grp_fcnal"
 
 ALL_TESTS="basic ${IPV4_TESTS} ${IPV6_TESTS}"
 TESTS="${ALL_TESTS}"
@@ -254,6 +254,60 @@ check_route6()
 	check_output "${out}" "${expected}"
 }
 
+check_large_grp()
+{
+	local ipv=$1
+	local ecmp=$2
+	local grpnum=100
+	local nhidstart=100
+	local grpidstart=1000
+	local iter=0
+	local nhidstr=""
+	local grpidstr=""
+	local grpstr=""
+	local ipstr=""
+
+	if [ $ipv -eq 4 ]; then
+		ipstr="172.16.1."
+	else
+		ipstr="2001:db8:91::"
+	fi
+
+	#
+	# Create $grpnum groups with specified $ecmp and dump them
+	#
+
+	# create nexthops with different gateways
+	iter=2
+	while [ $iter -le $(($ecmp + 1)) ]
+	do
+		nhidstr="$(($nhidstart + $iter))"
+		run_cmd "$IP nexthop add id $nhidstr via $ipstr$iter dev veth1"
+		check_nexthop "id $nhidstr" "id $nhidstr via $ipstr$iter dev veth1 scope link"
+
+		if [ $iter -le $ecmp ]; then
+			grpstr+="$nhidstr/"
+		else
+			grpstr+="$nhidstr"
+		fi
+		((iter++))
+	done
+
+	# create duplicate large ecmp groups
+	iter=0
+	while [ $iter -le $grpnum ]
+	do
+		grpidstr="$(($grpidstart + $iter))"
+		run_cmd "$IP nexthop add id $grpidstr group $grpstr"
+		check_nexthop "id $grpidstr" "id $grpidstr group $grpstr"
+		((iter++))
+	done
+
+	# dump large groups
+	run_cmd "$IP nexthop list"
+	log_test $? 0 "Dump large (x$ecmp) ecmp groups"
+}
+
 start_ip_monitor()
 {
 	local mtype=$1
@@ -700,6 +754,19 @@ ipv6_fcnal_runtime()
 	# route with src address and using nexthop - not allowed
 }
 
+ipv6_large_grp()
+{
+	local ecmp=32
+
+	echo
+	echo "IPv6 large groups (x$ecmp)"
+	echo "---------------------"
+
+	check_large_grp 6 $ecmp
+
+	$IP nexthop flush >/dev/null 2>&1
+}
+
 ipv4_fcnal()
 {
 	local rc
@@ -1066,6 +1133,19 @@ ipv4_fcnal_runtime()
 	log_test $? 0 "IPv4 route with MPLS encap, v6 gw - check"
 }
 
+ipv4_large_grp()
+{
+	local ecmp=32
+
+	echo
+	echo "IPv4 large groups (x$ecmp)"
+	echo "---------------------"
+
+	check_large_grp 4 $ecmp
+
+	$IP nexthop flush >/dev/null 2>&1
+}
+
 sysctl_nexthop_compat_mode_check()
 {
 	local sysctlname="net.ipv4.nexthop_compat_mode"

base-commit: dc0f3ed1973f101508957b59e529e03da1349e09
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next] net: add large ecmp group nexthop tests
  2020-05-27 16:41 [PATCH v2 net-next] net: add large ecmp group nexthop tests Stephen Worley
@ 2020-05-27 16:52 ` David Ahern
  2020-05-27 16:52 ` David Ahern
  2020-05-27 18:38 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2020-05-27 16:52 UTC (permalink / raw)
  To: Stephen Worley, netdev; +Cc: davem, sworley1995

On 5/27/20 10:41 AM, Stephen Worley wrote:
> Add a couple large ecmp group nexthop selftests to cover
> the remnant fixed by d69100b8eee27c2d60ee52df76e0b80a8d492d34.
> 
> The tests create 100 x32 ecmp groups of ipv4 and ipv6 and then
> dump them. On kernels without the fix, they will fail due
> to data remnant during the dump.
> 
> Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
> ---
>  tools/testing/selftests/net/fib_nexthops.sh | 84 ++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

Stephen: normally you summarize changes between versions. In this case
you only rebased so the summary would be:

v1
- rebased to top of net-next





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next] net: add large ecmp group nexthop tests
  2020-05-27 16:41 [PATCH v2 net-next] net: add large ecmp group nexthop tests Stephen Worley
  2020-05-27 16:52 ` David Ahern
@ 2020-05-27 16:52 ` David Ahern
  2020-05-27 18:38 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2020-05-27 16:52 UTC (permalink / raw)
  To: Stephen Worley, netdev; +Cc: davem, sworley1995

On 5/27/20 10:41 AM, Stephen Worley wrote:
> Add a couple large ecmp group nexthop selftests to cover
> the remnant fixed by d69100b8eee27c2d60ee52df76e0b80a8d492d34.
> 
> The tests create 100 x32 ecmp groups of ipv4 and ipv6 and then
> dump them. On kernels without the fix, they will fail due
> to data remnant during the dump.
> 
> Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
> ---
>  tools/testing/selftests/net/fib_nexthops.sh | 84 ++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

Stephen: normally you summarize changes between versions. In this case
you only rebased so the summary would be:

v2
- rebased to top of net-next





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next] net: add large ecmp group nexthop tests
  2020-05-27 16:41 [PATCH v2 net-next] net: add large ecmp group nexthop tests Stephen Worley
  2020-05-27 16:52 ` David Ahern
  2020-05-27 16:52 ` David Ahern
@ 2020-05-27 18:38 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-27 18:38 UTC (permalink / raw)
  To: sworley; +Cc: netdev, dsahern, sworley1995

From: Stephen Worley <sworley@cumulusnetworks.com>
Date: Wed, 27 May 2020 12:41:42 -0400

> Add a couple large ecmp group nexthop selftests to cover
> the remnant fixed by d69100b8eee27c2d60ee52df76e0b80a8d492d34.
> 
> The tests create 100 x32 ecmp groups of ipv4 and ipv6 and then
> dump them. On kernels without the fix, they will fail due
> to data remnant during the dump.
> 
> Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-27 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 16:41 [PATCH v2 net-next] net: add large ecmp group nexthop tests Stephen Worley
2020-05-27 16:52 ` David Ahern
2020-05-27 16:52 ` David Ahern
2020-05-27 18:38 ` David Miller

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.