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 82E1EA2EFC for ; Fri, 20 Sep 2019 08:31:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 79D391F1FF; Fri, 20 Sep 2019 08:31:24 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 919C51F178 for ; Fri, 20 Sep 2019 08:31:22 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 23:31:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,527,1559545200"; d="scan'208";a="217557697" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2019 23:31:15 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 19 Sep 2019 23:31:15 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 19 Sep 2019 23:31:14 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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, 19 Sep 2019 23:31:14 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.23]) with mapi id 14.03.0439.000; Fri, 20 Sep 2019 14:31:12 +0800 From: "Tu, Lijuan" To: "Zhang, YanX A" , "dts@dpdk.org" CC: "Yao, Lei A" , "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests:add new test suite mdd Thread-Index: AQHVbHBcMdttlUyxH0q6h7YE1bJvRKc0IRmA Date: Fri, 20 Sep 2019 06:31:12 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB24C67@SHSMSX101.ccr.corp.intel.com> References: <1568626042-4315-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: <1568626042-4315-1-git-send-email-yanx.a.zhang@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-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWU3MjM0YzAtYjYwNy00ZDJiLTlhNTAtZGZhMjQ3Y2RmMmY3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUk9IcExadEYyRDZUMEpTYzBhXC9NTXZnZllBXC9TUDd4N1Y3bHN4SG13S05xSGp6ZFZzRWxXTEN2WEtwb1wvNm5oMCJ9 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:add new test suite mdd 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 zhang,yan > Sent: Monday, September 16, 2019 5:27 PM > To: dts@dpdk.org > Cc: Yao, Lei A ; Zhang, YanX A > > Subject: [dts] [PATCH V1] tests:add new test suite mdd >=20 > add new test suite mdd. >=20 > Signed-off-by: zhang,yan > --- > tests/TestSuite_mdd.py | 206 > +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 206 insertions(+) > create mode 100644 tests/TestSuite_mdd.py >=20 > diff --git a/tests/TestSuite_mdd.py b/tests/TestSuite_mdd.py new file mod= e > 100644 index 0000000..7baea2c > --- /dev/null > +++ b/tests/TestSuite_mdd.py > @@ -0,0 +1,206 @@ > +# > + > +import re > +import time > +from packet import Packet > +from virt_common import VM > +from test_case import TestCase > +from pmd_output import PmdOutput > + > +VM_CORES_MASK =3D 'all' > +send_pks_num =3D 2000 > + > +class TestMDD(TestCase): > + > + supported_vf_driver =3D ['pci-stub', 'vfio-pci'] > + > + 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 > + > + # set vf assign method and vf driver > + 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.dut.send_expect('dmesg -c', '#') > + > + self.port_id_0 =3D 0 > + self.port_id_1 =3D 1 > + > + self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > + self.rx_port =3D self.tester.get_local_port(self.dut_ports[1]) > + > + def set_up(self): > + pass > + > + def setup_2pf_2vf_1vm_env(self): > + self.used_dut_port_0 =3D self.dut_ports[0] > + self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1, > driver=3D'ixgbe') > + self.sriov_vfs_port_0 =3D > self.dut.ports_info[self.used_dut_port_0]['vfs_port'] > + self.used_dut_port_1 =3D self.dut_ports[1] > + self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, > driver=3D'ixgbe') > + self.sriov_vfs_port_1 =3D > + self.dut.ports_info[self.used_dut_port_1]['vfs_port'] > + > + try: > + > + for port in self.sriov_vfs_port_0: > + port.bind_driver(self.vf_driver) > + > + for port in self.sriov_vfs_port_1: > + port.bind_driver(self.vf_driver) > + > + time.sleep(1) > + vf0_prop =3D {'opt_host': self.sriov_vfs_port_0[0].pci} > + vf1_prop =3D {'opt_host': self.sriov_vfs_port_1[0].pci} > + # not support driver=3Digb_uio,because driver is kernel driv= er > + # set up VM0 ENV > + self.vm0 =3D VM(self.dut, 'vm0', 'mdd') > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0= _prop) > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf1= _prop) > + self.vm_dut_0 =3D self.vm0.start() > + if self.vm_dut_0 is None: > + raise Exception("Set up VM0 ENV failed!") > + > + except Exception as e: > + self.destroy_2pf_2vf_1vm_env() > + raise Exception(e) > + > + def destroy_2pf_2vf_1vm_env(self): > + if getattr(self, 'vm0', None): > + # destroy testpmd in vm0 > + if getattr(self, 'vm0_testpmd', None): > + self.vm0_testpmd.execute_cmd('stop') > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.vm0_testpmd =3D None > + > + self.vm0_dut_ports =3D None > + # destroy vm0 > + self.vm0.stop() > + self.vm0 =3D None > + > + self.dut.virt_exit() > + > + if getattr(self, 'used_dut_port_0', None) !=3D None: > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) > + port =3D self.dut.ports_info[self.used_dut_port_0]['port'] > + port.bind_driver() > + self.used_dut_port_0 =3D None > + > + if getattr(self, 'used_dut_port_1', None) !=3D None: > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) > + port =3D self.dut.ports_info[self.used_dut_port_1]['port'] > + port.bind_driver() > + self.used_dut_port_1 =3D None > + > + for port_id in self.dut_ports: > + port =3D self.dut.ports_info[port_id]['port'] > + port.bind_driver() > + > + def start_testpmd_in_vm(self, txoffload=3D''): > + 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, "--portmask=3D0x3 = -- > tx-offloads=3D%s" % txoffload) > + self.vm0_testpmd.execute_cmd('set fwd mac') > + self.vm0_testpmd.execute_cmd('set promisc all off') > + self.vm0_testpmd.execute_cmd('start') > + > + def send_packets(self): > + > + tgen_ports =3D [] > + self.tester_intf =3D self.tester.get_interface(self.tx_port) > + tgen_ports.append((self.tx_port, self.rx_port)) > + self.pmd_vf0_mac =3D > + self.vm0_testpmd.get_port_mac(self.port_id_0) > + > + dst_mac =3D self.pmd_vf0_mac > + src_mac =3D self.tester.get_mac(self.tx_port) > + > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3D64) > + pkt.config_layer('ether', {'dst': dst_mac, 'src': src_mac}) > + time.sleep(2) > + self.vm0_testpmd.execute_cmd('clear port stats all') > + self.vm0_testpmd.execute_cmd('show port stats all') > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dsend_pks_num) > + time.sleep(2) > + > + def result_verify(self, pkt_fwd=3DTrue): > + pmd0_vf0_stats =3D self.vm0_testpmd.get_pmd_stats(self.port_id_0= ) > + pmd0_vf1_stats =3D self.vm0_testpmd.get_pmd_stats(self.port_id_1= ) > + time.sleep(2) > + > + vf0_rx_cnt =3D pmd0_vf0_stats['RX-packets'] > + self.verify(vf0_rx_cnt >=3D send_pks_num, "no packet was receive= d > + by vm0_VF0") > + > + vf0_rx_err =3D pmd0_vf0_stats['RX-errors'] > + self.verify(vf0_rx_err =3D=3D 0, "vm0_VF0 rx-errors") > + > + vf1_tx_cnt =3D pmd0_vf1_stats['TX-packets'] > + if pkt_fwd: > + self.verify(vf1_tx_cnt =3D=3D send_pks_num, "Packet forwardi= ng failed") > + else: > + self.verify(vf1_tx_cnt =3D=3D 0, "Packet is forwarded") > + > + def config_mdd(self, value): > + self.dut.restore_interfaces() > + self.dut.send_expect("rmmod ixgbe", "# ", 10) > + time.sleep(2) > + count =3D self.dut.send_expect("./usertools/dpdk-devbind.py -s |= grep > ixgbe | wc -l", "#") > + m =3D [value for i in range(int(count))] > + mdd =3D "MDD=3D" + str(m).replace("[", "").replace("]", "").repl= ace(" ", "") > + self.dut.send_expect("modprobe ixgbe %s" % mdd, "# ", 10) > + time.sleep(5) > + for port_info in self.dut.ports_info: > + port =3D port_info['port'] > + intf =3D port.get_interface_name() > + self.dut.send_expect("ifconfig %s up" % intf, "# ", 10) > + time.sleep(2) > + > + def test_1enable_mdd_dpdk_disable(self): > + self.config_mdd(1) > + self.setup_2pf_2vf_1vm_env() > + self.start_testpmd_in_vm(txoffload=3D'0x1') > + self.send_packets() > + self.result_verify(False) > + dmesg =3D self.dut.send_expect("dmesg -c |grep 'event'", "# ", 1= 0) > + self.verify("Malicious event" in dmesg,"mdd error") > + > + def test_2enable_mdd_dpdk_enable(self): > + self.config_mdd(1) > + self.setup_2pf_2vf_1vm_env() > + self.start_testpmd_in_vm(txoffload=3D'0x0') > + self.send_packets() > + self.result_verify(False) > + dmesg =3D self.dut.send_expect("dmesg -c |grep 'event'", "# ", 1= 0) > + self.verify("Malicious event" in dmesg,"mdd error") > + > + def test_3disable_mdd_dpdk_disable(self): > + self.config_mdd(0) > + self.setup_2pf_2vf_1vm_env() > + self.start_testpmd_in_vm(txoffload=3D'0x1') > + self.send_packets() > + self.result_verify(True) > + dmesg =3D self.dut.send_expect("dmesg -c |grep 'event'", "# ", 1= 0) > + self.verify("Malicious event" not in dmesg,"mdd error") > + > + def test_4disable_mdd_dpdk_enable(self): > + self.config_mdd(0) > + self.setup_2pf_2vf_1vm_env() > + self.start_testpmd_in_vm(txoffload=3D'0x0') > + self.send_packets() > + self.result_verify(True) > + dmesg =3D self.dut.send_expect("dmesg -c |grep 'event'", "# ", 1= 0) > + self.verify("Malicious event" not in dmesg,"mdd error") > + > + def tear_down(self): > + self.destroy_2pf_2vf_1vm_env() > + > + def tear_down_all(self): > + pass > -- > 2.17.2