test suite reviews and discussions
 help / color / mirror / Atom feed
From: sunqin <qinx.sun@intel.com>
To: dts@dpdk.org
Cc: sunqin <qinx.sun@intel.com>
Subject: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule check after port stop
Date: Thu,  4 Feb 2021 11:16:34 +0000	[thread overview]
Message-ID: <20210204111634.2633-1-qinx.sun@intel.com> (raw)

DPDK change: when port stop,flow rules will be obsolete to prevent memory leak.
modify 7 related test cases.

cvl_dcf_switch_filter: dcf_stop_start

dcf_lifecycle: handle_acl_filter_06

iavf_fdir: 
	stress_vf_port_reset_delete_rule
	stress_pf_reset_vf_delete_rule
	stress_pf_reset_vf_add_new_rule
	stress_vf_port_reset_add_new_rule
	stress_port_stop_start

Signed-off-by: sunqin <qinx.sun@intel.com>
---
 tests/TestSuite_cvl_dcf_switch_filter.py |  4 +-
 tests/TestSuite_dcf_lifecycle.py         |  5 +-
 tests/TestSuite_iavf_fdir.py             | 71 +++++++++++++-----------
 3 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py
index be2e6cd6..1904ef47 100644
--- a/tests/TestSuite_cvl_dcf_switch_filter.py
+++ b/tests/TestSuite_cvl_dcf_switch_filter.py
@@ -2189,8 +2189,8 @@ class CVLDCFSwitchFilterTest(TestCase):
         #stop the DCF, then start the DCF
         self.dut.send_expect("port stop 0", "testpmd> ")
         self.dut.send_expect("port start 0", "testpmd> ")
-        self.check_switch_filter_rule_list(0, rule_list)
-        #send matched packets, port 1 can still receive the packets.
+        #send matched packets, port 1 can not receive the packets.
+        matched_dic['expect_results'] = {"expect_pkts":0}
         self.send_and_check_packets(matched_dic)
 
     def test_mac_ipv4_pfcp_node(self):
diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index b5e60183..5ae6372f 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -1437,12 +1437,13 @@ class TestDcfLifeCycle(TestCase):
         # reset VF0 in testpmd
         cmds = ['stop', 'port stop 0', 'port reset 0', 'port start 0', 'start']
         [self.d_con([cmd, "testpmd> ", 15]) for cmd in cmds]
-        self.check_rule_list()
         self.clear_vf_pmd2_port0_stats()
         self.send_pkt_to_vf1_first(self.dmac)
         out = self.vf_pmd2_con(['stop', "testpmd> ", 15])
         drop_num = re.findall("RX-dropped:\s+(.*?)\s+?", out)
-        self.verify(int(drop_num[0]) == 1, 'the packet is not dropped by VF1, the rule can not take effect')
+        rx_num = re.findall("RX-total:\s+(.*?)\s+?", out)
+        self.verify(int(drop_num[0]) == 0, 'the packet is dropped by VF1, the rule still take effect')
+        self.verify(int(rx_num[0]) == 1, 'the packet not received by VF1')
         self.run_test_post()
 
     def test_dcf_with_acl_filter_01(self):
diff --git a/tests/TestSuite_iavf_fdir.py b/tests/TestSuite_iavf_fdir.py
index a14b4da7..25aa662b 100644
--- a/tests/TestSuite_iavf_fdir.py
+++ b/tests/TestSuite_iavf_fdir.py
@@ -3267,9 +3267,11 @@ class TestIAVFFdir(TestCase):
         self.dut.send_expect("port stop 0", "testpmd> ")
         self.dut.send_expect("port start 0", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
-        self.check_fdir_rule(port_id=0, rule_list=['0'])
+        #show the rule list, there is no rule listed
+        self.check_fdir_rule(port_id=0, stats=False)
         out = self.send_pkts_getouput(pkts=pkt)
-        rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 1}, stats=True)
+        rfc.verify_iavf_fdir_directed_by_rss(out)
+        rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 1}, stats=False)
 
     def test_stress_delete_rules(self):
         """
@@ -3354,11 +3356,13 @@ class TestIAVFFdir(TestCase):
         self.dut.send_expect("port reset 0", "testpmd> ")
         self.dut.send_expect("port start 0", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
-        # check the rule of port0 is still listed, but doesn't take effect.
-        self.check_fdir_rule(port_id=0, rule_list=['0'])
+        # check there is not rule listed on port 0, the rule of port 1 is still be listed.
+        self.check_fdir_rule(port_id=0, stats=False)
         self.check_fdir_rule(port_id=1, rule_list=['0'])
         out0 = self.send_pkts_getouput(pkts=pkts[0])
-        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "passthru": 1}, stats=True)
+        #check the packet is distributed by RSS
+        rfc.verify_iavf_fdir_directed_by_rss(out0)
+        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "passthru": 1}, stats=False)
         out1 = self.send_pkts_getouput(pkts=pkts[1])
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 1}, stats=True)
         # create the rule again
@@ -3393,22 +3397,22 @@ class TestIAVFFdir(TestCase):
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=True)
         # reset vf
         self.dut.send_expect("stop", "testpmd> ")
-        self.dut.send_expect("port stop 0", "testpmd> ")
-        self.dut.send_expect("port reset 0", "testpmd> ")
-        self.dut.send_expect("port start 0", "testpmd> ")
+        self.dut.send_expect("port stop 1", "testpmd> ")
+        self.dut.send_expect("port reset 1", "testpmd> ")
+        self.dut.send_expect("port start 1", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
-        # check the rule of port0 is still listed, but doesn't take effect.
+        # check the rule of port0 is still listed, check there is not rule listed on port 1.
         self.check_fdir_rule(port_id=0, rule_list=['0'])
-        self.check_fdir_rule(port_id=1, rule_list=['0'])
+        self.check_fdir_rule(port_id=1, stats=False)
         out0 = self.send_pkts_getouput(pkts=pkts[0])
-        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "passthru": 1}, stats=True)
+        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=True)
         out1 = self.send_pkts_getouput(pkts=pkts[1])
-        rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=True)
+        #check the packet is distributed by RSS
+        rfc.verify_iavf_fdir_directed_by_rss(out1)
+        rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=False)
         # delete the rules
-        self.dut.send_expect("flow destroy 0 rule 0", "Invalid flow destroy")
-        self.destroy_fdir_rule(rule_id='0', port_id=1)
-        out0 = self.send_pkts_getouput(pkts=pkts[0])
-        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=False)
+        self.destroy_fdir_rule(rule_id='0', port_id=0)
+        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=True)
         out1 = self.send_pkts_getouput(pkts=pkts[1])
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=False)
         # relaunch testpmd, and create the rules, check matched packets.
@@ -3450,6 +3454,8 @@ class TestIAVFFdir(TestCase):
         self.dut.send_expect("port reset 0", "testpmd> ")
         self.dut.send_expect("port start 0", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
+        #check there is not rule listed on vf0
+        self.check_fdir_rule(0,stats=False)
         out0 = self.send_pkts_getouput(pkts=pkts[2])
         rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "passthru": 1}, stats=True)
         out1 = self.send_pkts_getouput(pkts=pkts[1])
@@ -3491,36 +3497,37 @@ class TestIAVFFdir(TestCase):
         out1 = self.send_pkts_getouput(pkts=pkts[1])
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=True)
 
-        self.session_secondary.send_expect("ip link set %s vf 0 mac 00:11:22:33:44:56" % self.pf0_intf, "# ")
+        self.session_secondary.send_expect("ip link set %s vf 1 mac 00:11:22:33:44:56" % self.pf0_intf, "# ")
         out = self.dut.session.get_session_before(timeout=2)
-        self.verify("Port 0: reset event" in out, "failed to reset vf0")
+        self.verify("Port 1: reset event" in out, "failed to reset vf1")
         self.dut.send_expect("stop", "testpmd> ")
-        self.dut.send_expect("port stop 0", "testpmd> ")
-        self.dut.send_expect("port reset 0", "testpmd> ")
-        self.dut.send_expect("port start 0", "testpmd> ")
+        self.dut.send_expect("port stop 1", "testpmd> ")
+        self.dut.send_expect("port reset 1", "testpmd> ")
+        self.dut.send_expect("port start 1", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
+        #check there is not rule listed on vf1
+        self.check_fdir_rule(1,stats=False)
         out0 = self.send_pkts_getouput(pkts=pkts[2])
-        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "passthru": 1}, stats=True)
-        out1 = self.send_pkts_getouput(pkts=pkts[1])
-        rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=True)
-        # delete the rules
-        self.dut.send_expect("flow destroy 0 rule 0", "Invalid flow destroy")
-        self.destroy_fdir_rule(rule_id='0', port_id=1)
-        out0 = self.send_pkts_getouput(pkts=pkts[2])
+        rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 1, "passthru": 1}, stats=True)
+        out1 = self.send_pkts_getouput(pkts=pkts[0])
+        rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=True)
+        #delete the rules
+        self.dut.send_expect("flow destroy 0 rule 0", "Flow rule #0 destroyed")
+        out0 = self.send_pkts_getouput(pkts=pkts[0])
         rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=False)
-        out1 = self.send_pkts_getouput(pkts=pkts[1])
+        out1 = self.send_pkts_getouput(pkts=pkts[2])
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=False)
 
         # relaunch testpmd, and create the rules, check matched packets.
         self.dut.send_expect("quit", "# ")
         self.launch_testpmd()
         self.create_fdir_rule(rules, check_stats=True)
-        out0 = self.send_pkts_getouput(pkts=pkts[2])
+        out0 = self.send_pkts_getouput(pkts=pkts[0])
         rfc.check_iavf_fdir_mark(out0, pkt_num=1, check_param={"port_id": 0, "mark_id": 0, "queue": 6}, stats=True)
-        out1 = self.send_pkts_getouput(pkts=pkts[1])
+        out1 = self.send_pkts_getouput(pkts=pkts[2])
         rfc.check_iavf_fdir_mark(out1, pkt_num=1, check_param={"port_id": 1, "mark_id": 0, "queue": 6}, stats=True)
         self.dut.send_expect("quit", "# ")
-        self.session_secondary.send_expect("ip link set %s vf 0 mac 00:11:22:33:44:55" % self.pf0_intf, "# ")
+        self.session_secondary.send_expect("ip link set %s vf 1 mac 00:11:22:33:44:66" % self.pf0_intf, "# ")
         self.dut.close_session(self.session_secondary)
 
     def checksum_enablehw(self, port, hw):
-- 
2.17.1


             reply	other threads:[~2021-02-04  2:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 11:16 sunqin [this message]
2021-02-05  2:07 ` Sun, QinX
2021-02-05  2:29   ` Zhao, HaiyangX
2021-02-19  7:40     ` 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=20210204111634.2633-1-qinx.sun@intel.com \
    --to=qinx.sun@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).