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 E1606A0613 for ; Tue, 24 Sep 2019 08:32:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99871378E; Tue, 24 Sep 2019 08:32:45 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 8DBD4324D for ; Tue, 24 Sep 2019 08:32:44 +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 fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 23:32:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,543,1559545200"; d="scan'208";a="179384459" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 23 Sep 2019 23:32:43 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Sep 2019 23:32:42 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Sep 2019 23:32:42 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.195]) with mapi id 14.03.0439.000; Tue, 24 Sep 2019 14:32:39 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" CC: "Zhang, YanX A" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead pktgen send pkts Thread-Index: AQHVbcSFb2fsK7yUQEmuizFrGbN3kqcwKHuAgAmpXICAAJZEEA== Date: Tue, 24 Sep 2019 06:32:38 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB27547@SHSMSX101.ccr.corp.intel.com> References: <1568745212-10618-1-git-send-email-lihongx.ma@intel.com> <2C49E4B25FAD1D419F7564D633EF72E1F481BD@SHSMSX105.ccr.corp.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.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDc0OGE4M2ItNDYxYi00YTVkLTg3NjMtOTUxYTc3ZDY0NjAxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRkYxSkl6OUdzSUtkdHh1S3JSMXo0XC9KVXJzNDJ2c2JCTm5HK0FsNFwvMThnaE8rNGhSc29mZnUranlZOGVBQVB3In0= 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_port_start_stop: use scapy instead pktgen send pkts 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" Ok, thanks for letting me know > -----Original Message----- > From: Ma, LihongX > Sent: Tuesday, September 24, 2019 1:35 PM > To: Tu, Lijuan > Cc: Zhang, YanX A ; dts@dpdk.org > Subject: RE: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead > pktgen send pkts >=20 > Hi, Lijuan > You can ignore this patch, I will push version V2. >=20 > -----Original Message----- > From: Zhang, YanX A > Sent: Wednesday, September 18, 2019 10:02 AM > To: Ma, LihongX ; dts@dpdk.org > Cc: Ma, LihongX > Subject: RE: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead > pktgen send pkts >=20 > Tested-by: Zhang, YanX A >=20 > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Wednesday, September 18, 2019 2:34 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead pkt= gen > send pkts >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vf_port_start_stop.py | 82 +++++++++--------------------= ------ > 1 file changed, 20 insertions(+), 62 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_port_start_stop.py > b/tests/TestSuite_vf_port_start_stop.py > index 2ff2d1c..4f0e406 100644 > --- a/tests/TestSuite_vf_port_start_stop.py > +++ b/tests/TestSuite_vf_port_start_stop.py > @@ -10,6 +10,7 @@ from utils import RED, GREEN from net_device import > NetDevice from crb import Crb from scapy.all import * > +from scapy.layers.sctp import SCTP, SCTPChunkData > VM_CORES_MASK =3D 'all' >=20 > class TestVfPortStartStop(TestCase): > @@ -22,6 +23,8 @@ class TestVfPortStartStop(TestCase): > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > self.vm0 =3D None > self.filename =3D "/tmp/vf.pcap" > + self.tester_tx_port =3D self.tester.get_local_port(self.dut_port= s[0]) > + self.tester_tintf =3D > + self.tester.get_interface(self.tester_tx_port) >=20 > # set vf assign method and vf driver > self.vf_driver =3D self.get_suite_cfg()['vf_driver'] @@ -37,72 += 40,25 @@ > class TestVfPortStartStop(TestCase): > def set_up(self): >=20 > self.setup_1pf_2vf_1vm_env_flag =3D 0 > - > - def pktgen_prerequisites(self): > - """ > - igb_uio.ko should be put in ~ before you using pktgen > - """ > - out =3D self.tester.send_expect("ls", "#") > - self.verify("igb_uio.ko" in out, "No file igb_uio.ko, please add= it in ~") > - self.tester.send_expect("modprobe uio", "#", 70) > - out =3D self.tester.send_expect("lsmod | grep igb_uio", "#") > - if "igb_uio" in out: > - self.tester.send_expect("rmmod -f igb_uio", "#", 70) > - self.tester.send_expect("insmod ~/igb_uio.ko", "#", 60) > - out =3D self.tester.send_expect("lsmod | grep igb_uio", "#") > - assert ("igb_uio" in out), "Failed to insmod igb_uio" > - > - total_huge_pages =3D self.tester.get_total_huge_pages() > - if total_huge_pages =3D=3D 0: > - self.tester.mount_huge_pages() > - self.tester.set_huge_pages(2048) > - > - def pktgen_kill(self): > - """ > - Kill all pktgen on tester. > - """ > - pids =3D [] > - pid_reg =3D r'p(\d+)' > - out =3D self.tester.alt_session.send_expect("lsof -Fp /var/run/.= pg_config", > "#", 20) > - if len(out): > - lines =3D out.split('\r\n') > - for line in lines: > - m =3D re.match(pid_reg, line) > - if m: > - pids.append(m.group(1)) > - for pid in pids: > - self.tester.alt_session.send_expect('kill -9 %s' % pid, '# '= , 20) > + self.send_pks_session =3D None >=20 > def send_and_verify(self, dst_mac, testpmd): > """ > - Generates packets by pktgen > + Generates packets and verify > """ > self.testpmd_reset_status(testpmd) >=20 > - self.pktgen_prerequisites() > - # bind ports > - self.tester_tx_port =3D self.tester.get_local_port(self.dut_port= s[0]) > - self.tester_tx_pci =3D self.tester.ports_info[self.tester_tx_por= t]['pci'] > - port =3D self.tester.ports_info[self.tester_tx_port]['port'] > - self.tester_port_driver =3D port.get_nic_driver() > - self.tester.send_expect("./dpdk-devbind.py --force --bind=3Digb_= uio %s" % > self.tester_tx_pci, "#") > - > - src_mac =3D self.tester.get_mac(self.tester_tx_port) > + src_mac =3D self.tester.get_mac(self.tester_tx_port) > if src_mac =3D=3D 'N/A': > src_mac =3D "02:00:00:00:01" > - > - self.create_pcap_file(self.filename, dst_mac, src_mac) > - > - self.tester.send_expect("./pktgen -c 0x1f -n 2 --proc-type auto= --socket- > mem 128,128 --file-prefix pg -- -P -T -m '1.0' -s 0:%s" % self.filename, > "Pktgen >", 100) > - time.sleep(1) > - self.tester.send_expect("start all", "Pktgen>") > + self.send_pkts(self.filename, dst_mac, src_mac) > time.sleep(1) > self.check_port_start_stop(testpmd) > - # quit pktgen > - self.tester.send_expect("stop all", "Pktgen>") > - self.tester.send_expect("quit", "# ") > + self.tester.send_expect('killall -s INT scapy', '# ') > + self.tester.destroy_session(self.send_pks_session) > + self.send_pks_session =3D None >=20 > - def create_pcap_file(self, filename, dst_mac, src_mac): > + def send_pkts(self, filename, dst_mac, src_mac): > """ > Generates a valid PCAP file with the given configuration. > """ > @@ -118,6 +74,12 @@ class TestVfPortStartStop(TestCase): >=20 > wrpcap(filename, pkts) >=20 > + sendp_fmt =3D "sendp(pk, iface=3D'%s', loop=3D1)" % (self.tester= _tintf) > + self.send_pks_session =3D self.tester.create_session("scapy1") > + self.send_pks_session.send_expect("scapy", ">>>") > + self.send_pks_session.send_expect("pk=3Drdpcap('%s')" % filename= , > ">>>") > + self.send_pks_session.send_command(sendp_fmt) > + > def testpmd_reset_status(self, testpmd): > """ > Reset testpmd :stop forward & stop port @@ -242,13 +204,9 @@ cla= ss > TestVfPortStartStop(TestCase): >=20 > def tear_down_all(self): >=20 > - self.pktgen_kill() > - if getattr(self, 'tester_port_driver', None) and \ > - getattr(self, 'tester_tx_pci', None): > - self.tester.send_expect("./dpdk-devbind.py --bind=3D%s %s" \ > - %(self.tester_port_driver, self.tester_tx_pci), "#") > - tx_interface =3D self.tester.get_interface(self.tester_tx_po= rt) > - self.tester.send_expect("ifconfig %s up" % tx_interface, "#"= ) > + if self.send_pks_session: > + self.tester.send_expect('killall -s INT scapy', '# ') > + self.tester.destroy_session(self.send_pks_session) >=20 > if getattr(self, 'vm0', None): > self.vm0.stop() > -- > 2.7.4