test suite reviews and discussions
 help / color / mirror / Atom feed
From: "xiao,qimai" <qimaix.xiao@intel.com>
To: dts@dpdk.org
Cc: "xiao,qimai" <qimaix.xiao@intel.com>
Subject: [dts] [PATCH V2] update function send_packet of pmdrss_hash to reduce runtime
Date: Mon, 29 Apr 2019 18:01:35 +0800	[thread overview]
Message-ID: <1556532095-20759-1-git-send-email-qimaix.xiao@intel.com> (raw)

optimize function send_packet in pmdrss_hash

Signed-off-by: xiao,qimai <qimaix.xiao@intel.com>
---
 tests/TestSuite_pmdrss_hash.py | 148 ++++++++++++++-------------------
 1 file changed, 64 insertions(+), 84 deletions(-)

diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py
index 283a545..32dc263 100644
--- a/tests/TestSuite_pmdrss_hash.py
+++ b/tests/TestSuite_pmdrss_hash.py
@@ -85,79 +85,79 @@ class TestPmdrssHash(TestCase):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-tcp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1024)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-udp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1024)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-sctp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1024,dport=1024,tag=1)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-frag":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "l2_payload":
             for i in range(10):
                 packet = r'sendp([Ether(src="00:00:00:00:00:0%d",dst="%s")], iface="%s")' % (
                     i + 1, mac, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
 
         elif tran_type == "ipv6-other":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-tcp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1024)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-udp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1024)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-sctp":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1024,dport=1024,tag=1)], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-frag":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
                     mac, itf, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         else:
             print "\ntran_type error!\n"
 
@@ -235,131 +235,111 @@ class TestPmdrssHash(TestCase):
                 packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
 
         elif tran_type == "ipv4-tcp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1025)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-udp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1025)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-sctp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1024,dport=1025,tag=1)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv4-frag":
             for i in range(10):
                 packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "l2_payload":
             for i in range(10):
                 packet = r'sendp([Ether(src="00:00:00:00:00:%02d",dst="%s")], iface="%s")' % (
                     i + 1, mac, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-other":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
 
         elif tran_type == "ipv6-tcp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1025)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
 
         elif tran_type == "ipv6-udp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1025)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-sctp":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1024,dport=1025,tag=1)], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         elif tran_type == "ipv6-frag":
             for i in range(4):
                 packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
                     mac, i + 1, i + 2, itf)
                 self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
-                packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
+                packet2 = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
                     mac, i + 2, i + 1, itf)
-                self.tester.scapy_append(packet)
-                self.tester.scapy_execute()
-                time.sleep(.5)
+                self.tester.scapy_append(packet2)
+            self.tester.scapy_execute()
+            time.sleep(.5)
         else:
             print "\ntran_type error!\n"
 
-- 
2.17.1


             reply	other threads:[~2019-04-29  9:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 10:01 xiao,qimai [this message]
2019-05-13  2:24 ` Tu, Lijuan
2019-05-13  5:25 ` Li, WenjieX A
2019-05-13  5:27 ` Li, WenjieX A

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=1556532095-20759-1-git-send-email-qimaix.xiao@intel.com \
    --to=qimaix.xiao@intel.com \
    --cc=dts@dpdk.org \
    /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).