test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Han, YingyaX" <yingyax.han@intel.com>
To: "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH V1]tests/vmdq: Enable RSS so that each pool can receive packets
Date: Mon, 16 Mar 2020 08:59:12 +0000	[thread overview]
Message-ID: <BN7PR11MB2818CC9548E3AFFFA5CB0660FFF90@BN7PR11MB2818.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1584345873-114574-1-git-send-email-yingyax.han@intel.com>

[-- Attachment #1: Type: text/plain, Size: 17260 bytes --]

Tested_by  Han, YingyaX <yingyax.han@intel.com>

Best regards,
Yingya

-----Original Message-----
From: Han, YingyaX <yingyax.han@intel.com> 
Sent: Monday, March 16, 2020 4:05 PM
To: dts@dpdk.org
Cc: Han, YingyaX <yingyax.han@intel.com>
Subject: [dts][PATCH V1]tests/vmdq: Enable RSS so that each pool can receive packets

Signed-off-by: hanyingya <yingyax.han@intel.com>
---
 tests/TestSuite_vmdq.py | 257 ++++++++++++++++++----------------------
 1 file changed, 116 insertions(+), 141 deletions(-)

diff --git a/tests/TestSuite_vmdq.py b/tests/TestSuite_vmdq.py index 623d728..d7651da 100644
--- a/tests/TestSuite_vmdq.py
+++ b/tests/TestSuite_vmdq.py
@@ -11,44 +11,38 @@ import os
 import re
 from test_case import TestCase
 from time import sleep
+from settings import HEADER_SIZE
 from pktgen import PacketGeneratorHelper
 
+
 class TestVmdq(TestCase):
-    dut_ports = []
-    ip_dot1q_header_size = 22
-    default_framesize = 64
-    default_payload = default_framesize - ip_dot1q_header_size
-    current_frame_size = 0
-    destmac_port0 = "52:54:00:12:00:00"
-    destmac_port1 = "52:54:00:12:01:00"
-    da_repeat = 1
-    vlan_repeat = 1 
-    queues = 8
 
     def set_up_all(self):
         """
         Run at the start of each test suite.
         """
         self.tester.extend_external_packet_generator(TestVmdq, self)
-        
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
+        self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
+
         self.dut.send_expect("sed -i 's/CONFIG_RTE_MAX_QUEUES_PER_PORT=256/CONFIG_RTE_MAX_QUEUES_PER_PORT=1024/' ./config/common_base", "# ", 5)
-        
         self.dut.build_install_dpdk(self.target)
         # Update the max queue per port for Fortville.
         self.dut.send_expect("sed -i 's/define MAX_QUEUES 128/define MAX_QUEUES 1024/' ./examples/vmdq/main.c", "#", 5)
-        
-        self.dut_ports = self.dut.get_ports(self.nic)
-        self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
+        out = self.dut.send_expect("make -C examples/vmdq", "#", 10)
+        self.verify("Error" not in out, "Compilation error")
 
+        self.frame_size = 64
+        self.header_size = HEADER_SIZE['ip'] + HEADER_SIZE['eth']
+        self.destmac_port0 = "52:54:00:12:00:00"
+        self.destmac_port1 = "52:54:00:12:01:00"
         self.core_configs = []
         self.core_configs.append({'cores': '1S/1C/1T', 'mpps': {}})
         self.core_configs.append({'cores': '1S/2C/1T', 'mpps': {}})
         self.core_configs.append({'cores': '1S/2C/2T', 'mpps': {}})
         self.core_configs.append({'cores': '1S/4C/1T', 'mpps': {}})
 
-        self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
-        out = self.dut.send_expect("make -C examples/vmdq", "#", 10)
-        self.verify("Error" not in out, "Compilation error")
         # get dts output path
         if self.logger.log_path.startswith(os.sep):
             self.output_path = self.logger.log_path @@ -58,147 +52,121 @@ class TestVmdq(TestCase):
             self.output_path = os.sep.join([cur_path, self.logger.log_path])
         # create an instance to set stream field setting
         self.pktgen_helper = PacketGeneratorHelper()
+        self.prios = range(8)
 
-    def validateApproxEqual(self, lines):
+    def set_up(self):
         """
-        Check that all the rx queue stats are within a 30% range.
+        Run before each test case.
         """
-        minimum = 1000000
-        maximun = 0
-
-        # Need to use Python re package because utils.regexp only handles 1 group,
-        # we need 4.
-        scanner = re.compile(
-            "^Pool [0-9]+: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)$")
-        for l in lines:
-            m = scanner.search(l)
-            if m is None:
-                # Line at the end, "Finished handling signal", ignore
-                pass
-            else:
-                for stat in m.groups():
-                    if stat < minimum:
-                        minimum = stat
-                    if stat > maximun:
-                        maximun = stat
-        self.verify(maximun - minimum <= minimum *
-                    0.3, "Too wide variation in queue stats")
+        if self.nic in ("niantic", "springfountain"):
+            self.pools = 64
+        elif self.nic in ("fortville_spirit", "fortville_spirit_single"):
+            self.pools = 63
+        elif self.nic in ("fortville_eagle"):
+            self.pools = 34
+        else:
+            self.pools = 8
 
-    def Npools_128queues(self, npools):
+    def start_application(self, npools, core_config):
         """
-        MAX queues is 128
-        queues/pools = 128/npools
+        Prepare the commandline and start vmdq app
         """
-        self.current_frame_size = self.default_framesize
-
-        self.dut_ports = self.dut.get_ports(self.nic)
-
-        core_list = self.dut.get_core_list("1S/4C/1T", socket=self.ports_socket)
+        core_list = self.dut.get_core_list(core_config, socket=self.ports_socket)
+        self.verify(core_list is not None, "Requested cores failed")
         core_mask = utils.create_mask(core_list)
-
-        port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
+        port_mask = utils.create_mask(self.dut_ports)
         # Run the application
-        out = self.dut.send_expect("./examples/vmdq/build/vmdq_app -n 4 -c %s -- -p %s --nb-pools %s&" %
-                                   (core_mask, port_mask, str(npools)), "reading queues", 120)
+        self.dut.send_expect("./examples/vmdq/build/vmdq_app -c %s -n 4 -- -p %s --nb-pools %s --enable-rss" %
+                             (core_mask, port_mask, str(npools)), 
+ "reading queues", 120)
 
-        # Transmit traffic
+    def get_tgen_input(self, prios):
+        """
+        create streams for ports.
+        """
         tx_port = self.tester.get_local_port(self.dut_ports[0])
         rx_port = self.tester.get_local_port(self.dut_ports[1])
-        tx_mac = self.tester.get_mac(tx_port)
-
-        self.vlan_repeat = npools
-        self.da_repeat = npools
         tgen_input = []
-        for p in range(8):
-            self.tester.scapy_append('dmac="%s"' % self.destmac_port0)
-            self.tester.scapy_append('smac="%s"' % tx_mac)
-            self.tester.scapy_append(
-                'flows = [Ether(src=smac, dst=dmac)/Dot1Q(vlan=0,prio=%d)]'%p)
+        for prio in prios:
+            pcap = os.sep.join([self.output_path, "%s%d.pcap" % (self.suite_name, prio)])
+            tgen_input.append((tx_port, rx_port, "%s" % pcap))
+        return tgen_input
 
-            pcap = os.sep.join([self.output_path, "test%d.pcap" % p])
-            self.tester.scapy_append('wrpcap("%s", flows)' %pcap)
-
-            self.tester.scapy_execute()
-            tgen_input.append((tx_port, rx_port, "%s" %pcap))
-
-        self.tester.pktgen.clear_streams()
-        vm_config = self.set_fields()
-        # run packet generator
-        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 10,
-                                                        vm_config, self.tester.pktgen)
-        loss = self.tester.pktgen.measure_loss(stream_ids=streams)
-        self.logger.info("loss is {}!".format(loss))
+    def create_pcaps(self, prios):
+        """
+        create traffic flows to pcap files
+        """
+        payload = self.frame_size - self.header_size
+        for prio in prios:
+            self.tester.scapy_append(
+                'flows = [Ether(dst="%s")/Dot1Q(vlan=0,prio=%d)/IP(src="1.2.3.4", dst="1.1.1.1")/("X"*%d)]'
+                % (self.destmac_port0, prio, payload))
+            pcap = os.sep.join([self.output_path, "%s%d.pcap" % (self.suite_name, prio)])
+            self.tester.scapy_append('wrpcap("%s", flows)' % pcap)
+        self.tester.scapy_execute()
 
-        # Verify the accurate
-        self.verify(loss[0]/100 < 0.001, "Excessive packet loss")
+    def verify_all_vmdq_stats(self):
+        """
+        Every RX queue should have received approximately (+/-15%) the same number of incoming packets.
+        """
         out = self.get_vmdq_stats()
-        self.validateApproxEqual(out.split("\r\n"))
+        lines_list = out.split("\r\n")
+        nb_packets = []
+        for pool_info in lines_list:
+            if pool_info.startswith('Pool'):
+                nb_packets += pool_info.split()[2:]
+        nb_packets = list(map(int, nb_packets))
+        self.verify(min(nb_packets) > 0, "Some queues don't get any packet!")
+        self.verify(float((max(nb_packets) - min(nb_packets))/max(nb_packets)) <= 0.15,
+                    "Too wide variation in queue stats")
 
     def get_vmdq_stats(self):
-        vmdq_dcb_session = self.dut.new_session()
-        vmdq_dcb_session.send_expect("kill -s SIGHUP  `pgrep -fl vmdq_app | awk '{print $1}'`", "#", 20)
+        vmdq_session = self.dut.new_session()
+        vmdq_session.send_expect("kill -s SIGHUP  `pgrep -fl vmdq_app | 
+ awk '{print $1}'`", "#", 20)
         out = self.dut.get_session_output()
         self.logger.info(out)
-        vmdq_dcb_session.close()
+        vmdq_session.close()
         return out
 
-    def set_up(self):
+    def Npools_128queues(self, npools):
         """
-        Run before each test case.
+        MAX queues is 128
+        queues/pools = 128/npools
         """
-        self.dut.kill_all()
+        # Run the application
+        self.start_application(npools, "1S/4C/1T")
+        # Transmit traffic
+        self.create_pcaps(self.prios)
+        tgen_input = self.get_tgen_input(self.prios)
+        vm_config = self.set_fields(npools, npools)
+        # Start traffic transmission using approx 10% of line rate.
+        ratePercent = 10
+        # run packet generator
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, ratePercent, vm_config, self.tester.pktgen)
+        # set traffic option
+        options = {'duration': 15}
+        loss = self.tester.pktgen.measure_loss(stream_ids=streams, options=options)
+        self.logger.info("loss is [loss rate, SendNumbers, ReceNumbers]{}!".format(loss))
+        # Verify there is no packet loss
+        self.verify(loss[1] == loss[2], "Packet Loss! Send: %d, but only Receive: %d!".format(loss[1], loss[2]))
+        self.verify_all_vmdq_stats()
 
     def test_perf_vmdq_64pools_queues(self):
         """
         This function call "Npools_128queues" with different number
         of pools. Details see below. If not sure, set it as 8 pools.
         """
-        if self.nic in ("niantic", "springfountain"):
-            self.Npools_128queues(64)
-        elif self.nic in ("fortville_spirit", "fortville_spirit_single"):
-            self.Npools_128queues(63)
-        elif self.nic in ("fortville_eagle"):
-            self.Npools_128queues(34)
-        else: 
-            self.Npools_128queues(8)
+        self.Npools_128queues(self.pools)
 
     def test_perf_vmdq_performance(self):
         """
         Try different configuration and different packet size
         """
-        self.tester.get_interface(
-            self.tester.get_local_port(self.dut_ports[0]))
-
         frame_sizes = [64, 128, 256, 512, 1024, 1280, 1518]
         for config in self.core_configs:
-
             self.logger.info(config["cores"])
             self.dut.kill_all()
-
             core_config = config['cores']
-            core_list = self.dut.get_core_list(core_config,socket=self.ports_socket)
-            core_mask = utils.create_mask(core_list)
-            portmask = utils.create_mask(self.dut.get_ports())
-            if self.nic in ("niantic", "springfountain"):
-                self.queues = 64
-                self.dut.send_expect(
-                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 64&" %
-                    (self.dut.get_memory_channels(), core_mask, portmask), "reading queues", 30)
-            elif self.nic in ("fortville_spirit", "fortville_spirit_single"):
-                self.queues = 63
-                self.dut.send_expect(
-                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 63&" %
-                    (self.dut.get_memory_channels(), core_mask, portmask), "reading queues", 30)
-            elif self.nic in ("fortville_eagle"):
-                self.queues = 34
-                self.dut.send_expect(
-                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 34&" %
-                    (self.dut.get_memory_channels(), core_mask, portmask), "reading queues", 30)
-            else:
-                self.queues = 8
-                self.dut.send_expect(
-                    "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s --nb-pools 8&" %
-                    (self.dut.get_memory_channels(), core_mask, portmask), "reading queues", 30)
+            self.start_application(self.pools, core_config)
 
             tx_port = self.tester.get_local_port(self.dut_ports[0])
             rx_port = self.tester.get_local_port(self.dut_ports[1])
@@ -207,7 +175,6 @@ class TestVmdq(TestCase):
             sleep(5)
 
             for frame_size in frame_sizes:
-                TestVmdq.current_frame_size = frame_size
                 self.logger.info(str(frame_size))
 
                 self.tester.scapy_append('dstmac="%s"' % self.destmac_port0) @@ -215,10 +182,10 @@ class TestVmdq(TestCase):
                 self.tester.scapy_append('srcmac="%s"' % tx_mac)
                 self.tester.scapy_append(
                         'flows = [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=0)/("X"*%d)]' %
-                        (frame_size - TestVmdq.ip_dot1q_header_size))
+                        (frame_size - self.header_size))
 
                 pcap = os.sep.join([self.output_path, "test1.pcap"])
-                self.tester.scapy_append('wrpcap("%s", flows)' %pcap)
+                self.tester.scapy_append('wrpcap("%s", flows)' % pcap)
 
                 self.tester.scapy_execute()
 
@@ -227,18 +194,13 @@ class TestVmdq(TestCase):
                 self.tester.scapy_append('srcmac="%s"' % tx_mac)
                 self.tester.scapy_append(
                         'flows = [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=0)/("X"*%d)]' %
-                        (frame_size - TestVmdq.ip_dot1q_header_size))
+                        (frame_size - self.header_size))
 
                 pcap = os.sep.join([self.output_path, "test2.pcap"])
                 self.tester.scapy_append('wrpcap("%s", flows)' % pcap)
-
                 self.tester.scapy_execute()
 
-                self.vlan_repeat = self.queues
-                self.da_repeat = self.queues
-
                 tgen_input = []
-
                 pcap1 = os.sep.join([self.output_path, "test1.pcap"])
                 pcap2 = os.sep.join([self.output_path, "test2.pcap"])
 
@@ -247,13 +209,11 @@ class TestVmdq(TestCase):
 
                 # clear streams before add new streams
                 self.tester.pktgen.clear_streams()
-                vm_config = self.set_fields()
+                vm_config = self.set_fields(self.pools, self.pools)
                 # run packet generator
-                streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100,
-                                                    vm_config, self.tester.pktgen)
+                streams = 
+ self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, 
+ vm_config, self.tester.pktgen)
                 _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams)
-
-                config['mpps'][frame_size] = pps/1000000.0
+                config['mpps'][frame_size] = pps / 1000000.0
 
         for n in range(len(self.core_configs)):
             for size in frame_sizes:
@@ -271,12 +231,27 @@ class TestVmdq(TestCase):
         self.result_table_print()
 
     # Override etgen.dot1q function
-    def set_fields(self):
-        ''' set ip protocol field behavior '''
+    def set_fields(self, vid_range, dmac_range):
+        """
+        set ip protocol field behavior
+        """
         fields_config = {
-        'vlan':  {
-            0: {'range': self.vlan_repeat, 'action': 'inc'}},
-        'mac':  {
-            'dst': {'range': self.da_repeat, 'action': 'inc'}},}
-
+            'vlan': {
+                0: {'range': vid_range, 'action': 'inc'}},
+            'mac': {
+                'dst': {'range': dmac_range, 'action': 'inc'}},
+            'ip': {'src': {'action': 'random'}},
+        }
         return fields_config
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        pass
--
2.17.2


[-- Attachment #2: TestVmdq.log --]
[-- Type: application/octet-stream, Size: 587887 bytes --]

      reply	other threads:[~2020-03-16  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16  8:04 hanyingya
2020-03-16  8:59 ` Han, YingyaX [this message]

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=BN7PR11MB2818CC9548E3AFFFA5CB0660FFF90@BN7PR11MB2818.namprd11.prod.outlook.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).