* [dts] [PATCH 1/2] framework packet: support more default packet type
@ 2016-01-28 7:55 Yong Liu
2016-01-28 7:55 ` [dts] [PATCH 2/2] tests vf_vlan: support fm10k VF device Yong Liu
0 siblings, 1 reply; 2+ messages in thread
From: Yong Liu @ 2016-01-28 7:55 UTC (permalink / raw)
To: dts
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/packet.py b/framework/packet.py
index 0fa4df9..7f7e9d2 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -326,6 +326,11 @@ class Packet(object):
'TCP': {'layers': ['ether', 'ipv4', 'tcp', 'raw'], 'cfgload': True},
'UDP': {'layers': ['ether', 'ipv4', 'udp', 'raw'], 'cfgload': True},
'VLAN_UDP': {'layers': ['ether', 'dot1q', 'ipv4', 'udp', 'raw'], 'cfgload': True},
+ 'VLAN_TCP': {'layers': ['ether', 'dot1q', 'ipv4', 'tcp', 'raw'], 'cfgload': True},
+ 'VLAN_SCTP': {'layers': ['ether', 'dot1q', 'ipv4', 'sctp', 'raw'], 'cfgload': True},
+ 'VLAN_IPv6_UDP': {'layers': ['ether', 'dot1q', 'ipv6', 'udp', 'raw'], 'cfgload': True},
+ 'VLAN_IPv6_TCP': {'layers': ['ether', 'dot1q', 'ipv6', 'tcp', 'raw'], 'cfgload': True},
+ 'VLAN_IPv6_SCTP': {'layers': ['ether', 'dot1q', 'ipv6', 'sctp', 'raw'], 'cfgload': True},
'SCTP': {'layers': ['ether', 'ipv4', 'sctp', 'raw'], 'cfgload': True},
'IPv6_TCP': {'layers': ['ether', 'ipv6', 'tcp', 'raw'], 'cfgload': True},
'IPv6_UDP': {'layers': ['ether', 'ipv6', 'udp', 'raw'], 'cfgload': True},
--
1.8.4.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [dts] [PATCH 2/2] tests vf_vlan: support fm10k VF device
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
0 siblings, 0 replies; 2+ messages in thread
From: Yong Liu @ 2016-01-28 7:55 UTC (permalink / raw)
To: dts
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-28 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 7:55 [dts] [PATCH 1/2] framework packet: support more default packet type Yong Liu
2016-01-28 7:55 ` [dts] [PATCH 2/2] tests vf_vlan: support fm10k VF device Yong Liu
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).