test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/2] tests vf_vlan: support fm10k VF device
Date: Thu, 28 Jan 2016 15:55:20 +0800	[thread overview]
Message-ID: <1453967720-21839-2-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1453967720-21839-1-git-send-email-yong.liu@intel.com>

Nics in FM10k family have many differences between other nics. By
default vlan 1 is on the switch, and can't be removed.
FM10k VF device only support Rx vlan filter and Rx vlan strip will always on.
FM10k VF device not supprt Tx vlan offload.
FM10k VF device not supprt port based vlan.

Enhance vlan rx testing by add more packet types.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index 6bde6ca..6636a7b 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -8,7 +8,7 @@ from qemu_kvm import QEMUKvm
 from test_case import TestCase
 from pmd_output import PmdOutput
 from packet import Packet, sniff_packets, load_sniff_packets
-from settings import get_nic_name
+from settings import get_nic_name, DRIVERS
 import random
 
 VM_CORES_MASK = 'all'
@@ -20,9 +20,11 @@ class TestVfVlan(TestCase):
     def set_up_all(self):
 
         self.dut_ports = self.dut.get_ports(self.nic)
+        self.netobj = self.dut.ports_info[self.dut_ports[0]]['port']
         self.verify(len(self.dut_ports) > 1, "Insufficient ports")
         self.vm0 = None
         self.env_done = False
+        self.nic_driver = DRIVERS[self.nic]
 
     def set_up(self):
         self.setup_vm_env()
@@ -116,7 +118,8 @@ class TestVfVlan(TestCase):
 
     def destroy_vm_env(self):
         if getattr(self, 'vm0', None):
-            self.vm_dut_0.kill_all()
+            if self.vm_dut_0:
+                self.vm_dut_0.kill_all()
             self.vm0_testpmd = None
             self.vm0_dut_ports = None
             # destroy vm0
@@ -141,6 +144,9 @@ class TestVfVlan(TestCase):
         """
         Add port based vlan on vf device and check vlan tx work
         """
+        if self.nic_driver == "fm10k":
+            print dts.RED("FM10k not support port based vlan")
+            pass
         random_vlan = random.randint(1, MAX_VLAN)
 
         self.dut.send_expect(
@@ -174,8 +180,8 @@ class TestVfVlan(TestCase):
         if pkt_type == "UDP":
             pkt = Packet(pkt_type='UDP')
             pkt.config_layer('ether', {'dst': self.vf0_mac})
-        elif pkt_type == "VLAN_UDP":
-            pkt = Packet(pkt_type='VLAN_UDP')
+        else:
+            pkt = Packet(pkt_type=pkt_type)
             pkt.config_layer('dot1q', {'vlan': vlan})
             pkt.config_layer('ether', {'dst': self.vf0_mac})
 
@@ -185,6 +191,9 @@ class TestVfVlan(TestCase):
         return out
 
     def test_add_pvid_vf(self):
+        if self.nic_driver == "fm10k":
+            print dts.RED("FM10k not support port based vlan")
+            pass
         random_vlan = random.randint(1, MAX_VLAN)
 
         self.dut.send_expect(
@@ -255,6 +264,10 @@ class TestVfVlan(TestCase):
             tx_vlan in vlans, "Tx packet with vlan not received!!!")
 
     def test_vf_vlan_tx(self):
+        if self.nic_driver == "fm10k":
+            print dts.RED("FM10k not support Tx vlan offload")
+            pass
+
         random_vlan = random.randint(1, MAX_VLAN)
         tx_vlans = [1, random_vlan, MAX_VLAN]
         # start testpmd in VM
@@ -272,9 +285,11 @@ class TestVfVlan(TestCase):
 
     def test_vf_vlan_rx(self):
         random_vlan = random.randint(1, MAX_VLAN - 1)
+        pkt_types = ['VLAN_UDP', 'VLAN_TCP',
+                     'VLAN_SCTP', 'VLAN_IPv6_UDP', 'VLAN_IPv6_TCP']
         rx_vlans = [1, random_vlan, MAX_VLAN]
         # start testpmd in VM
-        self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
+        self.netobj = self.dut.ports_info[self.dut_ports[0]]['port']
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
         self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
@@ -285,53 +300,74 @@ class TestVfVlan(TestCase):
 
         # send packet without vlan
         out = self.send_and_getout(vlan=0, pkt_type="UDP")
+        print dts.GREEN(out)
         self.verify(
             "received 1 packets" in out, "Not received normal packet as default!!!")
 
         # send packet with vlan 0
         out = self.send_and_getout(vlan=0, pkt_type="VLAN_UDP")
-        self.verify("VLAN tci=0x0"
+        self.verify("received 1 packets"
                     in out, "Not received vlan 0 packet as default!!!")
+        print dts.GREEN(out)
 
         for rx_vlan in rx_vlans:
             self.vm0_testpmd.execute_cmd('rx_vlan add %d 0' % rx_vlan)
-            # send packet with same vlan
-            out = self.send_and_getout(vlan=rx_vlan, pkt_type="VLAN_UDP")
-            vlan_hex = hex(rx_vlan)
-            self.verify("VLAN tci=%s" %
-                        vlan_hex in out, "Not received expected vlan packet!!!")
+            if self.nic_driver == "fm10k":
+                self.netobj.add_vlan(vlan_id=rx_vlan)
+
+            for pkt_type in pkt_types:
+                # send packet with same vlan
+                out = self.send_and_getout(vlan=rx_vlan, pkt_type=pkt_type)
+                print dts.GREEN(out)
+                self.verify("received 1 packets"
+                            in out, "Not received expected vlan packet!!!")
+
+                if rx_vlan == MAX_VLAN:
+                    continue
+                wrong_vlan = (rx_vlan + 1) % 4096
+
+                # send packet with wrong vlan
+                out = self.send_and_getout(vlan=wrong_vlan, pkt_type=pkt_type)
+                self.verify(
+                    "received 1 packets" not in out, "Received filtered vlan packet!!!")
 
-            pkt = Packet(pkt_type='VLAN_UDP')
-            if rx_vlan == MAX_VLAN:
+            # fm10k default vlan is 1 and will not work after remove it
+            if rx_vlan == 1 and self.nic_driver == "fm10k":
                 continue
-            wrong_vlan = (rx_vlan + 1) % 4096
-
-            # send packet with wrong vlan
-            out = self.send_and_getout(vlan=wrong_vlan, pkt_type="VLAN_UDP")
-            self.verify(
-                "received 1 packets" not in out, "Received filtered vlan packet!!!")
 
-        for rx_vlan in rx_vlans:
-            self.vm0_testpmd.execute_cmd('rx_vlan rm 0 %d' % random_vlan)
-
-        # send packet with vlan 0
-        out = self.send_and_getout(vlan=0, pkt_type="VLAN_UDP")
-        self.verify("VLAN tci=0x0"
-                    in out, "Not received vlan 0 packet as default!!!")
-
-        # send packet without vlan
-        out = self.send_and_getout(pkt_type="UDP")
-        self.verify("received 1 packets" in out,
-                    "Not received normal packet after remove vlan filter!!!")
-
-        # send packet with vlan
-        out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
-        self.verify(
-            "received 1 packets" in out, "Not received vlan packet without vlan filter!!!")
+            self.vm0_testpmd.execute_cmd('rx_vlan rm 0 %d' % rx_vlan)
+            if self.nic_driver == "fm10k":
+                self.netobj.delete_vlan(vlan_id=rx_vlan)
+
+            for pkt_type in pkt_types:
+                # send packet with vlan 0
+                out = self.send_and_getout(vlan=0, pkt_type=pkt_type)
+                print dts.GREEN(out)
+                self.verify("received 1 packets"
+                            in out, "Removed vlan, not received vlan 0 packet!!!")
+
+                # send packet without vlan
+                out = self.send_and_getout(pkt_type=pkt_type)
+                print dts.GREEN(out)
+                self.verify("received 1 packets" in out,
+                            "Not received normal packet after remove vlan filter!!!")
+
+                # fm10k vlan filter will always on
+                if self.nic_driver == "fm10k":
+                    continue
+
+                # send packet with vlan
+                out = self.send_and_getout(vlan=rx_vlan, pkt_type=pkt_type)
+                self.verify(
+                    "received 1 packets" in out, "Not received vlan packet without vlan filter!!!")
 
         self.vm0_testpmd.quit()
 
     def test_vf_vlan_strip(self):
+        if self.nic_driver == "fm10k":
+            print dts.RED("Vlan strip will always on FM10k")
+            pass
+
         random_vlan = random.randint(1, MAX_VLAN - 1)
         rx_vlans = [1, random_vlan, MAX_VLAN]
         # start testpmd in VM
-- 
1.8.4.2

      reply	other threads:[~2016-01-28  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  7:55 [dts] [PATCH 1/2] framework packet: support more default packet type Yong Liu
2016-01-28  7:55 ` Yong Liu [this message]

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=1453967720-21839-2-git-send-email-yong.liu@intel.com \
    --to=yong.liu@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).