diff mbox series

[ovs-dev,v9,11/11] system-dpdk: Run traffic tests.

Message ID 20231120155650.36021-11-david.marchand@redhat.com
State Accepted
Delegated to: Simon Horman
Headers show
Series [ovs-dev,v9,01/11] system-dpdk: Introduce helpers for testpmd. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

David Marchand Nov. 20, 2023, 3:56 p.m. UTC
Integrate system-traffic.at tests as part of check-dpdk.

Some tests that can't work with the userspace datapath are skipped by
overriding some OVS_CHECK_* macros.

ADD_VETH is implemented using the net/af_xdp DPDK driver.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
---
Changes since v6:
- fixed some checkpatch warning,

Changes since v4:
- switched to net/af_xdp, this removes the tweaking needed for net/tap,
  and it lets existing tool relying on kernel netdevs. veth offloading
  still needs some tweaking,

Changes since v3:
- reverted --dummy-numa and opted for configuring a number of rxqs
  relevant to the number of NUMA sockets,

Changes since v2:
- added ADD_VETH_IGNORE_LOGS and moved ignored error logs to
  OVS_TRAFFIC_VSWITCHD_STOP,
- added --no-pci to DPDK options to avoid failing the tests when
  running in a vm with a virtio-net device,
- faked a mono numa/mono core so that OVS requests at max 2 txqs on
  the net/tap port,

---
 .ci/dpdk-build.sh                    |  3 +-
 .github/workflows/build-and-test.yml |  2 +-
 tests/system-dpdk-macros.at          | 77 ++++++++++++++++++++++++++++
 tests/system-dpdk-testsuite.at       |  2 +
 tests/system-dpdk.at                 |  3 --
 5 files changed, 82 insertions(+), 5 deletions(-)

Comments

David Marchand Nov. 21, 2023, 9:02 a.m. UTC | #1
On Mon, Nov 20, 2023 at 4:58 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Integrate system-traffic.at tests as part of check-dpdk.
>
> Some tests that can't work with the userspace datapath are skipped by
> overriding some OVS_CHECK_* macros.
>
> ADD_VETH is implemented using the net/af_xdp DPDK driver.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

I ran this series 10 times with no failure in GHA.
https://github.com/david-marchand/ovs/actions/runs/6882128624 (you may
browse through the 10 attempts through the "Latest #10" button in this
page though you need to be logged in)

Intel CI seems happy this time for every patch.

The robot also reported no issue when testing per patch.

SHIP IT!


Notes:
- there is an issue with "recent" glibc which will be looked at
separately to this series.
  For the detail on this topic, starting glibc 2.37 (iow Fedora 38 /
Ubuntu 23.04), dpdk logs are split at a 128 bytes boundary which
breaks log matching in the unit tests.
- this series runs fine on the dpdk-latest branch too,
Simon Horman Nov. 21, 2023, 1:44 p.m. UTC | #2
On Tue, Nov 21, 2023 at 10:02:35AM +0100, David Marchand wrote:
> On Mon, Nov 20, 2023 at 4:58 PM David Marchand
> <david.marchand@redhat.com> wrote:
> >
> > Integrate system-traffic.at tests as part of check-dpdk.
> >
> > Some tests that can't work with the userspace datapath are skipped by
> > overriding some OVS_CHECK_* macros.
> >
> > ADD_VETH is implemented using the net/af_xdp DPDK driver.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > Acked-by: Eelco Chaudron <echaudro@redhat.com>
> 
> I ran this series 10 times with no failure in GHA.
> https://github.com/david-marchand/ovs/actions/runs/6882128624 (you may
> browse through the 10 attempts through the "Latest #10" button in this
> page though you need to be logged in)
> 
> Intel CI seems happy this time for every patch.
> 
> The robot also reported no issue when testing per patch.
> 
> SHIP IT!

Thanks David,

applied.

- system-dpdk: Run traffic tests.
  https://github.com/openvswitch/ovs/commit/4e90baca89f0
- system-dpdk: Rework cleanup for vhost-user client tests.
  https://github.com/openvswitch/ovs/commit/1d0ff364b069
- system-dpdk: Refactor tests using vhost-user ports.
  https://github.com/openvswitch/ovs/commit/1c37d869c2a7
- system-dpdk: Fix race in some vhost-user client MTU test.
  https://github.com/openvswitch/ovs/commit/d0a6cf57ddee
- system-dpdk: Remove tap interfaces from vport MTU tests.
  https://github.com/openvswitch/ovs/commit/64c1d16c6aee
- netdev-afxdp: Postpone libbpf logging helper registration.
  https://github.com/openvswitch/ovs/commit/b561bbdc27a5
- system-dpdk: Refactor OVS daemons helpers.
  https://github.com/openvswitch/ovs/commit/818217eafee8
- tests: Define a macro to skip tc relying tests.
  https://github.com/openvswitch/ovs/commit/e6dd50d61549
- ci: Run DPDK tests in GitHub Actions.
  https://github.com/openvswitch/ovs/commit/ab3eca6122ad
- system-dpdk: Don't require hugetlbfs.
  https://github.com/openvswitch/ovs/commit/c488f28a0eaf
- system-dpdk: Introduce helpers for testpmd.
  https://github.com/openvswitch/ovs/commit/209667c0eef6
diff mbox series

Patch

diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
index 35540f0694..aa83e44643 100755
--- a/.ci/dpdk-build.sh
+++ b/.ci/dpdk-build.sh
@@ -38,7 +38,8 @@  function build_dpdk()
     # any DPDK driver.
     # check-dpdk unit tests requires testpmd and some net/ driver.
     DPDK_OPTS="$DPDK_OPTS -Denable_apps=test-pmd"
-    DPDK_OPTS="$DPDK_OPTS -Denable_drivers=net/null,net/tap,net/virtio"
+    enable_drivers="net/null,net/af_xdp,net/tap,net/virtio"
+    DPDK_OPTS="$DPDK_OPTS -Denable_drivers=$enable_drivers"
 
     # Install DPDK using prefix.
     DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 4f62efb7c3..09654205e7 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -5,7 +5,7 @@  on: [push, pull_request]
 jobs:
   build-dpdk:
     env:
-      dependencies: gcc libnuma-dev ninja-build
+      dependencies: gcc libbpf-dev libnuma-dev ninja-build pkgconf
       CC: gcc
       DPDK_GIT: https://dpdk.org/git/dpdk-stable
       DPDK_VER: 22.11.1
diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
index 7fedfd6515..dcdfa55741 100644
--- a/tests/system-dpdk-macros.at
+++ b/tests/system-dpdk-macros.at
@@ -127,3 +127,80 @@  m4_define([OVS_DPDK_STOP_TESTPMD],
   [AT_CHECK([kill `cat testpmd.pid`])
    OVS_WAIT([kill -0 `cat testpmd.pid`], [kill -9 `cat testpmd.pid`])
 ])
+
+
+# OVS_TRAFFIC_VSWITCHD_START([vsctl-args], [vsctl-output], [dbinit-aux-args])
+#
+# Creates a database and starts ovsdb-server, starts ovs-vswitchd
+# connected to that database, calls ovs-vsctl to create a bridge named
+# br0 with predictable settings, passing 'vsctl-args' as additional
+# commands to ovs-vsctl.  If 'vsctl-args' causes ovs-vsctl to provide
+# output (e.g. because it includes "create" commands) then 'vsctl-output'
+# specifies the expected output after filtering through uuidfilt.
+# 'dbinit-aux-args' are passed as additional commands to 'ovs-vsctl init'
+# before starting ovs-vswitchd.
+m4_define([OVS_TRAFFIC_VSWITCHD_START],
+  [
+   OVS_DPDK_PRE_CHECK()
+   OVS_WAIT_WHILE([ip link show ovs-netdev])
+   dnl For functional tests, no need for DPDK PCI probing.
+   OVS_DPDK_START([--no-pci], [--disable-system], [$3])
+   dnl Add bridges, ports, etc.
+   OVS_WAIT_WHILE([ip link show br0])
+   AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2])
+])
+
+
+# OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds])
+#
+# Gracefully stops ovs-vswitchd and ovsdb-server, checking their log files
+# for messages with severity WARN or higher and signaling an error if any
+# is present.  The optional ALLOWLIST may contain shell-quoted "sed"
+# commands to delete any warnings that are actually expected, e.g.:
+#
+#   OVS_TRAFFIC_VSWITCHD_STOP(["/expected error/d"])
+#
+# 'extra_cmds' are shell commands to be executed after OVS_VSWITCHD_STOP() is
+# invoked. They can be used to perform additional cleanups such as name space
+# removal.
+m4_define([OVS_TRAFFIC_VSWITCHD_STOP],
+  [OVS_DPDK_STOP_VSWITCHD([$1])
+   AT_CHECK([:; $2])
+])
+
+
+# Plug a veth into OVS via DPDK net/af_xdp.
+m4_define([ADD_VETH],
+    [ AT_CHECK([ip link add $1 type veth peer name ovs-$1 || return 77])
+      CONFIGURE_VETH_OFFLOADS([$1])
+      AT_CHECK([ip link set $1 netns $2])
+      AT_CHECK([ip link set dev ovs-$1 up])
+      AT_CHECK([ovs-vsctl add-port $3 ovs-$1 -- \
+                set interface ovs-$1 external-ids:iface-id="$1" -- \
+                set interface ovs-$1 type=dpdk -- \
+                set interface ovs-$1 options:dpdk-devargs=net_af_xdp$1,iface=ovs-$1])
+      NS_CHECK_EXEC([$2], [ip addr add $4 dev $1 $7])
+      NS_CHECK_EXEC([$2], [ip link set dev $1 up])
+      if test -n "$5"; then
+        NS_CHECK_EXEC([$2], [ip link set dev $1 address $5])
+      fi
+      if test -n "$6"; then
+        NS_CHECK_EXEC([$2], [ip route add default via $6])
+      fi
+      on_exit 'ip link del ovs-$1'
+    ]
+)
+
+
+m4_define([OVS_CHECK_8021AD],
+    [AT_SKIP_IF([:])])
+
+
+m4_define([OVS_CHECK_TC_QDISC],
+    [AT_SKIP_IF([:])])
+
+
+m4_define([CONFIGURE_VETH_OFFLOADS],
+    [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])
+     AT_CHECK([ethtool -K $1 txvlan off], [0], [ignore], [ignore])]
+)
diff --git a/tests/system-dpdk-testsuite.at b/tests/system-dpdk-testsuite.at
index 382f09e9ff..f61fbf9212 100644
--- a/tests/system-dpdk-testsuite.at
+++ b/tests/system-dpdk-testsuite.at
@@ -20,6 +20,8 @@  m4_include([tests/ovs-macros.at])
 m4_include([tests/ovsdb-macros.at])
 m4_include([tests/ofproto-macros.at])
 m4_include([tests/system-common-macros.at])
+m4_include([tests/system-userspace-macros.at])
 m4_include([tests/system-dpdk-macros.at])
 
 m4_include([tests/system-dpdk.at])
+m4_include([tests/system-traffic.at])
diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index 5e486d1f47..17742d20a0 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -1,6 +1,3 @@ 
-m4_define([CONFIGURE_VETH_OFFLOADS],
-   [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])])
-
 AT_BANNER([OVS-DPDK unit tests])
 
 dnl CHECK_MEMPOOL_PARAM([mtu], [numa], [+line])