test suite reviews and discussions
 help / color / mirror / Atom feed
From: Weiyuan Li <weiyuanx.li@intel.com>
To: dts@dpdk.org, yuan.peng@intel.com
Cc: Weiyuan Li <weiyuanx.li@intel.com>
Subject: [dts][PATCH V1 02/12] tests/vf_offload: update dts code for dpdk csum change
Date: Mon, 18 Jul 2022 10:54:37 +0800	[thread overview]
Message-ID: <20220718025447.13287-2-weiyuanx.li@intel.com> (raw)
In-Reply-To: <20220718025447.13287-1-weiyuanx.li@intel.com>

According to dpdk commit 9b4ea7ae77fa(app/testpmd: revert MAC update in checksum forwarding) modify
the script adapt to this chagne.

1. Modify VF case to enable promisc.
2. Modify PF case to send packet dst mac is random.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_vf_offload.py | 106 ++++++++++++++++++++++++----------
 1 file changed, 76 insertions(+), 30 deletions(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 4dd05cac..393e68a4 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -43,7 +43,7 @@ class TestVfOffload(TestCase):
         self.setup_2pf_2vf_1vm_env_flag = 0
         self.setup_2pf_2vf_1vm_env(driver="")
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
-        self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
+        self.portMask = utils.create_mask(self.vm0_dut_ports)
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
         self.tester.send_expect(
             "ifconfig %s mtu %s"
@@ -59,6 +59,14 @@ class TestVfOffload(TestCase):
     def set_up(self):
         pass
 
+    def ip_link_set(self, host_intf=None, cmd=None, port=None, types=None, value=0):
+        if host_intf is None or cmd is None or port is None or types is None:
+            return
+        set_command = f"ip link set {host_intf} {cmd} {port} {types} {value}"
+        out = self.dut.send_expect(set_command, "# ")
+        if "RTNETLINK answers: Invalid argument" in out:
+            self.dut.send_expect(set_command, "# ")
+
     def setup_2pf_2vf_1vm_env(self, driver="default"):
 
         self.used_dut_port_0 = self.dut_ports[0]
@@ -68,6 +76,37 @@ class TestVfOffload(TestCase):
         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, driver=driver)
         self.sriov_vfs_port_1 = self.dut.ports_info[self.used_dut_port_1]["vfs_port"]
 
+        self.host_intf_0 = self.dut.ports_info[self.used_dut_port_0]["intf"]
+        self.host_intf_1 = self.dut.ports_info[self.used_dut_port_1]["intf"]
+
+        self.ip_link_set(
+            host_intf=self.host_intf_0,
+            cmd="vf",
+            port=0,
+            types="trust",
+            value="on",
+        )
+        self.ip_link_set(
+            host_intf=self.host_intf_1,
+            cmd="vf",
+            port=0,
+            types="trust",
+            value="on",
+        )
+        self.ip_link_set(
+            host_intf=self.host_intf_0,
+            cmd="vf",
+            port=0,
+            types="spoofchk",
+            value="off",
+        )
+        self.ip_link_set(
+            host_intf=self.host_intf_1,
+            cmd="vf",
+            port=0,
+            types="spoofchk",
+            value="off",
+        )
         try:
 
             for port in self.sriov_vfs_port_0:
@@ -136,6 +175,10 @@ class TestVfOffload(TestCase):
         dut.send_expect("csum set udp hw %d" % port, "testpmd>")
         dut.send_expect("csum set tcp hw %d" % port, "testpmd>")
         dut.send_expect("csum set sctp hw %d" % port, "testpmd>")
+        dut.send_expect("csum set ip hw %d" % 1, "testpmd>")
+        dut.send_expect("csum set udp hw %d" % 1, "testpmd>")
+        dut.send_expect("csum set tcp hw %d" % 1, "testpmd>")
+        dut.send_expect("csum set sctp hw %d" % 1, "testpmd>")
         dut.send_expect("port start all", "testpmd>")
 
     def checksum_enablesw(self, port, dut):
@@ -144,6 +187,10 @@ class TestVfOffload(TestCase):
         dut.send_expect("csum set udp sw %d" % port, "testpmd>")
         dut.send_expect("csum set tcp sw %d" % port, "testpmd>")
         dut.send_expect("csum set sctp sw %d" % port, "testpmd>")
+        dut.send_expect("csum set ip sw %d" % 1, "testpmd>")
+        dut.send_expect("csum set udp sw %d" % 1, "testpmd>")
+        dut.send_expect("csum set tcp sw %d" % 1, "testpmd>")
+        dut.send_expect("csum set sctp sw %d" % 1, "testpmd>")
         dut.send_expect("port start all", "testpmd>")
 
     def checksum_validate(self, packets_sent, packets_expected):
@@ -154,12 +201,11 @@ class TestVfOffload(TestCase):
             self.tester.get_local_port(self.dut_ports[0])
         )
         rx_interface = self.tester.get_interface(
-            self.tester.get_local_port(self.dut_ports[0])
+            self.tester.get_local_port(self.dut_ports[1])
         )
-
         sniff_src = self.vm0_testpmd.get_port_mac(0)
         checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)")
-
+        sniff_src = "52:00:00:00:00:00"
         chksum = dict()
         result = dict()
 
@@ -175,16 +221,11 @@ class TestVfOffload(TestCase):
         self.tester.send_expect("exit()", "#")
 
         self.tester.scapy_background()
-        self.tester.scapy_append(
-            'p = sniff(filter="ether src %s", iface="%s", count=%d)'
-            % (sniff_src, rx_interface, len(packets_sent))
+        inst = self.tester.tcpdump_sniff_packets(
+            intf=rx_interface,
+            count=len(packets_sent),
+            filters=[{"layer": "ether", "config": {"src": sniff_src}}],
         )
-        self.tester.scapy_append("nr_packets=len(p)")
-        self.tester.scapy_append(
-            'reslist = [p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") for i in range(nr_packets)]'
-        )
-        self.tester.scapy_append("import string")
-        self.tester.scapy_append('RESULT = ",".join(reslist)')
 
         # Send packet.
         self.tester.scapy_foreground()
@@ -196,7 +237,15 @@ class TestVfOffload(TestCase):
 
         self.tester.scapy_execute()
         out = self.tester.scapy_get_result()
-        packets_received = out.split(",")
+
+        p = self.tester.load_tcpdump_sniff_packets(inst)
+        nr_packets = len(p)
+        print(p)
+        packets_received = [
+            p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%")
+            for i in range(nr_packets)
+        ]
+
         self.verify(
             len(packets_sent) == len(packets_received), "Unexpected Packets Drop"
         )
@@ -251,17 +300,15 @@ class TestVfOffload(TestCase):
         """
         self.vm0_testpmd.start_testpmd(
             VM_CORES_MASK,
-            "--portmask=%s " % (self.portMask)
-            + "--enable-rx-cksum "
-            + ""
-            + "--port-topology=loop",
+            "--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
+        self.vm0_testpmd.execute_cmd("set promisc 1 on")
+        self.vm0_testpmd.execute_cmd("set promisc 0 on")
 
         time.sleep(2)
         port_id_0 = 0
         mac = self.vm0_testpmd.get_port_mac(0)
-
         sndIP = "10.0.0.1"
         sndIPv6 = "::1"
         pkts = {
@@ -280,15 +327,15 @@ class TestVfOffload(TestCase):
         expIP = sndIP
         expIPv6 = sndIPv6
         pkts_ref = {
-            "IP/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)'
+            "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/UDP()/("X"*46)'
             % (mac, expIP),
-            "IP/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)'
+            "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/TCP()/("X"*46)'
             % (mac, expIP),
-            "IP/SCTP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/SCTP()/("X"*48)'
+            "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/SCTP()/("X"*48)'
             % (mac, expIP),
-            "IPv6/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)'
+            "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP()/("X"*46)'
             % (mac, expIPv6),
-            "IPv6/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/TCP()/("X"*46)'
+            "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP()/("X"*46)'
             % (mac, expIPv6),
         }
 
@@ -311,14 +358,13 @@ class TestVfOffload(TestCase):
         Enable SW checksum offload.
         Send same packet with incorrect checksum and verify checksum is valid.
         """
-
         self.vm0_testpmd.start_testpmd(
             VM_CORES_MASK,
-            "--portmask=%s " % (self.portMask)
-            + "--enable-rx-cksum "
-            + "--port-topology=loop",
+            "--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
+        self.vm0_testpmd.execute_cmd("set promisc 1 on")
+        self.vm0_testpmd.execute_cmd("set promisc 0 on")
 
         time.sleep(2)
 
@@ -457,7 +503,6 @@ class TestVfOffload(TestCase):
         )
 
         mac = self.vm0_testpmd.get_port_mac(0)
-
         self.vm0_testpmd.execute_cmd("set verbose 1", "testpmd> ", 120)
         self.vm0_testpmd.execute_cmd("port stop all", "testpmd> ", 120)
         self.vm0_testpmd.execute_cmd(
@@ -501,7 +546,8 @@ class TestVfOffload(TestCase):
         self.vm0_testpmd.execute_cmd("tso set 800 %d" % self.vm0_dut_ports[1])
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("port start all", "testpmd> ", 120)
-        self.vm0_testpmd.execute_cmd("set promisc all off", "testpmd> ", 120)
+        self.vm0_testpmd.execute_cmd("set promisc 0 on", "testpmd> ", 120)
+        self.vm0_testpmd.execute_cmd("set promisc 1 on", "testpmd> ", 120)
         self.vm0_testpmd.execute_cmd("start")
 
         self.tester.scapy_foreground()
-- 
2.27.0


  reply	other threads:[~2022-07-18  2:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  2:54 [dts][PATCH V1 01/12] tests/kernelpf_iavf: " Weiyuan Li
2022-07-18  2:54 ` Weiyuan Li [this message]
2022-07-18  2:54 ` [dts][PATCH V1 03/12] tests/checksum_offload: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 04/12] tests/ice_advanced_iavf_rss: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 05/12] tests/ice_advanced_rss: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 06/12] tests/ice_iavf_fdir: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 07/12] tests/tx_preparation: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 08/12] test_plans/kernelpf_iavf: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 09/12] test_plans/vf_offload: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 10/12] test_plans/ice_advanced_iavf_rss: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 11/12] test_plans/ice_advanced_rss: " Weiyuan Li
2022-07-18  2:54 ` [dts][PATCH V1 12/12] test_plans/ice_iavf_fdir: " Weiyuan Li
2022-08-10  5:42   ` Jiale, SongX

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=20220718025447.13287-2-weiyuanx.li@intel.com \
    --to=weiyuanx.li@intel.com \
    --cc=dts@dpdk.org \
    --cc=yuan.peng@intel.com \
    /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).