* [dts] [dts 2/5] [v2] add dynamic config test plan
2015-05-21 8:30 [dts] [dts 0/5] [v2] add dynamic config test and update checksum offload test code huilongx xu
2015-05-21 8:30 ` [dts] [dts 1/5] [v2] add dynamic config test in default test huilongx xu
@ 2015-05-21 8:30 ` huilongx xu
2015-05-21 8:30 ` [dts] [dts 3/5] [v2] add dynamic config test script huilongx xu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: huilongx xu @ 2015-05-21 8:30 UTC (permalink / raw)
To: dts; +Cc: jingguox.fu
From: huilong xu <huilongx.xu@intel.com>
add dynamic config test plan
this test suite include three cases.
a)nic start by testpmd app used PMD driver with default mode,it can forward package
b)nic start by testpmd app used PMD driver with default mode, then set promiscuous off,
it can't forward package,if the package dst mac isn't received port mac.
c)nic start by testpmd app used PMD driver with default mod, then set promiscuous on,
it can forward package, although the package dst mac isn't received port mac
Signed-off-by: huilong xu <huilongx.xu@intel.com>
---
test_plans/dynamic_config_test_plan.rst | 199 +++++++++++++++++++++++++++++++
1 files changed, 199 insertions(+), 0 deletions(-)
create mode 100644 test_plans/dynamic_config_test_plan.rst
diff --git a/test_plans/dynamic_config_test_plan.rst b/test_plans/dynamic_config_test_plan.rst
new file mode 100644
index 0000000..f1dbd1b
--- /dev/null
+++ b/test_plans/dynamic_config_test_plan.rst
@@ -0,0 +1,199 @@
+.. Copyright (c) <2010, 2011>, Intel Corporation
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=======================================
+Change driver configuration dynamically
+=======================================
+
+The purpose of this test is to check that it is possible to change the
+configuration of a port dynamically. The following command can be used
+to change the promiscuous mode of a specific port::
+
+ set promisc PORTID on|off
+
+A traffic generator sends traffic with a different destination mac
+address than the one that is configured on the port. Once the
+``testpmd`` application is started, it is possible to display the
+statistics of a port using::
+
+ show port stats PORTID
+
+When promiscuous mode is disabled, packet must not be received. When
+it is enabled, packets must be received. The change occurs without
+stopping the device or restarting the application.
+
+
+Prerequisites
+=============
+
+Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
+When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
+"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
+
+Connect the traffic generator to one of the ports (8 in this example).
+The size of the packets is not important, in this example it was 64.
+
+Start the testpmd application.
+
+Use the 'show port' command to see the MAC address and promiscuous mode for port 8.
+The default value for promosuous mode should be enabled::
+
+ testpmd> show port info 8
+
+ ********************* Infos for port 8 *********************
+ MAC address: 00:1B:21:6D:A3:6E
+ Link status: up
+ Link speed: 1000 Mbps
+ Link duplex: full-duplex
+ Promiscuous mode: enabled
+ Allmulticast mode: disabled
+
+
+Test Case: Default Mode
+=======================
+
+The promiscuous mode should be enabled by default.
+In promiscuous mode all packets should be received.
+
+Read the stats for port 8 before sending packets.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 1 RX-errors: 0 RX-bytes: 64
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Send a packet with destination MAC address different than the port 8 address.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 2 RX-errors: 0 RX-bytes: 128
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+Send a packet with with destination MAC address equal with the port 8 address.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 3 RX-errors: 0 RX-bytes: 192
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+
+
+Test Case: Disable Promiscuous Mode
+===================================
+
+Disable promiscuous mode and verify that the packets are received only for the
+packet with destination address matching the port 8 address.::
+
+ testpmd> set promisc 8 off
+
+Send a packet with destination MAC address different than the port 8 address.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 3 RX-errors: 0 RX-bytes: 192
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that no packet was received (RX-packets is the same).
+
+Send a packet with destination MAC address equal to the port 8 address.::
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 4 RX-errors: 0 RX-bytes: 256
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+
+
+
+Test Case: Enable Promiscuous Mode
+==================================
+
+Verify that promiscous mode is still disabled:::
+
+ testpmd> show port info 8
+
+ ********************* Infos for port 8 *********************
+ MAC address: 00:1B:21:6D:A3:6E
+ Link status: up
+ Link speed: 1000 Mbps
+ Link duplex: full-duplex
+ Promiscuous mode: disabled
+ Allmulticast mode: disabled
+
+Enable promiscuous mode and verify that the packets are received for any
+destination MAC address.::
+
+ testpmd> set promisc 8 on
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 4 RX-errors: 0 RX-bytes: 256
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+ testpmd> show port stats 8
+
+Send a packet with destination MAC address different than the port 8 address.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 5 RX-errors: 0 RX-bytes: 320
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+
+Send a packet with with destination MAC address equal with the port 8 address.::
+
+ testpmd> show port stats 8
+
+ ######################## NIC statistics for port 8 ########################
+ RX-packets: 6 RX-errors: 0 RX-bytes: 384
+ TX-packets: 0 TX-errors: 0 TX-bytes: 0
+ ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+
+
+
+
--
1.7.4.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [dts 3/5] [v2] add dynamic config test script
2015-05-21 8:30 [dts] [dts 0/5] [v2] add dynamic config test and update checksum offload test code huilongx xu
2015-05-21 8:30 ` [dts] [dts 1/5] [v2] add dynamic config test in default test huilongx xu
2015-05-21 8:30 ` [dts] [dts 2/5] [v2] add dynamic config test plan huilongx xu
@ 2015-05-21 8:30 ` huilongx xu
2015-05-21 8:30 ` [dts] [dts 4/5] [v2] update checksum offload test code huilongx xu
2015-05-21 8:30 ` [dts] [dts 5/5] [v2] add fortville nic test config huilongx xu
4 siblings, 0 replies; 6+ messages in thread
From: huilongx xu @ 2015-05-21 8:30 UTC (permalink / raw)
To: dts; +Cc: jingguox.fu
From: huilong xu <huilongx.xu@intel.com>
Signed-off-by: huilong xu <huilongx.xu@intel.com>
---
tests/TestSuite_dynamic_config.py | 262 +++++++++++++++++++++++++++++++++++++
1 files changed, 262 insertions(+), 0 deletions(-)
create mode 100644 tests/TestSuite_dynamic_config.py
diff --git a/tests/TestSuite_dynamic_config.py b/tests/TestSuite_dynamic_config.py
new file mode 100644
index 0000000..d1ad49c
--- /dev/null
+++ b/tests/TestSuite_dynamic_config.py
@@ -0,0 +1,262 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+
+Test the dynamic driver configuration feature.
+
+"""
+
+import dts
+
+from test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestDynamicConfig(TestCase):
+
+ #
+ #
+ #
+ # Test cases.
+ #
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+
+
+ Dynamic config Prerequistites
+ """
+
+ # Based on h/w type, choose how many ports to use
+ self.dut_ports = self.dut.get_ports(self.nic)
+ print self.dut_ports
+
+ # Verify that enough ports are available
+ if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
+ self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
+ else:
+ self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+
+ # Prepare cores and ports
+ cores = self.dut.get_core_list('1S/2C/2T')
+ coreMask = dts.create_mask(cores)
+ if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
+ portMask = dts.create_mask(self.dut_ports[:2])
+ else:
+ portMask = dts.create_mask([self.dut_ports[0]])
+
+ # launch app
+ cmd = "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt=0 \
+ --rxht=0 --rxwt=0 --txpt=39 --txht=0 --txwt=0 --portmask=%s" % (self.target, coreMask, portMask)
+
+ self.dut.send_expect("%s" % cmd, "testpmd> ", 120)
+
+ # get dest address from self.target port
+ out = self.dut.send_expect(
+ "show port info %d" % self.dut_ports[0], "testpmd> ")
+
+ self.dest = self.dut.get_mac_address(self.dut_ports[0])
+ mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
+
+ ret = dts.regexp(out, mac_scanner)
+
+ self.verify(ret is not None, "MAC address not found")
+ self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
+ self.verify("Promiscuous mode: enabled" in out,
+ "wrong default promiscuous value")
+ if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
+ self.dut.send_expect("start", "testpmd> ", 120)
+
+ def dynamic_config_send_packet(self, portid, destMac="00:11:22:33:44:55"):
+ """
+ Send 1 packet to portid
+ """
+
+ itf = self.tester.get_interface(self.tester.get_local_port(portid))
+
+ self.tester.scapy_foreground()
+ self.tester.scapy_append(
+ 'sendp([Ether(dst="%s", src="52:00:00:00:00:00")], iface="%s")' % (destMac, itf))
+
+ self.tester.scapy_execute()
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def test_dynamic_config_default_mode(self):
+ """
+ Dynamic config default mode test
+ """
+
+ portid = self.dut_ports[0]
+
+ # get the current rx statistic
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # send one packet with different MAC address than the portid
+ self.dynamic_config_send_packet(portid)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(pre_rxpkt)
+ + 1, "1st packet increasement check error")
+
+ # send one packet with the portid MAC address
+ self.dynamic_config_send_packet(portid, self.dest)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(pre_rxpkt)
+ + 1, "2nd packet increasement check error")
+
+ def test_dynamic_config_disable_promiscuous(self):
+ """
+ Dynamic config disable promiscuous test
+ """
+
+ portid = self.dut_ports[0]
+ if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
+ self.dut.send_expect("set promisc all off", "testpmd> ")
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+ self.dynamic_config_send_packet(portid)
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt), "1st packet increasment error")
+ self.dynamic_config_send_packet(portid, self.dest)
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt) + 1, "2nd packet increasment error")
+ else:
+ self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
+
+ # get the current rx statistic
+ out = self.dut.send_expect(
+ "show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # send one packet with different MAC address than the portid
+ self.dynamic_config_send_packet(portid)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt), "1st packet increasment error")
+
+ # send one packet with the portid MAC address
+ self.dynamic_config_send_packet(portid, self.dest)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt) + 1, "2nd packet increasment error")
+
+ def test_dynamic_config_enable_promiscuous(self):
+ """
+ Dynamic config enable promiscuous test
+ """
+
+ portid = self.dut_ports[0]
+
+ self.dut.send_expect("set promisc %d on" % portid, "testpmd> ")
+
+ # get the current rx statistic
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # send one packet with different MAC address than the portid
+ self.dynamic_config_send_packet(portid)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(pre_rxpkt)
+ + 1, "1st packet increasment error")
+
+ # send one packet with the portid MAC address
+ self.dynamic_config_send_packet(portid, self.dest)
+
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+
+ # check the pakcet increasment
+ self.verify(int(cur_rxpkt) == int(pre_rxpkt)
+ + 1, "2nd packet increasment error")
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ pass
--
1.7.4.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [dts 4/5] [v2] update checksum offload test code
2015-05-21 8:30 [dts] [dts 0/5] [v2] add dynamic config test and update checksum offload test code huilongx xu
` (2 preceding siblings ...)
2015-05-21 8:30 ` [dts] [dts 3/5] [v2] add dynamic config test script huilongx xu
@ 2015-05-21 8:30 ` huilongx xu
2015-05-21 8:30 ` [dts] [dts 5/5] [v2] add fortville nic test config huilongx xu
4 siblings, 0 replies; 6+ messages in thread
From: huilongx xu @ 2015-05-21 8:30 UTC (permalink / raw)
To: dts; +Cc: jingguox.fu
From: huilong xu <huilongx.xu@intel.com>
1.used default cores to start testpmd
2.update error checksum value
Signed-off-by: huilong xu <huilongx.xu@intel.com>
---
tests/TestSuite_checksum_offload.py | 103 ++++++++++++-----------------------
1 files changed, 36 insertions(+), 67 deletions(-)
diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 9c65563..abfebb6 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -44,28 +44,18 @@ import rst
from test_case import TestCase
from pmd_output import PmdOutput
-
class TestChecksumOffload(TestCase):
def set_up_all(self):
"""
Run at the start of each test suite.
-
Checksum offload prerequisites.
"""
# Based on h/w type, choose how many ports to use
- self.dut_ports = self.dut.get_ports()
-
+ self.dut_ports = self.dut.get_ports(self.nic)
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
-
- # Verify that enough threads are available
- cores = self.dut.get_core_list("1S/2C/2T")
- self.verify(cores is not None, "Insufficient cores for speed testing")
-
self.pmdout = PmdOutput(self.dut)
-
- self.coreMask = dts.create_mask(cores)
self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
@@ -74,7 +64,8 @@ class TestChecksumOffload(TestCase):
Run before each test case.
"""
if self.dut.want_func_tests:
- self.pmdout.start_testpmd("1S/2C/2T", "--portmask=%s " % (self.portMask) + "--disable-hw-vlan --enable-rx-cksum --crc-strip --txqflags=0")
+ self.pmdout.start_testpmd("Default", "--portmask=%s " %
+ (self.portMask) + "--disable-hw-vlan --enable-rx-cksum --crc-strip", socket=self.ports_socket)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd csum", "testpmd>")
@@ -169,32 +160,25 @@ class TestChecksumOffload(TestCase):
Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit packet.
Verify that the same number of packet are correctly received on the
traffic generator side.
- Use VLAN label.
"""
dmac = self.dut.get_mac_address(self.dut_ports[1])
- pktsChkErr = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/UDP(chksum=0x1)/("X"*46)' % dmac,
- 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=2)/IP(chksum=0x0)/TCP(chksum=0x0)/("X"*46)' % dmac,
- 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=3)/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48)' % dmac,
- 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=4)/IPv6(src="::1")/UDP(chksum=0x1)/("X"*46)' % dmac,
- 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=5)/IPv6(src="::1")/TCP(chksum=0x0)/("X"*46)' % dmac}
-
+ pktsChkErr = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % dmac,
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % dmac,
+ 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % dmac,
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % dmac,
+ 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % dmac}
pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/UDP()/("X"*46)' % dmac,
'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/TCP()/("X"*46)' % dmac,
'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % dmac,
'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::2")/UDP()/("X"*46)' % dmac,
'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::2")/TCP()/("X"*46)' % dmac}
-
self.checksum_enablehw(self.dut_ports[0])
self.checksum_enablehw(self.dut_ports[1])
-
self.dut.send_expect("start", "testpmd>")
-
result = self.checksum_validate(pktsChkErr, pkts)
-
self.dut.send_expect("stop", "testpmd>")
-
self.verify(len(result) == 0, string.join(result.values(), ","))
-
+
def test_checksum_offload_enable(self):
"""
Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit packet.
@@ -202,22 +186,19 @@ class TestChecksumOffload(TestCase):
Verify that the same number of packet are correctly received on the
traffic generator side.
"""
-
dmac = self.dut.get_mac_address(self.dut_ports[1])
- pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0x1)/("X"*46)' % dmac,
- 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0x0)/("X"*46)' % dmac,
- 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48)' % dmac,
- 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0x1)/("X"*46)' % dmac,
- 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0x0)/("X"*46)' % dmac
- }
+ pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % dmac,
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % dmac,
+ 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % dmac,
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % dmac,
+ 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % dmac}
pkts_ref = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/UDP()/("X"*46)' % dmac,
'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/TCP()/("X"*46)' % dmac,
'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % dmac,
'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::2")/UDP()/("X"*46)' % dmac,
- 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::2")/TCP()/("X"*46)' % dmac
- }
+ 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::2")/TCP()/("X"*46)' % dmac}
self.checksum_enablehw(self.dut_ports[0])
self.checksum_enablehw(self.dut_ports[1])
@@ -237,15 +218,13 @@ class TestChecksumOffload(TestCase):
Verify that the same number of packet are correctly received on
the traffic generator side.
"""
-
dmac = self.dut.get_mac_address(self.dut_ports[1])
-
sndIP = '10.0.0.1'
sndIPv6 = '::1'
- sndPkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0x1)/("X"*46)' % (dmac, sndIP),
- 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/TCP(chksum=0x0)/("X"*46)' % (dmac, sndIP),
- 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0x1)/("X"*46)' % (dmac, sndIPv6),
- 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0x0)/("X"*46)' % (dmac, sndIPv6)}
+ sndPkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % (dmac, sndIP),
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % (dmac, sndIP),
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' % (dmac, sndIPv6),
+ 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' % (dmac, sndIPv6)}
expIP = "10.0.0.2"
expIPv6 = '::2'
@@ -265,7 +244,6 @@ class TestChecksumOffload(TestCase):
"""
Test ans report checksum offload performance for given parameters.
"""
-
Bps = dict()
Pps = dict()
Pct = dict()
@@ -273,20 +251,20 @@ class TestChecksumOffload(TestCase):
result = [2, lcore, ptype, mode]
for size in size_list:
-
flow = flow_format % (dmac, size)
self.tester.scapy_append('wrpcap("test.pcap", [%s])' % flow)
-
self.tester.scapy_execute()
-
tgenInput = []
- tgenInput.append((self.tester.get_local_port(self.dut_ports[0]), self.tester.get_local_port(self.dut_ports[1]), "test.pcap"))
- tgenInput.append((self.tester.get_local_port(self.dut_ports[1]), self.tester.get_local_port(self.dut_ports[0]), "test.pcap"))
-
- Bps[str(size)], Pps[str(size)] = self.tester.traffic_generator_throughput(tgenInput)
+ tgenInput.append(
+ (self.tester.get_local_port(self.dut_ports[0]), self.tester.get_local_port(self.dut_ports[1]), "test.pcap"))
+ tgenInput.append(
+ (self.tester.get_local_port(self.dut_ports[1]), self.tester.get_local_port(self.dut_ports[0]), "test.pcap"))
+ Bps[str(size)], Pps[
+ str(size)] = self.tester.traffic_generator_throughput(tgenInput)
self.verify(Pps[str(size)] > 0, "No traffic detected")
Pps[str(size)] /= 1E6
- Pct[str(size)] = (Pps[str(size)] * 100) / self.wirespeed(self.nic, size, 2)
+ Pct[str(size)] = (Pps[str(size)] * 100) / \
+ self.wirespeed(self.nic, size, 2)
result.append(Pps[str(size)])
result.append(Pct[str(size)])
@@ -297,23 +275,16 @@ class TestChecksumOffload(TestCase):
"""
Test checksum offload performance.
"""
- self.dut_ports = self.dut.get_ports_performance()
- # Verify that enough ports are available
- self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
-
# sizes = [64, 128, 256, 512, 1024]
sizes = [64, 128]
- pkts = {
- 'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))',
- 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))',
- 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))',
- 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 else 0)(%d))',
- 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 else 0)(%d))'
- }
+ pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))',
+ 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))',
+ 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))',
+ 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 else 0)(%d))',
+ 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 else 0)(%d))'}
lcore = "1S/2C/1T"
portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
-
for mode in ["sw", "hw"]:
self.logger.info("%s performance" % mode)
rst.write_text(mode + " Performance" + '\r\n')
@@ -321,14 +292,12 @@ class TestChecksumOffload(TestCase):
for size in sizes:
tblheader.append("%sB mpps" % str(size))
tblheader.append("%sB %% " % str(size))
-
dts.results_table_add_header(tblheader)
-
- self.pmdout.start_testpmd(lcore, "--portmask=%s" % self.portMask, socket=self.ports_socket)
+ self.pmdout.start_testpmd(
+ lcore, "--portmask=%s" % self.portMask, socket=self.ports_socket)
self.dut.send_expect("set verbose 1", "testpmd> ")
self.dut.send_expect("set fwd csum", "testpmd> ")
-
if mode == "hw":
self.checksum_enablehw(self.dut_ports[0])
self.checksum_enablehw(self.dut_ports[1])
@@ -337,9 +306,9 @@ class TestChecksumOffload(TestCase):
self.checksum_enablesw(self.dut_ports[1])
self.dut.send_expect("start", "testpmd> ", 3)
-
for ptype in pkts.keys():
- self.benchmark(lcore, ptype, mode, pkts[ptype], sizes, self.nic)
+ self.benchmark(
+ lcore, ptype, mode, pkts[ptype], sizes, self.nic)
self.dut.send_expect("stop", "testpmd> ")
self.dut.send_expect("quit", "#", 10)
--
1.7.4.4
^ permalink raw reply [flat|nested] 6+ messages in thread