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 12053A00E6 for ; Tue, 6 Aug 2019 11:07:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E54591BDFF; Tue, 6 Aug 2019 11:07:58 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 9977D1B998 for ; Tue, 6 Aug 2019 11:07:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 01:54:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,353,1559545200"; d="scan'208";a="164918403" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga007.jf.intel.com with ESMTP; 06 Aug 2019 01:54:15 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 01:54:15 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 01:54:15 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Tue, 6 Aug 2019 16:53:07 +0800 From: "Tu, Lijuan" To: "Zhu, WenhuiX" , "Zhang, YanX A" , "dts@dpdk.org" CC: "Zhang, Yuwei1" , "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_vf_interrupt_pmd:Change the script according to the latest test_plan Thread-Index: AQHVS2qosGmJOMKFoE2QtWl6iRDlJabruKyAgAIZLDA= Date: Tue, 6 Aug 2019 08:53:07 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAFD17F@SHSMSX101.ccr.corp.intel.com> References: <1564995196-118013-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: 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.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTY4YTExZmItZjQ1Mi00Yzg3LTkyY2QtMjI3ZGQyNTkyN2FjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidUUzeHplMlwvWHNSckI0STl2WVQwVzBlbUFuTHAwXC9zQnZxempRMVN2OE1uSUFidktFXC9OVlBPbjI4SEZXTXVTbyJ9 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Zhu, WenhuiX > 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 > script according to the latest test_plan >=20 >=20 > Tested-by: Zhu, WenhuiX >=20 > -----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 > script according to the latest test_plan >=20 > Modify the script according to the latest test plan >=20 > Signed-off-by: zhang,yan > --- > tests/TestSuite_vf_interrupt_pmd.py | 285 +++++++++------------------- > 1 file changed, 87 insertions(+), 198 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_interrupt_pmd.py > b/tests/TestSuite_vf_interrupt_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.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 > 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/l3fw= d- > 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_u= ser 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_= user > 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_POWE= R", 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 samp= le: %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, > driver=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=3D= True): > - """ > - 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)], ifa= ce=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, "l= core 1 not > waked up") > - self.verify( > - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 n= ot sleeps") > - self.verify( > - "lcore 2 is waked up from rx interrupt on port 1" in out, "l= core 2 not > waked up") > - self.verify( > - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 n= ot 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=3D= False) > - 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, "l= core 1 not > waked up") > - self.verify( > - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 n= ot sleeps") > - self.verify( > - "lcore 2 is waked up from rx interrupt on port 1" in out, "l= core 2 not > waked up") > - self.verify( > - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 n= ot 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=3D= False) > - 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, "l= core 1 not > waked up") > - self.verify( > - "lcore 1 sleeps until interrupt triggers" in out, "lcore 1 n= ot sleeps") > - self.verify( > - "lcore 2 is waked up from rx interrupt on port 0" in out, "l= core 2 not > waked up") > - self.verify( > - "lcore 2 sleeps until interrupt triggers" in out, "lcore 2 n= ot sleeps") > - self.verify( > - "lcore 3 is waked up from rx interrupt on port 1" in out, "l= core 2 not > waked up") > - self.verify( > - "lcore 3 sleeps until interrupt triggers" in out, "lcore 2 n= ot sleeps") > - self.verify( > - "lcore 4 is waked up from rx interrupt on port 1" in out, "l= core 2 not > waked up") > - self.verify( > - "lcore 4 sleeps until interrupt triggers" in out, "lcore 2 n= ot 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): > """ > -- > 2.17.2