test suite reviews and discussions
 help / color / mirror / Atom feed
From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests/pvp_multi_paths: update code to support trex
Date: Tue, 13 Aug 2019 07:44:26 +0800	[thread overview]
Message-ID: <1565653466-31770-1-git-send-email-lihongx.ma@intel.com> (raw)

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 tests/TestSuite_pvp_multi_paths_performance.py     | 37 ++++++++++++++--------
 ...vp_multi_paths_vhost_single_core_performance.py | 31 +++++++++++-------
 ...p_multi_paths_virtio_single_core_performance.py | 36 +++++++++++++--------
 3 files changed, 65 insertions(+), 39 deletions(-)

diff --git a/tests/TestSuite_pvp_multi_paths_performance.py b/tests/TestSuite_pvp_multi_paths_performance.py
index 071b2c6..b633b98 100644
--- a/tests/TestSuite_pvp_multi_paths_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_performance.py
@@ -1,6 +1,6 @@
 # BSD LICENSE
 #
-# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@ Test PVP performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/4C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
@@ -59,11 +58,18 @@ class TestPVPMultiPathPerformance(TestCase):
         self.core_list_host = self.core_list[2:4]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -81,7 +87,6 @@ class TestPVPMultiPathPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -90,14 +95,17 @@ class TestPVPMultiPathPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        # set traffic option
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
@@ -119,10 +127,11 @@ class TestPVPMultiPathPerformance(TestCase):
         self.dut.send_expect("killall -s INT testpmd", "#")
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
         command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \
-                              " %s --legacy-mem --file-prefix=vhost --vdev " + \
+                              " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \
                               "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=1 --txd=1024 --rxd=1024"
         command_line_client = command_line_client % (self.target,
-            self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+            self.dut.get_memory_channels(), self.core_mask_host,
+            self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci'])
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
         self.vhost.send_expect("start", "testpmd> ", 120)
diff --git a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
index 8d94491..fcaadf2 100644
--- a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
@@ -1,6 +1,6 @@
 # BSD LICENSE
 #
-# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@ Test PVP vhost single core performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathVhostPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/5C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
         self.core_list = self.dut.get_core_list(
@@ -58,11 +57,18 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         self.core_list_host = self.core_list[3:5]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -78,7 +84,6 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -87,14 +92,16 @@ class TestPVPMultiPathVhostPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
diff --git a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
index 32f5171..6cd3a6d 100644
--- a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
@@ -36,7 +36,8 @@ Test PVP virtio single core performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathVirtioPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/5C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
@@ -59,11 +58,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.core_list_host = self.core_list[2:5]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -81,7 +87,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -90,14 +95,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        # set traffic option
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
@@ -119,10 +128,11 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.dut.send_expect("killall -s INT testpmd", "#")
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
         command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \
-                              " %s --legacy-mem --file-prefix=vhost --vdev " + \
+                              " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \
                               "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=2 --txd=1024 --rxd=1024"
         command_line_client = command_line_client % (self.target,
-            self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+            self.dut.get_memory_channels(), self.core_mask_host,
+            self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci'])
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd io", "testpmd> ", 120)
         self.vhost.send_expect("start", "testpmd> ", 120)
-- 
2.7.4


             reply	other threads:[~2019-08-13  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 23:44 lihong [this message]
2019-08-14  2:42 ` Wang, Yinan
2019-08-28  5:56 ` 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=1565653466-31770-1-git-send-email-lihongx.ma@intel.com \
    --to=lihongx.ma@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).