* [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth
@ 2018-06-28 16:56 Petr Machata
2018-06-28 16:56 ` [PATCH net-next 1/4] selftests: forwarding: lib: Split out setup_wait_dev() Petr Machata
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Petr Machata @ 2018-06-28 16:56 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: davem, shuah
The forwarding selftests infrastructure makes it possible to run the
individual tests on a purely software netdevices. Names of interfaces to
run the test with can be passed as command line arguments to a test.
lib.sh then creates veth pairs backing the interfaces if none exist in
the system.
However, the tests need to recognize that they might be run on a soft
device. Many mirror-to-gretap tests are buggy in this regard. This patch
set aims to fix the problems in running mirror-to-gretap tests on veth
devices.
In patch #1, a service function is split out of setup_wait().
In patch #2, installing a trap is made optional.
In patch #3, tc filters in several tests are tweaked to work with veth.
In patch #4, the logic for waiting for neighbor is fixed for veth.
Petr Machata (4):
selftests: forwarding: lib: Split out setup_wait_dev()
selftests: forwarding: lib: Avoid trapping soft devices
selftests: forwarding: Tweak tc filters for mirror-to-gretap tests
selftests: forwarding: mirror_gre_changes: Fix waiting for neighbor
tools/testing/selftests/net/forwarding/lib.sh | 41 +++++++++++++++-------
.../net/forwarding/mirror_gre_bridge_1d_vlan.sh | 6 ++--
.../selftests/net/forwarding/mirror_gre_changes.sh | 11 ++----
.../selftests/net/forwarding/mirror_gre_lib.sh | 2 +-
.../net/forwarding/mirror_gre_vlan_bridge_1q.sh | 6 ++--
5 files changed, 39 insertions(+), 27 deletions(-)
--
2.4.11
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/4] selftests: forwarding: lib: Split out setup_wait_dev()
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
@ 2018-06-28 16:56 ` Petr Machata
2018-06-28 16:56 ` [PATCH net-next 2/4] selftests: forwarding: lib: Avoid trapping soft devices Petr Machata
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Petr Machata @ 2018-06-28 16:56 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: davem, shuah
Split out of setup_wait() a function setup_wait_dev() that waits for a
single device. This gives tests the opportunity to wait for a selected
device after they tinkered with its upness.
Signed-off-by: Petr Machata <petrm@mellanox.com>
---
tools/testing/selftests/net/forwarding/lib.sh | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 1dfdf14894e2..ac1df4860fbe 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -185,18 +185,25 @@ log_info()
echo "INFO: $msg"
}
+setup_wait_dev()
+{
+ local dev=$1; shift
+
+ while true; do
+ ip link show dev $dev up \
+ | grep 'state UP' &> /dev/null
+ if [[ $? -ne 0 ]]; then
+ sleep 1
+ else
+ break
+ fi
+ done
+}
+
setup_wait()
{
for i in $(eval echo {1..$NUM_NETIFS}); do
- while true; do
- ip link show dev ${NETIFS[p$i]} up \
- | grep 'state UP' &> /dev/null
- if [[ $? -ne 0 ]]; then
- sleep 1
- else
- break
- fi
- done
+ setup_wait_dev ${NETIFS[p$i]}
done
# Make sure links are ready.
--
2.4.11
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/4] selftests: forwarding: lib: Avoid trapping soft devices
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
2018-06-28 16:56 ` [PATCH net-next 1/4] selftests: forwarding: lib: Split out setup_wait_dev() Petr Machata
@ 2018-06-28 16:56 ` Petr Machata
2018-06-28 16:56 ` [PATCH net-next 3/4] selftests: forwarding: Tweak tc filters for mirror-to-gretap tests Petr Machata
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Petr Machata @ 2018-06-28 16:56 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: davem, shuah
There are several cases where traffic that would normally be forwarded
in silicon needs to be observed in slow path. That's achieved by
trapping such traffic, and the functions trap_install() and
trap_uninstall() realize that. However, such treatment is obviously
wrong if the device in question is actually a soft device not backed by
an ASIC.
Therefore try to trap if possible, but fall back to inserting a continue
if not.
Signed-off-by: Petr Machata <petrm@mellanox.com>
---
tools/testing/selftests/net/forwarding/lib.sh | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index ac1df4860fbe..d1f14f83979e 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -479,9 +479,15 @@ trap_install()
local dev=$1; shift
local direction=$1; shift
- # For slow-path testing, we need to install a trap to get to
- # slow path the packets that would otherwise be switched in HW.
- tc filter add dev $dev $direction pref 1 flower skip_sw action trap
+ # Some devices may not support or need in-hardware trapping of traffic
+ # (e.g. the veth pairs that this library creates for non-existent
+ # loopbacks). Use continue instead, so that there is a filter in there
+ # (some tests check counters), and so that other filters are still
+ # processed.
+ tc filter add dev $dev $direction pref 1 \
+ flower skip_sw action trap 2>/dev/null \
+ || tc filter add dev $dev $direction pref 1 \
+ flower action continue
}
trap_uninstall()
@@ -489,11 +495,13 @@ trap_uninstall()
local dev=$1; shift
local direction=$1; shift
- tc filter del dev $dev $direction pref 1 flower skip_sw
+ tc filter del dev $dev $direction pref 1 flower
}
slow_path_trap_install()
{
+ # For slow-path testing, we need to install a trap to get to
+ # slow path the packets that would otherwise be switched in HW.
if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
trap_install "$@"
fi
--
2.4.11
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/4] selftests: forwarding: Tweak tc filters for mirror-to-gretap tests
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
2018-06-28 16:56 ` [PATCH net-next 1/4] selftests: forwarding: lib: Split out setup_wait_dev() Petr Machata
2018-06-28 16:56 ` [PATCH net-next 2/4] selftests: forwarding: lib: Avoid trapping soft devices Petr Machata
@ 2018-06-28 16:56 ` Petr Machata
2018-06-28 16:56 ` [PATCH net-next 4/4] selftests: forwarding: mirror_gre_changes: Fix waiting for neighbor Petr Machata
2018-06-30 11:35 ` [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Petr Machata @ 2018-06-28 16:56 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: davem, shuah
When running mirror_gre_bridge_1d_vlan tests on veth, several issues
cause spurious failures:
- vlan_ethtype should be ip, not ipv6 even in mirror-to-ip6gretap case,
because the overlay packet is still IPv4.
- Similarly ip_proto matches the innermost IP protocol, so can't be used
to filter out GRE packet. Drop the corresponding condition.
- Because the above fixes the filters to match in slow path as well,
they need to be made skip_hw so as not to double-count packets.
Signed-off-by: Petr Machata <petrm@mellanox.com>
---
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh | 6 ++++--
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh | 2 +-
tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh | 6 ++++--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh
index 3bb4c2ba7b14..197e769c2ed1 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh
@@ -74,12 +74,14 @@ test_vlan_match()
test_gretap()
{
- test_vlan_match gt4 'vlan_id 555 vlan_ethtype ip' "mirror to gretap"
+ test_vlan_match gt4 'skip_hw vlan_id 555 vlan_ethtype ip' \
+ "mirror to gretap"
}
test_ip6gretap()
{
- test_vlan_match gt6 'vlan_id 555 vlan_ethtype ipv6' "mirror to ip6gretap"
+ test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ip' \
+ "mirror to ip6gretap"
}
test_gretap_stp()
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh b/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
index 619b469365be..1c18e332cd4f 100644
--- a/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
@@ -62,7 +62,7 @@ full_test_span_gre_dir_vlan_ips()
"$backward_type" "$ip1" "$ip2"
tc filter add dev $h3 ingress pref 77 prot 802.1q \
- flower $vlan_match ip_proto 0x2f \
+ flower $vlan_match \
action pass
mirror_test v$h1 $ip1 $ip2 $h3 77 10
tc filter del dev $h3 ingress pref 77
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
index 1ac5038ae256..d3e75bb6a2d8 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh
@@ -88,12 +88,14 @@ test_vlan_match()
test_gretap()
{
- test_vlan_match gt4 'vlan_id 555 vlan_ethtype ip' "mirror to gretap"
+ test_vlan_match gt4 'skip_hw vlan_id 555 vlan_ethtype ip' \
+ "mirror to gretap"
}
test_ip6gretap()
{
- test_vlan_match gt6 'vlan_id 555 vlan_ethtype ipv6' "mirror to ip6gretap"
+ test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ip' \
+ "mirror to ip6gretap"
}
test_span_gre_forbidden_cpu()
--
2.4.11
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 4/4] selftests: forwarding: mirror_gre_changes: Fix waiting for neighbor
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
` (2 preceding siblings ...)
2018-06-28 16:56 ` [PATCH net-next 3/4] selftests: forwarding: Tweak tc filters for mirror-to-gretap tests Petr Machata
@ 2018-06-28 16:56 ` Petr Machata
2018-06-30 11:35 ` [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Petr Machata @ 2018-06-28 16:56 UTC (permalink / raw)
To: netdev, linux-kselftest; +Cc: davem, shuah
When running the test on soft devices, there's no mechanism to
gratuitously start resolving the neighbor for remote tunnel endpoint.
So instead of passively waiting, wait for the device to be up, and then
probe the neighbor with a ping.
Signed-off-by: Petr Machata <petrm@mellanox.com>
---
tools/testing/selftests/net/forwarding/mirror_gre_changes.sh | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
index aa29d46186a8..135902aa8b11 100755
--- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
+++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
@@ -122,15 +122,8 @@ test_span_gre_egress_up()
# After setting the device up, wait for neighbor to get resolved so that
# we can expect mirroring to work.
ip link set dev $swp3 up
- while true; do
- ip neigh sh dev $swp3 $remote_ip nud reachable |
- grep -q ^
- if [[ $? -ne 0 ]]; then
- sleep 1
- else
- break
- fi
- done
+ setup_wait_dev $swp3
+ ping -c 1 -I $swp3 $remote_ip &>/dev/null
quick_test_span_gre_dir $tundev ingress
mirror_uninstall $swp1 ingress
--
2.4.11
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
` (3 preceding siblings ...)
2018-06-28 16:56 ` [PATCH net-next 4/4] selftests: forwarding: mirror_gre_changes: Fix waiting for neighbor Petr Machata
@ 2018-06-30 11:35 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-06-30 11:35 UTC (permalink / raw)
To: petrm; +Cc: netdev, linux-kselftest, shuah
From: Petr Machata <petrm@mellanox.com>
Date: Thu, 28 Jun 2018 18:56:15 +0200
> The forwarding selftests infrastructure makes it possible to run the
> individual tests on a purely software netdevices. Names of interfaces to
> run the test with can be passed as command line arguments to a test.
> lib.sh then creates veth pairs backing the interfaces if none exist in
> the system.
>
> However, the tests need to recognize that they might be run on a soft
> device. Many mirror-to-gretap tests are buggy in this regard. This patch
> set aims to fix the problems in running mirror-to-gretap tests on veth
> devices.
>
> In patch #1, a service function is split out of setup_wait().
> In patch #2, installing a trap is made optional.
> In patch #3, tc filters in several tests are tweaked to work with veth.
> In patch #4, the logic for waiting for neighbor is fixed for veth.
Series applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-06-30 11:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-28 16:56 [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth Petr Machata
2018-06-28 16:56 ` [PATCH net-next 1/4] selftests: forwarding: lib: Split out setup_wait_dev() Petr Machata
2018-06-28 16:56 ` [PATCH net-next 2/4] selftests: forwarding: lib: Avoid trapping soft devices Petr Machata
2018-06-28 16:56 ` [PATCH net-next 3/4] selftests: forwarding: Tweak tc filters for mirror-to-gretap tests Petr Machata
2018-06-28 16:56 ` [PATCH net-next 4/4] selftests: forwarding: mirror_gre_changes: Fix waiting for neighbor Petr Machata
2018-06-30 11:35 ` [PATCH net-next 0/4] Fixes for running mirror-to-gretap tests on veth David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).