diff mbox series

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

Message ID 0c4c167ad644d3dda51b992e51ec1c27b8492457.1589605823.git.gmuthukr@redhat.com
State New
Headers show
Series system-dpdk: add userspace-tso tests | expand

Commit Message

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

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>
---
v2:
 - removed tso check in existing tests (added in v1)
 - improved validations in host and guest end
 - added tests for non-tso backend.

Testing info:

Found a bug in virtio pmd for virtio negotiation with TSO in backend:
http://patchwork.dpdk.org/patch/70233/

In summary, host side do not have bug after applying above patch in dpdk,
even though reported failure (test #6) in host side is due to pmd in guest
side (I am working on fixing it).

Without patch, host side would not be able to enable TSO (as explained in it).

With virtio pmd patch:

 6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:330)

  userspace-tcp on
  testpmd - vhostuser client
  ovs - vhostuser server

  host side:
    ovs received set_features for 0x910008183 which has VIRTIO_NET_F_CSUM 
    but no VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.

 6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:333)

  userspace-tcp on
  testpmd - vhostuser client
  ovs - vhostuser server

  guest side:
    TCP_TSO is not turned on in virtio_user pmd and having:
    UDP_CKSUM TCP_CKSUM

 7: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:395)

  userspace-tcp off
  testpmd - vhostuser server
  ovs - vhostuser client

  guest side:
    TSO features were not turned off in virtio_user pmd but having:
    UDP_CKSUM TCP_CKSUM TCP_TSO


Without virtio pmd patch:

 6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:295)

  userspace-tcp on
  testpmd - vhostuser server
  ovs - vhostuser client

  host side:
    ovs received set_features for 0x910008000 which do not have any offload flags.
    VIRTIO_NET_F_CSUM, VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.

 6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:330)

  userspace-tcp on
  testpmd - vhostuser client
  ovs - vhostuser server

  host side:
    ovs received set_features for 0x910008000 which do not have any offload flags.
    VIRTIO_NET_F_CSUM,  VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.

 7: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:395)

  userspace-tcp off
  testpmd - vhostuser server
  ovs - vhostuser client

  guest side:
    TSO features were not turned off in virtio_user pmd but having:
    UDP_CKSUM TCP_CKSUM TCP_TSO

---
 tests/system-dpdk-macros.at |  17 ++--
 tests/system-dpdk.at        | 199 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 211 insertions(+), 5 deletions(-)

Comments

Gowrishankar Muthukrishnan May 16, 2020, 6:04 a.m. UTC | #1
>
> +dnl
> --------------------------------------------------------------------------
> +dnl validate tso negotiation (without userspace-tso)
> +AT_SETUP([OVS-DPDK - validate tso negotiation (with userspace-tso)])
>

Minor Typo  here which I realized after sending the patch. AT_SETUP should
log "without userspace-tso".

I will correct this in the next revision of this patch.
Thanks.

+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()
>
Flavio Leitner May 21, 2020, 4:48 a.m. UTC | #2
On Sat, May 16, 2020 at 11:23:53AM +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>
> ---
> v2:
>  - removed tso check in existing tests (added in v1)
>  - improved validations in host and guest end
>  - added tests for non-tso backend.
> 
> Testing info:
> 
> Found a bug in virtio pmd for virtio negotiation with TSO in backend:
> http://patchwork.dpdk.org/patch/70233/
> 
> In summary, host side do not have bug after applying above patch in dpdk,
> even though reported failure (test #6) in host side is due to pmd in guest
> side (I am working on fixing it).
> 
> Without patch, host side would not be able to enable TSO (as explained in it).
> 
> With virtio pmd patch:
> 
>  6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:330)
> 
>   userspace-tcp on
>   testpmd - vhostuser client
>   ovs - vhostuser server
> 
>   host side:
>     ovs received set_features for 0x910008183 which has VIRTIO_NET_F_CSUM 
>     but no VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.
> 
>  6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:333)
> 
>   userspace-tcp on
>   testpmd - vhostuser client
>   ovs - vhostuser server
> 
>   guest side:
>     TCP_TSO is not turned on in virtio_user pmd and having:
>     UDP_CKSUM TCP_CKSUM
> 
>  7: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:395)
> 
>   userspace-tcp off
>   testpmd - vhostuser server
>   ovs - vhostuser client
> 
>   guest side:
>     TSO features were not turned off in virtio_user pmd but having:
>     UDP_CKSUM TCP_CKSUM TCP_TSO
> 
> 
> Without virtio pmd patch:
> 
>  6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:295)
> 
>   userspace-tcp on
>   testpmd - vhostuser server
>   ovs - vhostuser client
> 
>   host side:
>     ovs received set_features for 0x910008000 which do not have any offload flags.
>     VIRTIO_NET_F_CSUM, VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.
> 
>  6: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:330)
> 
>   userspace-tcp on
>   testpmd - vhostuser client
>   ovs - vhostuser server
> 
>   host side:
>     ovs received set_features for 0x910008000 which do not have any offload flags.
>     VIRTIO_NET_F_CSUM,  VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6.
> 
>  7: OVS-DPDK - validate tso negotiation (with userspace-tso) FAILED (system-dpdk.at:395)
> 
>   userspace-tcp off
>   testpmd - vhostuser server
>   ovs - vhostuser client
> 
>   guest side:
>     TSO features were not turned off in virtio_user pmd but having:
>     UDP_CKSUM TCP_CKSUM TCP_TSO
> 
> ---
>  tests/system-dpdk-macros.at |  17 ++--
>  tests/system-dpdk.at        | 199 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 211 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
> index e5ac4f4..e804153 100644
> --- a/tests/system-dpdk-macros.at
> +++ b/tests/system-dpdk-macros.at
> @@ -48,13 +48,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])
> @@ -69,7 +67,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])
>     OVS_DPDK_SET_SOCKET_MEM()
> diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
> index b032c5b..016bb43 100644
> --- a/tests/system-dpdk.at
> +++ b/tests/system-dpdk.at
> @@ -8,6 +8,7 @@ dnl Check if EAL init is successful
>  AT_SETUP([OVS-DPDK - EAL init])
>  AT_KEYWORDS([dpdk])
>  OVS_DPDK_PRE_CHECK()
> +OVS_DB_START()
>  OVS_DPDK_START()
>  AT_CHECK([grep "DPDK Enabled - initializing..." ovs-vswitchd.log], [], [stdout])
>  AT_CHECK([grep "EAL" ovs-vswitchd.log], [], [stdout])
> @@ -28,6 +29,7 @@ AT_SETUP([OVS-DPDK - add standard DPDK port])
>  AT_KEYWORDS([dpdk])
>  
>  OVS_DPDK_PRE_PHY_SKIP()
> +OVS_DB_START()
>  OVS_DPDK_START()
>  
>  dnl Add userspace bridge and attach it to OVS
> @@ -55,6 +57,7 @@ dnl Add vhost-user-client port
>  AT_SETUP([OVS-DPDK - add vhost-user-client port])
>  AT_KEYWORDS([dpdk])
>  OVS_DPDK_PRE_CHECK()
> +OVS_DB_START()
>  OVS_DPDK_START()
>  
>  dnl Add userspace bridge and attach it to OVS
> @@ -89,6 +92,7 @@ AT_SETUP([OVS-DPDK - ping vhost-user ports])
>  AT_KEYWORDS([dpdk])
>  OVS_DPDK_PRE_CHECK()
>  AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
> +OVS_DB_START()
>  OVS_DPDK_START()
>  
>  dnl Find number of sockets
> @@ -169,6 +173,7 @@ AT_SETUP([OVS-DPDK - ping vhost-user-client ports])
>  AT_KEYWORDS([dpdk])
>  OVS_DPDK_PRE_CHECK()
>  AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
> +OVS_DB_START()
>  OVS_DPDK_START()
>  
>  dnl Find number of sockets
> @@ -241,3 +246,197 @@ OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
>  OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
>  AT_CLEANUP
>  dnl --------------------------------------------------------------------------
> +
> +dnl --------------------------------------------------------------------------
> +dnl validate tso negotiation (with userspace-tso)
> +AT_SETUP([OVS-DPDK - validate tso negotiation (with userspace-tso)])
> +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
> +AT_CHECK([lscpu], [], [stdout])
> +AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "448,"}; print "448"}' > NUMA_NODE])

It is used 3 times in your patchset,  could this be a macro like
OVS_DPDK_PRE_PHY_SKIP ?

I haven't tested the patch yet, but I am not finding any other
issue.

Thanks for the patchset!
fbl


> +
> +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 "show port 0 tx_offload capabilities" >> CMDFILE])
> +tail -f /dev/null | testpmd --no-pci \
> +           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
> +           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
> +           --single-file-segments -- --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 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} /Per Port/ && /(TCP|UDP)_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])
> +
> +dnl Clean up the testpmd now
> +pkill -f -x -9 'tail -f /dev/null'
> +
> +dnl Add vhostuser port (server mode)
> +AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
> +          type=dpdkvhostuser], [],
> +         [stdout], [stderr])
> +AT_CHECK([ovs-vsctl show], [], [stdout])
> +
> +dnl Execute testpmd in background
> +on_exit "pkill -f -x -9 'tail -f /dev/null'"
> +AT_CHECK([echo "show device info all" > CMDFILE])
> +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
> +tail -f /dev/null | testpmd --no-pci \
> +           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
> +           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
> +           --single-file-segments -- --cmdline-file=CMDFILE \
> +           -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
> +
> +dnl Give settling time to the testpmd processes - NOTE: this is bad form.
> +sleep 10
> +
> +dnl Check whether TSO is turned 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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
> +           $OVS_RUNDIR/testpmd-dpdkvhostuser0.log],[0],[1])
> +
> +dnl Clean up the testpmd now
> +pkill -f -x -9 'tail -f /dev/null'
> +
> +dnl Clean up
> +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
> +OVS_VSWITCHD_STOP()
> +OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
> +OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
> +AT_CLEANUP
> +dnl --------------------------------------------------------------------------
> +
> +dnl --------------------------------------------------------------------------
> +dnl validate tso negotiation (without userspace-tso)
> +AT_SETUP([OVS-DPDK - validate tso negotiation (with userspace-tso)])
> +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
> +AT_CHECK([lscpu], [], [stdout])
> +AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "448,"}; print "448"}' > NUMA_NODE])
> +
> +dnl Add userspace bridge and attach it to OVS
> +AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
> +
> +dnl Add vhostuser port (client mode)
> +AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface \
> +          dpdkvhostuserclient0 \
> +          type=dpdkvhostuserclient \
> +          options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [],
> +         [stdout], [stderr])
> +AT_CHECK([ovs-vsctl show], [], [stdout])
> +
> +dnl Execute testpmd in background
> +on_exit "pkill -f -x -9 'tail -f /dev/null'"
> +AT_CHECK([echo "show device info all" > CMDFILE])
> +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
> +tail -f /dev/null | testpmd --no-pci \
> +           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
> +           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
> +           --single-file-segments -- --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 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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
> +           $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0])
> +
> +dnl Clean up the testpmd now
> +pkill -f -x -9 'tail -f /dev/null'
> +
> +dnl Clean up
> +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
> +
> +dnl Add vhostuser port (server mode)
> +AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
> +          type=dpdkvhostuser], [],
> +         [stdout], [stderr])
> +AT_CHECK([ovs-vsctl show], [], [stdout])
> +
> +dnl Execute testpmd in background
> +on_exit "pkill -f -x -9 'tail -f /dev/null'"
> +AT_CHECK([echo "show device info all" > CMDFILE])
> +AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
> +tail -f /dev/null | testpmd --no-pci \
> +           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
> +           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
> +           --single-file-segments -- --cmdline-file=CMDFILE \
> +           -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
> +
> +dnl Give settling time to the testpmd processes - NOTE: this is bad form.
> +sleep 10
> +
> +dnl Check whether TSO is turned off (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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
> +           $OVS_RUNDIR/testpmd-dpdkvhostuser0.log],[0],[0])
> +
> +dnl Clean up the testpmd now
> +pkill -f -x -9 'tail -f /dev/null'
> +
> +dnl Clean up
> +AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
> +OVS_VSWITCHD_STOP()
> +OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
> +OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
> +AT_CLEANUP
> +dnl --------------------------------------------------------------------------
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/tests/system-dpdk-macros.at b/tests/system-dpdk-macros.at
index e5ac4f4..e804153 100644
--- a/tests/system-dpdk-macros.at
+++ b/tests/system-dpdk-macros.at
@@ -48,13 +48,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])
@@ -69,7 +67,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])
    OVS_DPDK_SET_SOCKET_MEM()
diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index b032c5b..016bb43 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -8,6 +8,7 @@  dnl Check if EAL init is successful
 AT_SETUP([OVS-DPDK - EAL init])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
+OVS_DB_START()
 OVS_DPDK_START()
 AT_CHECK([grep "DPDK Enabled - initializing..." ovs-vswitchd.log], [], [stdout])
 AT_CHECK([grep "EAL" ovs-vswitchd.log], [], [stdout])
@@ -28,6 +29,7 @@  AT_SETUP([OVS-DPDK - add standard DPDK port])
 AT_KEYWORDS([dpdk])
 
 OVS_DPDK_PRE_PHY_SKIP()
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Add userspace bridge and attach it to OVS
@@ -55,6 +57,7 @@  dnl Add vhost-user-client port
 AT_SETUP([OVS-DPDK - add vhost-user-client port])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Add userspace bridge and attach it to OVS
@@ -89,6 +92,7 @@  AT_SETUP([OVS-DPDK - ping vhost-user ports])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
 AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Find number of sockets
@@ -169,6 +173,7 @@  AT_SETUP([OVS-DPDK - ping vhost-user-client ports])
 AT_KEYWORDS([dpdk])
 OVS_DPDK_PRE_CHECK()
 AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null])
+OVS_DB_START()
 OVS_DPDK_START()
 
 dnl Find number of sockets
@@ -241,3 +246,197 @@  OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
 OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
 AT_CLEANUP
 dnl --------------------------------------------------------------------------
+
+dnl --------------------------------------------------------------------------
+dnl validate tso negotiation (with userspace-tso)
+AT_SETUP([OVS-DPDK - validate tso negotiation (with userspace-tso)])
+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
+AT_CHECK([lscpu], [], [stdout])
+AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "448,"}; print "448"}' > NUMA_NODE])
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
+
+dnl Add vhostuser port (client mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface \
+          dpdkvhostuserclient0 \
+          type=dpdkvhostuserclient \
+          options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+AT_CHECK([echo "show device info all" > CMDFILE])
+AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- --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 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} /Per Port/ && /(TCP|UDP)_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])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Add vhostuser port (server mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
+          type=dpdkvhostuser], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+AT_CHECK([echo "show device info all" > CMDFILE])
+AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- --cmdline-file=CMDFILE \
+           -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
+
+dnl Give settling time to the testpmd processes - NOTE: this is bad form.
+sleep 10
+
+dnl Check whether TSO is turned 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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
+           $OVS_RUNDIR/testpmd-dpdkvhostuser0.log],[0],[1])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
+OVS_VSWITCHD_STOP()
+OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
+OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------
+
+dnl --------------------------------------------------------------------------
+dnl validate tso negotiation (without userspace-tso)
+AT_SETUP([OVS-DPDK - validate tso negotiation (with userspace-tso)])
+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
+AT_CHECK([lscpu], [], [stdout])
+AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "448,"}; print "448"}' > NUMA_NODE])
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
+
+dnl Add vhostuser port (client mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface \
+          dpdkvhostuserclient0 \
+          type=dpdkvhostuserclient \
+          options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+AT_CHECK([echo "show device info all" > CMDFILE])
+AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- --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 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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
+           $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log],[0],[0])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
+
+dnl Add vhostuser port (server mode)
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
+          type=dpdkvhostuser], [],
+         [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+AT_CHECK([echo "show device info all" > CMDFILE])
+AT_CHECK([echo "show port 0 tx_offload capabilities" >> CMDFILE])
+tail -f /dev/null | testpmd --no-pci \
+           --socket-mem="$(cat NUMA_NODE)" --socket-limit="$(cat NUMA_NODE)" \
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
+           --vdev="net_tap0,iface=tap0" --file-prefix page0 \
+           --single-file-segments -- --cmdline-file=CMDFILE \
+           -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
+
+dnl Give settling time to the testpmd processes - NOTE: this is bad form.
+sleep 10
+
+dnl Check whether TSO is turned off (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} /Per Port/ && /(TCP|UDP)_CKSUM/ && /TCP_TSO/ {n++} END{printf n}' \
+           $OVS_RUNDIR/testpmd-dpdkvhostuser0.log],[0],[0])
+
+dnl Clean up the testpmd now
+pkill -f -x -9 'tail -f /dev/null'
+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
+OVS_VSWITCHD_STOP()
+OVS_DPDK_HUGEPAGE_CLEANUP([rtemap_*])
+OVS_DPDK_HUGEPAGE_CLEANUP([page0map_0])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------