From patchwork Wed Aug 30 08:28:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 1827604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hzGjdjB3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RbHWy5dtjz1ygM for ; Wed, 30 Aug 2023 18:29:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D3BE641BBD; Wed, 30 Aug 2023 08:29:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D3BE641BBD Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hzGjdjB3 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M5eK0ArV1wsN; Wed, 30 Aug 2023 08:29:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id BC0C941B57; Wed, 30 Aug 2023 08:29:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BC0C941B57 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1B1F4C0DD8; Wed, 30 Aug 2023 08:29:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 51FB0C0039 for ; Wed, 30 Aug 2023 08:29:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2423E416A8 for ; Wed, 30 Aug 2023 08:28:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2423E416A8 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hzGjdjB3 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5OyaVyycMAg7 for ; Wed, 30 Aug 2023 08:28:51 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id EBCD341712 for ; Wed, 30 Aug 2023 08:28:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EBCD341712 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693384129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qxTF33ZDMz9DmZ4T8M6Hh0FSiY2fe+XswvUeGyPbDG0=; b=hzGjdjB3p5h9T9mm+yvSSkxkb5hCu+X8UmL5Dji4W0p/qRG0iCZUjgKLnpF00z+3FbhN3w SaIcvzMDln25hH6CGiQozVRHtYWpOy/1BuTDv/hvuT8Glc+K2UAt4fiOE5iNNM1iRsQN8J TUVJGgG0BU+I7z0ge/bXmRIdaZd7fFM= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-EgJHf7guNcyrwKQ8iTymWw-1; Wed, 30 Aug 2023 04:28:48 -0400 X-MC-Unique: EgJHf7guNcyrwKQ8iTymWw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 36562280D202; Wed, 30 Aug 2023 08:28:48 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.206]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA8C163F6C; Wed, 30 Aug 2023 08:28:46 +0000 (UTC) From: David Marchand To: dev@openvswitch.org Date: Wed, 30 Aug 2023 10:28:22 +0200 Message-ID: <20230830082822.2168900-7-david.marchand@redhat.com> In-Reply-To: <20230830082822.2168900-1-david.marchand@redhat.com> References: <20230830082822.2168900-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH v4 7/7] system-dpdk: Run traffic tests. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 with a tap interface in the kernel, directly polled by OVS with the net/tap DPDK driver. ADD_VETH_IGNORE_LOGS is provided to filter warning logs that may be emitted (like for example, lack of DPDK multiprocess feature which OVS does not care about). This driver expects an equal number of rxq and txq. On the other hand, OVS spawns one PMD thread per numa node, and OVS reserves one txq for non PMD thread usage. This means that a net/tap port n_rxq must be set to numa_count + 1. Signed-off-by: David Marchand --- 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, --- tests/system-dpdk-macros.at | 95 ++++++++++++++++++++++++++++++++++ tests/system-dpdk-testsuite.at | 2 + tests/system-dpdk.at | 7 +-- 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at index f29b3c283f..ce8e98f475 100644 --- a/tests/system-dpdk-macros.at +++ b/tests/system-dpdk-macros.at @@ -124,3 +124,98 @@ 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";"ADD_VETH_IGNORE_LOGS";dnl +/does not exist. The Open vSwitch kernel module is probably not loaded./d"]) + AT_CHECK([:; $2]) +]) + + +m4_define([OVS_CHECK_8021AD], + [AT_SKIP_IF([:])]) + + +m4_define([OVS_CHECK_TC_QDISC], + [AT_SKIP_IF([:])]) + + +m4_define([OVS_CHECK_TCPDUMP], + [AT_SKIP_IF([:])]) + + +# Fake a veth by creating a tap on kernel side and plug it in OVS using the +# net/tap DPDK driver. +m4_define([ADD_VETH], + dnl By default, OVS starts as many PMD threads as NUMA sockets. + dnl One txq is required for each PMD thread. One additional txq is required + dnl for OVS main thread. On the other hand, a tap device expects + dnl n_rxq == n_txq. + [ n_rxq=$(lscpu | awk '/^NUMA node\(s\):/ { print $NF + 1; }') + 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:n_rxq=${n_rxq} -- \ + set interface ovs-$1 options:dpdk-devargs=net_tap$1,iface=$1]) + OVS_WAIT_UNTIL([ip link show dev $1 | grep -qw LOWER_UP]) + AT_CHECK([ip link set $1 netns $2]) + 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 + ] +) + + +# Using a net/tap port with ADD_VETH can trigger some warning logs that can be +# filtered with the following macro: +m4_define([ADD_VETH_IGNORE_LOGS], + ["dnl +/tap_nl_dump_ext_ack(): Specified qdisc kind is unknown/d +/qdisc_create_multiq(): Could not add multiq qdisc (2): No such file or directory/d +/eth_dev_tap_create(): .*: failed to create multiq qdisc./d +/eth_dev_tap_create(): Disabling rte flow support: No such file or directory/d +/tap_mp_req_on_rxtx(): Failed to send start req to secondary/d"]) + + +m4_define([CONFIGURE_VETH_OFFLOADS], + [AT_CHECK([ethtool -K $1 tx 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 e8a04d1d86..3c812fa6e3 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]) @@ -140,7 +137,7 @@ OVS_WAIT_UNTIL([grep "vHost Device '$OVS_RUNDIR/dpdkvhostuser0' has been removed dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr]) -OVS_DPDK_STOP_VSWITCHD(["dnl +OVS_DPDK_STOP_VSWITCHD([ADD_VETH_IGNORE_LOGS";dnl /VHOST_CONFIG: (.*dpdkvhostuser0) recvmsg failed/d /VHOST_CONFIG: (.*dpdkvhostuser0) failed to connect: No such file or directory/d /dpdkvhostuser ports are considered deprecated; please migrate to dpdkvhostuserclient ports./d @@ -226,7 +223,7 @@ OVS_DPDK_STOP_TESTPMD() dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) -OVS_DPDK_STOP_VSWITCHD(["dnl +OVS_DPDK_STOP_VSWITCHD([ADD_VETH_IGNORE_LOGS";dnl /VHOST_CONFIG: (.*dpdkvhostclient0) recvmsg failed/d /VHOST_CONFIG: (.*dpdkvhostclient0) failed to connect: No such file or directory/d /dpdkvhostuser ports are considered deprecated; please migrate to dpdkvhostuserclient ports./d