Skip to content

Commit 289e9f6

Browse files
chaudronigsilya
authored andcommitted
tests: Add a simple DPDK rte_flow test framework.
This patch adds userspace DPDK with rte_flow offload unit tests. It can be run with the 'make check-dpdk-offloads' command; however, it requires a list of VFs that can be used for offloaded ports. More details on how to set this up can be found in the testing.rst file. Also note that currently not all tests are passing. This is true for both the old and the new offload infrastructure: - datapath - ping over ip6gre L2 tunnel This test appears to be failing because the hardware offload NIC is not properly handling checksum offloads. Specifically, the L4 checksum is not updated, and as a result the kernel drops the packets. - mpls - decap header dp-support - mpls - decap header slow-path These two tests fail due to side traffic: an IPv6 drop rule gets installed in hardware. However, this rule also drops MPLS-encapsulated IPv6 traffic. This appears to be a bug specific to the hardware offload NIC in use. Acked-by: Eli Britstein <elibr@nvidia.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
1 parent 90b6e83 commit 289e9f6

12 files changed

+568
-5
lines changed

Documentation/topics/testing.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,25 @@ manual to figure out how to `Configure hugepages`_.
363363
All the features documented under `Unit Tests`_ are available for the DPDK
364364
testsuite.
365365

366+
Userspace datapath with DPDK offload
367+
''''''''''''''''''''''''''''''''''''
368+
369+
To invoke the userspace datapath tests with DPDK and its rte_flow offload,
370+
the same prerequisites apply as above. In addition, six Virtual Function (VF)
371+
interfaces must be preconfigured and capable of hardware offloading traffic
372+
between each other.
373+
374+
These six VFs need to be passed as a list of PF PCI addresses with their
375+
corresponding VF indexes in the OVS_DPDK_VF_PCI_ADDRS variable.
376+
For example::
377+
378+
OVS_DPDK_VF_PCI_ADDRS="0000:17:00.0,0 0000:17:00.0,1 0000:17:00.0,2 0000:17:00.0,3 0000:17:00.0,4 0000:17:00.0,5"
379+
380+
To invoke the dpdk offloads testsuite with the userspace datapath, run::
381+
382+
make check-dpdk-offloads \
383+
OVS_DPDK_VF_PCI_ADDRS="0000:17:00.0,0 0000:17:00.0,1 0000:17:00.0,2 0000:17:00.0,3 0000:17:00.0,4 0000:17:00.0,5"
384+
366385
Userspace datapath: Testing and Validation of CPU-specific Optimizations
367386
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
368387

tests/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
/system-offloads-testsuite
3333
/system-offloads-testsuite.dir/
3434
/system-offloads-testsuite.log
35+
/system-dpdk-offloads-testsuite
36+
/system-dpdk-offloads-testsuite.dir/
37+
/system-dpdk-offloads-testsuite.log
3538
/test-aes128
3639
/test-atomic
3740
/test-bundle

tests/automake.mk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ EXTRA_DIST += \
77
$(SYSTEM_TSO_TESTSUITE_AT) \
88
$(SYSTEM_AFXDP_TESTSUITE_AT) \
99
$(SYSTEM_OFFLOADS_TESTSUITE_AT) \
10+
$(SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT) \
1011
$(SYSTEM_DPDK_TESTSUITE_AT) \
1112
$(OVSDB_CLUSTER_TESTSUITE_AT) \
1213
$(TESTSUITE) \
@@ -15,6 +16,7 @@ EXTRA_DIST += \
1516
$(SYSTEM_TSO_TESTSUITE) \
1617
$(SYSTEM_AFXDP_TESTSUITE) \
1718
$(SYSTEM_OFFLOADS_TESTSUITE) \
19+
$(SYSTEM_DPDK_OFFLOADS_TESTSUITE) \
1820
$(SYSTEM_DPDK_TESTSUITE) \
1921
$(OVSDB_CLUSTER_TESTSUITE) \
2022
tests/atlocal.in \
@@ -186,6 +188,13 @@ SYSTEM_OFFLOADS_TESTSUITE_AT = \
186188
tests/system-offloads-testsuite.at \
187189
tests/system-offloads-testsuite-macros.at
188190

191+
SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT = \
192+
tests/system-common-macros.at \
193+
tests/system-dpdk-macros.at \
194+
tests/system-dpdk-offloads.at \
195+
tests/system-dpdk-offloads-macros.at \
196+
tests/system-dpdk-offloads-testsuite.at
197+
189198
SYSTEM_DPDK_TESTSUITE_AT = \
190199
tests/system-common-macros.at \
191200
tests/system-dpdk-macros.at \
@@ -202,6 +211,7 @@ SYSTEM_USERSPACE_TESTSUITE = $(srcdir)/tests/system-userspace-testsuite
202211
SYSTEM_TSO_TESTSUITE = $(srcdir)/tests/system-tso-testsuite
203212
SYSTEM_AFXDP_TESTSUITE = $(srcdir)/tests/system-afxdp-testsuite
204213
SYSTEM_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-offloads-testsuite
214+
SYSTEM_DPDK_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-dpdk-offloads-testsuite
205215
SYSTEM_DPDK_TESTSUITE = $(srcdir)/tests/system-dpdk-testsuite
206216
OVSDB_CLUSTER_TESTSUITE = $(srcdir)/tests/ovsdb-cluster-testsuite
207217
DISTCLEANFILES += tests/atconfig tests/atlocal
@@ -315,6 +325,12 @@ check-offloads-valgrind: all $(valgrind_wrappers) $(check_DATA)
315325
@echo '----------------------------------------------------------------------'
316326
@echo 'Valgrind output can be found in tests/system-offloads-testsuite.dir/*/valgrind.*'
317327
@echo '----------------------------------------------------------------------'
328+
check-dpdk-offloads-valgrind: all $(valgrind_wrappers) $(check_DATA)
329+
$(SHELL) '$(SYSTEM_DPDK_OFFLOADS_TESTSUITE)' -C tests VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
330+
@echo
331+
@echo '----------------------------------------------------------------------'
332+
@echo 'Valgrind output can be found in tests/system-dpdk-offloads-testsuite.dir/*/valgrind.*'
333+
@echo '----------------------------------------------------------------------'
318334
check-tso-valgrind: all $(valgrind_wrappers) $(check_DATA)
319335
$(SHELL) '$(SYSTEM_TSO_TESTSUITE)' -C tests VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
320336
@echo
@@ -357,6 +373,10 @@ check-offloads: all
357373
set $(SHELL) '$(SYSTEM_OFFLOADS_TESTSUITE)' -C tests AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
358374
"$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" --recheck)
359375

376+
check-dpdk-offloads: all
377+
set $(SHELL) '$(SYSTEM_DPDK_OFFLOADS_TESTSUITE)' -C tests AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
378+
"$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" --recheck)
379+
360380
check-dpdk: all
361381
set $(SHELL) '$(SYSTEM_DPDK_TESTSUITE)' -C tests AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
362382
"$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" --recheck)
@@ -402,6 +422,10 @@ $(SYSTEM_OFFLOADS_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_OFFLOAD
402422
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
403423
$(AM_V_at)mv $@.tmp $@
404424

425+
$(SYSTEM_DPDK_OFFLOADS_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_DPDK_OFFLOADS_TESTSUITE_AT) $(COMMON_MACROS_AT)
426+
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
427+
$(AM_V_at)mv $@.tmp $@
428+
405429
$(SYSTEM_DPDK_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_DPDK_TESTSUITE_AT) $(COMMON_MACROS_AT)
406430
$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
407431
$(AM_V_at)mv $@.tmp $@

tests/ofproto-macros.at

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ s/ duration=[0-9.]*s,//
99
s/ cookie=0x0,//
1010
s/ table=0,//
1111
s/ n_packets=0,//
12-
s/ n_offload_packets=0,//
12+
s/ n_offload_packets=[0-9]*,//
1313
s/ n_bytes=0,//
14-
s/ n_offload_bytes=0,//
14+
s/ n_offload_bytes=[0-9]*,//
1515
s/ idle_age=[0-9]*,//
1616
s/ hard_age=[0-9]*,//
1717
s/dp_hash=0x[0-9a-f]*\//dp_hash=0x0\//
@@ -127,7 +127,7 @@ strip_xids () {
127127

128128
# Changes all 'used:...' to say 'used:0.0', to make output easier to compare.
129129
strip_used () {
130-
sed 's/used:[[0-9]]\.[[0-9]]*/used:0.0/'
130+
sed -E 's/used:[[0-9]]+\.[[0-9]]*/used:0.0/'
131131
}
132132

133133
# Removes all 'duration=...' to make output easier to compare.

tests/sendpkt.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
parser.add_option("-t", "--type", type="string", dest="packet_type",
3737
help="packet type ('eth' is the default PACKET_TYPE)",
3838
default="eth")
39+
parser.add_option("-c", "--count", type="int", dest="packet_count",
40+
help="number of packets to send (default: 1)",
41+
default=1)
3942

4043
(options, args) = parser.parse_args()
4144

@@ -44,9 +47,13 @@
4447
parser.print_help()
4548
sys.exit(1)
4649

47-
# validate the "-t" or "--type" option
50+
# validate the options
4851
if options.packet_type != "eth":
4952
parser.error('invalid argument to "-t"/"--type". Allowed value is "eth".')
53+
if options.packet_count < 1:
54+
parser.error('invalid argument to "-c"/"--count". '
55+
'Allowed value must be 1 or higher.')
56+
5057

5158
# Strip '0x' prefixes from hex input, combine into a single string and
5259
# convert to bytes.
@@ -68,7 +75,8 @@
6875
sys.exit(2)
6976

7077
try:
71-
sockfd.send(pkt)
78+
for i in range(options.packet_count):
79+
sockfd.send(pkt)
7280
except socket.error as msg:
7381
print('unable to send packet! error code: ' + str(msg[0]) + ' : '
7482
+ msg[1])

0 commit comments

Comments
 (0)