[dts] [PATCH V1]add dynamic config test and update checksum offload testsuit for support fortville nic test

Liu, Yong yong.liu at intel.com
Thu May 21 09:16:19 CEST 2015


Huilong, please see my comments below.

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of huilongx xu
> Sent: Thursday, May 21, 2015 2:59 PM
> To: dts at dpdk.org
> Cc: Fu, JingguoX
> Subject: [dts] [PATCH V1]add dynamic config test and update checksum
> offload testsuit for support fortville nic test
> 
> From: huilong xu <huilongx.xu at intel.com>
> 
> 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
> 
> Signed-off-by: huilong xu <huilongx.xu at intel.com>
> ---
>  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
> 
> diff --git a/execution.cfg b/execution.cfg
> index a67d7b3..3d38026 100644
> --- a/execution.cfg
> +++ b/execution.cfg
> @@ -16,7 +16,8 @@ test_suites=
>      fdir,
>      vlan,
>      ip_pipeline,
> -    pmd_bonded
> +    pmd_bonded,
> +    dynamic_config
>  targets=
>      x86_64-native-linuxapp-gcc
>  parameters=nic_type=cfg:func=true
> 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=<CRB IP Address>
> +drivername=<driver name igb_uio or vfio-pci>
> +test_suites=
> +    checksum_offload,
> +    dynamic_config
> +targets=
> +    x86_64-native-linuxapp-gcc
> +parameters=nic_type=cfg:func=true
> +
> +[Execution2]
> +crbs=<Performance CRB IP Address>
> +drivername=<driver name igb_uio or vfio-pci>
> +test_suites=
> +    l2fwd,
> +    l3fwd,
> +    pmd
> +targets=
> +    x86_64-native-linuxapp-gcc
> +parameters=nic_type=niantic:perf=true
> 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).
> +
> +
> +
> +
> 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
> 
> -
>  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,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 = 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}
> -
> +        if self.nic in ["fortville_eagle", "fortville_spirit",
> "fortville_spirit_single"]:
> +            pktsChkErr = {'IP/UDP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0x0a)/("X"*46)' % dmac,
> +                          'IP/TCP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0x0a)/("X"*46)' % dmac,
> +                          'IP/SCTP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0x0a)/("X"*48)' % dmac,
> +                          'IPv6/UDP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0x0a)/("X"*46)' % dmac,
> +                          'IPv6/TCP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0x0a)/("X"*46)' % dmac}
> +        else:
> +            pktsChkErr = {'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}

Huilong, can you use same invalid checksum value like "0xffff" for all types of packets.
It can make the function more clearly.

>          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 +193,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
> -                }
> +                'IPv6/TCP': 'Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0x0)/("X"*46)' % dmac}
> 

Same comment as above.

>          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,9 +225,7 @@ 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),
> @@ -265,7 +251,6 @@ class TestChecksumOffload(TestCase):
>          """
>          Test ans report checksum offload performance for given parameters.
>          """
> -
>          Bps = dict()
>          Pps = dict()
>          Pct = dict()
> @@ -273,20 +258,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 +282,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 +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=%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 +313,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)
> 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



More information about the dts mailing list