From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id BD5CD5947 for ; Thu, 21 May 2015 09:19:08 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 21 May 2015 00:19:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,467,1427785200"; d="scan'208";a="732911382" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by orsmga002.jf.intel.com with ESMTP; 21 May 2015 00:19:06 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 21 May 2015 15:16:22 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.23]) by SHSMSX101.ccr.corp.intel.com ([10.239.4.153]) with mapi id 14.03.0224.002; Thu, 21 May 2015 15:16:20 +0800 From: "Liu, Yong" To: "Xu, HuilongX" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH V1]add dynamic config test and update checksum offload testsuit for support fortville nic test Thread-Index: AQHQk5Oxnq5d8oRyakKv4u+wMAgOkJ2GBDyA Date: Thu, 21 May 2015 07:16:19 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10E31A74@SHSMSX103.ccr.corp.intel.com> References: <1432191556-11445-1-git-send-email-huilongx.xu@intel.com> In-Reply-To: <1432191556-11445-1-git-send-email-huilongx.xu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "Fu, JingguoX" Subject: Re: [dts] [PATCH V1]add dynamic config test and update checksum offload testsuit for support fortville nic test 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: , X-List-Received-Date: Thu, 21 May 2015 07:19:10 -0000 Huilong, please see my comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilongx xu > Sent: Thursday, May 21, 2015 2:59 PM > To: dts@dpdk.org > Cc: Fu, JingguoX > Subject: [dts] [PATCH V1]add dynamic config test and update checksum > offload testsuit for support fortville nic test >=20 > From: huilong xu >=20 > changed list: > 1. update checksum offload test suite for support fortville nic test > 2. add dynamic config test suite > 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 > 3. add execution_FVL.cfg file for fortville nic test > 4, add dynamic config test suite in execution.cfg >=20 > Signed-off-by: huilong xu > --- > execution.cfg | 3 +- > execution_FVL.cfg | 20 +++ > test_plans/dynamic_config_test_plan.rst | 199 +++++++++++++++++++++++ > tests/TestSuite_checksum_offload.py | 94 ++++------- > tests/TestSuite_dynamic_config.py | 262 > +++++++++++++++++++++++++++++++ > 5 files changed, 518 insertions(+), 60 deletions(-) > create mode 100644 execution_FVL.cfg > create mode 100644 test_plans/dynamic_config_test_plan.rst > create mode 100644 tests/TestSuite_dynamic_config.py >=20 > diff --git a/execution.cfg b/execution.cfg > index a67d7b3..3d38026 100644 > --- a/execution.cfg > +++ b/execution.cfg > @@ -16,7 +16,8 @@ test_suites=3D > fdir, > vlan, > ip_pipeline, > - pmd_bonded > + pmd_bonded, > + dynamic_config > targets=3D > x86_64-native-linuxapp-gcc > parameters=3Dnic_type=3Dcfg:func=3Dtrue > diff --git a/execution_FVL.cfg b/execution_FVL.cfg > new file mode 100644 > index 0000000..c57f33d > --- /dev/null > +++ b/execution_FVL.cfg > @@ -0,0 +1,20 @@ > +[Execution1] > +crbs=3D > +drivername=3D > +test_suites=3D > + checksum_offload, > + dynamic_config > +targets=3D > + x86_64-native-linuxapp-gcc > +parameters=3Dnic_type=3Dcfg:func=3Dtrue > + > +[Execution2] > +crbs=3D > +drivername=3D > +test_suites=3D > + l2fwd, > + l3fwd, > + pmd > +targets=3D > + x86_64-native-linuxapp-gcc > +parameters=3Dnic_type=3Dniantic:perf=3Dtrue > 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. > + > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > +Change driver configuration dynamically > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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=3Dvfio-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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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). > + > + > + > + > diff --git a/tests/TestSuite_checksum_offload.py > b/tests/TestSuite_checksum_offload.py > index 9c65563..a25cf45 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 >=20 > - > class TestChecksumOffload(TestCase): >=20 > 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 =3D self.dut.get_ports() > - > + self.dut_ports =3D self.dut.get_ports(self.nic) > # Verify that enough ports are available > self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports for > testing") > - > - # Verify that enough threads are available > - cores =3D self.dut.get_core_list("1S/2C/2T") > - self.verify(cores is not None, "Insufficient cores for speed > testing") > - > self.pmdout =3D PmdOutput(self.dut) > - > - self.coreMask =3D dts.create_mask(cores) > self.portMask =3D dts.create_mask([self.dut_ports[0], > self.dut_ports[1]]) > self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) >=20 > @@ -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=3D%s " % > (self.portMask) + "--disable-hw-vlan --enable-rx-cksum --crc-strip -- > txqflags=3D0") > + self.pmdout.start_testpmd("Default", "--portmask=3D%s " % > + (self.portMask) + "--disable-hw- > vlan --enable-rx-cksum --crc-strip", socket=3Dself.ports_socket) > self.dut.send_expect("set verbose 1", "testpmd>") > self.dut.send_expect("set fwd csum", "testpmd>") >=20 > @@ -169,32 +160,32 @@ 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 =3D self.dut.get_mac_address(self.dut_ports[1]) > - pktsChkErr =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/Dot1Q(vlan=3D1)/IP(chksum=3D0x0)/UDP(chksum=3D= 0x1)/("X" > *46)' % dmac, > - 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/Dot1Q(vlan=3D2)/IP(chksum=3D0x0)/TCP(chksum=3D= 0x0)/("X" > *46)' % dmac, > - 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/Dot1Q(vlan=3D3)/IP(chksum=3D0x0)/SCTP(chksum= =3D0x0)/("X > "*48)' % dmac, > - 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/Dot1Q(vlan=3D4)/IPv6(src=3D"::1")/UDP(chksum= =3D0x1)/("X > "*46)' % dmac, > - 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/Dot1Q(vlan=3D5)/IPv6(src=3D"::1")/TCP(chksum= =3D0x0)/("X > "*46)' % dmac} > - > + if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single"]: > + pktsChkErr =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/UDP(chksum=3D0x0a)/("X"*46)' = % dmac, > + 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/TCP(chksum=3D0x0a)/("X"*46)' = % dmac, > + 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/SCTP(chksum=3D0x0a)/("X"*48)'= % dmac, > + 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/UDP(chksum=3D0x0a)/("X"*46)'= % dmac, > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/TCP(chksum=3D0x0a)/("X"*46)'= % dmac} > + else: > + pktsChkErr =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/UDP(chksum=3D0x1)/("X"*46)' %= dmac, > + 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/TCP(chksum=3D0x0)/("X"*46)' %= dmac, > + 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/SCTP(chksum=3D0x0)/("X"*48)' = % dmac, > + 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/UDP(chksum=3D0x1)/("X"*46)' = % dmac, > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/TCP(chksum=3D0x0)/("X"*46)' = % dmac} Huilong, can you use same invalid checksum value like "0xffff" for all type= s of packets. It can make the function more clearly. > pkts =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/UDP()/("X"*46)' % dmac, > 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/TCP()/("X"*46)' % dmac, > 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/SCTP()/("X"*48)' % dmac, > 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::2")/UDP()/("X"*46)' % dmac, > 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::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 =3D self.checksum_validate(pktsChkErr, pkts) > - > self.dut.send_expect("stop", "testpmd>") > - > self.verify(len(result) =3D=3D 0, string.join(result.values(), "= ,")) > - > + > def test_checksum_offload_enable(self): > """ > Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit packet. > @@ -202,22 +193,19 @@ class TestChecksumOffload(TestCase): > Verify that the same number of packet are correctly received on > the > traffic generator side. > """ > - > dmac =3D self.dut.get_mac_address(self.dut_ports[1]) >=20 > pkts =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/UDP(chksum=3D0x1)/("X"*46)' %= dmac, > 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/TCP(chksum=3D0x0)/("X"*46)' %= dmac, > 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(chksum=3D0x0)/SCTP(chksum=3D0x0)/("X"*48)' = % dmac, > 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/UDP(chksum=3D0x1)/("X"*46)' = % dmac, > - 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/TCP(chksum=3D0x0)/("X"*46)' = % dmac > - } > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::1")/TCP(chksum=3D0x0)/("X"*46)' = % dmac} >=20 Same comment as above. > pkts_ref =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/UDP()/("X"*46)' % dmac, > 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/TCP()/("X"*46)' % dmac, > 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"127.0.0.2")/SCTP()/("X"*48)' % dmac, > 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::2")/UDP()/("X"*46)' % dmac, > - 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::2")/TCP()/("X"*46)' % dmac > - } > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6(src=3D"::2")/TCP()/("X"*46)' % dmac} >=20 > self.checksum_enablehw(self.dut_ports[0]) > self.checksum_enablehw(self.dut_ports[1]) > @@ -237,9 +225,7 @@ class TestChecksumOffload(TestCase): > Verify that the same number of packet are correctly received on > the traffic generator side. > """ > - > dmac =3D self.dut.get_mac_address(self.dut_ports[1]) > - > sndIP =3D '10.0.0.1' > sndIPv6 =3D '::1' > sndPkts =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP(src=3D"%s",chksum=3D0x0)/UDP(chksum=3D0x1)/= ("X"*46)' > % (dmac, sndIP), > @@ -265,7 +251,6 @@ class TestChecksumOffload(TestCase): > """ > Test ans report checksum offload performance for given parameter= s. > """ > - > Bps =3D dict() > Pps =3D dict() > Pct =3D dict() > @@ -273,20 +258,20 @@ class TestChecksumOffload(TestCase): >=20 > result =3D [2, lcore, ptype, mode] > for size in size_list: > - > flow =3D flow_format % (dmac, size) > self.tester.scapy_append('wrpcap("test.pcap", [%s])' % flow) > - > self.tester.scapy_execute() > - > tgenInput =3D [] > - > 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)] =3D > 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)] =3D > self.tester.traffic_generator_throughput(tgenInput) > self.verify(Pps[str(size)] > 0, "No traffic detected") > Pps[str(size)] /=3D 1E6 > - Pct[str(size)] =3D (Pps[str(size)] * 100) / > self.wirespeed(self.nic, size, 2) > + Pct[str(size)] =3D (Pps[str(size)] * 100) / \ > + self.wirespeed(self.nic, size, 2) >=20 > result.append(Pps[str(size)]) > result.append(Pct[str(size)]) > @@ -297,23 +282,16 @@ class TestChecksumOffload(TestCase): > """ > Test checksum offload performance. > """ > - self.dut_ports =3D self.dut.get_ports_performance() > - # Verify that enough ports are available > - self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports for > testing") > - > # sizes =3D [64, 128, 256, 512, 1024] > sizes =3D [64, 128] > - pkts =3D { > - 'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))', > - 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))', > - 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))', > - 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 > else 0)(%d))', > - 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 > else 0)(%d))' > - } > + pkts =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))', > + 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/TCP()/("X"*(%d-58))', > + 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IP()/SCTP()/("X"*(%d-50+2))', > + 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 > else 0)(%d))', > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 > else 0)(%d))'} >=20 > lcore =3D "1S/2C/1T" > portMask =3D 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 +299,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=3D%s" % > self.portMask, socket=3Dself.ports_socket) > + self.pmdout.start_testpmd( > + lcore, "--portmask=3D%s" % self.portMask, > socket=3Dself.ports_socket) >=20 > self.dut.send_expect("set verbose 1", "testpmd> ") > self.dut.send_expect("set fwd csum", "testpmd> ") > - > if mode =3D=3D "hw": > self.checksum_enablehw(self.dut_ports[0]) > self.checksum_enablehw(self.dut_ports[1]) > @@ -337,9 +313,9 @@ class TestChecksumOffload(TestCase): > self.checksum_enablesw(self.dut_ports[1]) >=20 > 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) >=20 > self.dut.send_expect("stop", "testpmd> ") > self.dut.send_expect("quit", "#", 10) > 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 =3D 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) >=3D 2, "Insufficient ports"= ) > + else: > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports"= ) > + > + # Prepare cores and ports > + cores =3D self.dut.get_core_list('1S/2C/2T') > + coreMask =3D dts.create_mask(cores) > + if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single"]: > + portMask =3D dts.create_mask(self.dut_ports[:2]) > + else: > + portMask =3D dts.create_mask([self.dut_ports[0]]) > + > + # launch app > + cmd =3D "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt= =3D0 > \ > + --rxht=3D0 --rxwt=3D0 --txpt=3D39 --txht=3D0 --txwt=3D0 --portma= sk=3D%s" % > (self.target, coreMask, portMask) > + > + self.dut.send_expect("%s" % cmd, "testpmd> ", 120) > + > + # get dest address from self.target port > + out =3D self.dut.send_expect( > + "show port info %d" % self.dut_ports[0], "testpmd> ") > + > + self.dest =3D self.dut.get_mac_address(self.dut_ports[0]) > + mac_scanner =3D r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})" > + > + ret =3D dts.regexp(out, mac_scanner) > + > + self.verify(ret is not None, "MAC address not found") > + self.verify(cmp(ret.lower(), self.dest) =3D=3D 0, "MAC address w= rong") > + 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=3D"00:11:22:33:44:55"): > + """ > + Send 1 packet to portid > + """ > + > + itf =3D > self.tester.get_interface(self.tester.get_local_port(portid)) > + > + self.tester.scapy_foreground() > + self.tester.scapy_append( > + 'sendp([Ether(dst=3D"%s", src=3D"52:00:00:00:00:00")], > iface=3D"%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 =3D self.dut_ports[0] > + > + # get the current rx statistic > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D int(pre_rxpkt) > + + 1, "2nd packet increasement check error") > + > + def test_dynamic_config_disable_promiscuous(self): > + """ > + Dynamic config disable promiscuous test > + """ > + > + portid =3D 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 =3D self.dut.send_expect( > + "show port stats %d" % self.dut_ports[1], "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "TX-packets: ([0-9]+)") > + > + self.dynamic_config_send_packet(portid) > + pre_rxpkt =3D cur_rxpkt > + out =3D self.dut.send_expect( > + "show port stats %d" % self.dut_ports[1], "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "TX-packets: ([0-9]+)") > + self.verify(int(cur_rxpkt) =3D=3D int( > + pre_rxpkt), "1st packet increasment error") > + self.dynamic_config_send_packet(portid, self.dest) > + pre_rxpkt =3D cur_rxpkt > + out =3D self.dut.send_expect( > + "show port stats %d" % self.dut_ports[1], "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "TX-packets: ([0-9]+)") > + self.verify(int(cur_rxpkt) =3D=3D 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 =3D self.dut.send_expect( > + "show port stats %d" % portid, "testpmd> ") > + cur_rxpkt =3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect( > + "show port stats %d" % portid, "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect( > + "show port stats %d" % portid, "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D int( > + pre_rxpkt) + 1, "2nd packet increasment error") > + > + def test_dynamic_config_enable_promiscuous(self): > + """ > + Dynamic config enable promiscuous test > + """ > + > + portid =3D self.dut_ports[0] > + > + self.dut.send_expect("set promisc %d on" % portid, "testpmd> ") > + > + # get the current rx statistic > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D 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 =3D cur_rxpkt > + out =3D self.dut.send_expect("show port stats %d" % portid, > "testpmd> ") > + cur_rxpkt =3D dts.regexp(out, "RX-packets: ([0-9]+)") > + > + # check the pakcet increasment > + self.verify(int(cur_rxpkt) =3D=3D 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