From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 74D654C8B for ; Wed, 28 Nov 2018 09:26:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2018 00:26:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,290,1539673200"; d="scan'208";a="253753424" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 28 Nov 2018 00:26:30 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 28 Nov 2018 00:26:30 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 28 Nov 2018 00:26:29 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Wed, 28 Nov 2018 16:26:27 +0800 From: "Tu, Lijuan" To: "Zhao, MeijuanX" , "dts@dpdk.org" CC: "Zhao, MeijuanX" Thread-Topic: [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio Thread-Index: AQHUhufX1awHUV8NzEyauurb1dH26qVk2kGg Date: Wed, 28 Nov 2018 08:26:27 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0B9C1BE7@SHSMSX101.ccr.corp.intel.com> References: <1543388472-9880-1-git-send-email-meijuanx.zhao@intel.com> In-Reply-To: <1543388472-9880-1-git-send-email-meijuanx.zhao@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODBkODk5ZmMtN2ViOC00YTAzLWEwYmItMmIyNjU5NzJlOGMzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNkJTTVFrOGNnZ2V2WDl2eGJEYmNiNUtMbE9CYzFCUmxPXC84UHM4elZKYnhRZWVibXlqUGxrekJsek1Lb2IwMU0ifQ== x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenorio 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, 28 Nov 2018 08:26:32 -0000 Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhao,meijuan > Sent: Wednesday, November 28, 2018 3:01 PM > To: dts@dpdk.org > Cc: Zhao, MeijuanX > Subject: [dts] [PATCH V2 1/2] tests/vf macfilter: add dpdk pf test scenor= io >=20 > Signed-off-by: zhao,meijuan > --- > tests/TestSuite_vf_macfilter.py | 51 +++++++++++++++++++++++---------- > 1 file changed, 36 insertions(+), 15 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilt= er.py > index f0de169..bf94016 100644 > --- a/tests/TestSuite_vf_macfilter.py > +++ b/tests/TestSuite_vf_macfilter.py > @@ -13,13 +13,14 @@ VM_CORES_MASK =3D 'all' > class TestVfMacFilter(TestCase): >=20 > supported_vf_driver =3D ['pci-stub', 'vfio-pci'] > + vf0_wrongmac =3D "00:11:22:33:48:55" > + vf0_setmac =3D "00:11:22:33:44:55" >=20 > def set_up_all(self): > self.dut_ports =3D self.dut.get_ports(self.nic) > self.verify(len(self.dut_ports) > 1, "Insufficient ports") > self.vm0 =3D None > self.pf0_vf0_mac =3D "00:12:34:56:78:01" > - self.iplinkset =3D True >=20 > # set vf assign method and vf driver > self.vf_driver =3D self.get_suite_cfg()['vf_driver'] @@ -36,14 += 37,14 > @@ class TestVfMacFilter(TestCase): >=20 > self.setup_2pf_2vf_1vm_env_flag =3D 0 >=20 > - def setup_2pf_2vf_1vm_env(self, driver=3D'default'): > + def setup_2pf_2vf_1vm_env(self, driver=3D'default',set_mac): >=20 > self.used_dut_port_0 =3D self.dut_ports[0] > self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1, > driver=3Ddriver) > self.sriov_vfs_port_0 =3D > self.dut.ports_info[self.used_dut_port_0]['vfs_port'] > pf_intf0 =3D self.dut.ports_info[0]['port'].get_interface_name() >=20 > - if self.iplinkset: > + if set_mac: > self.dut.send_expect("ip link set %s vf 0 mac %s" %(pf_intf0= , > self.pf0_vf0_mac), "#") >=20 > self.used_dut_port_1 =3D self.dut_ports[1] @@ -124,15 +125,17 > @@ class TestVfMacFilter(TestCase): > ###### send the packets with wrong MAC address to VF, check if the VF wi= ll > not RX the packets. >=20 > def test_kernel_2pf_2vf_1vm_iplink_macfilter(self): > + self.setup_2pf_2vf_1vm_env(driver=3D'',True) > + self.result_verify_iplink(True) >=20 > - self.setup_2pf_2vf_1vm_env(driver=3D'') > - > + def result_verify_iplink(self,set_mac): > + if set_mac =3D=3D False: > + self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' % > + self.pf0_vf0_mac) > self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > self.vm0_testpmd.start_testpmd(VM_CORES_MASK) > # Get VF's MAC > pmd_vf0_mac =3D self.vm0_testpmd.get_port_mac(0) > - vf0_wrongmac =3D "00:11:22:33:48:55" > self.vm0_testpmd.execute_cmd('set promisc all off') > self.vm0_testpmd.execute_cmd('set fwd mac') > self.vm0_testpmd.execute_cmd('start') > @@ -147,18 +150,19 @@ class TestVfMacFilter(TestCase): > src_mac =3D self.tester.get_mac(tx_port) > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] >=20 > - print "\nfirst send packets to the kernel PF set MAC, expected > result is RX packets=3DTX packets\n" > + print "\nfirst send packets to the PF set MAC, expected result i= s > RX packets=3DTX packets\n" > result1 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result1 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nSecondly, negative test, send packets to a wrong MAC, > expected result is RX packets=3D0\n" > - dst_mac =3D vf0_wrongmac > + dst_mac =3D self.vf0_wrongmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result2 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result2 !=3D True, "VF0 failed to forward packets to= VF1") >=20 > + > #######2. test case for kernel pf and dpdk vf 2pf_2vf_1vm MAC filter > scenario. > ####### kernel pf will not set MAC address and the VF will get a random > generated MAC ####### in the testpmd in VM, and then add VF mac > address in the testpmd,for example, VF_MAC1 @@ -168,19 +172,36 @@ > class TestVfMacFilter(TestCase): >=20 > def test_kernel_2pf_2vf_1vm_mac_add_filter(self): >=20 > - self.iplinkset =3D False > - self.setup_2pf_2vf_1vm_env(driver=3D'') > + self.setup_2pf_2vf_1vm_env(driver=3D'',False) > + self.send_packet_and_verify() > + > +#######3. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter > scenario. > +####### kernel pf will not set MAC address and the VF will get a random > +generated MAC ####### in the testpmd in VM, and then add VF mac > address > +in the testpmd,for example, VF_MAC1 ####### then send packets to the VF > +with the random generated MAC and the new added VF_MAC1 ####### > and the > +expected result is that all packets can be RXed and TXed. What's more, s= end > ####### packets with a wrong MAC address to the VF will not received by > the VF. > + def test_dpdk_2pf_2vf_1vm_mac_add_filter(self): > + self.setup_2pf_2vf_1vm_env(driver=3D'igb_uio',False) > + self.send_packet_and_verify() > + > +######4. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter > +scenario ###### dpdk pf will first run 'set vf mac addr 0 0 > +xx:xx:xx:xx:xx:xx, then ###### in the vm, send packets with this MAC to > +VF, check if the MAC filter works. Also ###### send the packets with wro= ng > MAC address to VF, check if the VF will not RX the packets. > + def test_dpdk_2pf_2vf_1vm_iplink_macfilter(self): > + self.setup_2pf_2vf_1vm_env(driver=3D'igb_uio',False) > + self.result_verify_iplink(False) >=20 > + def send_packet_and_verify(self): > self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > self.vm0_testpmd.start_testpmd(VM_CORES_MASK) >=20 > # Get VF0 port MAC address > pmd_vf0_mac =3D self.vm0_testpmd.get_port_mac(0) > - vf0_setmac =3D "00:11:22:33:44:55" > - vf0_wrongmac =3D "00:11:22:33:48:55" > self.vm0_testpmd.execute_cmd('set promisc all off') > - ret =3D self.vm0_testpmd.execute_cmd('mac_addr add > 0 %s' %vf0_setmac) > + ret =3D self.vm0_testpmd.execute_cmd('mac_addr add 0 %s' > + %self.vf0_setmac) > # check the operation is supported or not. > print ret >=20 > @@ -203,14 +224,14 @@ class TestVfMacFilter(TestCase): > self.verify(result1 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nsecondly, send packets to the new added MAC, expected > result is RX packets=3DTX packets\n" > - dst_mac =3D vf0_setmac > + dst_mac =3D self.vf0_setmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result2 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result2 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nThirdly, negative test, send packets to a wrong MAC, > expected result is RX packets=3D0\n" > - dst_mac =3D vf0_wrongmac > + dst_mac =3D self.vf0_wrongmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result3 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > -- > 2.17.2