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 V3] tests/cvl_advanced_iavf_rss_gtpu: set vlan id for vf
Date: Tue, 13 Apr 2021 15:52:19 +0000
Message-ID: <20210413155219.20110-1-qinx.sun@intel.com> (raw)

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


             reply	other threads:[~2021-04-13  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 15:52 sunqin [this message]
2021-04-13  7:24 ` Sun, QinX
2021-05-07  6:29   ` 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=20210413155219.20110-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

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git