Message ID | 20200709060433.27998-1-gmuthukr@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,v7] system-dpdk: add negotiation check for userspace-tso | expand |
Hi Gowrishankar, On Thu, Jul 09, 2020 at 11:34:33AM +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> > --- > v7: > - fixed ovs stop log check for added tests. > - test #8 is skipped using AT_ macro. > > Sample test output: > ## ------------------------------- ## > ## openvswitch 2.13.90 test suite. ## > ## ------------------------------- ## > > OVS-DPDK unit tests > > 1: OVS-DPDK - EAL init ok > 2: OVS-DPDK - add standard DPDK port skipped (system-dpdk.at:36) > 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 skipped (system-dpdk.at:448) > 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso off ok > > ## ------------- ## > ## Test results. ## > ## ------------- ## > > 7 tests were successful. > 2 tests were skipped. > > --- > tests/system-dpdk-macros.at | 17 ++- > tests/system-dpdk.at | 301 +++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 309 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..ef03fb2 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]) > @@ -15,6 +21,7 @@ AT_CHECK([grep "DPDK Enabled - initialized" ovs-vswitchd.log], [], [stdout]) > OVS_VSWITCHD_STOP(["/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 available hugepages reported in hugepages-1048576kB/d > /EAL: No free hugepages reported in hugepages-1048576kB/d"]) > AT_CLEANUP > dnl -------------------------------------------------------------------------- The addition of the hugepages message in the filter is good in this and other tests as well, but it should be on a separate patch altogether because this one is only about tso negotiation, correct? Otherwise it looks good to me. Thanks fbl > @@ -27,6 +34,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 > @@ -41,6 +49,7 @@ OVS_VSWITCHD_STOP("/does not exist. The Open vSwitch kernel module is probably n > /Failed to enable flow control/d > /Global register is changed during/d > /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d > +/EAL: No available hugepages reported in hugepages-1048576kB/d > /EAL: No free hugepages reported in hugepages-1048576kB/d > ") > AT_CLEANUP > @@ -53,6 +62,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 > @@ -74,6 +84,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably > \@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 available hugepages reported in hugepages-1048576kB@d > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > AT_CLEANUP > dnl -------------------------------------------------------------------------- > @@ -86,11 +97,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]) > @@ -153,6 +164,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > AT_CLEANUP > dnl -------------------------------------------------------------------------- > @@ -163,11 +175,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]) > @@ -229,6 +241,287 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > \@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([" > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > +\@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 -------------------------------------------------------------------------- > + > +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([" > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > +\@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 -------------------------------------------------------------------------- > + > +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) > +dnl KNOWN BUG in dpdk/testpmd: > +dnl Once TSO is turned on in testpmd, at the same time TSO was off in OVS, > +dnl testpmd should not allow turning on TSO flag in driver. Testpmd needs to be > +dnl fixed. > +AT_SKIP_IF([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([" > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > +\@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 -------------------------------------------------------------------------- > + > +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([" > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > +\@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 -------------------------------------------------------------------------- > -- > 1.8.3.1 >
Hi Flavio, I think it should be fine as we even do a similar adjustment of splitting OVS_DPDK_START into DB and daemon start ops for existing tests as well. What do you think?. Thanks, Gowrishankar On Thu, Jul 9, 2020 at 6:26 PM Flavio Leitner <fbl@sysclose.org> wrote: > > Hi Gowrishankar, > > On Thu, Jul 09, 2020 at 11:34:33AM +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> > > --- > > v7: > > - fixed ovs stop log check for added tests. > > - test #8 is skipped using AT_ macro. > > > > Sample test output: > > ## ------------------------------- ## > > ## openvswitch 2.13.90 test suite. ## > > ## ------------------------------- ## > > > > OVS-DPDK unit tests > > > > 1: OVS-DPDK - EAL init ok > > 2: OVS-DPDK - add standard DPDK port skipped ( > system-dpdk.at:36) > > 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 skipped ( > system-dpdk.at:448) > > 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso > off ok > > > > ## ------------- ## > > ## Test results. ## > > ## ------------- ## > > > > 7 tests were successful. > > 2 tests were skipped. > > > > --- > > tests/system-dpdk-macros.at | 17 ++- > > tests/system-dpdk.at | 301 > +++++++++++++++++++++++++++++++++++++++++++- > > 2 files changed, 309 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..ef03fb2 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]) > > @@ -15,6 +21,7 @@ AT_CHECK([grep "DPDK Enabled - initialized" > ovs-vswitchd.log], [], [stdout]) > > OVS_VSWITCHD_STOP(["/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 available hugepages reported in hugepages-1048576kB/d > > /EAL: No free hugepages reported in hugepages-1048576kB/d"]) > > AT_CLEANUP > > dnl > -------------------------------------------------------------------------- > > The addition of the hugepages message in the filter is good > in this and other tests as well, but it should be on a > separate patch altogether because this one is only about > tso negotiation, correct? > > Otherwise it looks good to me. > Thanks > fbl > > > > > > @@ -27,6 +34,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 > > @@ -41,6 +49,7 @@ OVS_VSWITCHD_STOP("/does not exist. The Open vSwitch > kernel module is probably n > > /Failed to enable flow control/d > > /Global register is changed during/d > > /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using > unreliable clock cycles !/d > > +/EAL: No available hugepages reported in hugepages-1048576kB/d > > /EAL: No free hugepages reported in hugepages-1048576kB/d > > ") > > AT_CLEANUP > > @@ -53,6 +62,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 > > @@ -74,6 +84,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch > kernel module is probably > > \@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 available hugepages reported in hugepages-1048576kB@d > > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > > AT_CLEANUP > > dnl > -------------------------------------------------------------------------- > > @@ -86,11 +97,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]) > > @@ -153,6 +164,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open > vSwitch kernel module is probably > > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > > AT_CLEANUP > > dnl > -------------------------------------------------------------------------- > > @@ -163,11 +175,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]) > > @@ -229,6 +241,287 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open > vSwitch kernel module is probably > > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > > \@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([" > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > +\@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 > -------------------------------------------------------------------------- > > + > > +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([" > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > +\@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 > -------------------------------------------------------------------------- > > + > > +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) > > +dnl KNOWN BUG in dpdk/testpmd: > > +dnl Once TSO is turned on in testpmd, at the same time TSO was off in > OVS, > > +dnl testpmd should not allow turning on TSO flag in driver. Testpmd > needs to be > > +dnl fixed. > > +AT_SKIP_IF([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([" > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > +\@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 > -------------------------------------------------------------------------- > > + > > +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([" > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > +\@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 > -------------------------------------------------------------------------- > > -- > > 1.8.3.1 > > > > -- > fbl > >
On Thu, Jul 09, 2020 at 07:14:02PM +0530, Gowrishankar Muthukrishnan wrote: > Hi Flavio, > I think it should be fine as we even do a similar adjustment of splitting > OVS_DPDK_START into DB and daemon start ops for existing tests as well. > What do you think?. That is required to have TSO negotiation checks, so it's part of the patch. On another hand, those new filtering messages are unrelated. A patch should make one logical change. fbl > > Thanks, > Gowrishankar > > On Thu, Jul 9, 2020 at 6:26 PM Flavio Leitner <fbl@sysclose.org> wrote: > > > > > Hi Gowrishankar, > > > > On Thu, Jul 09, 2020 at 11:34:33AM +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> > > > --- > > > v7: > > > - fixed ovs stop log check for added tests. > > > - test #8 is skipped using AT_ macro. > > > > > > Sample test output: > > > ## ------------------------------- ## > > > ## openvswitch 2.13.90 test suite. ## > > > ## ------------------------------- ## > > > > > > OVS-DPDK unit tests > > > > > > 1: OVS-DPDK - EAL init ok > > > 2: OVS-DPDK - add standard DPDK port skipped ( > > system-dpdk.at:36) > > > 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 skipped ( > > system-dpdk.at:448) > > > 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso > > off ok > > > > > > ## ------------- ## > > > ## Test results. ## > > > ## ------------- ## > > > > > > 7 tests were successful. > > > 2 tests were skipped. > > > > > > --- > > > tests/system-dpdk-macros.at | 17 ++- > > > tests/system-dpdk.at | 301 > > +++++++++++++++++++++++++++++++++++++++++++- > > > 2 files changed, 309 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..ef03fb2 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]) > > > @@ -15,6 +21,7 @@ AT_CHECK([grep "DPDK Enabled - initialized" > > ovs-vswitchd.log], [], [stdout]) > > > OVS_VSWITCHD_STOP(["/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 available hugepages reported in hugepages-1048576kB/d > > > /EAL: No free hugepages reported in hugepages-1048576kB/d"]) > > > AT_CLEANUP > > > dnl > > -------------------------------------------------------------------------- > > > > The addition of the hugepages message in the filter is good > > in this and other tests as well, but it should be on a > > separate patch altogether because this one is only about > > tso negotiation, correct? > > > > Otherwise it looks good to me. > > Thanks > > fbl > > > > > > > > > > > @@ -27,6 +34,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 > > > @@ -41,6 +49,7 @@ OVS_VSWITCHD_STOP("/does not exist. The Open vSwitch > > kernel module is probably n > > > /Failed to enable flow control/d > > > /Global register is changed during/d > > > /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using > > unreliable clock cycles !/d > > > +/EAL: No available hugepages reported in hugepages-1048576kB/d > > > /EAL: No free hugepages reported in hugepages-1048576kB/d > > > ") > > > AT_CLEANUP > > > @@ -53,6 +62,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 > > > @@ -74,6 +84,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch > > kernel module is probably > > > \@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 available hugepages reported in hugepages-1048576kB@d > > > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > > > AT_CLEANUP > > > dnl > > -------------------------------------------------------------------------- > > > @@ -86,11 +97,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]) > > > @@ -153,6 +164,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open > > vSwitch kernel module is probably > > > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > > > \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) > > > AT_CLEANUP > > > dnl > > -------------------------------------------------------------------------- > > > @@ -163,11 +175,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]) > > > @@ -229,6 +241,287 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open > > vSwitch kernel module is probably > > > \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d > > > \@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([" > > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > > +\@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 > > -------------------------------------------------------------------------- > > > + > > > +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([" > > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > > +\@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 > > -------------------------------------------------------------------------- > > > + > > > +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) > > > +dnl KNOWN BUG in dpdk/testpmd: > > > +dnl Once TSO is turned on in testpmd, at the same time TSO was off in > > OVS, > > > +dnl testpmd should not allow turning on TSO flag in driver. Testpmd > > needs to be > > > +dnl fixed. > > > +AT_SKIP_IF([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([" > > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > > +\@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 > > -------------------------------------------------------------------------- > > > + > > > +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([" > > > +\@EAL: No available hugepages reported in hugepages-1048576kB@d > > > +\@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 > > -------------------------------------------------------------------------- > > > -- > > > 1.8.3.1 > > > > > > > -- > > fbl > > > > > > -- > Gowrishankar M > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
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..ef03fb2 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]) @@ -15,6 +21,7 @@ AT_CHECK([grep "DPDK Enabled - initialized" ovs-vswitchd.log], [], [stdout]) OVS_VSWITCHD_STOP(["/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 available hugepages reported in hugepages-1048576kB/d /EAL: No free hugepages reported in hugepages-1048576kB/d"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -27,6 +34,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 @@ -41,6 +49,7 @@ OVS_VSWITCHD_STOP("/does not exist. The Open vSwitch kernel module is probably n /Failed to enable flow control/d /Global register is changed during/d /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d +/EAL: No available hugepages reported in hugepages-1048576kB/d /EAL: No free hugepages reported in hugepages-1048576kB/d ") AT_CLEANUP @@ -53,6 +62,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 @@ -74,6 +84,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably \@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 available hugepages reported in hugepages-1048576kB@d \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -86,11 +97,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]) @@ -153,6 +164,7 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d \@EAL: No free hugepages reported in hugepages-1048576kB@d"]) AT_CLEANUP dnl -------------------------------------------------------------------------- @@ -163,11 +175,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]) @@ -229,6 +241,287 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably \@failed to enumerate system datapaths: No such file or directory@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 available hugepages reported in hugepages-1048576kB@d \@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([" +\@EAL: No available hugepages reported in hugepages-1048576kB@d +\@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 -------------------------------------------------------------------------- + +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([" +\@EAL: No available hugepages reported in hugepages-1048576kB@d +\@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 -------------------------------------------------------------------------- + +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) +dnl KNOWN BUG in dpdk/testpmd: +dnl Once TSO is turned on in testpmd, at the same time TSO was off in OVS, +dnl testpmd should not allow turning on TSO flag in driver. Testpmd needs to be +dnl fixed. +AT_SKIP_IF([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([" +\@EAL: No available hugepages reported in hugepages-1048576kB@d +\@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 -------------------------------------------------------------------------- + +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([" +\@EAL: No available hugepages reported in hugepages-1048576kB@d +\@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 --------------------------------------------------------------------------
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> --- v7: - fixed ovs stop log check for added tests. - test #8 is skipped using AT_ macro. Sample test output: ## ------------------------------- ## ## openvswitch 2.13.90 test suite. ## ## ------------------------------- ## OVS-DPDK unit tests 1: OVS-DPDK - EAL init ok 2: OVS-DPDK - add standard DPDK port skipped (system-dpdk.at:36) 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 skipped (system-dpdk.at:448) 9: OVS-DPDK - validate negotiation when both ovs and testpmd have tso off ok ## ------------- ## ## Test results. ## ## ------------- ## 7 tests were successful. 2 tests were skipped. --- tests/system-dpdk-macros.at | 17 ++- tests/system-dpdk.at | 301 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 309 insertions(+), 9 deletions(-)