test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V3]nic_single_core_perf: support CVL nic single core test
@ 2020-01-17  6:41 han,yingya
  0 siblings, 0 replies; only message in thread
From: han,yingya @ 2020-01-17  6:41 UTC (permalink / raw)
  To: dts; +Cc: hanyingya

From: hanyingya <yingyax.han@intel.com>

Signed-off-by: hanyingya <yingyax.han@intel.com>
---
 tests/TestSuite_nic_single_core_perf.py | 101 ++++++++++++++----------
 1 file changed, 59 insertions(+), 42 deletions(-)

diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py
index f43b5db..d7ca0f2 100644
--- a/tests/TestSuite_nic_single_core_perf.py
+++ b/tests/TestSuite_nic_single_core_perf.py
@@ -53,17 +53,20 @@ class TestNicSingleCorePerf(TestCase):
         Run at the start of each test suite.
         PMD prerequisites.
         """
-        self.verify(self.nic in ['niantic', 'fortville_25g', 'fortville_spirit',
-                                 'ConnectX5_MT4121', 'ConnectX4_LX_MT4117'],
-                                 "Not required NIC ")
+        self.verify(self.nic in ['niantic', 'fortville_25g', 'fortville_spirit', 'ConnectX5_MT4121',
+                                 'ConnectX4_LX_MT4117', 'columbiaville_100g', 'columbiaville_25g'], "Not required NIC ")
 
         self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip']
 
-        # Update DPDK config file and rebuild to get best perf on fortville
+        # Update DPDK config file and rebuild to get best perf on fortville and columbiaville.
         if self.nic in ["fortville_25g", "fortville_spirit"]:
             self.dut.send_expect(
                 "sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=y/' ./config/common_base", "#", 20)
             self.dut.build_install_dpdk(self.target)
+        elif self.nic in ["columbiaville_100g", "columbiaville_25g"]:
+            self.dut.send_expect(
+                "sed -i -e 's/CONFIG_RTE_LIBRTE_ICE_16BYTE_RX_DESC=n/CONFIG_RTE_LIBRTE_ICE_16BYTE_RX_DESC=y/' ./config/common_base", "#", 20)
+            self.dut.build_install_dpdk(self.target)
 
         # Based on h/w type, choose how many ports to use
         self.dut_ports = self.dut.get_ports()
@@ -135,41 +138,55 @@ class TestNicSingleCorePerf(TestCase):
             'IP(src="1.2.3.4",dst="192.18.2.0")',
             'IP(src="1.2.3.4",dst="192.18.2.1")']
 
-    def create_pacap_file(self, frame_size):
+    def create_pacap_file(self, frame_size, port_num):
         """
         Prepare traffic flow
         """
         payload_size = frame_size - HEADER_SIZE['ip'] - HEADER_SIZE['eth']
         pcaps = {}
         for _port in self.dut_ports:
-            index = self.dut_ports[_port]
-            cnt = 0
-            for layer in self.flows()[_port * 2:(_port + 1) * 2]:
-                flow = ['Ether(src="52:00:00:00:00:00")/%s/("X"*%d)' % (layer, payload_size)]
-                pcap = os.sep.join([self.output_path, "dst{0}_{1}.pcap".format(index, cnt)])
+            if 1 == port_num:
+                flow = ['Ether(src="52:00:00:00:00:00")/%s/("X"*%d)' % (self.flows()[_port], payload_size)]
+                pcap = os.sep.join([self.output_path, "dst{0}.pcap".format(_port)])
                 self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, string.join(flow, ',')))
                 self.tester.scapy_execute()
-                if index not in pcaps:
-                    pcaps[index] = []
-                pcaps[index].append(pcap)
-                cnt += 1
+                pcaps[_port] = []
+                pcaps[_port].append(pcap)
+            else:
+                index = self.dut_ports[_port]
+                cnt = 0
+                for layer in self.flows()[_port * 2:(_port + 1) * 2]:
+                    flow = ['Ether(src="52:00:00:00:00:00")/%s/("X"*%d)' % (layer, payload_size)]
+                    pcap = os.sep.join([self.output_path, "dst{0}_{1}.pcap".format(index, cnt)])
+                    self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, string.join(flow, ',')))
+                    self.tester.scapy_execute()
+                    if index not in pcaps:
+                        pcaps[index] = []
+                    pcaps[index].append(pcap)
+                    cnt += 1
         return pcaps
 
-    def prepare_stream(self, pcaps):
+    def prepare_stream(self, pcaps, port_num):
         """
         create streams for ports,one port one stream
         """
         tgen_input = []
-        for rxPort in range(self.nb_ports):
-            if rxPort % self.nb_ports == 0 or self.nb_ports % rxPort == 2:
-                txIntf = self.tester.get_local_port(self.dut_ports[rxPort + 1])
-                port_id = self.dut_ports[rxPort + 1]
-            else:
-                txIntf = self.tester.get_local_port(self.dut_ports[rxPort - 1])
-                port_id = self.dut_ports[rxPort - 1]
-            rxIntf = self.tester.get_local_port(self.dut_ports[rxPort])
-            for pcap in pcaps[port_id]:
+        if 1 == port_num:
+            txIntf = self.tester.get_local_port(self.dut_ports[0])
+            rxIntf = txIntf
+            for pcap in pcaps[0]:
                 tgen_input.append((txIntf, rxIntf, pcap))
+        else:
+            for rxPort in range(self.nb_ports):
+                if rxPort % self.nb_ports == 0 or self.nb_ports % rxPort == 2:
+                    txIntf = self.tester.get_local_port(self.dut_ports[rxPort + 1])
+                    port_id = self.dut_ports[rxPort + 1]
+                else:
+                    txIntf = self.tester.get_local_port(self.dut_ports[rxPort - 1])
+                    port_id = self.dut_ports[rxPort - 1]
+                rxIntf = self.tester.get_local_port(self.dut_ports[rxPort])
+                for pcap in pcaps[port_id]:
+                    tgen_input.append((txIntf, rxIntf, pcap))
         return tgen_input
 
     def test_perf_nic_single_core(self):
@@ -177,8 +194,7 @@ class TestNicSingleCorePerf(TestCase):
         Run nic single core performance
         """
         self.nb_ports = len(self.dut_ports)
-        self.verify(self.nb_ports == 2 or self.nb_ports == 4,
-                    "Require 2 or 4 ports to test")
+        self.verify(self.nb_ports >= 1, "At least 1 port is required to test")
         self.perf_test(self.nb_ports)
         self.handle_results()
 
@@ -203,8 +219,7 @@ class TestNicSingleCorePerf(TestCase):
         if load_global_setting(UPDATE_EXPECTED) == "yes":
             for frame_size in self.test_parameters.keys():
                 for nb_desc in self.test_parameters[frame_size]:
-                    self.expected_throughput[frame_size][nb_desc] = \
-                        round(self.throughput[frame_size][nb_desc], 3)
+                    self.expected_throughput[frame_size][nb_desc] = round(self.throughput[frame_size][nb_desc], 3)
 
     def perf_test(self, port_num):
         """
@@ -212,12 +227,12 @@ class TestNicSingleCorePerf(TestCase):
         """
         # ports whitelist
         eal_para = ""
-        for i in range(self.nb_ports):
+        for i in range(port_num):
             eal_para += " -w " + self.dut.ports_info[i]['pci']
 
         # run testpmd with 2 cores, one for interaction ,and one for forwarding
         core_config = "1S/2C/1T"
-        core_list = self.dut.get_core_list(core_config, socket = self.socket)
+        core_list = self.dut.get_core_list(core_config, socket=self.socket)
         self.logger.info("Executing Test Using cores: %s" % core_list)
         port_mask = utils.create_mask(self.dut_ports)
 
@@ -226,17 +241,19 @@ class TestNicSingleCorePerf(TestCase):
         # fortville has to use 2 queues at least to get the best performance
         if self.nic in ["fortville_25g", "fortville_spirit"]:
             param += " --rxq=2 --txq=2"
+        # columbiaville use one queue per port for best performance.
+        elif self.nic in ["columbiaville_100g", "columbiaville_25g"]:
+            param += "  --rxq=%d --rxq=%d" % (port_num, port_num)
 
         for frame_size in self.test_parameters.keys():
             self.throughput[frame_size] = dict()
-            pcaps = self.create_pacap_file(frame_size)
-            tgenInput = self.prepare_stream(pcaps)
+            pcaps = self.create_pacap_file(frame_size, port_num)
+            tgenInput = self.prepare_stream(pcaps, port_num)
             for nb_desc in self.test_parameters[frame_size]:
-                self.logger.info("Test running at parameters: " +
-                    "framesize: {}, rxd/txd: {}".format(frame_size, nb_desc))
+                self.logger.info("Test running at parameters: " + "framesize: {}, rxd/txd: {}".format(frame_size, nb_desc))
                 parameter = param + " --txd=%d --rxd=%d" % (nb_desc, nb_desc)
                 self.pmdout.start_testpmd(
-                    core_config, parameter, eal_para, socket = self.socket)
+                    core_config, parameter, eal_para, socket=self.socket)
                 self.dut.send_expect("start", "testpmd> ", 15)
 
                 vm_config = self.set_fields()
@@ -256,10 +273,8 @@ class TestNicSingleCorePerf(TestCase):
                 self.dut.send_expect("stop", "testpmd> ")
                 self.dut.send_expect("quit", "# ", 30)
 
-                self.verify(throughput,
-                    "No traffic detected, please check your configuration")
-                self.logger.info("Throughput of " +
-                    "framesize: {}, rxd/txd: {} is :{} Mpps".format(
+                self.verify(throughput, "No traffic detected, please check your configuration")
+                self.logger.info("Throughput of " + "framesize: {}, rxd/txd: {} is :{} Mpps".format(
                         frame_size, nb_desc, throughput))
 
         return self.throughput
@@ -288,8 +303,7 @@ class TestNicSingleCorePerf(TestCase):
                 ret_data[header[4]] = "{:.3f} Mpps".format(
                     self.expected_throughput[frame_size][nb_desc])
                 ret_data[header[5]] = "{:.3f} Mpps".format(
-                    self.throughput[frame_size][nb_desc] -
-                        self.expected_throughput[frame_size][nb_desc])
+                    self.throughput[frame_size][nb_desc] - self.expected_throughput[frame_size][nb_desc])
 
                 ret_datas[nb_desc] = deepcopy(ret_data)
             self.test_result[frame_size] = deepcopy(ret_datas)
@@ -365,5 +379,8 @@ class TestNicSingleCorePerf(TestCase):
             self.dut.send_expect(
                 "sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=y/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n/' ./config/common_base", "#", 20)
             self.dut.build_install_dpdk(self.target)
-
+        elif self.nic in ["columbiaville_100g", "columbiaville_25g"]:
+            self.dut.send_expect(
+                "sed -i -e 's/CONFIG_RTE_LIBRTE_ICE_16BYTE_RX_DESC=y/CONFIG_RTE_LIBRTE_ICE_16BYTE_RX_DESC=n/' ./config/common_base", "#", 20)
+            self.dut.build_install_dpdk(self.target)
         self.dut.kill_all()
-- 
2.17.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-17  6:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17  6:41 [dts] [PATCH V3]nic_single_core_perf: support CVL nic single core test han,yingya

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).