From: JiangYuX <yux.jiang@intel.com>
To: dts@dpdk.org
Cc: JiangYu <yux.jiang@intel.com>
Subject: [dts] [PATCH V1] tests/perf_virtio_user_loopback: Add one new case and Optimize script
Date: Thu, 19 Nov 2020 13:19:25 +0000 [thread overview]
Message-ID: <20201119131925.2053604-1-yux.jiang@intel.com> (raw)
From: JiangYu <yux.jiang@intel.com>
1,Automate new case:TC10 perf_loopback_packed_ring_vectorized_path
2,Optimize testpmd function
Signed-off-by: JiangYu <yux.jiang@intel.com>
---
tests/TestSuite_perf_virtio_user_loopback.py | 78 ++++++++++++++++------------
1 file changed, 46 insertions(+), 32 deletions(-)
diff --git a/tests/TestSuite_perf_virtio_user_loopback.py b/tests/TestSuite_perf_virtio_user_loopback.py
index 9f40d36..4408786 100644
--- a/tests/TestSuite_perf_virtio_user_loopback.py
+++ b/tests/TestSuite_perf_virtio_user_loopback.py
@@ -43,6 +43,7 @@ import re
import json
import rst
import os
+from pmd_output import PmdOutput
from copy import deepcopy
from test_case import TestCase
from settings import UPDATE_EXPECTED, load_global_setting
@@ -70,6 +71,8 @@ class TestPerfVirtioUserLoopback(TestCase):
self.vhost = self.dut.new_session(suite="vhost")
self.virtio_user = self.dut.new_session(suite="virtio-user")
+ self.vhost_pmd = PmdOutput(self.dut, self.vhost)
+ self.virtio_user_pmd = PmdOutput(self.dut, self.virtio_user)
self.save_result_flag = True
self.json_obj = dict()
self.path=self.dut.apps_name['test-pmd']
@@ -106,36 +109,31 @@ class TestPerfVirtioUserLoopback(TestCase):
"""
start testpmd on vhost
"""
- eal_params = self.dut.create_eal_parameters(cores=self.core_list_host,
- no_pci=True, prefix='vhost')
- command_line_client = self.path + " %s " + \
- "--socket-mem %s --vdev " + \
- "'net_vhost0,iface=vhost-net,queues=%d' -- -i --nb-cores=%d " + \
- "--rxq=%d --txq=%d --txd=%d --rxd=%d"
- command_line_client = command_line_client % (
- eal_params, self.socket_mem, self.queue_number,
- self.nb_cores, self.queue_number, self.queue_number,
- nb_desc, nb_desc)
- self.vhost.send_expect(command_line_client, "testpmd> ", 120)
- self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
+ vdevs = "'net_vhost0,iface=vhost-net,queues={},client=0'".format(self.queue_number)
+ eal_params = "--socket-mem {} --vdev {}".format(self.socket_mem, vdevs)
+ param = "--nb-cores={} --rxq={} --txq={} --txd={} --rxd={}".format(self.nb_cores, self.queue_number, self.queue_number, nb_desc, nb_desc)
+ self.vhost_pmd.start_testpmd(self.core_list_host, param=param, no_pci=True, ports=[], eal_param=eal_params, prefix='vhost', fixed_prefix=True)
+ self.vhost_pmd.execute_cmd("set fwd mac", "testpmd> ", 120)
def start_virtio_testpmd(self, nb_desc, args):
"""
start testpmd on virtio
"""
- eal_params = self.dut.create_eal_parameters(cores=self.core_list_user,
- no_pci=True, prefix='virtio')
- command_line_user = self.path+ " %s " + \
- " --socket-mem %s " + \
- "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,queues=%d,%s " + \
- "-- -i %s --rss-ip --nb-cores=%d --rxq=%d --txq=%d --txd=%d --rxd=%d"
- command_line_user = command_line_user % (
- eal_params, self.socket_mem,
- self.queue_number, args["version"], args["path"], self.nb_cores,
- self.queue_number, self.queue_number, nb_desc, nb_desc)
- self.virtio_user.send_expect(command_line_user, "testpmd> ", 120)
- self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120)
- self.virtio_user.send_expect("start", "testpmd> ", 120)
+ eal_param = "--socket-mem {} --vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,queues={},{}".format(self.socket_mem, self.queue_number, args["version"])
+ if self.check_2M_env:
+ eal_param += " --single-file-segments"
+ if 'vectorized_path' in self.running_case:
+ eal_param += " --force-max-simd-bitwidth=512"
+ param = "{} --rss-ip --nb-cores={} --rxq={} --txq={} --txd={} --rxd={}".format(args["path"], self.nb_cores, self.queue_number, self.queue_number, nb_desc, nb_desc)
+ self.virtio_user_pmd.start_testpmd(cores=self.core_list_user, param=param, eal_param=eal_param, \
+ no_pci=True, ports=[], prefix="virtio", fixed_prefix=True)
+ self.virtio_user_pmd.execute_cmd("set fwd mac", "testpmd> ", 120)
+ self.virtio_user_pmd.execute_cmd("start", "testpmd> ", 120)
+
+ @property
+ def check_2M_env(self):
+ out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ")
+ return True if out == '2048' else False
def calculate_avg_throughput(self):
"""
@@ -143,10 +141,10 @@ class TestPerfVirtioUserLoopback(TestCase):
"""
results = 0.0
results_row = []
- out = self.vhost.send_expect("show port stats all", "testpmd>", 60)
+ out = self.vhost_pmd.execute_cmd("show port stats all", "testpmd>", 60)
time.sleep(5)
for i in range(10):
- out = self.vhost.send_expect("show port stats all", "testpmd>", 60)
+ out = self.vhost_pmd.execute_cmd("show port stats all", "testpmd>", 60)
time.sleep(5)
lines = re.search("Rx-pps:\s*(\d*)", out)
result = lines.group(1)
@@ -161,22 +159,22 @@ class TestPerfVirtioUserLoopback(TestCase):
"""
for frame_size in self.frame_sizes:
self.throughput[frame_size] = dict()
- self.vhost.send_expect("set txpkts %d" % frame_size, "testpmd> ", 30)
- self.vhost.send_expect("start tx_first 32", "testpmd> ", 30)
+ self.vhost_pmd.execute_cmd("set txpkts %d" % frame_size, "testpmd> ", 30)
+ self.vhost_pmd.execute_cmd("start tx_first 32", "testpmd> ", 30)
Mpps = self.calculate_avg_throughput()
self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
self.throughput[frame_size][nb_desc] = Mpps
self.logger.info("Trouthput of " +
"framesize: {}, rxd/txd: {} is :{} Mpps".format(
frame_size, nb_desc, Mpps))
- self.vhost.send_expect("stop", "testpmd> ", 60)
+ self.vhost_pmd.execute_cmd("stop", "testpmd> ", 60)
def close_all_testpmd(self):
"""
close all testpmd of vhost and virtio
"""
- self.vhost.send_expect("quit", "#", 60)
- self.virtio_user.send_expect("quit", "#", 60)
+ self.vhost_pmd.execute_cmd("quit", "#", 60)
+ self.virtio_user_pmd.execute_cmd("quit", "#", 60)
def close_all_session(self):
"""
@@ -422,6 +420,22 @@ class TestPerfVirtioUserLoopback(TestCase):
self.handle_expected()
self.handle_results()
+ def test_perf_loopback_packed_ring_vectorized_path(self):
+ """
+ Test Case 10: loopback test with packed ring vectorized path
+ """
+ self.test_target = "packed_ring_vectorized_path"
+ virtio_pmd_arg = {"version": "packed_vq=1,in_order=1,mrg_rxbuf=0,vectorized=1",
+ "path": "--tx-offloads=0x0"}
+ self.expected_throughput = self.get_suite_cfg()['expected_throughput'][self.test_target]
+ nb_desc = self.test_parameters[64][0]
+ self.start_vhost_testpmd(nb_desc)
+ self.start_virtio_testpmd(nb_desc, virtio_pmd_arg)
+ self.send_and_verify(nb_desc, "virtio_1.1 vectorized")
+ self.close_all_testpmd()
+ self.handle_expected()
+ self.handle_results()
+
def tear_down(self):
"""
Run after each test case.
--
2.7.4
next reply other threads:[~2020-11-19 5:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 13:19 JiangYuX [this message]
2020-11-19 5:21 ` Jiang, YuX
2020-11-19 8:45 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201119131925.2053604-1-yux.jiang@intel.com \
--to=yux.jiang@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).