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 959C2A00E6 for ; Wed, 7 Aug 2019 05:12:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E1CD4F91; Wed, 7 Aug 2019 05:12:02 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 64E272C16 for ; Wed, 7 Aug 2019 05:11:59 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 20:11:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,356,1559545200"; d="scan'208";a="192805213" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 06 Aug 2019 20:11:56 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 20:11:56 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 5 Aug 2019 22:10:21 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.15]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.163]) with mapi id 14.03.0439.000; Tue, 6 Aug 2019 13:09:18 +0800 From: "Zhang, Yuwei1" To: "Zhu, WenhuiX" , "Zhang, YanX A" , "dts@dpdk.org" CC: "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_vf_interrupt_pmd:Change the script according to the latest test_plan Thread-Index: AQHVS2rPggedhUjMaU+7DGxyTZfTTabtkzcg Date: Tue, 6 Aug 2019 05:09:18 +0000 Message-ID: References: <1564995196-118013-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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/TestSuite_vf_interrupt_pmd:Change the script according to the latest test_plan 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" Acked-by: Yuwei Zhang -----Original Message----- From: Zhu, WenhuiX=20 Sent: Monday, August 5, 2019 4:50 PM To: Zhang, YanX A ; dts@dpdk.org Cc: Zhang, Yuwei1 ; Zhang, YanX A Subject: RE: [dts] [PATCH V1] tests/TestSuite_vf_interrupt_pmd:Change the s= cript according to the latest test_plan Tested-by: Zhu, WenhuiX -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhang,yan Sent: Monday, August 5, 2019 4:53 PM To: dts@dpdk.org Cc: Zhang, Yuwei1 ; Zhang, YanX A Subject: [dts] [PATCH V1] tests/TestSuite_vf_interrupt_pmd:Change the scrip= t according to the latest test_plan Modify the script according to the latest test plan Signed-off-by: zhang,yan --- tests/TestSuite_vf_interrupt_pmd.py | 285 +++++++++------------------- 1 file changed, 87 insertions(+), 198 deletions(-) diff --git a/tests/TestSuite_vf_interrupt_pmd.py b/tests/TestSuite_vf_inter= rupt_pmd.py index b78bf8f..1cf2e4e 100644 --- a/tests/TestSuite_vf_interrupt_pmd.py +++ b/tests/TestSuite_vf_interrupt_pmd.py @@ -36,13 +36,11 @@ Test vf_interrupt_pmd. """ =20 import utils -import string import time import re -from pmd_output import PmdOutput -from qemu_kvm import QEMUKvm -from test_case import TestCase =20 +from test_case import TestCase +from packet import Packet =20 class TestVfInterruptPmd(TestCase): =20 @@ -52,241 +50,132 @@ class TestVfInterruptPmd(TestCase): """ self.dut_ports =3D self.dut.get_ports(self.nic) self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") - cores =3D self.dut.get_core_list("1S/4C/1T") - self.coremask =3D utils.create_mask(cores) - self.portmask =3D utils.create_mask(self.dut_ports) =20 - self.path =3D "./examples/l3fwd-power/build/l3fwd-power" + 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.por= ts_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 testport_0 =3D self.tester.get_local_port(self.dut_ports[0]) self.rx_intf_0 =3D self.tester.get_interface(testport_0) - testport_1 =3D self.tester.get_local_port(self.dut_ports[1]) - self.rx_intf_1 =3D self.tester.get_interface(testport_1) + self.tester_mac =3D self.tester.get_mac(testport_0) =20 self.mac_port_0 =3D self.dut.get_mac_address(self.dut_ports[0]) - self.mac_port_1 =3D self.dut.get_mac_address(self.dut_ports[1]) - - self.dut.virt_exit() =20 - def build_app(self, use_dut): - # build sample app - out =3D use_dut.build_dpdk_apps("./examples/l3fwd-power") - self.verify("Error" not in out, "compilation error 1") - self.verify("No such file" not in out, "compilation error 2") + self.prepare_l3fwd_power() + self.dut.send_expect('modprobe vfio-pci', '#') =20 def set_up(self): """ Run before each test case. """ - pass + self.dut.restore_interfaces() =20 - def generate_sriov_vfport(self, use_driver): + def prepare_l3fwd_power(self): """ - generate sriov vfs by port + Change the DPDK source code and recompile """ - self.used_dut_port_0 =3D self.dut_ports[0] - self.used_dut_port_1 =3D self.dut_ports[1] - self.dut.generate_sriov_vfs_by_port( - self.used_dut_port_0, 1, driver=3Duse_driver) - self.sriov_vfs_port_0 =3D self.dut.ports_info[ - self.used_dut_port_0]['vfs_port'] - self.dut.generate_sriov_vfs_by_port( - self.used_dut_port_1, 1, driver=3Duse_driver) - self.sriov_vfs_port_1 =3D self.dut.ports_info[ - self.used_dut_port_1]['vfs_port'] - - def bind_vfs(self, driver): + self.dut.send_expect( + "sed -i -e '/DEV_RX_OFFLOAD_CHECKSUM,/d' ./examples/l3fwd-= power/main.c", "#", 10) + + out =3D self.dut.send_expect("make -C examples/l3fwd-power", "#") + self.verify("Error" not in out, "compilation error") + + def send_and_verify(self, mac, testinterface): """ - bind vfs to driver + Send a packet and verify """ - for port in self.sriov_vfs_port_0: - port.bind_driver(driver) - time.sleep(1) - for port in self.sriov_vfs_port_1: - port.bind_driver(driver) - time.sleep(1) + pkt =3D Packet(pkt_type=3D'UDP') + pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac}) + pkt.send_pkt(tx_port=3Dtestinterface) =20 - def setup_vm_env(self): + out1 =3D self.dut.get_session_output(timeout=3D2) + self.verify( + "lcore %s is waked up from rx interrupt on port 0" % self.= core_user in out1, "Wake up failed") + self.verify( + "lcore %s sleeps until interrupt triggers" % self.core_use= r in out1, "lcore 1 not sleeps") + + def set_NIC_link(self): + """ + When starting l3fwd-power on vf, ensure that PF link is up + """ + 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) + + def begin_l3fwd_power(self): """ - Start One VM with one virtio device + begin l3fwd-power """ - self.dut_testpmd =3D PmdOutput(self.dut) - self.dut_testpmd.start_testpmd( - "Default", "--rxq=3D4 --txq=3D4 --port-topology=3Dchained") - self.dut_testpmd.execute_cmd("start") - - vf0_prop_1 =3D {'opt_host': self.sriov_vfs_port_0[0].pci} - vf0_prop_2 =3D {'opt_host': self.sriov_vfs_port_1[0].pci} - self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_interrupt_pmd') - self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_1) - self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_2) + cmd_vhost_net =3D "./examples/l3fwd-power/build/l3fwd-power -n %d = -c %s" % ( + self.dut.get_memory_channels(), self.core_mask_user) + \ + " -- -P -p 1 --config=3D'(0,0,%s)'" % self.core_us= er try: - self.vm0_dut =3D self.vm0.start() - if self.vm0_dut is None: - raise Exception("Set up VM ENV failed") + self.logger.info("Launch l3fwd_sample sample:") + self.out =3D self.dut.send_expect(cmd_vhost_net, "L3FWD_POWER"= , 60) + if "Error" in self.out: + raise Exception("Launch l3fwd-power sample failed") else: - self.verify(self.vm0_dut.ports_info[ - 0]['intf'] !=3D 'N/A', "Not interface") + self.logger.info("Launch l3fwd-power sample finished") except Exception as e: - self.destroy_vm_env() - self.logger.error("Failure for %s" % str(e)) + self.logger.error("ERROR: Failed to launch l3fwd-power sample= : %s" % str(e)) =20 - self.vm0_vf0_mac =3D self.vm0_dut.get_mac_address(0) - self.vm0_vf1_mac =3D self.vm0_dut.get_mac_address(1) - self.vm0_dut.send_expect("systemctl stop NetworkManager", "# ", 60= ) - - def destroy_vm_env(self): + def test_nic_interrupt_VF_vfio_pci(self, driver=3D'default'): """ - destroy vm environment + Check Interrupt for VF with vfio driver """ - if getattr(self, 'vm0', None): - self.vm0_dut.kill_all() - self.vm0_dut_ports =3D None - # destroy vm0 - self.vm0.stop() - self.vm0 =3D None + self.set_NIC_link() =20 - if getattr(self, 'used_dut_port_0', None) !=3D None: - self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) - self.used_dut_port_0 =3D None + # 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, drive= r=3Ddriver) + self.sriov_vfs_port_0 =3D self.dut.ports_info[self.used_dut_port_0= ]['vfs_port'] =20 - if getattr(self, 'used_dut_port_1', None) !=3D None: - self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) - self.used_dut_port_1 =3D None + for port in self.sriov_vfs_port_0: + port.bind_driver('vfio-pci') =20 - self.env_done =3D False + self.begin_l3fwd_power() + 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() =20 - def change_port_conf(self, use_dut, lsc_enable=3DTrue, rxq_enable=3DTr= ue): - """ - change interrupt enable - """ - sed_cmd_fmt =3D "/intr_conf.*=3D.*{/,/\}\,$/c\ .intr_conf =3D {= \\n\\t\\t.lsc =3D %d,\\n\\t\\t.rxq =3D %d,\\n\\t}," - lsc =3D 1 - rxq =3D 1 - if lsc_enable: - lsc =3D 0 - if rxq_enable: - rxq =3D 1 - sed_cmd_str =3D sed_cmd_fmt % (lsc, rxq) - out =3D use_dut.send_expect( - "sed -i '%s' examples/l3fwd-power/main.c" % sed_cmd_str, "# ",= 60) - - def scapy_send_packet(self, mac, testinterface, queuenum=3D1): - """ - Send a packet to port - """ - if queuenum =3D=3D 1: - self.tester.scapy_append( - 'sendp([Ether(dst=3D"%s")/IP()/UDP()/Raw(\'X\'*18)], iface= =3D"%s")' % (mac, testinterface)) - elif queuenum =3D=3D 2: - for dst in range(16): - self.tester.scapy_append( - 'sendp([Ether(dst=3D"%s")/IP(dst=3D"127.0.0.%d")/UDP()= /Raw(\'X\'*18)], iface=3D"%s")' % (mac, dst, testinterface)) - else: - for dst in range(256): - self.tester.scapy_append( - 'sendp([Ether(dst=3D"%s")/IP(dst=3D"127.0.0.%d")/UDP()= /Raw(\'X\'*18)], iface=3D"%s")' % (mac, dst, testinterface)) - self.tester.scapy_execute() - - def test_vf_VM_uio(self): - """ - verify VF interrupt pmd in VM with uio - """ - self.verify(self.drivername in ['igb_uio'], "NOT Support") - self.generate_sriov_vfport('igb_uio') - self.bind_vfs('pci-stub') - self.setup_vm_env() - self.change_port_conf(self.vm0_dut, lsc_enable=3DTrue, rxq_enable= =3DFalse) - self.build_app(self.vm0_dut) - - cmd =3D self.path + \ - " -c f -n %d -- -p 0x3 -P --config=3D'(0,0,1),(1,0,2)'" % ( - self.vm0_dut.get_memory_channels()) - self.vm0_dut.send_expect(cmd, "L3FWD_POWER", 60) - self.scapy_send_packet(self.vm0_vf0_mac, self.rx_intf_0) - self.scapy_send_packet(self.vm0_vf1_mac, self.rx_intf_1) - out =3D self.vm0_dut.get_session_output(timeout=3D30) - self.destroy_vm_env() - self.dut.send_expect("quit", "# ", 60) - self.verify( - "lcore 1 is waked up from rx interrupt on port 0" in out, "lco= re 1 not waked up") - self.verify( - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 not= sleeps") - self.verify( - "lcore 2 is waked up from rx interrupt on port 1" in out, "lco= re 2 not waked up") - self.verify( - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 not= sleeps") + self.send_and_verify(self.vf_mac, self.rx_intf_0) =20 - def test_vf_host_uio(self): + def test_nic_interrupt_PF_vfio_pci(self): """ - verify VF interrupt pmd in Host with uio + Check Interrupt for PF with vfio-pci driver """ - self.verify(self.drivername in ['igb_uio'], "NOT Support") - self.dut.restore_interfaces() - self.generate_sriov_vfport('ixgbe') - self.bind_vfs('igb_uio') - self.change_port_conf(self.dut, lsc_enable=3DTrue, rxq_enable=3DFa= lse) - self.build_app(self.dut) - - cmd =3D self.path + " -c %s -n %d -- -p %s -P --config=3D'(0,0,1),= (1,0,2)'" % ( - self.coremask, self.dut.get_memory_channels(), self.portmask) - self.dut.send_expect(cmd, "L3FWD_POWER", 60) - self.scapy_send_packet(self.mac_port_0, self.rx_intf_0) - self.scapy_send_packet(self.mac_port_1, self.rx_intf_1) - out =3D self.dut.get_session_output(timeout=3D60) - self.dut.send_expect("^C", "# ", 60) - self.verify( - "lcore 1 is waked up from rx interrupt on port 0" in out, "lco= re 1 not waked up") - self.verify( - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 not= sleeps") - self.verify( - "lcore 2 is waked up from rx interrupt on port 1" in out, "lco= re 2 not waked up") - self.verify( - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 not= sleeps") + self.dut.ports_info[0]['port'].bind_driver(driver=3D'vfio-pci') + + self.begin_l3fwd_power() =20 - def test_vf_host_vfio(self): + self.send_and_verify(self.mac_port_0, self.rx_intf_0) + + def test_nic_interrupt_PF_igb_uio(self): """ - verify VF interrupt pmd in Host with vfio + Check Interrupt for PF with igb_uio driver """ - self.verify(self.drivername in ['vfio-pci'], "NOT Support") - self.dut.restore_interfaces() - self.generate_sriov_vfport('ixgbe') - self.bind_vfs('vfio-pci') - self.change_port_conf(self.dut, lsc_enable=3DTrue, rxq_enable=3DFa= lse) - self.build_app(self.dut) - - cmd =3D self.path + " -c %s -n %d -- -p %s -P --config=3D'(0,0,1),= (0,1,2)(1,0,3),(1,1,4)'" % ( - self.coremask, self.dut.get_memory_channels(), self.portmask) - self.dut.send_expect(cmd, "L3FWD_POWER", 60) - self.scapy_send_packet(self.mac_port_0, self.rx_intf_0, 2) - self.scapy_send_packet(self.mac_port_1, self.rx_intf_1, 2) - out =3D self.dut.get_session_output(timeout=3D60) - self.dut.send_expect("^C", "# ", 60) - print out - self.verify( - "lcore 1 is waked up from rx interrupt on port 0" in out, "lco= re 1 not waked up") - self.verify( - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 not= sleeps") - self.verify( - "lcore 2 is waked up from rx interrupt on port 0" in out, "lco= re 2 not waked up") - self.verify( - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 not= sleeps") - self.verify( - "lcore 3 is waked up from rx interrupt on port 1" in out, "lco= re 2 not waked up") - self.verify( - "lcore 3 sleeps until interrupt triggers" in out, "lcore 2 not= sleeps") - self.verify( - "lcore 4 is waked up from rx interrupt on port 1" in out, "lco= re 2 not waked up") - self.verify( - "lcore 4 sleeps until interrupt triggers" in out, "lcore 2 not= sleeps") + self.dut.ports_info[0]['port'].bind_driver(driver=3D'igb_uio') + + self.begin_l3fwd_power() + + self.send_and_verify(self.mac_port_0, self.rx_intf_0) =20 def tear_down(self): """ Run after each test case. """ - self.dut.virt_exit() - self.dut.kill_all() - time.sleep(2) + self.dut.send_expect("^c", "#", 20) =20 def tear_down_all(self): """ --=20 2.17.2