Message ID | 20200708103434.20424-1-gmuthukr@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,v6] system-dpdk: add negotiation check for userspace-tso | expand |
Hi Gowrishankar, Thanks again for following up. This patch still fails to me because of those ovs-vswitchd NUMA messages I told in my previous e-mail. I think we need to address that (and the VHOST_CONFIG error as well) because other tests already do that. Then we have test #8 failing due to testpmd bug. I am not sure how much value there is for OVS to see that, so how about we skip the test if testpmd has that bug? In this case, instead of seeing: 8: OVS-DPDK - validate negotiation when ovs alone has tso off FAILED (system-dpdk.at:431) We would see: 8: OVS-DPDK - validate negotiation when ovs alone has tso off skipped (system-dpdk.at:432) Once testpmd if fixed, the test will pass (or fail if OVS side fails). If you agree, I suggest to include the following patch to address both issues. Please add a comment above AT_SKIP_IF explaining the testpmd bug for future reference. Thanks, fbl diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at index a30f11533..1bcd532a1 100644 --- a/tests/system-dpdk.at +++ b/tests/system-dpdk.at @@ -303,7 +303,9 @@ AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) -OVS_VSWITCHD_STOP() +OVS_VSWITCHD_STOP(["\@EAL: Invalid NUMA socket, default to 0@d +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d +"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -367,7 +369,9 @@ AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) -OVS_VSWITCHD_STOP() +OVS_VSWITCHD_STOP(["\@EAL: Invalid NUMA socket, default to 0@d +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d +"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -425,7 +429,7 @@ sleep 1 dnl Check whether TSO is turned off (host side) AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) -AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) +AT_SKIP_IF([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) dnl Check whether TSO is turned off (guest side) AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ @@ -433,7 +437,9 @@ AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) -OVS_VSWITCHD_STOP() +OVS_VSWITCHD_STOP(["\@EAL: Invalid NUMA socket, default to 0@d +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d +"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -497,6 +503,8 @@ AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf dnl Clean up AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) -OVS_VSWITCHD_STOP() +OVS_VSWITCHD_STOP(["\@EAL: Invalid NUMA socket, default to 0@d +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d +"]) AT_CLEANUP dnl -------------------------------------------------------------------------- On Wed, Jul 08, 2020 at 04:04:34PM +0530, Gowrishankar Muthukrishnan wrote: > 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> > --- > v6: > - refactored tests to drop vhostuser mode for ovs (depreciated feature) > and add tests to also validate tso bits from testpmd view (when ovs > turns on/off tso). > > Sample output: > > OVS-DPDK unit tests > > 1: OVS-DPDK - EAL init ok > 2: OVS-DPDK - add standard DPDK port skipped (system-dpdk.at:35) > 3: OVS-DPDK - add vhost-user-client port ok > 4: OVS-DPDK - ping vhost-user ports ok > 5: OVS-DPDK - ping vhost-user-client ports ok > 6: OVS-DPDK - validate negotiation when both ovs and testpmd have tso on ok > 7: OVS-DPDK - validate negotiation when ovs alone has tso on ok > 8: OVS-DPDK - validate negotiation when ovs alone has tso off FAILED (system-dpdk.at:431) > 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso off ok > > Test Failure #8: > > Sub-test passed for OVS end, but failed on testpmd end. Once TSO is > turned on in testpmd, at the same time TSO was off in OVS, testpmd > should not allow turning on TSO flag in driver (I'm working on > patching it in dpdk). > --- > tests/system-dpdk-macros.at | 17 ++- > tests/system-dpdk.at | 276 +++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 284 insertions(+), 9 deletions(-) > > diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at > index c6708ca..9e55f10 100644 > --- a/tests/system-dpdk-macros.at > +++ b/tests/system-dpdk-macros.at > @@ -33,13 +33,11 @@ m4_define([OVS_DPDK_PRE_PHY_SKIP], > ]) > > > -# OVS_DPDK_START() > +# 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). > +# Create an empty database and start ovsdb-server. > # > -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]) > @@ -54,7 +52,16 @@ m4_define([OVS_DPDK_START], > > dnl Initialize database. > AT_CHECK([ovs-vsctl --no-wait init]) > +]) > + > > +# OVS_DPDK_START() > +# > +# 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]) > > diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at > index a015d52..a30f115 100644 > --- a/tests/system-dpdk.at > +++ b/tests/system-dpdk.at > @@ -1,6 +1,11 @@ > m4_define([CONFIGURE_VETH_OFFLOADS], > [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])]) > > +m4_define([SET_NUMA_NODE], > + [ > + AT_CHECK([lscpu | awk '/NUMA node\(s\)/ {c=1; while (c++<$(3)) {printf "$1,"}; print "$1"}' > NUMA_NODE]) > +]) > + > AT_BANNER([OVS-DPDK unit tests]) > > dnl -------------------------------------------------------------------------- > @@ -8,6 +13,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]) > @@ -27,6 +33,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 > @@ -53,6 +60,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 > @@ -86,11 +94,11 @@ 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 > -AT_CHECK([lscpu], [], [stdout]) > -AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE]) > +SET_NUMA_NODE([512]) > > dnl Add userspace bridge and attach it to OVS > AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev]) > @@ -163,11 +171,11 @@ 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 > -AT_CHECK([lscpu], [], [stdout]) > -AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE]) > +SET_NUMA_NODE([512]) > > dnl Add userspace bridge and attach it to OVS > AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev]) > @@ -232,3 +240,263 @@ 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 validate negotiation when both ovs and testpmd have tso on > +AT_SETUP([OVS-DPDK - validate negotiation when both ovs and testpmd have tso on]) > +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],[ignore],[dnl > +1 > +]) > +dnl Find number of sockets > +SET_NUMA_NODE([512]) > + > +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'" > +AT_CHECK([echo "show device info all" > CMDFILE]) > +AT_CHECK([echo "stop" >> CMDFILE]) > +AT_CHECK([echo "port stop 0" >> CMDFILE]) > +AT_CHECK([echo "tso set 1500 0" >> CMDFILE]) > +AT_CHECK([echo "csum set tcp hw 0" >> CMDFILE]) > +AT_CHECK([echo "port start 0" >> CMDFILE]) > +AT_CHECK([echo "start" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) > +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ > + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ > + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ > + --single-file-segments -- --cmdline-file=CMDFILE \ > + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & > + > +dnl Give settling time to the testpmd processes - NOTE: this is bad form. > +sleep 10 > + > +dnl Clean up the testpmd now > +pkill -f -x -9 'tail -f /dev/null' > +sleep 1 > + > +dnl Check whether TSO is turned on (host side) > +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ > + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) > +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[1801]) > + > +dnl Check whether TSO is turned on (guest side) > +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ > + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[1]) > + > +dnl Clean up > +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) > +OVS_VSWITCHD_STOP() > +AT_CLEANUP > +dnl -------------------------------------------------------------------------- > + > +dnl -------------------------------------------------------------------------- > +dnl validate negotiation when ovs alone has tso on > +AT_SETUP([OVS-DPDK - validate negotiation when ovs alone has tso on]) > +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],[ignore],[dnl > +1 > +]) > +dnl Find number of sockets > +SET_NUMA_NODE([512]) > + > +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'" > +AT_CHECK([echo "show device info all" > CMDFILE]) > +AT_CHECK([echo "stop" >> CMDFILE]) > +AT_CHECK([echo "port stop 0" >> CMDFILE]) > +AT_CHECK([echo "port start 0" >> CMDFILE]) > +AT_CHECK([echo "start" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) > +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ > + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ > + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ > + --single-file-segments -- --cmdline-file=CMDFILE \ > + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & > + > +dnl Give settling time to the testpmd processes - NOTE: this is bad form. > +sleep 10 > + > +dnl Clean up the testpmd now > +pkill -f -x -9 'tail -f /dev/null' > +sleep 1 > + > +dnl Check whether TSO is turned off (host side) > +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ > + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) > +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) > + > +dnl Check whether TSO is turned off (guest side) > +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ > + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) > + > +dnl Clean up > +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) > +OVS_VSWITCHD_STOP() > +AT_CLEANUP > +dnl -------------------------------------------------------------------------- > + > +dnl -------------------------------------------------------------------------- > +dnl validate negotiation when ovs alone has tso off > +AT_SETUP([OVS-DPDK - validate negotiation when ovs alone has tso off]) > +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=false]) > +OVS_DPDK_START() > +AT_CHECK([grep -c 'Userspace TCP Segmentation Offloading support enabled' \ > + ovs-vswitchd.log],[ignore],[dnl > +0 > +]) > +dnl Find number of sockets > +SET_NUMA_NODE([512]) > + > +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'" > +AT_CHECK([echo "show device info all" > CMDFILE]) > +AT_CHECK([echo "stop" >> CMDFILE]) > +AT_CHECK([echo "port stop 0" >> CMDFILE]) > +AT_CHECK([echo "tso set 1500 0" >> CMDFILE]) > +AT_CHECK([echo "csum set tcp hw 0" >> CMDFILE]) > +AT_CHECK([echo "port start 0" >> CMDFILE]) > +AT_CHECK([echo "start" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) > +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ > + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ > + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ > + --single-file-segments -- --cmdline-file=CMDFILE \ > + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & > + > +dnl Give settling time to the testpmd processes - NOTE: this is bad form. > +sleep 10 > + > +dnl Clean up the testpmd now > +pkill -f -x -9 'tail -f /dev/null' > +sleep 1 > + > +dnl Check whether TSO is turned off (host side) > +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ > + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) > +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) > + > +dnl Check whether TSO is turned off (guest side) > +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ > + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) > + > +dnl Clean up > +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) > +OVS_VSWITCHD_STOP() > +AT_CLEANUP > +dnl -------------------------------------------------------------------------- > + > +dnl -------------------------------------------------------------------------- > +dnl validate negotiation when both ovs and testpmd have tso off > +AT_SETUP([OVS-DPDK - validate negotiation when both ovs and testpmd have tso off]) > +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=false]) > +OVS_DPDK_START() > +AT_CHECK([grep -c 'Userspace TCP Segmentation Offloading support enabled' \ > + ovs-vswitchd.log],[ignore],[dnl > +0 > +]) > +dnl Find number of sockets > +SET_NUMA_NODE([512]) > + > +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'" > +AT_CHECK([echo "show device info all" > CMDFILE]) > +AT_CHECK([echo "stop" >> CMDFILE]) > +AT_CHECK([echo "port stop 0" >> CMDFILE]) > +AT_CHECK([echo "port start 0" >> CMDFILE]) > +AT_CHECK([echo "start" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) > +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) > +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ > + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ > + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ > + --single-file-segments -- --cmdline-file=CMDFILE \ > + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & > + > +dnl Give settling time to the testpmd processes - NOTE: this is bad form. > +sleep 10 > + > +dnl Clean up the testpmd now > +pkill -f -x -9 'tail -f /dev/null' > +sleep 1 > + > +dnl Check whether TSO is turned off (host side) > +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ > + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) > +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) > + > +dnl Check whether TSO is turned off (guest side) > +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ > + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) > + > +dnl Clean up > +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) > +OVS_VSWITCHD_STOP() > +AT_CLEANUP > +dnl -------------------------------------------------------------------------- > -- > 1.8.3.1 >
Thanks Flavio, I did not realize my workaround patch in another commit making the tests pass always :) . Added corrections in ovs_stop accordingly now. Thank you again.
diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at index c6708ca..9e55f10 100644 --- a/tests/system-dpdk-macros.at +++ b/tests/system-dpdk-macros.at @@ -33,13 +33,11 @@ m4_define([OVS_DPDK_PRE_PHY_SKIP], ]) -# OVS_DPDK_START() +# 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). +# Create an empty database and start ovsdb-server. # -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]) @@ -54,7 +52,16 @@ m4_define([OVS_DPDK_START], dnl Initialize database. AT_CHECK([ovs-vsctl --no-wait init]) +]) + +# OVS_DPDK_START() +# +# 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]) diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at index a015d52..a30f115 100644 --- a/tests/system-dpdk.at +++ b/tests/system-dpdk.at @@ -1,6 +1,11 @@ m4_define([CONFIGURE_VETH_OFFLOADS], [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])]) +m4_define([SET_NUMA_NODE], + [ + AT_CHECK([lscpu | awk '/NUMA node\(s\)/ {c=1; while (c++<$(3)) {printf "$1,"}; print "$1"}' > NUMA_NODE]) +]) + AT_BANNER([OVS-DPDK unit tests]) dnl -------------------------------------------------------------------------- @@ -8,6 +13,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]) @@ -27,6 +33,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 @@ -53,6 +60,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 @@ -86,11 +94,11 @@ 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 -AT_CHECK([lscpu], [], [stdout]) -AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE]) +SET_NUMA_NODE([512]) dnl Add userspace bridge and attach it to OVS AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev]) @@ -163,11 +171,11 @@ 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 -AT_CHECK([lscpu], [], [stdout]) -AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE]) +SET_NUMA_NODE([512]) dnl Add userspace bridge and attach it to OVS AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev]) @@ -232,3 +240,263 @@ 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 validate negotiation when both ovs and testpmd have tso on +AT_SETUP([OVS-DPDK - validate negotiation when both ovs and testpmd have tso on]) +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],[ignore],[dnl +1 +]) +dnl Find number of sockets +SET_NUMA_NODE([512]) + +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'" +AT_CHECK([echo "show device info all" > CMDFILE]) +AT_CHECK([echo "stop" >> CMDFILE]) +AT_CHECK([echo "port stop 0" >> CMDFILE]) +AT_CHECK([echo "tso set 1500 0" >> CMDFILE]) +AT_CHECK([echo "csum set tcp hw 0" >> CMDFILE]) +AT_CHECK([echo "port start 0" >> CMDFILE]) +AT_CHECK([echo "start" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ + --single-file-segments -- --cmdline-file=CMDFILE \ + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & + +dnl Give settling time to the testpmd processes - NOTE: this is bad form. +sleep 10 + +dnl Clean up the testpmd now +pkill -f -x -9 'tail -f /dev/null' +sleep 1 + +dnl Check whether TSO is turned on (host side) +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[1801]) + +dnl Check whether TSO is turned on (guest side) +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[1]) + +dnl Clean up +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) +OVS_VSWITCHD_STOP() +AT_CLEANUP +dnl -------------------------------------------------------------------------- + +dnl -------------------------------------------------------------------------- +dnl validate negotiation when ovs alone has tso on +AT_SETUP([OVS-DPDK - validate negotiation when ovs alone has tso on]) +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],[ignore],[dnl +1 +]) +dnl Find number of sockets +SET_NUMA_NODE([512]) + +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'" +AT_CHECK([echo "show device info all" > CMDFILE]) +AT_CHECK([echo "stop" >> CMDFILE]) +AT_CHECK([echo "port stop 0" >> CMDFILE]) +AT_CHECK([echo "port start 0" >> CMDFILE]) +AT_CHECK([echo "start" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ + --single-file-segments -- --cmdline-file=CMDFILE \ + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & + +dnl Give settling time to the testpmd processes - NOTE: this is bad form. +sleep 10 + +dnl Clean up the testpmd now +pkill -f -x -9 'tail -f /dev/null' +sleep 1 + +dnl Check whether TSO is turned off (host side) +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) + +dnl Check whether TSO is turned off (guest side) +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) + +dnl Clean up +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) +OVS_VSWITCHD_STOP() +AT_CLEANUP +dnl -------------------------------------------------------------------------- + +dnl -------------------------------------------------------------------------- +dnl validate negotiation when ovs alone has tso off +AT_SETUP([OVS-DPDK - validate negotiation when ovs alone has tso off]) +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=false]) +OVS_DPDK_START() +AT_CHECK([grep -c 'Userspace TCP Segmentation Offloading support enabled' \ + ovs-vswitchd.log],[ignore],[dnl +0 +]) +dnl Find number of sockets +SET_NUMA_NODE([512]) + +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'" +AT_CHECK([echo "show device info all" > CMDFILE]) +AT_CHECK([echo "stop" >> CMDFILE]) +AT_CHECK([echo "port stop 0" >> CMDFILE]) +AT_CHECK([echo "tso set 1500 0" >> CMDFILE]) +AT_CHECK([echo "csum set tcp hw 0" >> CMDFILE]) +AT_CHECK([echo "port start 0" >> CMDFILE]) +AT_CHECK([echo "start" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ + --single-file-segments -- --cmdline-file=CMDFILE \ + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & + +dnl Give settling time to the testpmd processes - NOTE: this is bad form. +sleep 10 + +dnl Clean up the testpmd now +pkill -f -x -9 'tail -f /dev/null' +sleep 1 + +dnl Check whether TSO is turned off (host side) +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) + +dnl Check whether TSO is turned off (guest side) +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) + +dnl Clean up +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) +OVS_VSWITCHD_STOP() +AT_CLEANUP +dnl -------------------------------------------------------------------------- + +dnl -------------------------------------------------------------------------- +dnl validate negotiation when both ovs and testpmd have tso off +AT_SETUP([OVS-DPDK - validate negotiation when both ovs and testpmd have tso off]) +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=false]) +OVS_DPDK_START() +AT_CHECK([grep -c 'Userspace TCP Segmentation Offloading support enabled' \ + ovs-vswitchd.log],[ignore],[dnl +0 +]) +dnl Find number of sockets +SET_NUMA_NODE([512]) + +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'" +AT_CHECK([echo "show device info all" > CMDFILE]) +AT_CHECK([echo "stop" >> CMDFILE]) +AT_CHECK([echo "port stop 0" >> CMDFILE]) +AT_CHECK([echo "port start 0" >> CMDFILE]) +AT_CHECK([echo "start" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE]) +AT_CHECK([echo "show port 0 tx_offload configuration" >> CMDFILE]) +tail -f /dev/null | testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\ + --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \ + --vdev="net_tap0,iface=tap0" --file-prefix page0 \ + --single-file-segments -- --cmdline-file=CMDFILE \ + -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 & + +dnl Give settling time to the testpmd processes - NOTE: this is bad form. +sleep 10 + +dnl Clean up the testpmd now +pkill -f -x -9 'tail -f /dev/null' +sleep 1 + +dnl Check whether TSO is turned off (host side) +AT_CHECK([awk '/negotiated Virtio features/ {a=$NF} END{print a}' \ + $OVS_RUNDIR/ovs-vswitchd.log],[],[stdout]) +AT_CHECK([printf "%X" $(( $(cat stdout) & ((1<<0)|(1<<11)|(1<<12)) ))],[],[0]) + +dnl Check whether TSO is turned off (guest side) +AT_CHECK([awk 'BEGIN{n=0} /Port :/ && /TCP_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \ + $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0]) + +dnl Clean up +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) +OVS_VSWITCHD_STOP() +AT_CLEANUP +dnl --------------------------------------------------------------------------
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> --- v6: - refactored tests to drop vhostuser mode for ovs (depreciated feature) and add tests to also validate tso bits from testpmd view (when ovs turns on/off tso). Sample output: OVS-DPDK unit tests 1: OVS-DPDK - EAL init ok 2: OVS-DPDK - add standard DPDK port skipped (system-dpdk.at:35) 3: OVS-DPDK - add vhost-user-client port ok 4: OVS-DPDK - ping vhost-user ports ok 5: OVS-DPDK - ping vhost-user-client ports ok 6: OVS-DPDK - validate negotiation when both ovs and testpmd have tso on ok 7: OVS-DPDK - validate negotiation when ovs alone has tso on ok 8: OVS-DPDK - validate negotiation when ovs alone has tso off FAILED (system-dpdk.at:431) 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso off ok Test Failure #8: Sub-test passed for OVS end, but failed on testpmd end. Once TSO is turned on in testpmd, at the same time TSO was off in OVS, testpmd should not allow turning on TSO flag in driver (I'm working on patching it in dpdk). --- tests/system-dpdk-macros.at | 17 ++- tests/system-dpdk.at | 276 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 284 insertions(+), 9 deletions(-)