From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59BD3A0525; Fri, 21 Feb 2020 08:57:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 384354C81; Fri, 21 Feb 2020 08:57:15 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 776F2397D for ; Fri, 21 Feb 2020 08:57:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2020 23:57:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,467,1574150400"; d="scan'208";a="436872621" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 20 Feb 2020 23:57:12 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 20 Feb 2020 23:57:12 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 20 Feb 2020 23:57:11 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 20 Feb 2020 23:57:11 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.222]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.225]) with mapi id 14.03.0439.000; Fri, 21 Feb 2020 15:57:10 +0800 From: "Tu, Lijuan" To: "Wang, Yinan" , "dts@dpdk.org" CC: "Wang, Yinan" Thread-Topic: [dts] [PATCH v1] tests/vf_interrupt_pmd: add vf multi-queues interrupt test for i40e driver Thread-Index: AQHV6HMhjcqLmh1JrEmMu6uvGPzO7aglSBcQ Date: Fri, 21 Feb 2020 07:57:09 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBCCBD2@SHSMSX101.ccr.corp.intel.com> References: <20200220214940.110575-1-yinan.wang@intel.com> In-Reply-To: <20200220214940.110575-1-yinan.wang@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.2.0.6 dlp-reaction: no-action 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 v1] tests/vf_interrupt_pmd: add vf multi-queues interrupt test for i40e driver 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yinan > Sent: Friday, February 21, 2020 5:50 AM > To: dts@dpdk.org > Cc: Wang, Yinan > Subject: [dts] [PATCH v1] tests/vf_interrupt_pmd: add vf multi-queues > interrupt test for i40e driver >=20 > From: Wang Yinan >=20 > Signed-off-by: Wang Yinan > --- > tests/TestSuite_vf_interrupt_pmd.py | 184 +++++++++++++++++++++------- > 1 file changed, 143 insertions(+), 41 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_interrupt_pmd.py > b/tests/TestSuite_vf_interrupt_pmd.py > index ae9abd6..21b24a1 100644 > --- a/tests/TestSuite_vf_interrupt_pmd.py > +++ b/tests/TestSuite_vf_interrupt_pmd.py > @@ -38,8 +38,8 @@ Test vf_interrupt_pmd. > import utils > import time > import re > - > -from qemu_kvm import QEMUKvm > +import pdb > +from virt_common import VM > from test_case import TestCase > from packet import Packet >=20 > @@ -55,16 +55,13 @@ class TestVfInterruptPmd(TestCase): > self.env_done =3D False > cores =3D "1S/4C/1T" > self.number_of_ports =3D 1 > - > self.dut_ports =3D self.dut.get_ports() > self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > ports =3D [] > for port in range(self.number_of_ports): > ports.append(self.dut_ports[port]) > - > self.core_list =3D self.dut.get_core_list(cores, socket=3Dself.p= orts_socket) > self.core_user =3D self.core_list[0] > - > self.port_mask =3D utils.create_mask(ports) > self.core_mask_user =3D utils.create_mask(self.core_list[0:1]) >=20 > @@ -74,17 +71,14 @@ class TestVfInterruptPmd(TestCase): > self.rx_intf_0 =3D self.tester.get_interface(testport_0) > self.tester_mac =3D self.tester.get_mac(testport_0) > self.vf0_mac =3D "00:12:34:56:78:01" > + self.vf_mac =3D "00:12:34:56:78:02" > self.mac_port_0 =3D self.dut.get_mac_address(self.dut_ports[0]) > - > - self.vf_driver =3D self.get_suite_cfg()['vf_driver'] > - if self.vf_driver is None: > - self.vf_driver =3D 'pci-stub' > - self.verify(self.vf_driver in self.supported_vf_driver, "Unsppor= ted vf > driver") > - if self.vf_driver =3D=3D 'pci-stub': > - self.vf_assign_method =3D 'pci-assign' > - else: > - self.vf_assign_method =3D 'vfio-pci' > - self.dut.send_expect('modprobe vfio-pci', '#') > + self.queues =3D 1 > + self.vf_driver =3D 'vfio-pci' > + self.vf_assign_method =3D 'vfio-pci' > + """ > + If self.vf_driver =3D=3D 'pci-stub', self.vf_assign_method =3D '= pci-assign' > + """ >=20 > def set_up(self): > """ > @@ -97,8 +91,8 @@ class TestVfInterruptPmd(TestCase): > Change the DPDK source code and recompile > """ > use_dut.send_expect( > - "sed -i -e '/DEV_RX_OFFLOAD_CHECKSUM,/d' ./examples/l3fw= d- > power/main.c", "#", 10) > - > + "sed -i -e '/DEV_RX_OFFLOAD_CHECKSUM,/d' \ > + ./examples/l3fwd-power/main.c", "#", 10) > out =3D use_dut.send_expect("make -C examples/l3fwd-power", "#") > self.verify("Error" not in out, "compilation error") >=20 > @@ -109,7 +103,16 @@ class TestVfInterruptPmd(TestCase): > pkt =3D Packet(pkt_type=3D'UDP') > pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac}) > pkt.send_pkt(self.tester, tx_port=3Dtestinterface) > + self.out2 =3D use_dut.get_session_output(timeout=3D2) >=20 > + def send_packet_loop(self, mac, testinterface, use_dut, ip_addr): > + """ > + Send a packet and verify > + """ > + pkt =3D Packet(pkt_type=3D'UDP') > + pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac}) > + pkt.config_layer('ipv4', {'dst': '2.1.1.5', 'src': '2.1.1.%s' % = ip_addr}) > + pkt.send_pkt(self.tester, tx_port=3Dtestinterface) > self.out2 =3D use_dut.get_session_output(timeout=3D2) >=20 > def set_NIC_link(self): > @@ -118,7 +121,6 @@ class TestVfInterruptPmd(TestCase): > """ > self.used_dut_port =3D self.dut_ports[0] > self.host_intf =3D self.dut.ports_info[self.used_dut_port]['intf= '] > - > self.dut.send_expect("ifconfig %s up" % self.host_intf, '#', 3) >=20 > def begin_l3fwd_power(self, use_dut): > @@ -138,13 +140,34 @@ class TestVfInterruptPmd(TestCase): > except Exception as e: > self.logger.error("ERROR: Failed to launch l3fwd-power samp= le: %s" % > str(e)) >=20 > + def begin_l3fwd_power_multi_queues(self, use_dut): > + """ > + begin l3fwd-power > + """ > + config_info =3D"" > + for queue in range(self.queues): > + if config_info !=3D "": > + config_info +=3D ',' > + config_info +=3D '(0,%d,%d)' % (queue, queue) > + cmd_vhost_net =3D "./examples/l3fwd-power/build/l3fwd-power -l 0= -%d > -n 4 -- -P -p 0x1" % \ > + queue + " --config=3D'%s'" % config_info > + try: > + self.logger.info("Launch l3fwd_sample sample:") > + self.out =3D use_dut.send_expect(cmd_vhost_net, "L3FWD_POWER= ", > 60) > + self.logger.info(self.out) > + if "Error" in self.out: > + raise Exception("Launch l3fwd-power sample failed") > + else: > + self.logger.info("Launch l3fwd-power sample finished") > + except Exception as e: > + self.logger.error("ERROR: Failed to launch l3fwd-power > + sample: %s" % str(e)) > + > def setup_vm_env(self, driver=3D'default'): > """ > Start a vm using a virtual NIC > """ > if self.env_done: > return > - > 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) @@ -160,7 +183,7 @= @ class > TestVfInterruptPmd(TestCase): > port.bind_driver(self.vf_driver) >=20 > vf0_prop_0 =3D {'opt_host': self.sriov_vfs_port_0[0].pci} > - self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_interrupt_pmd') > + self.vm0 =3D VM(self.dut, 'vm0', 'vf_interrupt_pmd') > self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0_pro= p_0) > try: > self.vm0_dut =3D self.vm0.start() @@ -200,7 +223,6 @@ class > TestVfInterruptPmd(TestCase): > self.vm0_dut.send_expect("modprobe -r vfio", '#', 3) > self.vm0_dut.send_expect("modprobe vfio > enable_unsafe_noiommu_mode=3D1", '#', 3) > self.vm0_dut.send_expect("modprobe vfio-pci", '#', 3) > - > self.vm0_dut.bind_interfaces_linux(driver=3D"vfio-pci") >=20 > def test_nic_interrupt_VM_vfio_pci(self): > @@ -209,9 +231,9 @@ class TestVfInterruptPmd(TestCase): > """ > self.setup_vm_env() > self.prepare_l3fwd_power(self.vm0_dut) > - > + self.vm0_dut.send_expect("ip link set %s vf 0 mac %s" % > + (self.host_intf0, self.vf0_mac), "# ") > self.VF0_bind_vfio_pci() > - > cores =3D "1S/1C/1T" > core_list =3D self.vm0_dut.get_core_list(cores) > core_user =3D core_list[0] > @@ -220,42 +242,40 @@ class TestVfInterruptPmd(TestCase): > cmd =3D self.path + \ > " -c %s -n %d -- -P -p 0x01 --config=3D'(0,0,%s)'" % ( > core_mask_user, self.vm0_dut.get_memory_channels(), co= re_user) > + > self.vm0_dut.send_expect(cmd, "L3FWD_POWER", 60) > - time.sleep(1) > self.send_packet(self.vf0_mac, self.rx_intf_0, self.vm0_dut) > self.destroy_vm_env() > - > self.verify( > - "lcore %s is waked up from rx interrupt on port 0" % core_us= er in > self.out2, "Wake up failed") > + "lcore %s is waked up from rx interrupt on port 0" % > + core_user in self.out2, "Wake up failed") > self.verify( > - "lcore %s sleeps until interrupt triggers" % core_user in se= lf.out2, > "lcore %s not sleeps" % core_user) > + "lcore %s sleeps until interrupt triggers" % > + core_user in self.out2, "lcore %s not sleeps" % core_user) >=20 > def test_nic_interrupt_VF_vfio_pci(self, driver=3D'default'): > """ > Check Interrupt for VF with vfio driver > """ > self.prepare_l3fwd_power(self.dut) > - > self.set_NIC_link() > - > # generate VF and bind to vfio-pci > 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'] > - > for port in self.sriov_vfs_port_0: > port.bind_driver('vfio-pci') > - > + # set vf mac > + self.dut.send_expect("ip link set %s vf 0 mac %s" % > + (self.host_intf, self.vf_mac), "# ") > self.begin_l3fwd_power(self.dut) > - pattern =3D re.compile(r"(([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})") > - self.vf_mac =3D pattern.search(self.out).group() > - > self.send_packet(self.vf_mac, self.rx_intf_0, self.dut) > - > self.verify( > - "lcore %s is waked up from rx interrupt on port 0" % self.co= re_user in > self.out2, "Wake up failed") > + "lcore %s is waked up from rx interrupt on port 0" % > + self.core_user in self.out2,"Wake up failed") > self.verify( > - "lcore %s sleeps until interrupt triggers" % self.core_user = in self.out2, > "lcore %s not sleeps" % self.core_user) > + "lcore %s sleeps until interrupt triggers" % > + self.core_user in self.out2,"lcore %s not sleeps" % > + self.core_user) >=20 > def test_nic_interrupt_PF_vfio_pci(self): > """ > @@ -270,9 +290,11 @@ class TestVfInterruptPmd(TestCase): > self.send_packet(self.mac_port_0, self.rx_intf_0, self.dut) >=20 > self.verify( > - "lcore %s is waked up from rx interrupt on port 0" % self.co= re_user in > self.out2, "Wake up failed") > + "lcore %s is waked up from rx interrupt on port 0" % > + self.core_user in self.out2, "Wake up failed") > self.verify( > - "lcore %s sleeps until interrupt triggers" % self.core_user = in self.out2, > "lcore %s not sleeps" % self.core_user) > + "lcore %s sleeps until interrupt triggers" % > + self.core_user in self.out2, "lcore %s not sleeps" % > + self.core_user) >=20 > def test_nic_interrupt_PF_igb_uio(self): > """ > @@ -287,9 +309,89 @@ class TestVfInterruptPmd(TestCase): > self.send_packet(self.mac_port_0, self.rx_intf_0, self.dut) >=20 > self.verify( > - "lcore %s is waked up from rx interrupt on port 0" % self.co= re_user in > self.out2, "Wake up failed") > + "lcore %s is waked up from rx interrupt on port 0" % self.co= re_user in > + self.out2, "Wake up failed") > self.verify( > - "lcore %s sleeps until interrupt triggers" % self.core_user = in self.out2, > "lcore %s not sleeps" % self.core_user) > + "lcore %s sleeps until interrupt triggers" % self.core_user = in self.out2, > + "lcore %s not sleeps" % self.core_user) > + > + def test_nic_multi_queues_interrupt_VF_vfio_pci(self, driver=3D'defa= ult'): > + """ > + Check Interrupt for VF with vfio driver, need test with i40e dri= ver > + """ > + self.verify(self.nic in ("fortville_spirit"), "the port can not = run this suite") > + self.queues =3D 4 > + self.prepare_l3fwd_power(self.dut) > + self.set_NIC_link() > + # generate VF and bind to vfio-pci > + 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'] > + for port in self.sriov_vfs_port_0: > + port.bind_driver('vfio-pci') > + # set vf mac > + self.dut.send_expect("ip link set %s vf 0 mac %s" % (self.host_i= ntf, > self.vf_mac), > + "# ") > + self.begin_l3fwd_power_multi_queues(self.dut) > + stroutput =3D "" > + for ip in range(2,10): > + self.send_packet_loop(self.vf_mac, self.rx_intf_0, self.dut,= ip) > + stroutput =3D stroutput + self.out2 > + for queue in range(self.queues): > + self.verify( > + "lcore %d is waked up from rx interrupt on port 0" \ > + % queue in stroutput, "Wake up failed") > + self.verify( > + "lcore %d sleeps until interrupt triggers" % queue in st= routput, > + "lcore %d not sleeps" % queue) > + > + def test_nic_multi_queues_interrupt_VM_vfio_pci(self): > + """ > + Check for interrupts within the VM, need test with i40e driver > + """ > + self.verify(self.nic in ("fortville_spirit"), "the port can not = run this suite") > + self.setup_vm_env() > + self.vm0_dut.send_expect("ip link set %s vf 0 mac %s" % > + (self.host_intf0, self.vf0_mac), "# ") > + self.queues =3D 4 > + self.prepare_l3fwd_power(self.vm0_dut) > + self.VF0_bind_vfio_pci() > + cores =3D "1S/4C/1T" > + core_list =3D self.vm0_dut.get_core_list(cores) > + core_user =3D core_list[0] > + core_mask_user =3D utils.create_mask(core_list) > + config_info =3D"" > + for queue in range(self.queues): > + if config_info !=3D "": > + config_info +=3D ',' > + config_info +=3D '(0,%d,%d)' % (queue, queue) > + cmd =3D "./examples/l3fwd-power/build/l3fwd-power -c %s -n 4 -- = -P -p > 0x1" \ > + % core_mask_user + \ > + " --config=3D'%s'" % config_info > + self.vm0_dut.send_expect(cmd, "L3FWD_POWER", 60) > + time.sleep(1) > + try: > + self.logger.info("Launch l3fwd_sample sample:") > + self.out =3D self.vm0_dut.send_expect(cmd, "L3FWD_POWER", 60= ) > + if "Error" in self.out: > + raise Exception("Launch l3fwd-power sample failed") > + else: > + self.logger.info("Launch l3fwd-power sample finished") > + except Exception as e: > + self.logger.error("ERROR: Failed to launch l3fwd-power sampl= e: %s" > + % str(e)) > + stroutput =3D "" > + for ip in range(2, 10): > + self.send_packet_loop(self.vf0_mac, self.rx_intf_0, self.vm0= _dut, ip) > + stroutput =3D stroutput + self.out2 > + self.destroy_vm_env() > + for queue in range(self.queues): > + self.verify( > + "lcore %d is waked up from rx interrupt on port 0" > + % queue in stroutput, "Wake up failed") > + self.verify( > + "lcore %d sleeps until interrupt triggers" > + % queue in stroutput, "lcore %d not sleeps" % queue) >=20 > def tear_down(self): > """ > -- > 2.17.1