test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V3] tests/cvl_advanced_iavf_rss_gtpu: set vlan id for vf
@ 2021-04-13 15:52 sunqin
  2021-04-13  7:24 ` Sun, QinX
  0 siblings, 1 reply; 3+ messages in thread
From: sunqin @ 2021-04-13 15:52 UTC (permalink / raw)
  To: dts; +Cc: sunqin

Confirm with developer that the design of dpdk is changed for VF, 
the VLAN ID needs to be set before VF receives VLAN packets

Signed-off-by: sunqin <qinx.sun@intel.com>
---
v1: add vlan id in a common function,will be called by most of cases
v2: add vlan id only for related cases
v3: remove the added VLAN to reduce the impact on other cases

 tests/TestSuite_cvl_advanced_iavf_rss_gtpu.py | 45 +++++++++++++------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/tests/TestSuite_cvl_advanced_iavf_rss_gtpu.py b/tests/TestSuite_cvl_advanced_iavf_rss_gtpu.py
index 1987a522..d19ddbf0 100644
--- a/tests/TestSuite_cvl_advanced_iavf_rss_gtpu.py
+++ b/tests/TestSuite_cvl_advanced_iavf_rss_gtpu.py
@@ -6988,11 +6988,30 @@ class TestCVLAdvancedIAVFRSSGTPU(TestCase):
             self.pmd_output.quit()
             self.launch_testpmd(symmetric=symmetric)
             self.pmd_output.execute_cmd("start")
-        self.pmd_output.execute_cmd('vlan set filter on 0')
-        self.pmd_output.execute_cmd('rx_vlan add 1 0')
-        self.pmd_output.execute_cmd('rx_vlan add 3 0')
-        self.pmd_output.execute_cmd('rx_vlan add 5 0')
-        self.pmd_output.execute_cmd('rx_vlan add 7 0')
+
+    def set_vlan_filter(self,state='on',port_id=0):
+        """
+        :param state: on/off
+        """
+        self.pmd_output.execute_cmd('vlan set filter {} {}'.format(state, port_id))
+
+    def vlan_action(self,action,vlan_id,port_id=0):
+        """
+        :param action: add/rm
+        :param vlan_id: support int and list
+        """
+        if not isinstance(vlan_id,list):
+            vlan_id = [vlan_id]
+        [self.pmd_output.execute_cmd('rx_vlan {} {} {}'.format(action, id , port_id)) for id in vlan_id]
+
+    def handle_vlan_case(self,cases_info,vlan_id,port_id):
+        try:
+            self.set_vlan_filter('on',port_id)
+            self.vlan_action('add',vlan_id,port_id)
+            self.rssprocess.handle_rss_distribute_cases(cases_info=cases_info)
+        finally:
+            self.vlan_action('rm', vlan_id,port_id)
+            self.set_vlan_filter('off', port_id)
 
     def test_mac_ipv4_gtpu_ipv4(self):
         self.switch_testpmd(symmetric=False)
@@ -7804,35 +7823,35 @@ class TestCVLAdvancedIAVFRSSGTPU(TestCase):
     # vf rss gtpc gtpu
     def test_mac_ipv4_gtpu(self):
         self.switch_testpmd(symmetric=False)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_gtpu_toeplitz)
+        self.handle_vlan_case(mac_ipv4_gtpu_toeplitz, [1,3,5], 0)
 
     def test_mac_ipv6_gtpu(self):
         self.switch_testpmd(symmetric=False)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv6_gtpu_toeplitz)
+        self.handle_vlan_case(mac_ipv6_gtpu_toeplitz, [1,5,7], 0)
 
     def test_mac_ipv4_gtpc(self):
         self.switch_testpmd(symmetric=False)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_gtpc_toeplitz)
+        self.handle_vlan_case(mac_ipv4_gtpc_toeplitz, [1,3,5], 0)
 
     def test_mac_ipv6_gtpc(self):
         self.switch_testpmd(symmetric=False)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv6_gtpc_toeplitz)
+        self.handle_vlan_case(mac_ipv6_gtpc_toeplitz, [1,3,5], 0)
 
     def test_mac_ipv4_gtpu_symmetric(self):
         self.switch_testpmd(symmetric=True)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_gtpu_symmetric_toeplitz)
+        self.handle_vlan_case(mac_ipv4_gtpu_symmetric_toeplitz, 1, 0)
 
     def test_mac_ipv6_gtpu_symmetric(self):
         self.switch_testpmd(symmetric=True)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv6_gtpu_symmetric_toeplitz)
+        self.handle_vlan_case(mac_ipv6_gtpu_symmetric_toeplitz, 1, 0)
 
     def test_mac_ipv4_gtpc_symmetric(self):
         self.switch_testpmd(symmetric=True)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_gtpc_symmetric_toeplitz)
+        self.handle_vlan_case(mac_ipv4_gtpc_symmetric_toeplitz, 1, 0)
 
     def test_mac_ipv6_gtpc_symmetric(self):
         self.switch_testpmd(symmetric=True)
-        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv6_gtpc_symmetric_toeplitz)
+        self.handle_vlan_case(mac_ipv6_gtpc_symmetric_toeplitz, 1, 0)
 
     def tear_down(self):
         # destroy all flow rule on port 0
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-07  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 15:52 [dts] [PATCH V3] tests/cvl_advanced_iavf_rss_gtpu: set vlan id for vf sunqin
2021-04-13  7:24 ` Sun, QinX
2021-05-07  6:29   ` Tu, Lijuan

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