test suite reviews and discussions
 help / color / mirror / Atom feed
From: Lingli Chen <linglix.chen@intel.com>
To: dts@dpdk.org
Cc: Lingli Chen <linglix.chen@intel.com>
Subject: [dts][PATCH V2 2/2] tests/kernelpf_iavf: add vf_queue_start_stop test script
Date: Fri, 12 May 2023 17:55:04 +0800	[thread overview]
Message-ID: <20230512095504.7343-2-linglix.chen@intel.com> (raw)
In-Reply-To: <20230512095504.7343-1-linglix.chen@intel.com>

add vf_queue_start_stop test script

Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
i40e:failed by bug: DPDK-37084 stop rxq, Forward statistics for RX-packets is error   
ice: failed by bug: DPDK-36737

 tests/TestSuite_kernelpf_iavf.py | 127 ++++++++++++++++++++++++++++++-
 1 file changed, 125 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index c69b8748..49d82545 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -14,7 +14,7 @@ import re
 import time
 
 import framework.utils as utils
-from framework.packet import Packet
+from framework.packet import Packet, strip_pktload
 from framework.pmd_output import PmdOutput
 from framework.settings import (
     DPDK_DCFMODE_SETTING,
@@ -89,7 +89,7 @@ class TestKernelpfIavf(TestCase):
 
     def set_up(self):
 
-        if self.running_case == "test_vf_rx_interrupt":
+        if self.running_case in ["test_vf_rx_interrupt", "test_vf_queue_start_stop"]:
             self.destroy_vm_env()
         elif self.env_done is False:
             self.setup_vm_env()
@@ -1240,6 +1240,124 @@ class TestKernelpfIavf(TestCase):
             self.tester_intf, pkt=pkt, pkt_len=pkt_len, crc_strip=True
         )
 
+    def check_forwarding(self, dmac, rx_received=True, received=True):
+        self.send_packet_check_pktload(0, 0, dmac, rx_received, received)
+
+    def send_packet_check_pktload(
+        self, txPort, rxPort, dmac, rx_received, received=True
+    ):
+        """
+        Send packages according to parameters.
+        """
+        rxitf = self.tester.get_interface(self.tester.get_local_port(rxPort))
+        txitf = self.tester.get_interface(self.tester.get_local_port(txPort))
+
+        pkt = Packet(pkt_type="UDP", pkt_len=64)
+        inst = self.tester.tcpdump_sniff_packets(rxitf)
+        pkt.config_layer("ether", {"dst": dmac})
+        pkt.send_pkt(self.tester, tx_port=txitf, count=4)
+        sniff_pkts = self.tester.load_tcpdump_sniff_packets(inst)
+        out = self.dut.get_session_output()
+        if rx_received:
+            self.verify(
+                "port 0/queue 0: received 1 packets" in out,
+                "start queue revice package failed, out = %s" % out,
+            )
+        else:
+            self.verify(
+                "port 0/queue 0: received 1 packets" not in out,
+                "start queue revice package failed, out = %s" % out,
+            )
+
+        if received:
+            res = strip_pktload(sniff_pkts, layer="L4")
+            self.verify(
+                "58 58 58 58 58 58 58 58" in res, "receive queue not work as expected"
+            )
+        else:
+            self.verify(len(sniff_pkts) == 0, "stop queue not work as expected")
+
+    def test_vf_queue_start_stop(self):
+        """
+        vf queue start/stop test
+        """
+        self.pmd_out = PmdOutput(self.dut)
+        # generate vf
+        self.dut.bind_interfaces_linux(self.kdriver)
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 1)
+        self.vf_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"][0]
+
+        self.vf_port.bind_driver(driver="vfio-pci")
+        self.vf_port_pci = self.dut.ports_info[self.dut_ports[0]]["sriov_vfs_pci"][0]
+        self.core_config = "1S/2C/1T"
+        self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
+        cores = self.dut.get_core_list(self.core_config, socket=self.ports_socket)
+        # dpdk start
+        try:
+            self.pmd_out.start_testpmd(
+                cores=cores,
+                eal_param="-a %s --file-prefix=vf" % self.vf_port_pci,
+                param="--portmask=0x1 --port-topology=loop",
+            )
+            self.dut.send_expect("set fwd mac", "testpmd>")
+            self.dut.send_expect("set verbose 1", "testpmd>")
+            self.dut.send_expect("start", "testpmd>")
+            self.pmd_out.wait_link_status_up("all")
+            dmac = self.pmd_out.get_port_mac(0)
+            self.check_forwarding(dmac)
+            out = self.dut.send_expect("stop", "testpmd>")
+            self.verify(
+                "RX-packets: 4" in out, "Forward statistics for RX-packets is error"
+            )
+            self.verify(
+                "TX-packets: 4" in out, "Forward statistics for TX-packets is error"
+            )
+        except Exception as e:
+            raise IOError("dpdk start and first forward failure: %s" % e)
+
+        try:
+            # stop rx queue test
+            print("test stop rx queue")
+            self.dut.send_expect("port 0 rxq 0 stop", "testpmd>")
+            self.dut.send_expect("start", "testpmd>")
+            self.check_forwarding(dmac, rx_received=False, received=False)
+
+            out = self.dut.send_expect("stop", "testpmd>")
+            self.verify(
+                "RX-packets: 0" in out, "Forward statistics for RX-packets is error"
+            )
+
+            # stop tx queue test
+            print("test start rx queue stop tx queue")
+            self.dut.send_expect("port 0 rxq 0 start", "testpmd>")
+            self.dut.send_expect("port 0 txq 0 stop", "testpmd>")
+            self.dut.send_expect("start", "testpmd>")
+            self.check_forwarding(dmac, rx_received=False, received=False)
+            out = self.dut.send_expect("stop", "testpmd>")
+            self.verify(
+                "TX-packets: 0" in out, "Forward statistics for TX-packets is error"
+            )
+        except Exception as e:
+            raise IOError("queue stop forward failure: %s" % e)
+
+        try:
+            # start tx queue test
+            print("test start rx and tx queue")
+            self.dut.send_expect("port 0 txq 0 start", "testpmd>")
+            self.dut.send_expect("start", "testpmd>")
+            self.check_forwarding(dmac)
+            out = self.dut.send_expect("stop", "testpmd>")
+            self.verify(
+                "RX-packets: 4" in out,
+                "restart txq Forward statistics for RX-packets is error",
+            )
+            self.verify(
+                "TX-packets: 4" in out,
+                "restart txq Forward statistics for TX-packets is error",
+            )
+        except Exception as e:
+            raise IOError("queue start forward failure: %s" % e)
+
     def scapy_send_packet(self, mac, testinterface, vlan_flags=False, count=1):
         """
         Send a packet to port
@@ -1296,6 +1414,11 @@ class TestKernelpfIavf(TestCase):
                 "killall %s" % self.l3fwdpower_name, "# ", 60, alt_session=True
             )
             self.destroy_2vf_in_2pf()
+        elif self.running_case == "test_vf_queue_start_stop":
+            try:
+                self.dut.send_expect("quit", "#")
+            except:
+                print("Failed to quit testpmd")
         else:
             self.vm_testpmd.execute_cmd("quit", "#")
             time.sleep(1)
-- 
2.34.1


  reply	other threads:[~2023-05-12  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12  9:55 [dts][PATCH V2 1/2] test_plans/kernelpf_iavf: add vf_queue_start_stop test plan Lingli Chen
2023-05-12  9:55 ` Lingli Chen [this message]
2023-05-25  2:43   ` [dts][PATCH V2 2/2] tests/kernelpf_iavf: add vf_queue_start_stop test script 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=20230512095504.7343-2-linglix.chen@intel.com \
    --to=linglix.chen@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).