From: zhaomeijuan <meijuanx.zhao@intel.com>
To: dts@dpdk.org
Cc: zhaomeijuan <meijuanx.zhao@intel.com>
Subject: [dts] [next][PATCH V1 5/7] tests/ipfrag
Date: Sun, 28 Apr 2019 10:47:16 +0000 [thread overview]
Message-ID: <20190428104718.9143-5-meijuanx.zhao@intel.com> (raw)
In-Reply-To: <20190428104718.9143-1-meijuanx.zhao@intel.com>
*.remove old or unused module and code
which replace it with pktgen API
*.change max framesize as 1518
*.quit task before start another
Signed-off-by: zhaomeijuan <meijuanx.zhao@intel.com>
---
tests/TestSuite_ipfrag.py | 68 ++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 23 deletions(-)
diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py
index 9f47a2c..c23e05b 100644
--- a/tests/TestSuite_ipfrag.py
+++ b/tests/TestSuite_ipfrag.py
@@ -38,8 +38,11 @@ import utils
import string
import re
import time
+import os
from settings import HEADER_SIZE
from packet import Packet
+from pktgen import PacketGeneratorHelper
+
lpm_table_ipv4 = [
"{IPv4(100,10,0,0), 16, P1}",
@@ -84,7 +87,6 @@ class TestIpfrag(TestCase):
# Based on h/w type, choose how many ports to use
ports = self.dut.get_ports()
- print ports
# Verify that enough ports are available
self.verify(len(ports) >= 2, "Insufficient ports for testing")
@@ -109,14 +111,12 @@ l3fwd_ipv4_route_array[] = {\\\n"
rtLpmTbl[idx] = pat.sub(self.portRepl, rtLpmTbl[idx])
lpmStr_ipv4 = lpmStr_ipv4 + ' ' * 4 + rtLpmTbl[idx] + ",\\\n"
lpmStr_ipv4 = lpmStr_ipv4 + "};"
- print lpmStr_ipv4
lpmStr_ipv6 = "static struct l3fwd_ipv6_route l3fwd_ipv6_route_array[] = {\\\n"
rtLpmTbl = list(lpm_table_ipv6)
for idx in range(len(rtLpmTbl)):
rtLpmTbl[idx] = pat.sub(self.portRepl, rtLpmTbl[idx])
lpmStr_ipv6 = lpmStr_ipv6 + ' ' * 4 + rtLpmTbl[idx] + ",\\\n"
lpmStr_ipv6 = lpmStr_ipv6 + "};"
- print lpmStr_ipv6
self.dut.send_expect(r"sed -i '/l3fwd_ipv4_route_array\[\].*{/,/^\}\;/c\\%s' examples/ip_fragmentation/main.c" % lpmStr_ipv4, "# ")
self.dut.send_expect(r"sed -i '/l3fwd_ipv6_route_array\[\].*{/,/^\}\;/c\\%s' examples/ip_fragmentation/main.c" % lpmStr_ipv6, "# ")
# make application
@@ -139,6 +139,16 @@ l3fwd_ipv4_route_array[] = {\\\n"
self.txItf = self.tester.get_interface(self.tester.get_local_port(P0))
self.rxItf = self.tester.get_interface(self.tester.get_local_port(P1))
self.dmac = self.dut.get_mac_address(P0)
+
+ # get dts output path
+ if self.logger.log_path.startswith(os.sep):
+ self.output_path = self.logger.log_path
+ else:
+ cur_path = os.path.dirname(
+ os.path.dirname(os.path.realpath(__file__)))
+ self.output_path = os.sep.join([cur_path, self.logger.log_path])
+ # create an instance to set stream field setting
+ self.pktgen_helper = PacketGeneratorHelper()
def functional_check_ipv4(self, pkt_sizes, burst=1, flag=None):
"""
@@ -200,9 +210,9 @@ l3fwd_ipv4_route_array[] = {\\\n"
for size in pkt_sizes[::burst]:
# simulate to set TG properties
if flag == 'frag':
- # each packet max len: 1522 - 18 (eth) - 40 (ipv6) - 8 (ipv6 ext hdr) = 1456
- expPkts = (size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) / 1456
- if (size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) % 1456:
+ # each packet max len: 1518 - 18 (eth) - 40 (ipv6) - 8 (ipv6 ext hdr) = 1452
+ expPkts = (size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) / 1452
+ if (size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) % 1452:
expPkts += 1
val = 0
else:
@@ -296,35 +306,47 @@ l3fwd_ipv4_route_array[] = {\\\n"
portmask = utils.create_mask([P0, P1])
+ self.dut.send_expect("^c", "# ", 120)
self.dut.send_expect("examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % (
core_mask, self.dut.get_memory_channels(), portmask, num_pthreads), "IP_FRAG:", 120)
result = [2, lcore, num_pthreads]
for size in size_list:
dmac = self.dut.get_mac_address(P0)
- flows = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.10.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
- 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.20.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
- 'Ether(dst="%s")/IPv6(dst="101:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58),
- 'Ether(dst="%s")/IPv6(dst="201:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)]
- self.tester.scapy_append('wrpcap("test1.pcap", [%s])' % string.join(flows, ','))
+ flows_p0 = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.10.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
+ 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.20.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
+ 'Ether(dst="%s")/IPv6(dst="101:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58),
+ 'Ether(dst="%s")/IPv6(dst="201:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)]
# reserved for rx/tx bidirection test
dmac = self.dut.get_mac_address(P1)
- flows = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.30.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
- 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.40.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
- 'Ether(dst="%s")/IPv6(dst="301:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58),
- 'Ether(dst="%s")/IPv6(dst="401:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)]
- self.tester.scapy_append('wrpcap("test2.pcap", [%s])' % string.join(flows, ','))
-
- self.tester.scapy_execute()
-
+ flows_p1 = ['Ether(dst="%s")/IP(src="1.2.3.4", dst="100.30.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
+ 'Ether(dst="%s")/IP(src="1.2.3.4", dst="100.40.0.1", flags=0)/("X"*%d)' % (dmac, size - 38),
+ 'Ether(dst="%s")/IPv6(dst="301:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58),
+ 'Ether(dst="%s")/IPv6(dst="401:101:101:101:101:101:101:101",src="ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load="X"*%d)' % (dmac, size - 58)]
+ flow_len = len(flows_p0)
tgenInput = []
- tgenInput.append((self.tester.get_local_port(P0), self.tester.get_local_port(P1), "test1.pcap"))
- tgenInput.append((self.tester.get_local_port(P1), self.tester.get_local_port(P0), "test2.pcap"))
-
+ for i in range(flow_len):
+
+ pcap0 = os.sep.join([self.output_path, "p0_{}.pcap".format(i)])
+ self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap0, flows_p0[i]))
+ pcap1 = os.sep.join([self.output_path, "p1_{}.pcap".format(i)])
+ self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap1, flows_p1[i]))
+ self.tester.scapy_execute()
+
+ tgenInput.append((self.tester.get_local_port(P0), self.tester.get_local_port(P1), pcap0))
+ tgenInput.append((self.tester.get_local_port(P1), self.tester.get_local_port(P0), pcap1))
+
factor = (size + 1517) / 1518
# wireSpd = 2 * 10000.0 / ((20 + size) * 8)
- Bps[str(size)], Pps[str(size)] = self.tester.traffic_generator_throughput(tgenInput)
+
+ # clear streams before add new streams
+ self.tester.pktgen.clear_streams()
+ # run packet generator
+ streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100,
+ None, self.tester.pktgen)
+ Bps[str(size)], Pps[str(size)] = self.tester.pktgen.measure_throughput(stream_ids=streams)
+
self.verify(Pps[str(size)] > 0, "No traffic detected")
Pps[str(size)] *= 1.0 / factor / 1000000
Pct[str(size)] = (1.0 * Bps[str(size)] * 100) / (2 * 10000000000)
--
2.17.1
next prev parent reply other threads:[~2019-04-28 2:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 10:47 [dts] [next][PATCH V1 1/7] tests/checksum_offload zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 2/7] tests/distributor zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 3/7] tests/efd zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 4/7] tests/fm10k_perf zhaomeijuan
2019-04-28 10:47 ` zhaomeijuan [this message]
2019-04-28 10:47 ` [dts] [next][PATCH V1 6/7] tests/kni zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 7/7] tests/l2fwd zhaomeijuan
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=20190428104718.9143-5-meijuanx.zhao@intel.com \
--to=meijuanx.zhao@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).