diff mbox series

[ovs-dev] system-dpdk: Improve user configured mempool test.

Message ID 20220905105022.107298-1-sunil.pai.g@intel.com
State Superseded
Headers show
Series [ovs-dev] system-dpdk: Improve user configured mempool test. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Pai G, Sunil Sept. 5, 2022, 10:50 a.m. UTC
Improve the test by adding and varying the MTU of a vhost port to check if
relevant mempools are created/(re)used.

Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
---
 tests/system-dpdk.at | 61 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 58 insertions(+), 3 deletions(-)

Comments

Kevin Traynor Sept. 13, 2022, 12:27 p.m. UTC | #1
On 05/09/2022 12:50, Sunil Pai G wrote:
> Improve the test by adding and varying the MTU of a vhost port to check if
> relevant mempools are created/(re)used.
> 
> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>

Thanks Sunil. Checked on master and branch-3.0 and working fine.

Acked-by: Kevin Traynor <ktraynor@redhat.com>

> ---
>   tests/system-dpdk.at | 61 +++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 58 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
> index 15f97097a..f3bf7065d 100644
> --- a/tests/system-dpdk.at
> +++ b/tests/system-dpdk.at
> @@ -1123,17 +1123,72 @@ dnl --------------------------------------------------------------------------
>   dnl Setup user configured mempools
>   AT_SETUP([OVS-DPDK - user configured mempool])
>   AT_KEYWORDS([dpdk])
> +AT_SKIP_IF([! which dpdk-testpmd >/dev/null 2>/dev/null])
>   OVS_DPDK_PRE_CHECK()
>   OVS_DPDK_START_OVSDB()
>   OVS_DPDK_START_VSWITCHD()
>   
> -AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=9000,6000,1500])
> +AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=8000,6000,1500])
>   AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true])
>   
> -CHECK_MEMPOOL_PARAM([9000], [ALL], [])
> +CHECK_MEMPOOL_PARAM([8000], [ALL], [])
>   CHECK_MEMPOOL_PARAM([6000], [ALL], [])
>   CHECK_MEMPOOL_PARAM([1500], [ALL], [])
>   
> -OVS_VSWITCHD_STOP("[SYSTEM_DPDK_ALLOWED_LOGS]")
> +AT_CHECK(ovs-appctl vlog/set netdev_dpdk:dbg)
> +
> +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])
> +
> +dnl Add userspace bridge and vhostuser-client port
> +AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
> +AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
> +AT_CHECK([ovs-vsctl show], [], [stdout])
> +sleep 2
> +
> +dnl Parse log file for vhost init
> +AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
> +AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
> +AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
> +
> +dnl Execute testpmd in background
> +on_exit "pkill -f -x -9 'tail -f /dev/null'"
> +tail -f /dev/null | dpdk-testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\
> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
> +           --file-prefix page0 --single-file-segments -- -a > $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 &
> +
> +OVS_WAIT_UNTIL([grep "virtio is now ready for processing" ovs-vswitchd.log])
> +
> +dnl Check if the right user configured mempool is found for default MTU (1500)
> +AT_CHECK([grep "Found user configured shared mempool .* suitable for port with MTU 1500" ovs-vswitchd.log], [], [stdout])
> +AT_CHECK([grep "Port dpdkvhostuserclient0: Requesting a mempool" ovs-vswitchd.log], [], [stdout])
> +
> +dnl Change the MTU value to 7000 to trigger mempool change
> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=7000)
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 7000"])
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
> +
> +dnl Change back the MTU value to 1500 to trigger mempool change (re-use)
> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=1500)
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 1500"])
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Reusing mempool"])
> +
> +dnl Change the MTU value beyond the max value in shared-mempool-config list
> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=9000)
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "No user configured shared mempool mbuf sizes found suitable for port with MTU 9000"])
> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
> +
> +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])
> +OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
> +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
> +])")
>   AT_CLEANUP
>   dnl --------------------------------------------------------------------------
Ilya Maximets Sept. 13, 2022, 1:30 p.m. UTC | #2
On 9/13/22 14:27, Kevin Traynor wrote:
> On 05/09/2022 12:50, Sunil Pai G wrote:
>> Improve the test by adding and varying the MTU of a vhost port to check if
>> relevant mempools are created/(re)used.
>>
>> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
> 
> Thanks Sunil. Checked on master and branch-3.0 and working fine.
> 
> Acked-by: Kevin Traynor <ktraynor@redhat.com>

Hi.  I have one question: Does this test require testpmd?

I mean, if we're not testing vhost-user specifically, we should,
probably, reduce the number of components involved and just use
dpdk 'null' ports, for example.

Best regards, Ilya Maximets.

> 
>> ---
>>   tests/system-dpdk.at | 61 +++++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 58 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
>> index 15f97097a..f3bf7065d 100644
>> --- a/tests/system-dpdk.at
>> +++ b/tests/system-dpdk.at
>> @@ -1123,17 +1123,72 @@ dnl --------------------------------------------------------------------------
>>   dnl Setup user configured mempools
>>   AT_SETUP([OVS-DPDK - user configured mempool])
>>   AT_KEYWORDS([dpdk])
>> +AT_SKIP_IF([! which dpdk-testpmd >/dev/null 2>/dev/null])
>>   OVS_DPDK_PRE_CHECK()
>>   OVS_DPDK_START_OVSDB()
>>   OVS_DPDK_START_VSWITCHD()
>>   -AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=9000,6000,1500])
>> +AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=8000,6000,1500])
>>   AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true])
>>   -CHECK_MEMPOOL_PARAM([9000], [ALL], [])
>> +CHECK_MEMPOOL_PARAM([8000], [ALL], [])
>>   CHECK_MEMPOOL_PARAM([6000], [ALL], [])
>>   CHECK_MEMPOOL_PARAM([1500], [ALL], [])
>>   -OVS_VSWITCHD_STOP("[SYSTEM_DPDK_ALLOWED_LOGS]")
>> +AT_CHECK(ovs-appctl vlog/set netdev_dpdk:dbg)
>> +
>> +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])
>> +
>> +dnl Add userspace bridge and vhostuser-client port
>> +AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
>> +AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
>> +AT_CHECK([ovs-vsctl show], [], [stdout])
>> +sleep 2
>> +
>> +dnl Parse log file for vhost init
>> +AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
>> +AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
>> +AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
>> +
>> +dnl Execute testpmd in background
>> +on_exit "pkill -f -x -9 'tail -f /dev/null'"
>> +tail -f /dev/null | dpdk-testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\
>> +           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
>> +           --file-prefix page0 --single-file-segments -- -a > $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 &
>> +
>> +OVS_WAIT_UNTIL([grep "virtio is now ready for processing" ovs-vswitchd.log])
>> +
>> +dnl Check if the right user configured mempool is found for default MTU (1500)
>> +AT_CHECK([grep "Found user configured shared mempool .* suitable for port with MTU 1500" ovs-vswitchd.log], [], [stdout])
>> +AT_CHECK([grep "Port dpdkvhostuserclient0: Requesting a mempool" ovs-vswitchd.log], [], [stdout])
>> +
>> +dnl Change the MTU value to 7000 to trigger mempool change
>> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
>> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=7000)
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 7000"])
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
>> +
>> +dnl Change back the MTU value to 1500 to trigger mempool change (re-use)
>> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
>> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=1500)
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 1500"])
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Reusing mempool"])
>> +
>> +dnl Change the MTU value beyond the max value in shared-mempool-config list
>> +TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
>> +AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=9000)
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "No user configured shared mempool mbuf sizes found suitable for port with MTU 9000"])
>> +OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
>> +
>> +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])
>> +OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
>> +\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
>> +])")
>>   AT_CLEANUP
>>   dnl --------------------------------------------------------------------------
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Pai G, Sunil Sept. 14, 2022, 8:43 a.m. UTC | #3
> >> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
> >
> > Thanks Sunil. Checked on master and branch-3.0 and working fine.
> >
> > Acked-by: Kevin Traynor <ktraynor@redhat.com>
> 
> Hi.  I have one question: Does this test require testpmd?
> 
> I mean, if we're not testing vhost-user specifically, we should, probably,
> reduce the number of components involved and just use dpdk 'null' ports,
> for example.
> 

Hi Ilya, it doesn’t require testpmd. Sure, I have incorporated your suggestion in v2 here:
https://patchwork.ozlabs.org/project/openvswitch/patch/20220914083659.225297-1-sunil.pai.g@intel.com/

@Kevin, since the test was changed slightly, I didnt carry your ack to v2.
Would you mind looking over v2 as well please ?

Thanks and regards
Sunil

<snipped>
Kevin Traynor Sept. 14, 2022, 9:27 a.m. UTC | #4
On 14/09/2022 10:43, Pai G, Sunil wrote:
> 
> 
>>>> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
>>>
>>> Thanks Sunil. Checked on master and branch-3.0 and working fine.
>>>
>>> Acked-by: Kevin Traynor <ktraynor@redhat.com>
>>
>> Hi.  I have one question: Does this test require testpmd?
>>
>> I mean, if we're not testing vhost-user specifically, we should, probably,
>> reduce the number of components involved and just use dpdk 'null' ports,
>> for example.
>>
> 
> Hi Ilya, it doesn’t require testpmd. Sure, I have incorporated your suggestion in v2 here:
> https://patchwork.ozlabs.org/project/openvswitch/patch/20220914083659.225297-1-sunil.pai.g@intel.com/
> 
> @Kevin, since the test was changed slightly, I didnt carry your ack to v2.
> Would you mind looking over v2 as well please ?
> 

Sure, LGTM. Good idea to reduce the components,

thanks,
Kevin.

> Thanks and regards
> Sunil
> 
> <snipped>
diff mbox series

Patch

diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index 15f97097a..f3bf7065d 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -1123,17 +1123,72 @@  dnl --------------------------------------------------------------------------
 dnl Setup user configured mempools
 AT_SETUP([OVS-DPDK - user configured mempool])
 AT_KEYWORDS([dpdk])
+AT_SKIP_IF([! which dpdk-testpmd >/dev/null 2>/dev/null])
 OVS_DPDK_PRE_CHECK()
 OVS_DPDK_START_OVSDB()
 OVS_DPDK_START_VSWITCHD()
 
-AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=9000,6000,1500])
+AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:shared-mempool-config=8000,6000,1500])
 AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true])
 
-CHECK_MEMPOOL_PARAM([9000], [ALL], [])
+CHECK_MEMPOOL_PARAM([8000], [ALL], [])
 CHECK_MEMPOOL_PARAM([6000], [ALL], [])
 CHECK_MEMPOOL_PARAM([1500], [ALL], [])
 
-OVS_VSWITCHD_STOP("[SYSTEM_DPDK_ALLOWED_LOGS]")
+AT_CHECK(ovs-appctl vlog/set netdev_dpdk:dbg)
+
+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])
+
+dnl Add userspace bridge and vhostuser-client port
+AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
+AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+sleep 2
+
+dnl Parse log file for vhost init
+AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
+
+dnl Execute testpmd in background
+on_exit "pkill -f -x -9 'tail -f /dev/null'"
+tail -f /dev/null | dpdk-testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\
+           --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
+           --file-prefix page0 --single-file-segments -- -a > $OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 &
+
+OVS_WAIT_UNTIL([grep "virtio is now ready for processing" ovs-vswitchd.log])
+
+dnl Check if the right user configured mempool is found for default MTU (1500)
+AT_CHECK([grep "Found user configured shared mempool .* suitable for port with MTU 1500" ovs-vswitchd.log], [], [stdout])
+AT_CHECK([grep "Port dpdkvhostuserclient0: Requesting a mempool" ovs-vswitchd.log], [], [stdout])
+
+dnl Change the MTU value to 7000 to trigger mempool change
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=7000)
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 7000"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
+
+dnl Change back the MTU value to 1500 to trigger mempool change (re-use)
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=1500)
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Found user configured shared mempool .* suitable for port with MTU 1500"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Reusing mempool"])
+
+dnl Change the MTU value beyond the max value in shared-mempool-config list
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK(ovs-vsctl set Interface dpdkvhostuserclient0 mtu_request=9000)
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "No user configured shared mempool mbuf sizes found suitable for port with MTU 9000"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Port dpdkvhostuserclient0: Requesting a mempool"])
+
+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])
+OVS_VSWITCHD_STOP("m4_join([], [SYSTEM_DPDK_ALLOWED_LOGS], [
+\@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
+])")
 AT_CLEANUP
 dnl --------------------------------------------------------------------------