Hi Kevin, Thanks for the patch, one comment below, let me know your thoughts.
> -----Original Message----- > From: dev <[email protected]> On Behalf Of Kevin Traynor > Sent: Friday, June 24, 2022 3:43 PM > To: [email protected] > Cc: [email protected] > Subject: [ovs-dev] [PATCH v5 3/3] system-dpdk: Add unit test for user > configured mempools. > > Test that user configured mempool params have been stored. > > Signed-off-by: Kevin Traynor <[email protected]> > Reviewed-by: David Marchand <[email protected]> > --- > tests/system-dpdk.at | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at index > 7d2715c4a..8889861a2 100644 > --- a/tests/system-dpdk.at > +++ b/tests/system-dpdk.at > @@ -13,4 +13,19 @@ m4_define([SYSTEM_DPDK_ALLOWED_LOGS],[ > ]) > > +dnl CHECK_MEMPOOL_PARAM([mtu], [numa], [+line]) dnl dnl Waits for logs > +to indicate that the user has configured a mempool dnl for 'mtu' on > +'numa'. Checking starts from line number 'line' in dnl > +ovs-vswitchd.log. > +m4_define([CHECK_MEMPOOL_PARAM], [ > + line_st=$3 > + if [[ -z "$line_st" ]] > + then > + line_st="+0" > + fi > + OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log dnl > + | grep "User configured shared mempool set for: MTU > +$1, NUMA $2."]) > +]) > + > dnl --------------------------------------------------------------------- > ----- > dnl Check if EAL init is successful > @@ -405,2 +420,21 @@ OVS_VSWITCHD_STOP("m4_join([], > [SYSTEM_DPDK_ALLOWED_LOGS], [ AT_CLEANUP dnl dnl ----------------------- > --------------------------------------------------- > + > +dnl > +----------------------------------------------------------------------- > +--- > +dnl Setup user configured mempools > +AT_SETUP([OVS-DPDK - user configured mempool]) > +AT_KEYWORDS([dpdk]) > +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:dpdk-init=true]) > + > +CHECK_MEMPOOL_PARAM([9000], [ALL], []) > +CHECK_MEMPOOL_PARAM([6000], [ALL], []) > +CHECK_MEMPOOL_PARAM([1500], [ALL], []) > + > +OVS_VSWITCHD_STOP("[SYSTEM_DPDK_ALLOWED_LOGS]") > +AT_CLEANUP > +dnl > +----------------------------------------------------------------------- > +--- > -- The test case seems to be quite simple, how about the following change to test few more cases ? diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at index 8c36ae655..7f6a0e16f 100644 --- a/tests/system-dpdk.at +++ b/tests/system-dpdk.at @@ -596,13 +596,65 @@ 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 +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 +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 -------------------------------------------------------------------------- Thanks and regards, Sunil _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
