From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 52C77A0679 for ; Mon, 29 Apr 2019 11:57:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 16FCD1B142; Mon, 29 Apr 2019 11:57:16 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 6A462568A for ; Mon, 29 Apr 2019 11:57:14 +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 fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Apr 2019 02:57:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,409,1549958400"; d="scan'208";a="165863434" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 29 Apr 2019 02:57:12 -0700 From: "xiao,qimai" To: dts@dpdk.org Cc: "xiao,qimai" Date: Mon, 29 Apr 2019 18:01:35 +0800 Message-Id: <1556532095-20759-1-git-send-email-qimaix.xiao@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V2] update function send_packet of pmdrss_hash to reduce runtime 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" optimize function send_packet in pmdrss_hash Signed-off-by: xiao,qimai --- 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