From: Yingya Han <yingyax.han@intel.com>
To: dts@dpdk.org
Cc: Yingya Han <yingyax.han@intel.com>
Subject: [dts][PTACH V1 3/3]tests/perf_test_base: optimize l3fwd related cases
Date: Wed, 18 May 2022 14:20:39 +0800 [thread overview]
Message-ID: <20220518062039.2234504-4-yingyax.han@intel.com> (raw)
In-Reply-To: <20220518062039.2234504-1-yingyax.han@intel.com>
1) framework already supports rx_mode, delete the avx2/avx512 setting in case.
2) l3fwd uses the parameters "-E" and "-L" to correspond to EM and LPM modes respectively.
the default is LPM mode.
Signed-off-by: Yingya Han <yingyax.han@intel.com>
---
tests/perf_test_base.py | 100 +++++++++++++++-------------------------
1 file changed, 37 insertions(+), 63 deletions(-)
diff --git a/tests/perf_test_base.py b/tests/perf_test_base.py
index fb4f123a..9a73787a 100644
--- a/tests/perf_test_base.py
+++ b/tests/perf_test_base.py
@@ -145,7 +145,6 @@ class PerfTestBase(object):
def __init__(self, valports, socket, mode=None, bin_type=None):
self.__bin_type = bin_type or BIN_TYPE.L3FWD
self.__compile_rx_desc = None
- self.__compile_avx = None
self.__rxtx_queue_size = None
self.__mode = mode or SUITE_TYPE.PF
self.__suite = None
@@ -378,6 +377,7 @@ class PerfTestBase(object):
layer = {
"ether": {
"dst": dmacs[self.__valports.index(port_id)],
+ "src": "02:00:00:00:00:0%d" % port_id,
},
}
else:
@@ -385,6 +385,7 @@ class PerfTestBase(object):
layer = {
"ether": {
"dst": dmac,
+ "src": "02:00:00:00:00:0%d" % port_id,
},
}
return layer
@@ -694,8 +695,7 @@ class PerfTestBase(object):
# init testpmd
if self.__pf_driver is not NIC_DRV.PCI_STUB:
self.__init_host_testpmd()
- self.__l3fwd_em = self.__l3fwd_init(MATCH_MODE.EM)
- self.__l3fwd_lpm = self.__l3fwd_init(MATCH_MODE.LPM)
+ self.__l3fwd_init()
def __init_host_testpmd(self):
"""
@@ -767,7 +767,7 @@ class PerfTestBase(object):
)
return "loop" if port_num == 1 else "chained"
- def __testpmd_start(self, mode, core_mask, config, frame_size):
+ def __testpmd_start(self, mode, eal_para, config, frame_size):
# use test pmd
bin = os.path.join(self.__target_dir, self.dut.apps_name["test-pmd"])
fwd_mode, _config = config
@@ -775,21 +775,16 @@ class PerfTestBase(object):
command_line = (
"{bin} "
"-v "
- "-c {cores} "
- "-n {channel} "
- "{allowlist}"
+ "{eal_para}"
"-- -i "
+ "--portmask {port_mask} "
"{config} "
"{port_topo} "
""
).format(
**{
"bin": bin,
- "cores": core_mask,
- "channel": self.dut.get_memory_channels(),
- "allowlist": self.__bin_ps_allow_list
- if self.__bin_ps_allow_list
- else "",
+ "eal_para": eal_para,
"port_mask": utils.create_mask(self.__valports),
"config": _config,
"port_topo": port_topo,
@@ -823,53 +818,30 @@ class PerfTestBase(object):
self.dut.send_expect("quit", "# ")
self.__is_bin_ps_on = False
- def __l3fwd_init(self, mode, rename=True):
+ def __l3fwd_init(self):
"""
- Prepare long prefix match table, __replace P(x) port pattern
+ compile l3fwd
"""
self.app_name = self.dut.apps_name["l3fwd"].replace(" ", "")
- l3fwd_method = "".join(["_", mode.value])
- flg = 1 if mode is MATCH_MODE.LPM else 0
- _opt = (
- "USER_FLAGS=-DAPP_LOOKUP_METHOD={}".format(flg)
- if self.__mode is SUITE_TYPE.PF
- else ""
- )
- out = self.dut.build_dpdk_apps("./examples/l3fwd", _opt)
+ out = self.dut.build_dpdk_apps("./examples/l3fwd")
self.verify("Error" not in out, "compilation error 1")
self.verify("No such file" not in out, "compilation error 2")
- if not rename:
- return "./" + self.app_name
- # rename binary file
- self.d_con(
- ("mv -f " + self.app_name + " " + self.app_name + "{}").format(
- l3fwd_method
- )
- )
- l3fwd_bin = os.path.join("./" + self.app_name + l3fwd_method)
- return l3fwd_bin
+ self.__l3fwd_bin = os.path.join("./" + self.app_name)
- def __l3fwd_start(self, mode, core_mask, config, frame_size):
- bin = self.__l3fwd_em if mode is MATCH_MODE.EM else self.__l3fwd_lpm
+ def __l3fwd_start(self, mode, eal_para, config, frame_size):
# Start L3fwd application
command_line = (
"{bin} "
"-v "
- "-c {cores} "
- "-n {channel} "
- "{allowlist}"
+ "{eal_para}"
"-- "
"-p {port_mask} "
"--config '{config}'"
""
).format(
**{
- "bin": bin,
- "cores": core_mask,
- "channel": self.dut.get_memory_channels(),
- "allowlist": self.__bin_ps_allow_list
- if self.__bin_ps_allow_list
- else "",
+ "bin": self.__l3fwd_bin,
+ "eal_para": eal_para,
"port_mask": utils.create_mask(self.__valports),
"config": config,
}
@@ -886,6 +858,9 @@ class PerfTestBase(object):
)
if self.nic in suppored_nics or self.__mode is SUITE_TYPE.VF:
command_line += " --parse-ptype"
+ if mode == MATCH_MODE.EM:
+ # use exact mode
+ command_line += " -E"
if frame_size > 1518:
command_line += " --enable-jumbo --max-pkt-len %d" % frame_size
# ignore duplicate start binary with the same option
@@ -909,13 +884,18 @@ class PerfTestBase(object):
self.d_con(["^C", "# ", 25])
self.__is_bin_ps_on = False
- def __bin_ps_start(self, mode, core_mask, config, frame_size):
+ def __bin_ps_start(self, mode, core_list, config, frame_size):
+ eal_para = self.dut.create_eal_parameters(
+ cores=core_list,
+ ports=self.__bin_ps_allow_list,
+ socket=self.__socket,
+ )
bin_methods = {
BIN_TYPE.PMD: self.__testpmd_start,
BIN_TYPE.L3FWD: self.__l3fwd_start,
}
start_func = bin_methods.get(self.__bin_type)
- start_func(mode, core_mask, config, frame_size)
+ start_func(mode, eal_para, config, frame_size)
def __bin_ps_close(self):
bin_methods = {
@@ -1210,7 +1190,7 @@ class PerfTestBase(object):
try:
test_content = self.__test_content.get("port_configs")
results = []
- for config, core_mask, port_conf, frame_size in test_content:
+ for config, core_list, port_conf, frame_size in test_content:
# Start application binary process
self.logger.info(
(
@@ -1224,7 +1204,7 @@ class PerfTestBase(object):
self.__bin_type.value,
)
)
- self.__bin_ps_start(mode, core_mask, port_conf, frame_size)
+ self.__bin_ps_start(mode, core_list, port_conf, frame_size)
result = self.__throughput(l3_proto, mode, frame_size)
# Stop binary process
self.__bin_ps_close()
@@ -1249,7 +1229,7 @@ class PerfTestBase(object):
try:
test_content = self.__test_content.get("port_configs")
results = []
- for config, core_mask, port_conf, frame_size in test_content:
+ for config, core_list, port_conf, frame_size in test_content:
# Start application binary process
self.logger.info(
(
@@ -1263,7 +1243,7 @@ class PerfTestBase(object):
self.__bin_type.value,
)
)
- self.__bin_ps_start(mode, core_mask, port_conf, frame_size)
+ self.__bin_ps_start(mode, core_list, port_conf, frame_size)
result = self.__rfc2544(config, l3_proto, mode, frame_size)
# Stop binary process
self.__bin_ps_close()
@@ -1365,12 +1345,12 @@ class PerfTestBase(object):
if self.__bin_type == BIN_TYPE.PMD:
# keep only one logic core of the main core
- cores_mask = utils.create_mask(corelist[thread_num - 1 :])
+ _corelist = corelist[thread_num - 1 :]
[
configs.append(
[
test_item,
- cores_mask,
+ _corelist,
[
fixed_config[0],
fixed_config[1]
@@ -1384,7 +1364,6 @@ class PerfTestBase(object):
]
# (port,queue,lcore)
else:
- cores_mask = utils.create_mask(corelist)
total = len(grp)
# ignore first 2 cores
_corelist = (corelist * (total // len(corelist) + 1))[:total]
@@ -1393,7 +1372,7 @@ class PerfTestBase(object):
configs.append(
[
test_item,
- cores_mask,
+ _corelist,
",".join(
[
"({0},{1},{2})".format(port, queue, core)
@@ -1509,7 +1488,6 @@ class PerfTestBase(object):
cores_for_all = test_content.get("cores_for_all", False)
self.__compile_rx_desc = test_content.get("compile_rx_desc")
if self.__bin_type == BIN_TYPE.PMD:
- self.__compile_avx = test_content.get("compile_avx")
forwarding_mode = test_content.get("forwarding_mode") or "io"
descriptor_numbers = test_content.get("descriptor_numbers") or {
"txd": 2048,
@@ -1536,7 +1514,7 @@ class PerfTestBase(object):
return test_content
def __get_bin_ps_allowlist(self, port_list=None):
- allowlist = ""
+ allowlist = []
if self.__mode is SUITE_TYPE.PF:
if not port_list:
return None
@@ -1544,15 +1522,11 @@ class PerfTestBase(object):
pci = self.dut.ports_info[port_index].get("pci")
if not pci:
continue
- allowlist += "-a {} ".format(pci)
+ allowlist.append(pci)
else:
- allowlist = "".join(
- [
- "-a {} ".format(pci)
- for _, info in self.__vf_ports_info.items()
- for pci in info.get("vfs_pci")
- ]
- )
+ for _, info in self.__vf_ports_info.items():
+ for pci in info.get("vfs_pci"):
+ allowlist.append(pci)
return allowlist
--
2.25.1
next prev parent reply other threads:[~2022-05-18 6:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 6:20 [dts][PTACH V1 0/3] revise L3fwd " Yingya Han
2022-05-18 6:20 ` [dts][PTACH V1 1/3]conf/*: improve performance conf settings Yingya Han
2022-05-18 6:20 ` [dts][PTACH V1 2/3]test_plan/l3fwd: remove invalid compilation Yingya Han
2022-05-18 6:20 ` Yingya Han [this message]
2022-05-18 14:08 ` [dts][PTACH V1 3/3]tests/perf_test_base: optimize l3fwd related cases lijuan.tu
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=20220518062039.2234504-4-yingyax.han@intel.com \
--to=yingyax.han@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).