diff mbox series

[ovs-dev,3/3] system-dpdk: add negotiation check for userspace-tso

Message ID 3bea47d5007ded2b8f9685a1665051660667f0e3.1589456076.git.gmuthukr@redhat.com
State New
Headers show
Series system-dpdk: add userspace-tso tests | expand

Commit Message

Gowrishankar Muthukrishnan May 14, 2020, 11:48 a.m. UTC
This patch adds minimal check for userspace-tso in system-dpdk
tests, starting with verification on virtio negotiation.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>
---
 tests/system-dpdk-macros.at |  16 +++++--
 tests/system-dpdk.at        | 102 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
index 943cbdf..b5c0648 100644
--- a/tests/system-dpdk-macros.at
+++ b/tests/system-dpdk-macros.at
@@ -61,12 +61,12 @@  m4_define([OVS_DPDK_SET_SOCKET_MEM],
 ])
 
 
+# OVS_DB_START()
 #
 # Create an empty database and start ovsdb-server. Add special configuration
-# dpdk-init to enable DPDK functionality. Start ovs-vswitchd connected to that
-# database using system devices (no dummies).
+# dpdk-init to enable DPDK functionality.
 #
-m4_define([OVS_DPDK_START],
+m4_define([OVS_DB_START],
   [dnl Create database.
    AT_CHECK([touch .conf.db.~lock~])
    AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
@@ -81,8 +81,16 @@  m4_define([OVS_DPDK_START],
 
    dnl Initialize database.
    AT_CHECK([ovs-vsctl --no-wait init])
+])
 
-   dnl Enable DPDK functionality
+# OVS_DPDK_START()
+#
+# Create an empty database and start ovsdb-server. Add special configuration
+# dpdk-init to enable DPDK functionality. Start ovs-vswitchd connected to that
+# database using system devices (no dummies).
+#
+m4_define([OVS_DPDK_START],
+   [dnl Enable DPDK functionality
    AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true])
    OVS_DPDK_SET_SOCKET_MEM()
    AT_CHECK([lscpu], [], [stdout])
diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index b032c5b..ab100b8 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -8,6 +8,7 @@  dnl Check if EAL init is successful
 AT_SETUP([OVS-DPDK - EAL init])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
+OVS_DB_START()
 OVS_DPDK_START()
 AT_CHECK([grep "DPDK Enabled - initializing..." ovs-vswitchd.log], [], [stdout])
 AT_CHECK([grep "EAL" ovs-vswitchd.log], [], [stdout])
@@ -28,6 +29,7 @@  AT_SETUP([OVS-DPDK - add standard DPDK port])
 AT_KEYWORDS([dpdk])
 
 OVS_DPDK_PRE_PHY_SKIP()
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Add userspace bridge and attach it to OVS
@@ -55,6 +57,7 @@  dnl Add vhost-user-client port
 AT_SETUP([OVS-DPDK - add vhost-user-client port])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Add userspace bridge and attach it to OVS
@@ -89,6 +92,7 @@  AT_SETUP([OVS-DPDK - ping vhost-user ports])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
 AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Find number of sockets
@@ -127,6 +131,12 @@  tail -f /dev/null | testpmd --no-pci \
 dnl Give settling time to the testpmd processes - NOTE: this is bad form.
 sleep 10
 
+dnl Check whether TSO is turned off
+AT_CHECK([grep -c 'negotiated Virtio features: 0x910008182' \
+          ovs-vswitchd.log],[0],[dnl
+1
+])
+
 dnl Move the tap devices to the namespaces
 AT_CHECK([ps aux | grep testpmd], [], [stdout], [stderr])
 AT_CHECK([ip link show], [], [stdout], [stderr])
@@ -169,6 +179,7 @@  AT_SETUP([OVS-DPDK - ping vhost-user-client ports])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
 AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Find number of sockets
@@ -206,6 +217,12 @@  tail -f /dev/null | testpmd --no-pci \
 dnl Give settling time to the testpmd processes - NOTE: this is bad form.
 sleep 10
 
+dnl Check whether TSO is turned off
+AT_CHECK([grep -c 'negotiated Virtio features: 0x910008182' \
+          ovs-vswitchd.log],[0],[dnl
+1
+])
+
 dnl Move the tap devices to the namespaces
 AT_CHECK([ps aux | grep testpmd], [], [stdout], [stderr])
 AT_CHECK([ip link show], [], [stdout], [stderr])
@@ -241,3 +258,88 @@  OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
 OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
 AT_CLEANUP
 dnl --------------------------------------------------------------------------
+
+dnl --------------------------------------------------------------------------
+dnl validate tso negotiation
+AT_SETUP([OVS-DPDK - validate tso negotiation])
+AT_KEYWORDS([dpdk])
+OVS_DPDK_PRE_CHECK()
+AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
+OVS_DB_START()
+AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:userspace-tso-enable=true])
+OVS_DPDK_START()
+AT_CHECK([grep -c 'Userspace TCP Segmentation Offloading support enabled' \
+          ovs-vswitchd.log],[0],[dnl
+1
+])
+dnl Find number of sockets
+AT_CHECK([lscpu], [], [stdout])
+AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "448,"}; print "448"}' > NUMA_NODE])
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
+
+dnl Add vhostuser port (client mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface \
+          dpdkvhostuserclient0 \
+          type=dpdkvhostuserclient \
+          options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 &
+
+dnl Give settling time to the testpmd processes - NOTE: this is bad form.
+sleep 10
+
+dnl Check whether TSO is turned on
+AT_CHECK([grep -c 'negotiated Virtio features: 0x910009983' \
+          ovs-vswitchd.log],[0],[dnl
+1
+])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
+
+dnl Add vhostuser port (server mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
+          type=dpdkvhostuser], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
+
+dnl Give settling time to the testpmd processes - NOTE: this is bad form.
+sleep 10
+
+dnl Check whether TSO is turned off
+AT_CHECK([grep -c 'negotiated Virtio features: 0x910008183' \
+          ovs-vswitchd.log],[0],[dnl
+1
+])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
+OVS_VSWITCHD_STOP()
+OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
+OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------