From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 665AC2B91 for ; Wed, 29 Jun 2016 02:57:41 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 28 Jun 2016 17:57:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,543,1459839600"; d="scan'208";a="985246950" Received: from stv-crb-56.sh.intel.com (HELO [10.239.128.116]) ([10.239.128.116]) by orsmga001.jf.intel.com with ESMTP; 28 Jun 2016 17:57:40 -0700 Message-ID: <57731DC8.10605@intel.com> Date: Wed, 29 Jun 2016 09:00:56 +0800 From: "Liu, Yong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Lijuan Tu , dts@dpdk.org References: <1466757602-27290-1-git-send-email-lijuanx.a.tu@intel.com> In-Reply-To: <1466757602-27290-1-git-send-email-lijuanx.a.tu@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dts] [PATCH v2]tests sriov_kvm: test vlan mirror with random vlan id X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 00:57:41 -0000 Hi Lijuan, The git commit log is different from the patch content. I think commit log should be "Check vlan mirror rule with vlan id in [0,1,random,4095]." And please create patch based on latest master branch, your patch base is different from master branch. I can't apply it on master branch. On 06/24/2016 04:40 PM, Lijuan Tu wrote: > vlan 0 is not a validated vlan id. > validated vlan id is between 1 to 4095 > > Signed-off-by: Lijuan Tu > --- > tests/TestSuite_sriov_kvm.py | 83 ++++++++++++++++++++++++-------------------- > 1 file changed, 45 insertions(+), 38 deletions(-) > > diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py > index cc63804..7903317 100644 > --- a/tests/TestSuite_sriov_kvm.py > +++ b/tests/TestSuite_sriov_kvm.py > @@ -11,6 +11,7 @@ Test userland 10Gb PMD. > import re > import time > from functools import wraps > +import random > > import dts > from qemu_kvm import QEMUKvm > @@ -19,6 +20,7 @@ from test_case import TestCase > from pmd_output import PmdOutput > FRAME_SIZE_64 = 64 > VM_CORES_MASK = 'all' > +MAX_VLAN = 4095 > > > class TestSriovKvm(TestCase): > @@ -76,7 +78,7 @@ class TestSriovKvm(TestCase): > 'dest_mac':False > 'src_mac':"52:00:00:00:00:00" > } > - 'dot1q': > + 'vlan': > { > 'vlan':1 > } > @@ -93,7 +95,7 @@ class TestSriovKvm(TestCase): > """ > ret_ether_ip = {} > ether = {} > - dot1q = {} > + vlan = {} > ip = {} > udp = {} > > @@ -120,13 +122,13 @@ class TestSriovKvm(TestCase): > else: > ether['src_mac'] = ether_ip["ether"]["src_mac"] > > - if not ether_ip.get('dot1q'): > + if not ether_ip.get('vlan'): > pass > else: > - if not ether_ip['dot1q'].get('vlan'): > - dot1q['vlan'] = '1' > + if not ether_ip['vlan'].get('vlan'): > + vlan['vlan'] = '1' > else: > - dot1q['vlan'] = ether_ip['dot1q']['vlan'] > + vlan['vlan'] = ether_ip['vlan']['vlan'] > > if not ether_ip.get('ip'): > ip['dest_ip'] = "10.239.129.88" > @@ -155,7 +157,7 @@ class TestSriovKvm(TestCase): > udp['src_port'] = ether_ip['udp']['src_port'] > > ret_ether_ip['ether'] = ether > - ret_ether_ip['dot1q'] = dot1q > + ret_ether_ip['vlan'] = vlan > ret_ether_ip['ip'] = ip > ret_ether_ip['udp'] = udp > > @@ -183,7 +185,7 @@ class TestSriovKvm(TestCase): > 'dest_mac':False > 'src_mac':"52:00:00:00:00:00" > } > - 'dot1q': > + 'vlan': > { > 'vlan':1 > } > @@ -234,9 +236,9 @@ class TestSriovKvm(TestCase): > self.tester.scapy_append( > 'srcmac="%s"' % ret_ether_ip['ether']['src_mac']) > > - if ether_ip.get('dot1q'): > + if ether_ip.get('vlan'): > self.tester.scapy_append( > - 'vlanvalue=%d' % int(ret_ether_ip['dot1q']['vlan'])) > + 'vlanvalue=%d' % int(ret_ether_ip['vlan']['vlan'])) > self.tester.scapy_append( > 'destip="%s"' % ret_ether_ip['ip']['dest_ip']) > self.tester.scapy_append( > @@ -245,7 +247,7 @@ class TestSriovKvm(TestCase): > 'destport=%d' % ret_ether_ip['udp']['dest_port']) > self.tester.scapy_append( > 'srcport=%d' % ret_ether_ip['udp']['src_port']) > - if not ret_ether_ip.get('dot1q'): > + if not ret_ether_ip.get('vlan'): > send_cmd = 'sendp([Ether(dst=nutmac, src=srcmac)/' + \ > 'IP(dst=destip, src=srcip, len=%s)/' % pktlen + \ > 'UDP(sport=srcport, dport=destport)/' + \ > @@ -628,6 +630,8 @@ class TestSriovKvm(TestCase): > self.reset_port_mirror_rule(port, rule_id) > > def setup_two_vm_common_prerequisite(self): > + self.host_testpmd.execute_cmd('port stop all') > + self.host_testpmd.execute_cmd('port start all') > self.vm0_dut_ports = self.vm_dut_0.get_ports('any') > self.vm0_testpmd = PmdOutput(self.vm_dut_0) > self.vm0_testpmd.start_testpmd(VM_CORES_MASK) > @@ -821,36 +825,39 @@ class TestSriovKvm(TestCase): > vlan_id = 0 > vf_mask = '0x1' > packet_num = 10 > + random_vlan = random.randint(1, MAX_VLAN - 1) > + vlan_ids = [0, 1, random_vlan, MAX_VLAN] > > - if self.nic.startswith('fortville'): > - vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask) > - vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0)) > - else: > - self.host_testpmd.execute_cmd( > - 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask)) > - rule_id = self.set_port_vlan_mirror(port_id_0, '0 dst-pool 1 on') > + for vlan_id in vlan_ids: > + if self.nic.startswith('fortville'): > + vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask) > + vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0)) > + else: > + self.host_testpmd.execute_cmd( > + 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask)) > + rule_id = self.set_port_vlan_mirror(port_id_0, '%d dst-pool 1 on' % vlan_id) > > - vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0) > - ether_ip = {} > - ether_ip['dot1q'] = {'vlan': '%d' % vlan_id} > - self.send_packet( > - self.vm_dut_0, > - self.vm0_dut_ports, > - port_id_0, > - count=packet_num, > - **ether_ip) > - vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0) > - vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > + vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0) > + ether_ip = {} > + ether_ip['vlan'] = {'vlan': '%d' % vlan_id} > + self.send_packet( > + self.vm_dut_0, > + self.vm0_dut_ports, > + port_id_0, > + count=packet_num, > + **ether_ip) > + vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0) > + vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > > - vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats) > - vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats) > + vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats) > + vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats) > > - self.verify(vm1_ret_stats['RX-packets'] == packet_num and > - vm1_ret_stats['TX-packets'] == packet_num, > - "Vlan mirror failed between VM0 and VM1!") > + self.verify(vm1_ret_stats['RX-packets'] == packet_num and > + vm1_ret_stats['TX-packets'] == packet_num, > + "Vlan mirror failed between VM0 and VM1!") > > - self.reset_port_mirror_rule(port_id_0, rule_id) > + self.reset_port_mirror_rule(port_id_0, rule_id) > > def test_two_vms_vlan_and_pool_mirror(self): > self.setup_2vm_2vf_env() > @@ -886,7 +893,7 @@ class TestSriovKvm(TestCase): > > vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > ether_ip = {} > - ether_ip['dot1q'] = {'vlan': '%d' % vlan_id} > + ether_ip['vlan'] = {'vlan': '%d' % vlan_id} > self.send_packet( > self.vm_dut_1, > self.vm1_dut_ports, > @@ -1016,7 +1023,7 @@ class TestSriovKvm(TestCase): > self.vm0_testpmd.execute_cmd('start') > > ether_ip = {} > - ether_ip['dot1q'] = {'vlan': '%d' % vlan_id} > + ether_ip['vlan'] = {'vlan': '%d' % vlan_id} > vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0) > vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0) > self.send_packet(