[ovs-dev,RFC,6/6] system-dpdk: Connect two namespaces via virtio

Message ID 20180801203118.24126-7-aconole@redhat.com
State New
Delegated to: Ian Stokes
Headers show
Series
  • system-dpdk: add support to ping two namespaces
Related show

Commit Message

Aaron Conole Aug. 1, 2018, 8:31 p.m.
From: Bala Sankaran <bsankara@redhat.com>

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@redhat.com>
Co-authored-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
NOTE: This currently is broken, and needs some help to fix.  The
biggest issue we currently see is that the ovs-vswitchd does not
successfully configure memory regions, failing with the generic:
"Cannot allocate memory" from the mmap() call in
vhost_user_set_mem_table.

We have used dpdk 17.11 for ovs-vswitchd, and 18.05+ for the
testpmd version.

 tests/system-dpdk.at | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

Patch

diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index 58dc8aaae..14ea2edce 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -74,3 +74,78 @@  OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably
 \@EAL: No free hugepages reported in hugepages-1048576kB@d"])
 AT_CLEANUP
 dnl --------------------------------------------------------------------------
+
+
+
+dnl --------------------------------------------------------------------------
+dnl Add 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 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/vhu0], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient1 -- set Interface dpdkvhostuserclient1 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/vhu1], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+sleep 2
+
+dnl Parse log file
+AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "vHost User device 'dpdkvhostuserclient1' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/vhu0: reconnecting..." ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/vhu1: reconnecting..." 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'"
+(echo start && tail -f /dev/null) | /usr/local/bin/testpmd --socket-mem=512 \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/vhu0,server=1" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- -a >$OVS_RUNDIR/testpmd-vhu0.log 2>&1 &
+(echo start && tail -f /dev/null) | /usr/local/bin/testpmd --socket-mem=512 \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/vhu1,server=1" \
+           --vdev=net_tap1,iface=tap1 --file-prefix page1 \
+           --single-file-segments -- -a >$OVS_RUNDIR/testpmd-vhu1.log 2>&1 &
+
+dnl give settling time to the testpmd processes
+sleep 2
+
+dnl move the tap devices to the namespaces
+AT_CHECK([ip link set tap0 netns ns1], [], [stdout], [stderr])
+AT_CHECK([ip link set tap1 netns ns2], [], [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 ns2 ip link show], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns2 ip link show | grep tap1], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns2 ip link set tap1 up], [], [stdout], [stderr])
+AT_CHECK([ip netns exec ns2 ip addr add 172.31.110.12/24 dev tap1], [], [stdout], [stderr])
+
+ip netns exec ns1 arping -c 4 -I tap0 172.31.110.12
+
+ovs-vsctl show
+ovs-appctl dpctl/dump-dps
+ovs-appctl dpctl/show netdev@ovs-netdev
+ps aux | grep testpmd
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient1], [], [stdout], [stderr])
+OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded.@d
+\@Failed to enable flow control@d
+\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/hu0: No such file or directory@d
+\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/vhu1: No such file or directory@d
+\@Global register is changed during@d
+\@EAL:   Invalid NUMA socket, default to 0@d
+\@EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !@d
+\@EAL: No free hugepages reported in hugepages-1048576kB@d"])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------