From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Ma, LihongX" <lihongx.ma@intel.com>
Cc: "Zhang, YanX A" <yanx.a.zhang@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead pktgen send pkts
Date: Tue, 24 Sep 2019 06:32:38 +0000 [thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB27547@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <BE1E572D0441E34284F1F8B7AC28F1970BB03FC2@SHSMSX101.ccr.corp.intel.com>
Ok, thanks for letting me know
> -----Original Message-----
> From: Ma, LihongX
> Sent: Tuesday, September 24, 2019 1:35 PM
> To: Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Zhang, YanX A <yanx.a.zhang@intel.com>; dts@dpdk.org
> Subject: RE: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead
> pktgen send pkts
>
> Hi, Lijuan
> You can ignore this patch, I will push version V2.
>
> -----Original Message-----
> From: Zhang, YanX A
> Sent: Wednesday, September 18, 2019 10:02 AM
> To: Ma, LihongX <lihongx.ma@intel.com>; dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: RE: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead
> pktgen send pkts
>
> Tested-by: Zhang, YanX A <yanx.a.zhang@intel.com>
>
> -----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 <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] tests/vf_port_start_stop: use scapy instead pktgen
> send pkts
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_vf_port_start_stop.py | 82 +++++++++--------------------------
> 1 file changed, 20 insertions(+), 62 deletions(-)
>
> 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 = 'all'
>
> class TestVfPortStartStop(TestCase):
> @@ -22,6 +23,8 @@ class TestVfPortStartStop(TestCase):
> self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> self.vm0 = None
> self.filename = "/tmp/vf.pcap"
> + self.tester_tx_port = self.tester.get_local_port(self.dut_ports[0])
> + self.tester_tintf =
> + self.tester.get_interface(self.tester_tx_port)
>
> # set vf assign method and vf driver
> self.vf_driver = self.get_suite_cfg()['vf_driver'] @@ -37,72 +40,25 @@
> class TestVfPortStartStop(TestCase):
> def set_up(self):
>
> self.setup_1pf_2vf_1vm_env_flag = 0
> -
> - def pktgen_prerequisites(self):
> - """
> - igb_uio.ko should be put in ~ before you using pktgen
> - """
> - out = 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 = 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 = self.tester.send_expect("lsmod | grep igb_uio", "#")
> - assert ("igb_uio" in out), "Failed to insmod igb_uio"
> -
> - total_huge_pages = self.tester.get_total_huge_pages()
> - if total_huge_pages == 0:
> - self.tester.mount_huge_pages()
> - self.tester.set_huge_pages(2048)
> -
> - def pktgen_kill(self):
> - """
> - Kill all pktgen on tester.
> - """
> - pids = []
> - pid_reg = r'p(\d+)'
> - out = self.tester.alt_session.send_expect("lsof -Fp /var/run/.pg_config",
> "#", 20)
> - if len(out):
> - lines = out.split('\r\n')
> - for line in lines:
> - m = 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 = None
>
> def send_and_verify(self, dst_mac, testpmd):
> """
> - Generates packets by pktgen
> + Generates packets and verify
> """
> self.testpmd_reset_status(testpmd)
>
> - self.pktgen_prerequisites()
> - # bind ports
> - self.tester_tx_port = self.tester.get_local_port(self.dut_ports[0])
> - self.tester_tx_pci = self.tester.ports_info[self.tester_tx_port]['pci']
> - port = self.tester.ports_info[self.tester_tx_port]['port']
> - self.tester_port_driver = port.get_nic_driver()
> - self.tester.send_expect("./dpdk-devbind.py --force --bind=igb_uio %s" %
> self.tester_tx_pci, "#")
> -
> - src_mac = self.tester.get_mac(self.tester_tx_port)
> + src_mac = self.tester.get_mac(self.tester_tx_port)
> if src_mac == 'N/A':
> src_mac = "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 = None
>
> - 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):
>
> wrpcap(filename, pkts)
>
> + sendp_fmt = "sendp(pk, iface='%s', loop=1)" % (self.tester_tintf)
> + self.send_pks_session = self.tester.create_session("scapy1")
> + self.send_pks_session.send_expect("scapy", ">>>")
> + self.send_pks_session.send_expect("pk=rdpcap('%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 @@ class
> TestVfPortStartStop(TestCase):
>
> def tear_down_all(self):
>
> - 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=%s %s" \
> - %(self.tester_port_driver, self.tester_tx_pci), "#")
> - tx_interface = self.tester.get_interface(self.tester_tx_port)
> - 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)
>
> if getattr(self, 'vm0', None):
> self.vm0.stop()
> --
> 2.7.4
prev parent reply other threads:[~2019-09-24 6:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 18:33 lihong
2019-09-18 2:02 ` Zhang, YanX A
2019-09-24 5:34 ` Ma, LihongX
2019-09-24 6:32 ` Tu, Lijuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8CE3E05A3F976642AAB0F4675D0AD20E0BB27547@SHSMSX101.ccr.corp.intel.com \
--to=lijuan.tu@intel.com \
--cc=dts@dpdk.org \
--cc=lihongx.ma@intel.com \
--cc=yanx.a.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).