This patch adds userspace DOCA offload unit tests. They can be run
with the 'make check-doca-offloads' command. More details on how to
set this up can be found in the testing.rst file.

Signed-off-by: Eelco Chaudron <[email protected]>

---
v3 changes:
  - Shared DPDK offload macros to avoid duplicate code.

v2 changes:
  - Fixed some style issues.

NOTE: This patch requires the netdev-doca series patch sent out
      earlier by Eli Britstein. With the below version it's
      passing all the tests.
      https://patchwork.ozlabs.org/project/openvswitch/list/?series=515611
---
 Documentation/topics/testing.rst        |  23 ++++++
 tests/.gitignore                        |   3 +
 tests/automake.mk                       |  25 ++++++
 tests/system-doca-offloads-macros.at    |  20 +++++
 tests/system-doca-offloads-testsuite.at |  28 +++++++
 tests/system-doca-offloads.at           | 104 ++++++++++++++++++++++++
 tests/system-dpdk-macros.at             |  10 +++
 tests/system-dpdk-offloads-macros.at    |  49 +++++++----
 tests/system-traffic.at                 |  24 +++---
 9 files changed, 256 insertions(+), 30 deletions(-)
 create mode 100644 tests/system-doca-offloads-macros.at
 create mode 100644 tests/system-doca-offloads-testsuite.at
 create mode 100644 tests/system-doca-offloads.at

diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst
index 278b5c1d0..17bcf709b 100644
--- a/Documentation/topics/testing.rst
+++ b/Documentation/topics/testing.rst
@@ -262,6 +262,8 @@ The results of the testsuite are in 
``tests/system-userspace-testsuite.dir``.
 All the features documented under `Unit Tests`_ are available for the userspace
 datapath testsuite.
 
+.. _userspace-datapath-dpdk:
+
 Userspace datapath with DPDK
 ++++++++++++++++++++++++++++
 
@@ -326,6 +328,27 @@ To invoke the DPDK offloads testsuite with the userspace 
datapath, run::
    This has only been tested on NVIDIA blades due to the limited availability
    of other blades that support rte_flow.
 
+Userspace datapath with DOCA offload
+++++++++++++++++++++++++++++++++++++
+
+To invoke the userspace datapath tests with DOCA offload,
+the same prerequisites apply as for :ref:`userspace-datapath-dpdk`.
+In addition, six Virtual Function (VF) interfaces must be preconfigured on a
+single Physical Function (PF) that supports DOCA hardware offload.
+
+This is an example on how to set this up for an NVIDIA blade on port
+``ens2f0np0``::
+
+    OVS_PF_PCI=$(basename $(readlink /sys/class/net/ens2f0np0/device))
+    echo 0 > /sys/bus/pci/devices/$OVS_PF_PCI/sriov_numvfs
+    devlink dev eswitch set pci/$OVS_PF_PCI mode switchdev
+    echo 6 > /sys/bus/pci/devices/$OVS_PF_PCI/sriov_numvfs
+
+This PF's PCI ID needs to be passed with the OVS_PF_PCI variable.
+To invoke the DOCA offloads testsuite with the userspace datapath, run::
+
+    make check-doca-offloads OVS_PF_PCI=0000:17:00.0
+
 Kernel datapath
 +++++++++++++++
 
diff --git a/tests/.gitignore b/tests/.gitignore
index b76025d9a..597c83a7f 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -32,6 +32,9 @@
 /system-offloads-testsuite
 /system-offloads-testsuite.dir/
 /system-offloads-testsuite.log
+/system-doca-offloads-testsuite
+/system-doca-offloads-testsuite.dir/
+/system-doca-offloads-testsuite.log
 /system-dpdk-offloads-testsuite
 /system-dpdk-offloads-testsuite.dir/
 /system-dpdk-offloads-testsuite.log
diff --git a/tests/automake.mk b/tests/automake.mk
index 544d91512..f2f2535b9 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -7,6 +7,7 @@ EXTRA_DIST += \
        $(SYSTEM_TSO_TESTSUITE_AT) \
        $(SYSTEM_AFXDP_TESTSUITE_AT) \
        $(SYSTEM_OFFLOADS_TESTSUITE_AT) \
+       $(SYSTEM_DOCA_OFFLOADS_TESTSUITE_AT) \
        $(SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT) \
        $(SYSTEM_DPDK_TESTSUITE_AT) \
        $(OVSDB_CLUSTER_TESTSUITE_AT) \
@@ -16,6 +17,7 @@ EXTRA_DIST += \
        $(SYSTEM_TSO_TESTSUITE) \
        $(SYSTEM_AFXDP_TESTSUITE) \
        $(SYSTEM_OFFLOADS_TESTSUITE) \
+       $(SYSTEM_DOCA_OFFLOADS_TESTSUITE) \
        $(SYSTEM_DPDK_OFFLOADS_TESTSUITE) \
        $(SYSTEM_DPDK_TESTSUITE) \
        $(OVSDB_CLUSTER_TESTSUITE) \
@@ -189,6 +191,14 @@ SYSTEM_OFFLOADS_TESTSUITE_AT = \
        tests/system-offloads-testsuite.at \
        tests/system-offloads-testsuite-macros.at
 
+SYSTEM_DOCA_OFFLOADS_TESTSUITE_AT = \
+       tests/system-common-macros.at \
+       tests/system-doca-offloads.at \
+       tests/system-doca-offloads-macros.at \
+       tests/system-doca-offloads-testsuite.at \
+       tests/system-dpdk-macros.at \
+       tests/system-dpdk-offloads-macros.at
+
 SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT = \
        tests/system-common-macros.at \
        tests/system-dpdk-macros.at \
@@ -211,6 +221,7 @@ SYSTEM_USERSPACE_TESTSUITE = 
$(srcdir)/tests/system-userspace-testsuite
 SYSTEM_TSO_TESTSUITE = $(srcdir)/tests/system-tso-testsuite
 SYSTEM_AFXDP_TESTSUITE = $(srcdir)/tests/system-afxdp-testsuite
 SYSTEM_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-offloads-testsuite
+SYSTEM_DOCA_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-doca-offloads-testsuite
 SYSTEM_DPDK_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-dpdk-offloads-testsuite
 SYSTEM_DPDK_TESTSUITE = $(srcdir)/tests/system-dpdk-testsuite
 OVSDB_CLUSTER_TESTSUITE = $(srcdir)/tests/ovsdb-cluster-testsuite
@@ -325,6 +336,12 @@ check-offloads-valgrind: all $(valgrind_wrappers) 
$(check_DATA)
        @echo 
'----------------------------------------------------------------------'
        @echo 'Valgrind output can be found in 
tests/system-offloads-testsuite.dir/*/valgrind.*'
        @echo 
'----------------------------------------------------------------------'
+check-doca-offloads-valgrind: all $(valgrind_wrappers) $(check_DATA)
+       $(SHELL) '$(SYSTEM_DOCA_OFFLOADS_TESTSUITE)' -C tests 
VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d 
$(TESTSUITEFLAGS) -j1
+       @echo
+       @echo 
'----------------------------------------------------------------------'
+       @echo 'Valgrind output can be found in 
tests/system-doca-offloads-testsuite.dir/*/valgrind.*'
+       @echo 
'----------------------------------------------------------------------'
 check-dpdk-offloads-valgrind: all $(valgrind_wrappers) $(check_DATA)
        $(SHELL) '$(SYSTEM_DPDK_OFFLOADS_TESTSUITE)' -C tests 
VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d 
$(TESTSUITEFLAGS) -j1
        @echo
@@ -373,6 +390,10 @@ check-offloads: all
        set $(SHELL) '$(SYSTEM_OFFLOADS_TESTSUITE)' -C tests  
AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
        "$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" 
--recheck)
 
+check-doca-offloads: all
+       set $(SHELL) '$(SYSTEM_DOCA_OFFLOADS_TESTSUITE)' -C tests  
AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
+       "$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" 
--recheck)
+
 check-dpdk-offloads: all
        set $(SHELL) '$(SYSTEM_DPDK_OFFLOADS_TESTSUITE)' -C tests  
AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
        "$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" 
--recheck)
@@ -415,6 +436,10 @@ $(SYSTEM_OFFLOADS_TESTSUITE): package.m4 
$(SYSTEM_TESTSUITE_AT) $(SYSTEM_OFFLOAD
        $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o [email protected] [email protected]
        $(AM_V_at)mv [email protected] $@
 
+$(SYSTEM_DOCA_OFFLOADS_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) 
$(SYSTEM_DOCA_OFFLOADS_TESTSUITE_AT) $(COMMON_MACROS_AT)
+       $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o [email protected] [email protected]
+       $(AM_V_at)mv [email protected] $@
+
 $(SYSTEM_DPDK_OFFLOADS_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) 
$(SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT) $(COMMON_MACROS_AT)
        $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o [email protected] [email protected]
        $(AM_V_at)mv [email protected] $@
diff --git a/tests/system-doca-offloads-macros.at 
b/tests/system-doca-offloads-macros.at
new file mode 100644
index 000000000..c440f1d22
--- /dev/null
+++ b/tests/system-doca-offloads-macros.at
@@ -0,0 +1,20 @@
+AT_COPYRIGHT([Copyright (c) 2026 Red Hat, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at:
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.])
+
+# The OVS_DOCA_OFFLOAD flag is defined here before including
+# system-dpdk-offloads-macros.at, so that its m4_ifdef blocks expand
+# with DOCA-specific settings.  This avoids code duplication between
+# the two offload macro files.
+m4_define([OVS_DOCA_OFFLOAD], [])
+m4_include([tests/system-dpdk-offloads-macros.at])
diff --git a/tests/system-doca-offloads-testsuite.at 
b/tests/system-doca-offloads-testsuite.at
new file mode 100644
index 000000000..f69d872bf
--- /dev/null
+++ b/tests/system-doca-offloads-testsuite.at
@@ -0,0 +1,28 @@
+AT_INIT
+
+AT_COPYRIGHT([Copyright (c) 2026 Red Hat, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at:
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.])
+
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
+
+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-doca-offloads-macros.at])
+
+m4_include([tests/system-doca-offloads.at])
+m4_include([tests/system-traffic.at])
diff --git a/tests/system-doca-offloads.at b/tests/system-doca-offloads.at
new file mode 100644
index 000000000..9de982e59
--- /dev/null
+++ b/tests/system-doca-offloads.at
@@ -0,0 +1,104 @@
+AT_COPYRIGHT([Copyright (c) 2026 Red Hat, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at:
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.])
+
+AT_BANNER([DOCA offload unit tests])
+
+AT_SETUP([doca offload - ping between two hardware offloaded ports])
+OVS_DPDK_OFFLOAD_PRE_CHECK()
+OVS_TRAFFIC_VSWITCHD_START()
+AT_CHECK([ovs-appctl vlog/set netdev_doca:dbg])
+
+AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
+ADD_NAMESPACES(at_ns0, at_ns1)
+ADD_VF(p0, at_ns0, br0, "10.1.1.1/24")
+ADD_VF(p1, at_ns1, br0, "10.1.1.2/24")
+
+NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.2 \
+                         | FORMAT_PING], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+# Once actual hardware offload is supported, type should be changed from 'ovs'
+# to 'doca,offloaded'.
+OVS_WAIT_UNTIL_EQUAL(
+  [ovs-appctl dpctl/dump-flows --names type=ovs \
+   | DUMP_DP_IP_CLEAN_SORTED], [dnl
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([doca offload - ping between six hardware offloaded ports])
+OVS_DPDK_OFFLOAD_PRE_CHECK()
+OVS_TRAFFIC_VSWITCHD_START()
+
+AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:max-idle=20000])
+ADD_NAMESPACES(at_ns0, at_ns1, at_ns2, at_ns3, at_ns4, at_ns5)
+ADD_VF(p0, at_ns0, br0, "10.1.1.1/24")
+ADD_VF(p1, at_ns1, br0, "10.1.1.2/24")
+ADD_VF(p2, at_ns2, br0, "10.1.1.3/24")
+ADD_VF(p3, at_ns3, br0, "10.1.1.4/24")
+ADD_VF(p4, at_ns4, br0, "10.1.1.5/24")
+ADD_VF(p5, at_ns5, br0, "10.1.1.6/24")
+
+for NS in $(seq 0 5); do
+    START=$((NS + 2))
+    for IP in $(seq "$START" 6); do
+        NS_CHECK_EXEC([at_ns$NS], [ping -q -c 3 -i 0.3 -W 2 10.1.1.$IP \
+                                   | FORMAT_PING], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+    done
+done
+
+# Once actual hardware offload is supported, type should be changed from 'ovs'
+# to 'doca,offloaded'.
+OVS_WAIT_UNTIL_EQUAL(
+  [ovs-appctl dpctl/dump-flows --names type=ovs \
+   | DUMP_DP_IP_CLEAN_SORTED], [dnl
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p2
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p3
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p4
+in_port(ovs-p0),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p5
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p2
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p3
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p4
+in_port(ovs-p1),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p5
+in_port(ovs-p2),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0
+in_port(ovs-p2),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p2),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p3
+in_port(ovs-p2),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p4
+in_port(ovs-p2),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p5
+in_port(ovs-p3),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0
+in_port(ovs-p3),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p3),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p2
+in_port(ovs-p3),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p4
+in_port(ovs-p3),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p5
+in_port(ovs-p4),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0
+in_port(ovs-p4),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p4),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p2
+in_port(ovs-p4),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p3
+in_port(ovs-p4),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p5
+in_port(ovs-p5),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p0
+in_port(ovs-p5),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p1
+in_port(ovs-p5),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p2
+in_port(ovs-p5),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p3
+in_port(ovs-p5),eth(macs),eth_type(0x0800),ipv4(frag=no), packets:2, 
bytes:196, used:0.0s, actions:ovs-p4])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
index 3f0df2d9b..9575c90e9 100644
--- a/tests/system-dpdk-macros.at
+++ b/tests/system-dpdk-macros.at
@@ -200,3 +200,13 @@ 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])]
 )
+
+
+# DUMP_DP_IP_CLEAN_SORTED()
+#
+# Clean up and sort the ovs-appctl dpctl/dump-flows output for comparing.
+#
+m4_define([DUMP_DP_IP_CLEAN_SORTED], [dnl
+  grep 'eth_type(0x0800)' \
+    | sed -e 
's/eth(src=[[a-z0-9:]]*,dst=[[a-z0-9:]]*)/eth(macs)/;s/recirc_id(0),//' \
+    | strip_used | strip_ptype | sort])
diff --git a/tests/system-dpdk-offloads-macros.at 
b/tests/system-dpdk-offloads-macros.at
index 3c6cce1a8..eae9130f0 100644
--- a/tests/system-dpdk-offloads-macros.at
+++ b/tests/system-dpdk-offloads-macros.at
@@ -69,11 +69,20 @@ m4_define([OVS_TRAFFIC_VSWITCHD_START],
    OVS_DPDK_OFFLOAD_PRE_CHECK()
    OVS_WAIT_WHILE([ip link show ovs-netdev])
    OVS_DPDK_START([--disable-system],
-                  [-- set Open_vSwitch . other_config:hw-offload=true $3])
+                  [m4_ifdef([OVS_DOCA_OFFLOAD],
+                    [-- set Open_vSwitch . other_config:doca-init=true dnl
+                     -- set Open_vSwitch . other_config:hw-offload=true $3],
+                    [-- set Open_vSwitch . other_config:hw-offload=true $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])
+   m4_ifdef([OVS_DOCA_OFFLOAD], [
+     pf_net=/sys/bus/pci/devices/$OVS_PF_PCI/net
+     OVS_DOCA_PF_PORT=$(basename $(ls -d $pf_net/* 2>/dev/null | head -n 1))
+     AT_CHECK([ovs-vsctl -- _ADD_BR([brPF])])
+     AT_CHECK([ovs-vsctl add-port brPF $OVS_DOCA_PF_PORT -- dnl
+               set interface $OVS_DOCA_PF_PORT type=doca])])
 ])
 
 # OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds])
@@ -108,14 +117,23 @@ m4_define([ADD_VF],
       VF=$(ovs_get_vf_port $OVS_PF_PCI $VF_IDX)
       AT_CHECK([test -n "$VF"])
 
+      m4_ifdef([OVS_DOCA_OFFLOAD], [
+        REP=$(ovs_get_representor_port $OVS_PF_PCI $VF_IDX)
+        AT_CHECK([test -n "$REP"])
+        AT_CHECK([ip link set $REP name ovs-$1 && \
+                  printf '%s\n' "$REP" > ORIG_REP_$1])])
+
       AT_CHECK([ip link set $VF down])
       AT_CHECK([ip link set $VF netns $2])
-      AT_CHECK([ip netns exec $2 ip link set $VF name $1 && printf '%s\n' 
"$VF" > ORIG_$1])
+      AT_CHECK([ip netns exec $2 ip link set $VF name $1 && \
+                printf '%s\n' "$VF" > ORIG_VF_$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:dpdk-devargs=$OVS_PF_PCI,representor=vf$VF_IDX])
+                m4_ifdef([OVS_DOCA_OFFLOAD],
+                  [set interface ovs-$1 type=doca],
+                  [set interface ovs-$1 type=dpdk -- \
+                   set interface ovs-$1 \
+                   options:dpdk-devargs=$OVS_PF_PCI,representor=vf$VF_IDX])])
       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
@@ -127,20 +145,15 @@ m4_define([ADD_VF],
       if test -n "$6"; then
         NS_CHECK_EXEC([$2], [ip route add default via $6])
       fi
-      on_exit "orig=\$(cat ORIG_$1); \
-               rm -f ORIG_$1; \
+      on_exit "orig_vf=\$(cat ORIG_VF_$1); \
+               rm -f ORIG_VF_$1; \
                ip netns exec $2 ip link set $1 down; \
-               ip netns exec $2 ip link set $1 name \"\$orig\"; \
-               ip netns exec $2 ip link set \"\$orig\" netns 1"
+               ip netns exec $2 ip link set $1 name \"\$orig_vf\"; \
+               ip netns exec $2 ip link set \"\$orig_vf\" netns 1"
+      m4_ifdef([OVS_DOCA_OFFLOAD], [
+        on_exit "orig_rep=\$(cat ORIG_REP_$1); \
+                 rm -f ORIG_REP_$1; \
+                 ip link set ovs-$1 name \"\$orig_rep\""])
     ]
 )
 m4_define([ADD_VETH], [ADD_VF($@)])
-
-# DUMP_DP_IP_CLEAN_SORTED()
-#
-# Clean up and sort the ovs-dpctl dump-flow output for comparing.
-#
-m4_define([DUMP_DP_IP_CLEAN_SORTED], [dnl
-  grep 'eth_type(0x0800)' \
-    | sed -e 
's/eth(src=[[a-z0-9:]]*,dst=[[a-z0-9:]]*)/eth(macs)/;s/recirc_id(0),//' \
-    | strip_used | strip_ptype | sort])
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 6550f90d9..fddcce88b 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -2207,9 +2207,9 @@ dnl SLOW_ACTION test1: check datapatch actions
 AT_CHECK([ovs-ofctl del-flows br0])
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
-AT_CHECK([ovs-appctl ofproto/trace br0 
"in_port=1,dl_type=0x800,dl_src=e6:66:c1:11:11:11,dl_dst=e6:66:c1:22:22:22,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,tp_src=8,tp_dst=9"],
 [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace --names br0 
"in_port=1,dl_type=0x800,dl_src=e6:66:c1:11:11:11,dl_dst=e6:66:c1:22:22:22,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,tp_src=8,tp_dst=9"],
 [0], [stdout])
 AT_CHECK([tail -3 stdout], [0],
-[Datapath actions: 
trunc(100),3,5,trunc(100),3,trunc(100),5,3,trunc(200),5,trunc(65535),3
+[Datapath actions: 
trunc(100),ovs-p1,ovs-p2,trunc(100),ovs-p1,trunc(100),ovs-p2,ovs-p1,trunc(200),ovs-p2,trunc(65535),ovs-p1
 This flow is handled by the userspace slow path because it:
   - Uses action(s) not supported by datapath.
 ])
@@ -2553,10 +2553,10 @@ AT_CHECK([ovs-ofctl add-flows --bundle br0 flows.txt])
 dnl Generate some traffic.
 NS_CHECK_EXEC([at_ns0], [ping -q -c 10 -i 0.1 -w 2 10.1.1.2], [1], [ignore])
 
-OVS_WAIT_UNTIL_EQUAL([ovs-appctl dpctl/dump-flows | grep "eth_type(0x0800)" | 
dnl
-                      strip_ptype | strip_eth | strip_recirc | strip_stats | 
dnl
-                      strip_used | sort], [dnl
-recirc_id(<recirc>),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, 
bytes:0, used:0.0s, actions:drop])
+OVS_WAIT_UNTIL_EQUAL([ovs-appctl dpctl/dump-flows --names | dnl
+                      grep "eth_type(0x0800)" | strip_ptype | strip_eth | dnl
+                      strip_recirc | strip_stats | strip_used | sort], [dnl
+recirc_id(<recirc>),in_port(ovs-p0),eth_type(0x0800),ipv4(frag=no), packets:0, 
bytes:0, used:0.0s, actions:drop])
 
 OVS_TRAFFIC_VSWITCHD_STOP(["/WARN/d"])
 AT_CLEANUP
@@ -2708,11 +2708,11 @@ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 
\
     $(ovs-ofctl compose-packet --bare 'ND_NS_PKT,nd_target=2001::1:0:392')],
   [0], [ignore])
 
-AT_CHECK([ovs-appctl dpctl/dump-flows | strip_stats | strip_used | dnl
+AT_CHECK([ovs-appctl dpctl/dump-flows --names | strip_stats | strip_used | dnl
           strip_key32 | strip_ptype | strip_eth | strip_recirc | dnl
           grep ",nd" | sort], [0], [dnl
-recirc_id(<recirc>),in_port(2),eth(src=36:b1:ee:7c:01:03,dst=36:b1:ee:7c:01:02),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=2001::1:0:392),
 packets:0, bytes:0, used:never, actions:1,3
-recirc_id(<recirc>),in_port(2),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=3000::1),
 packets:0, bytes:0, used:never, actions:drop
+recirc_id(<recirc>),in_port(ovs-p0),eth(src=36:b1:ee:7c:01:03,dst=36:b1:ee:7c:01:02),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=2001::1:0:392),
 packets:0, bytes:0, used:never, actions:br0,ovs-p1
+recirc_id(<recirc>),in_port(ovs-p0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=3000::1),
 packets:0, bytes:0, used:never, actions:drop
 ])
 
 OVS_WAIT_UNTIL([ovs-appctl dpctl/dump-flows | grep ",nd" | wc -l | grep -E ^0])
@@ -2727,11 +2727,11 @@ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 
\
     $(ovs-ofctl compose-packet --bare 'ND_NS_PKT,nd_target=3000::1')],
   [0], [ignore])
 
-AT_CHECK([ovs-appctl dpctl/dump-flows | strip_stats | strip_used | dnl
+AT_CHECK([ovs-appctl dpctl/dump-flows --names | strip_stats | strip_used | dnl
           strip_key32 | strip_ptype | strip_eth | strip_recirc | dnl
           grep ",nd" | sort], [0], [dnl
-recirc_id(<recirc>),in_port(2),eth(src=36:b1:ee:7c:01:03,dst=36:b1:ee:7c:01:02),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=2001::1:0:392),
 packets:0, bytes:0, used:never, actions:1,3
-recirc_id(<recirc>),in_port(2),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=3000::1),
 packets:0, bytes:0, used:never, actions:drop
+recirc_id(<recirc>),in_port(ovs-p0),eth(src=36:b1:ee:7c:01:03,dst=36:b1:ee:7c:01:02),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=2001::1:0:392),
 packets:0, bytes:0, used:never, actions:br0,ovs-p1
+recirc_id(<recirc>),in_port(ovs-p0),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=136),nd(target=3000::1),
 packets:0, bytes:0, used:never, actions:drop
 ])
 
 OVS_TRAFFIC_VSWITCHD_STOP
-- 
2.52.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to