[V1] tests/iavf_fdir: modify expection of rule check after port stop

Message ID 20210204111634.2633-1-qinx.sun@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/iavf_fdir: modify expection of rule check after port stop |

Commit Message

Sun, QinX Feb. 4, 2021, 11:16 a.m. UTC
  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(-)
  

Comments

Sun, QinX Feb. 5, 2021, 2:07 a.m. UTC | #1
Tested-by: Sun, QinX <qinx.sun@intel.com>
 
Regards,
Sun Qin

> -----Original Message-----
> From: sunqin <qinx.sun@intel.com>
> Sent: Thursday, February 4, 2021 7:17 PM
> To: dts@dpdk.org
> Cc: Sun, QinX <qinx.sun@intel.com>
> Subject: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule check after port stop
  
Zhao, HaiyangX Feb. 5, 2021, 2:29 a.m. UTC | #2
Acked-by: Haiyang Zhao <haiyangx.zhao@intel.com>

Best Regards,
Zhao Haiyang

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Sun, QinX
> Sent: Friday, February 5, 2021 10:07
> To: dts@dpdk.org
> Subject: Re: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule check
> after port stop
> 
> Tested-by: Sun, QinX <qinx.sun@intel.com>
> 
> Regards,
> Sun Qin
> 
> > -----Original Message-----
> > From: sunqin <qinx.sun@intel.com>
> > Sent: Thursday, February 4, 2021 7:17 PM
> > To: dts@dpdk.org
> > Cc: Sun, QinX <qinx.sun@intel.com>
> > Subject: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule check
> after port stop
  
Tu, Lijuan Feb. 19, 2021, 7:40 a.m. UTC | #3
Applied

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Zhao, HaiyangX
> Sent: 2021年2月5日 10:29
> To: Sun, QinX <qinx.sun@intel.com>; dts@dpdk.org
> Subject: Re: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule check
> after port stop
> 
> Acked-by: Haiyang Zhao <haiyangx.zhao@intel.com>
> 
> Best Regards,
> Zhao Haiyang
> 
> > -----Original Message-----
> > From: dts <dts-bounces@dpdk.org> On Behalf Of Sun, QinX
> > Sent: Friday, February 5, 2021 10:07
> > To: dts@dpdk.org
> > Subject: Re: [dts] [PATCH V1] tests/iavf_fdir: modify expection of
> > rule check after port stop
> >
> > Tested-by: Sun, QinX <qinx.sun@intel.com>
> >
> > Regards,
> > Sun Qin
> >
> > > -----Original Message-----
> > > From: sunqin <qinx.sun@intel.com>
> > > Sent: Thursday, February 4, 2021 7:17 PM
> > > To: dts@dpdk.org
> > > Cc: Sun, QinX <qinx.sun@intel.com>
> > > Subject: [dts] [PATCH V1] tests/iavf_fdir: modify expection of rule
> > > check
> > after port stop
  

Patch

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):