[ovs-dev] [PATCH v3 6/6] system-dpdk: Connect network namespaces via dpdkvhostuser ports

Bala Sankaran bsankara at redhat.com
Tue Aug 28 17:47:30 UTC 2018


This adds a new test to the 'check-dpdk' subsystem that will exercise
allocations, PMDs, and the vhost-user code path.

Signed-off-by: Bala Sankaran <bsankara at redhat.com>
Co-authored-by: Aaron Conole <aconole at redhat.com>
Signed-off-by: Aaron Conole <aconole at redhat.com>
---
 tests/system-dpdk.at | 77 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index 58dc8aaae..914a1b644 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -1,3 +1,6 @@
+m4_define([CONFIGURE_VETH_OFFLOADS],
+   [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])])
+
 AT_BANNER([OVS-DPDK unit tests])
 
 dnl --------------------------------------------------------------------------
@@ -74,3 +77,77 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably
 \@EAL: No free hugepages reported in hugepages-1048576kB at d"])
 AT_CLEANUP
 dnl --------------------------------------------------------------------------
+
+
+
+dnl --------------------------------------------------------------------------
+dnl Ping vhost-user-client port
+AT_SETUP([OVS-DPDK datapath - ping vhost-user-client ports])
+AT_KEYWORDS([dpdk])
+OVS_DPDK_PRE_CHECK()
+OVS_DPDK_START()
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
+AT_CHECK([ovs-vsctl add-port br10 vhu0 -- set Interface vhu0 \
+          type=dpdkvhostuser], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Parse log file
+AT_CHECK([grep "VHOST_CONFIG: vhost-user server: socket created" \
+          ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "Socket $OVS_RUNDIR/vhu0 created for vhost-user port vhu0" \
+          ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "VHOST_CONFIG: bind to $OVS_RUNDIR/vhu0" ovs-vswitchd.log], [],
+         [stdout])
+
+dnl Set up namespaces
+ADD_NAMESPACES(ns1, ns2)
+
+dnl execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+tail -f /dev/null | testpmd --socket-mem=512 \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/vhu0" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- -a >$OVS_RUNDIR/testpmd-vhu0.log 2>&1 &
+
+dnl add veth device
+ADD_VETH(tap1, ns2, br10, "172.31.110.12/24")
+
+dnl give settling time to the testpmd processes - NOTE: this is bad form.
+sleep 10
+
+dnl move the tap devices to the namespaces
+AT_CHECK([ps aux | grep testpmd], [], [stdout], [stderr])
+AT_CHECK([ip link show], [], [stdout], [stderr])
+AT_CHECK([ip link set tap0 netns ns1], [], [stdout], [stderr])
+
+AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns1 ip link show | grep tap0], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns1 ip link set tap0 up], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns1 ip addr add 172.31.110.11/24 dev tap0], [],
+         [stdout], [stderr])
+
+AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns2 ip link show], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns1 arping -c 4 -I tap0 172.31.110.12], [], [stdout],
+         [stderr])
+
+dnl clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 vhu0], [], [stdout], [stderr])
+OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded. at d
+\@Failed to enable flow control at d
+\@VHOST_CONFIG: recvmsg failed at d
+\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/vhu0: No such file or directory at d
+\@Global register is changed during at d
+\@dpdkvhostuser ports are considered deprecated;  please migrate to dpdkvhostuserclient ports. at d
+\@failed to enumerate system datapaths: No such file or directory at d
+\@EAL:   Invalid NUMA socket, default to 0 at d
+\@EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !@d
+\@EAL: No free hugepages reported in hugepages-1048576kB at d"])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------
-- 
2.17.1



More information about the dev mailing list