From patchwork Fri Dec 3 10:13:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Xia X-Patchwork-Id: 104842 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1A4AA0548; Fri, 3 Dec 2021 03:13:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFB824014F; Fri, 3 Dec 2021 03:13:11 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 8C8FE40041 for ; Fri, 3 Dec 2021 03:13:09 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="235629866" X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="235629866" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:07 -0800 X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="610219997" Received: from unknown (HELO dpdk.lan) ([10.240.183.77]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:04 -0800 From: Yan Xia To: dts@dpdk.org Cc: Yan Xia Subject: [dts][PATCH V1 1/3] test_plans/fdir_test_plan: delete fdir Date: Fri, 3 Dec 2021 10:13:09 +0000 Message-Id: <20211203101311.148370-1-yanx.xia@intel.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org delete fdir dpdk commit-id: 1be514fbc ethdev: remove legacy FDIR filter type support Signed-off-by: Yan Xia --- test_plans/fdir_test_plan.rst | 986 ---------------------------------- 1 file changed, 986 deletions(-) delete mode 100644 test_plans/fdir_test_plan.rst diff --git a/test_plans/fdir_test_plan.rst b/test_plans/fdir_test_plan.rst deleted file mode 100644 index 72ac3207..00000000 --- a/test_plans/fdir_test_plan.rst +++ /dev/null @@ -1,986 +0,0 @@ -.. Copyright (c) <2010-2017>, 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. - - -=========================== -Niantic Flow Director Tests -=========================== - - -Description -=========== - -This document provides the plan for testing the Flow Director (FDir) feature of -the Intel 82599 10GbE Ethernet Controller. FDir allows an application to add -filters that identify specific flows (or sets of flows), by examining the VLAN -header, IP addresses, port numbers, protocol type (IPv4/IPv6, UDP/TCP, SCTP), or -a two-byte tuple within the first 64 bytes of the packet. - -There are two types of filters: - -1. Perfect match filters, where there must be a match between the fields of - received packets and the programmed filters. -2. Signature filters, where there must be a match between a hash-based signature - if the fields in the received packet. - -There is also support for global masks that affect all filters by masking out -some fields, or parts of fields from the matching process. - -Within DPDK, the FDir feature can be configured through the API in the -lib_ethdev library, and this API is used by the ``testpmd`` application. - -Note that RSS features can not be enabled at the same time as FDir. - - -Prerequisites -============= - -If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When -using vfio, use the following commands to load the vfio driver and bind it -to the device under test:: - - modprobe vfio - modprobe vfio-pci - usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id - -The DUT has a dual port Intel 82599 10GbE Ethernet Controller, with one of these -ports connected to a port on another device that is controlled by the Scapy -packet generator. - -The Ethernet interface identifier of the port that Scapy will use must be known. -In all tests below, it is referred to as "eth9". - -The following packets should be created in Scapy. Any reasonable MAC address can -be given but other fields must be as shown:: - - p_udp=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/IP(src="192.168.0.1", - dst="192.168.0.2")/UDP(sport=1024,dport=1024) - p_udp1=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/IP(src="192.168.1.1", - dst="192.168.1.2")/UDP(sport=0,dport=0) - p_tcp=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/IP(src="192.168.0.1", - dst="192.168.0.2")/TCP(sport=1024,dport=1024) - p_ip=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/IP(src="192.168.0.1", - dst="192.168.0.2") - p_ipv6_udp=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IPv6(src="2001:0db8:85a3:0000:0000:8a2e:0370:7000", - dst="2001:0db8:85a3:0000:0000:8a2e:0370:7338")/UDP(sport=1024,dport=1024) - p_udp_1=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="192.168.0.1", dst="192.168.0.1")/UDP(sport=1024,dport=1024) - p_udp_2=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C") - /IP(src="192.168.0.15", dst="192.168.0.15")/UDP(sport=1024,dport=1024) - p_udp_3=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="192.168.0.1", dst="192.168.1.1")/UDP(sport=1024,dport=1024) - p_udp_4=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4400,dport=0x4500) - p_udp_5=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4411,dport=0x4517) - p_udp_6=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="10.11.12.1", dst="10.11.12.2")/UDP(sport=0x4500,dport=0x5500) - p_gre1=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0x1)/IP()/UDP() - p_gre2=Ether(src=get_if_hwaddr("eth9"), dst="00:1B:21:91:3D:2C")/ - IP(src="192.168.0.1", dst="192.168.0.2")/GRE(proto=0xff)/IP()/UDP() - -The test commands below assume that port 0 on the DUT is the port that is -connected to the traffic generator. All fdir cmdline please see doc on http://www.dpdk.org/doc/guides/testpmd_app_ug/testpmd_funcs.html#filter-functions. If this is not the case, the following -``testpmd`` commands must be changed, and also the ``--portmask`` parameter. - -* ``show port fdir `` -* ``add_perfect_filter `` -* ``add_signature_filter `` -* ``set_masks_filter `` -* ``rx_vlan add all `` - -Most of the tests below involve sending single packets from the generator and -checking if the packets match the configured filter, and go to a set queue. To -see this, there must be multiple queues, setup by passing the following command- -line arguments: ``--nb-cores=2 --rxq=2 --txq=2``. And at run-time, the -forwarding mode must be set to rxonly, and the verbosity level > 0:: - - testpmd> set verbose 1 - testpmd> set fwd rxonly - - -Test case: Setting memory reserved for FDir filters -=================================================== - -Each FDir filter requires space in the Rx Packet Buffer (perfect filters require -32 B of space, and signature filters require 8 B of space). The total amount of -memory - and therefore the number of concurrent filters - can be set when -initializing FDir. - - -Sub-case: Reserving 64 KB -------------------------- - -Start the ``testpmd`` application as follows:: - - ./testpmd -c 0xf -- -i --portmask=0x1 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K - -Check with the ``show port fdir`` command that the amount of FDIR filters that -are free to be used is equal to 2048 (2048 * 32B = 64KB).:: - - testpmd> show port fdir 0 - - ######################## FDIR infos for port 0 ######################## - collision: 0 free: 2048 - maxhash: 0 maxlen: 0 - add : 0 remove : 0 - f_add: 0 f_remove: 0 - ######################################################################## - - -Sub-case: Reserving 128 KB --------------------------- - -Start the ``testpmd`` application as follows:: - - ./testpmd -c 0xf -- -i --portmask=0x1 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=128K - -Check with the ``show port fdir`` command that the amount of FDIR filters that -are free to be used is equal to 4096 (4096 * 32B = 128KB).:: - - testpmd> show port fdir 0 - - ######################## FDIR infos for port 0 ######################## - collision: 0 free: 4096 - maxhash: 0 maxlen: 0 - add : 0 remove : 0 - f_add: 0 f_remove: 0 - ######################################################################## - - -Sub-case: Reserving 256 KB --------------------------- - -Start the ``testpmd`` application as follows:: - - ./testpmd -c 0xf -- -i --portmask=0x1 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=256K - -Check with the ``show port fdir`` command that the amount of FDIR filters that -are free to be used is equal to 8192 (8192 * 32B = 256KB).:: - - testpmd> show port fdir 0 - - ######################## FDIR infos for port 0 ######################## - collision: 0 free: 8192 - maxhash: 0 maxlen: 0 - add : 0 remove : 0 - f_add: 0 f_remove: 0 - ######################################################################## - - -Test case: FDir signature matching mode -======================================= - -This test adds signature filters to the hardware, and then checks whether sent -packets match those filters. In order to this, the packet should first be sent -from ``Scapy`` before the filter is created, to verify that it is not matched by -a FDir filter. The filter is then added from the ``testpmd`` command line and -the packet is sent again. - -Launch the userland ``testpmd`` application as follows:: - - ./testpmd -c 0xf -- -i --portmask=1 --nb-cores=2 --rxq=2 --txq=2 --disable-rss - --pkt-filter-mode=signature - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - -Send the ``p_udp`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_signature_filter 0 udp src 192.168.0.1 1024 dst 192.168.0.2 - 1024 flexbytes 0x800 vlan 0 queue 1 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x143c - FDIR id=0xe230 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - - - -Send the ``p_tcp`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_signature_filter 0 tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 - flexbytes 0x800 vlan 0 queue 1 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x1b47 - FDIR id=0xbd2b - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Send the ``p_ip`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_signature_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x800 vlan 0 queue 1 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x1681 - FDIR id=0xf3ed - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Send the ``p_ipv6_udp`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_signature_filter 0 udp src 2001:0db8:85a3:0000:0000:8a2e:0370:7000 1024 - dst 2001:0db8:85a3:0000:0000:8a2e:0370:7338 1024 flexbytes 0x86dd vlan 0 queue 1 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x86dd - length=62 - nb_segs=1 - - FDIR hash=0x4aa - FDIR id=0xea83 - PKT_RX_PKT_RX_FDIR - PKT_RX_IPV6_HDR - - -Test case: FDir perfect matching mode -===================================== - -This test adds perfect-match filters to the hardware, and then checks whether -sent packets match those filters. In order to this, the packet should first be -sent from ``Scapy`` before the filter is created, to verify that it is not -matched by a FDir filter. The filter is then added from the ``testpmd`` command -line and the packet is sent again.:: - - ./testpmd -c 0xf -- -i --portmask=1 --nb-cores=2 --rxq=2 --txq=2 --disable-rss - --pkt-filter-mode=perfect - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - -Send the ``p_udp`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_perfect_filter 0 udp src 192.168.0.1 1024 dst 192.168.0.2 1024 - flexbytes 0x800 vlan 0 queue 1 soft 0x14 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x43c - FDIR id=0x14 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Update the perfect filter match the ``p_udp1`` packet and send the packet and check -that there is a match:: - - testpmd> add_perfect_filter 0 udp src 192.168.1.1 1024 dst 192.168.1.2 0 - flexbytes 0x800 vlan 0 queue 1 soft 0x14 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - -nb_segs=1 - FDIR hash=0x43c - FDIR id=0x14 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Remove the perfect filter match the ``p_udp1`` and ``p_udp`` packets, and send the packet again. -Check that no FDir information is printed:: - - testpmd> port 0/queue 0: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Send the ``p_tcp`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_perfect_filter 0 tcp src 192.168.0.1 1024 dst 192.168.0.2 1024 - flexbytes 0x800 vlan 0 queue 1 soft 0x15 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x347 - FDIR id=0x15 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Send the ``p_ip`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_perfect_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 - flexbytes 0x800 vlan 0 queue 1 soft 0x17 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x681 - FDIR id=0x17 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Test case: FDir filter masks -============================ - -This section tests the functionality of the setting FDir masks to affect -which fields, or parts of fields are used in the matching process. Note that -setting up a mask resets all the FDir filters, so the ``testpmd`` application -does not have to be relaunched for each sub-case. - -Launch the userland ``testpmd`` application:: - - ./testpmd -c 0xf -- -i --portmask=1 --nb-cores=2 --rxq=2 --txq=2 --disable-rss - --pkt-filter-mode=perfect - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - -Sub-case: IP address masking ----------------------------- - -Create the following IPv4 mask on port 0. This mask means the lower byte of the -source and destination IP addresses will not be considered in the matching -process:: - - testpmd> set_masks_filter 0 only_ip_flow 0 src_mask 0xffffff00 0xffff - dst_mask 0xffffff00 0xffff flexbytes 1 vlan_id 1 vlan_prio 1 - -Then, add the following perfect IPv4 filter:: - - testpmd> add_perfect_filter 0 udp src 192.168.0.0 1024 dst 192.168.0.0 1024 - flexbytes 0x800 vlan 0 queue 1 soft 0x17 - -Then send the ``p_udp_1``, ``p_udp_2``, and ``p_udp_3`` packets from Scapy. The -first two packets should match the masked filter, but the third packet will not, -as it differs in the second lowest IP address byte.:: - - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x6cf - FDIR id=0x17 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x6cf - FDIR id=0x17 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 0: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Sub-case: Port masking ----------------------- - -Create the following mask on port 0. This mask means the lower byte of the -source and destination ports will not be considered in the matching process:: - - testpmd> set_masks_filter 0 only_ip_flow 0 src_mask 0xffffffff 0xff00 - dst_mask 0xffffffff 0xff00 flexbytes 1 vlan_id 1 vlan_prio 1 - -Then, add the following perfect IPv4 filter:: - - testpmd> add_perfect_filter 0 udp src 10.11.12.1 0x4400 dst 10.11.12.2 0x4500 - flexbytes 0x800 vlan 0 queue 1 soft 0x4 - -Then send the ``p_udp_4``, ``p_udp_5``, and ``p_udp_6`` packets from Scapy. The -first two packets should match the masked filter, but the third packet will not, -as it differs in higher byte of the port numbers.:: - - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x41d - FDIR id=0x4 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x41d - FDIR id=0x4 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 0: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Sub-case: L4Type field masking ------------------------------- - -Create the following mask on port 0. This mask means that the L4type field of -packets will not be considered. Note that in this case, the source and the -destination port masks are irrelevant and must be set to zero:: - - testpmd> set_masks_filter 0 only_ip_flow 1 src_mask 0xffffffff 0x0 - dst_mask 0xffffffff 0x0 flexbytes 1 vlan_id 1 vlan_prio 1 - -Then, add the following perfect IPv4 filter:: - - testpmd> add_perfect_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 - flexbytes 0x800 vlan 0 queue 1 soft 0x42 - -Then send the ``p_udp`` and ``p_tcp`` packets from Scapy. Both packets will -match the filter:: - - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x681 - FDIR id=0x42 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=60 - nb_segs=1 - - FDIR hash=0x681 - FDIR id=0x42 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Test case: FDir ``flexbytes`` filtering -======================================= - -The FDir feature supports setting up filters that can match on any two byte -field within the first 64 bytes of a packet. Which byte offset to use is -set by passing command line arguments to ``testpmd``. In this test a value of -``18`` corresponds to the bytes at offset 36 and 37, as the offset is in 2-byte -units:: - - ./testpmd -c 0xf -- -i --portmask=1 --nb-cores=2 --rxq=2 --txq=2 --disable-rss - --pkt-filter-mode=perfect --pkt-filter-flexbytes-offset=18 - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - -Send the ``p_gre1`` packet and verify that there is not a match. Then add the -filter and check that there is a match:: - - testpmd> add_perfect_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x1 vlan 0 queue 1 soft 0x1 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=66 - nb_segs=1 - - FDIR hash=0x18b - FDIR id=0x1 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - -Send the ``p_gre2`` packet and verify that there is not a match. Then add a -second filter and check that there is a match:: - - testpmd> add_perfect_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0xff vlan 0 queue 1 soft 0xff - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=66 - nb_segs=1 - FDIR hash=0x3a1 - FDIR id=0xff - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Sub-case: ``flexbytes`` FDir masking ------------------------------------- - -A mask can also be applied to the ``flexbytes`` filter:: - - testpmd> set_masks_filter 0 only_ip_flow 0 src_mask 0xffffffff 0xffff - dst_mask 0xffffffff 0xffff flexbytes 0 vlan_id 1 vlan_prio 1 - -Then, add the following perfect filter (same as first filter in prev. test), and -check that this time both packets match (``p_gre1`` and ``p_gre2``):: - - testpmd> add_perfect_filter 0 ip src 192.168.0.1 0 dst 192.168.0.2 0 flexbytes 0x0 vlan 0 queue 1 soft 0x42 - testpmd> port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=66 - nb_segs=1 - FDIR hash=0x2f3 - FDIR id=0x42 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 1: received 1 packets - src=00:1B:21:53:1F:14 - dst=00:1B:21:91:3D:2C - type=0x0800 - length=66 - nb_segs=1 - FDIR hash=0x2f3 - FDIR id=0x42 - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Test case: FDir VLAN field filtering -==================================== - -Connect port 0 of the DUT to a traffic generator capable of sending packets with -VLAN headers. - -Then launch the ``testpmd`` application, and enable VLAN packet reception:: - - ./testpmd -c 0xf -- -i --portmask=1 --nb-cores=2 --rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> rx_vlan add all 0 - testpmd> start - -From the traffic generator, transmit a packet with the following details, and -verify that it does not match any FDir filters.: - -* VLAN ID = 0x0FFF -* IP source address = 192.168.0.1 -* IP destination address = 192.168.0.2 -* UDP source port = 1024 -* UDP destination port = 1024 - -Then, add the following perfect VLAN filter, resend the packet and verify that -it matches the filter:: - - testpmd> add_perfect_filter 0 udp src 192.168.0.1 1024 dst 192.168.0.2 1024 - flexbytes 0x8100 vlan 0xfff queue 1 soft 0x47 - testpmd> port 0/queue 1: received 1 packets - src=00:00:03:00:03:00 - dst=00:00:03:00:02:00 - type=0x0800 - length=64 - nb_segs=1 - - FDIR hash=0x7e9 - FDIR id=0x47 - VLAN tci=0xfff - PKT_RX_VLAN_PKT - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Sub-case: VLAN field masking ----------------------------- - -First, set the following mask to disable the matching of the VLAN field, and add -a perfect filter to match any VLAN identifier:: - - testpmd> set_masks_filter 0 only_ip_flow 0 src_mask 0xffffffff 0xffff - dst_mask 0xffffffff 0xffff flexbytes 1 vlan_id 0 vlan_prio 0 - testpmd> add_perfect_filter 0 udp src 192.168.0.1 1024 dst 192.168.0.2 1024 - flexbytes 0x8100 vlan 0 queue 1 soft 0x47 - -Then send the same packet above, but with the VLAN field change first to 0x001, -and then to 0x0017. The packets should still match the filter::: - - testpmd> port 0/queue 1: received 1 packets - src=00:00:03:00:03:00 - dst=00:00:03:00:02:00 - type=0x0800 - length=64 - nb_segs=1 - - FDIR hash=0x7e8 - FDIR id=0x47 - VLAN tci=0x1 - PKT_RX_VLAN_PKT - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - port 0/queue 1: received 1 packets - src=00:00:03:00:03:00 - dst=00:00:03:00:02:00 - type=0x0800 - length=64 - nb_segs=1 - - FDIR hash=0x7e8 - FDIR id=0x47 - VLAN tci=0x17 - PKT_RX_VLAN_PKT - PKT_RX_PKT_RX_FDIR - PKT_RX_IP_CKSUM - PKT_RX_IPV4_HDR - - -Test Case : test with ipv4 TOS, PROTO, TTL -========================================== - -1. start testpmd and initialize flow director flex payload configuration:: - - ./testpmd -c fffff -n 4 -- -i --disable-rss --pkt-filter-mode=perfect --rxq=8 --txq=8 --nb-cores=8 - testpmd> port stop 0 - testpmd> flow_director_flex_payload 0 l2 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l3 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l4 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_mask 0 flow all (0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff) - testpmd> port start 0 - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - - Note:: - - assume FLEXBYTES = "0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88" - assume payload = "\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88" - -2. setup the fdir input set of IPv4:: - - testpmd> set_fdir_input_set 0 ipv4-other none select - testpmd> set_fdir_input_set 0 ipv4-other src-ipv4 add - testpmd> set_fdir_input_set 0 ipv4-other dst-ipv4 add - -3. add ipv4-tos to fdir input set, set tos to 16 and 8:: - - testpmd> set_fdir_input_set 0 ipv4-other ipv4-tos add - setup flow director filter rules, - - rule_1:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 16 proto 255 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 1 fd_id 1 - - rule_2:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 8 proto 255 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 2 fd_id 2 - - send packet to DUT, - - packet_1:: - - sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=16, proto=255, ttl=255)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_1 should be received by queue 1. - - packet_2:: - - sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=8, proto=255, ttl=255)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_2 should be received by queue 2. - - * Delete rule_1, send packet_1 again, packet_1 should be received by queue 0. - * Delete rule_2, send packet_2 again, packet_2 should be received by queue 0. - -4. add ipv4-proto to fdir input set, set proto to 253 and 254:: - - testpmd> set_fdir_input_set 0 ipv4-other ipv4-proto add - - setup flow director filter rules - rule_3:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 16 proto 253 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 3 fd_id 3 - - rule_4:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 8 proto 254 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 4 fd_id 4 - - send packet to DUT, - - packet_3:: - - 'sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=16, proto=253, ttl=255)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_3 should be received by queue 3. - - packet_4:: - - 'sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=8, proto=254, ttl=255)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_4 should be received by queue 4. - - * Delete rule_3, send packet_3 again, packet_3 should be received by queue 0. - * Delete rule_4, send packet_4 again, packet_4 should be received by queue 0. - -5. test ipv4-ttl, set ttl to 32 and 64:: - - testpmd> set_fdir_input_set 0 ipv4-other ipv4-ttl add - - setup flow director filter rules, - rule_5:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 16 proto 253 ttl 32 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 5 fd_id 5 - - rule_6:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 8 proto 254 ttl 64 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 6 fd_id 6 - - send packet to DUT, - - packet_5:: - - 'sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=16, proto=253, ttl=32)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_5 should be received by queue 5. - - packet_6:: - - 'sendp([Ether(dst="%s")/IP(src="192.168.0.1", dst="192.168.0.2", tos=8, proto=254, ttl=64)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_6 should be received by queue 6. - - * Delete rule_5, send packet_5 again, packet_5 should be received by queue 0. - * Delete rule_6, send packet_6 again, packet_6 should be received by queue 0. - -6. removed all entry of fdir:: - - - testpmd>flush_flow_director 0 - testpmd>show port fdir 0 - -Example:: - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 16 proto 255 ttl 255 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 1 fd_id 1 - - flow_director_filter 0 mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 tos 8 proto 255 ttl 255 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 2 fd_id 2 - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IP(src="192.168.1.1", dst="192.168.1.2", tos=16, proto=255, ttl=255)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IP(src="192.168.1.1", dst="192.168.1.2", tos=8, proto=255, ttl=255)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - -Test Case 2: test with ipv6 tc, next-header, hop-limits -======================================================= - -1. start testpmd and initialize flow director flex payload configuration:: - - ./testpmd -c fffff -n 4 -- -i --disable-rss --pkt-filter-mode=perfect --rxq=8 --txq=8 --nb-cores=8 - testpmd> port stop 0 - testpmd> flow_director_flex_payload 0 l2 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l3 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l4 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_mask 0 flow all (0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff) - testpmd> port start 0 - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - - Note:: - - assume FLEXBYTES = "0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88" - assume payload = "\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88" - -2. setup the fdir input set of IPv6:: - - testpmd> set_fdir_input_set 0 ipv6-other none select - testpmd> set_fdir_input_set 0 ipv6-other src-ipv6 add - testpmd> set_fdir_input_set 0 ipv6-other dst-ipv6 add - -3. add ipv6-tc to fdir input set, set tc to 16 and 8:: - - testpmd> set_fdir_input_set 0 ipv6-other ipv6-tc add - - setup flow director filter rules, - - rule_1:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 255 ttl 64 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 1 fd_id 1 - - rule_2:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 255 ttl 64 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 2 fd_id 2 - - send packet to DUT, - - packet_1:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=255, hlim=64)/Raw(%s)], iface="%s")' \ - %(dst_mac, payload, itf) - - packet_1 should be received by queue 1. - - packet_2:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=255, hlim=64)/Raw(%s)], iface="%s")' \ - %(dst_mac, payload, itf) - - packet_2 should be received by queue 2. - - * Delete rule_1, send packet_1 again, packet_1 should be received by queue 0. - * Delete rule_2, send packet_2 again, packet_2 should be received by queue 0. - -4. add ipv6-next-header to fdir input set, set nh to 253 and 254:: - - testpmd> set_fdir_input_set 0 ipv6-other ipv6-next-header add - - setup flow director filter rules, - rule_3:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 253 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 3 fd_id 3 - - rule_4:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 254 ttl 255 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 4 fd_id 4 - - send packet to DUT, - - packet_3:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=253, hlim=64)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_3 should be received by queue 3. - - packet_4:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=254, hlim=64)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_4 should be received by queue 4. - - * Delete rule_3, send packet_3 again, packet_3 should be received by queue 0. - * Delete rule_4, send packet_4 again, packet_4 should be received by queue 0. - -5. add ipv6-hop-limits to fdir input set, set hlim to 32 and 64:: - - testpmd> set_fdir_input_set 0 ipv6-other ipv6-hop-limits add - - setup flow director filter rules, - rule_5:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 253 ttl 32 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 5 fd_id 5 - - rule_6:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 254 ttl 64 vlan 0 \ - flexbytes (FLEXBYTES) fwd pf queue 6 fd_id 6 - - send packet to DUT, - - packet_5:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=253, hlim=32)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_5 should be received by queue 5. - - packet_6:: - - 'sendp([Ether(dst="%s")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=254, hlim=64)/Raw(%s)], iface="%s")'\ - %(dst_mac, payload, itf) - - packet_6 should be received by queue 6. - - * Delete rule_5, send packet_5 again, packet_5 should be received by queue 0. - * Delete rule_6, send packet_6 again, packet_6 should be received by queue 0. - - 6. removed all entry of fdir:: - - testpmd>flush_flow_director 0 - testpmd>show port fdir 0 - -Example:: - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 255 ttl 64 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 1 fd_id 1 - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 255 ttl 64 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 2 fd_id 2 - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 253 ttl 64 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 3 fd_id 3 - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 254 ttl 64 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 4 fd_id 4 - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 16 proto 253 ttl 32 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 5 fd_id 5 - - flow_director_filter 0 mode IP add flow ipv6-other src 2000::1 dst 2000::2 tos 8 proto 254 ttl 48 vlan 0 flexbytes (0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88) fwd pf queue 6 fd_id 6 - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=255, hlim=64)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=255, hlim=64)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=253, hlim=64)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=254, hlim=64)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=16, nh=253, hlim=32)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - sendp([Ether(src="00:00:00:00:00:01", dst="00:00:00:00:01:00")/IPv6(src="2000::1", dst="2000::2", tc=8, nh=254, hlim=48)/Raw(load="\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88")], iface="ens260f0") - - -Test Case 3: test with ivlan (qinq not work) -============================================== - -1. start testpmd and initialize flow director flex payload configuration:: - - ./testpmd -c fffff -n 4 -- -i --disable-rss --pkt-filter-mode=perfect --rxq=8 --txq=8 --nb-cores=8 - testpmd> port stop 0 - testpmd> flow_director_flex_payload 0 l2 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l3 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_payload 0 l4 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) - testpmd> flow_director_flex_mask 0 flow all (0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff) - testpmd> port start 0 - - testpmd> vlan set qinq on 0 - - testpmd> set verbose 1 - testpmd> set fwd rxonly - testpmd> start - - Note:: - - assume FLEXBYTES = "0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88" - assume payload = "\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88" - -2. setup the fdir input set:: - - testpmd> set_fdir_input_set 0 ipv4-udp none select - testpmd> set_fdir_input_set 0 ipv4-udp ivlan add - - -3. setup flow director filter rules, - - rule_1:: - - flow_director_filter 0 mode IP add flow ipv4-udp src 192.168.1.1 1021 dst 192.168.1.2 1022 tos 16 ttl 255 \ - vlan 1 flexbytes (FLEXBYTES) fwd pf queue 1 fd_id 1 - - rule_2:: - - flow_director_filter 0 mode IP add flow ipv4-udp src 192.168.1.1 1021 dst 192.168.1.2 1022 tos 16 ttl 255 \ - vlan 15 flexbytes (FLEXBYTES) fwd pf queue 2 fd_id 2 - - rule_3:: - - flow_director_filter 0 mode IP add flow ipv4-udp src 192.168.1.1 1021 dst 192.168.1.2 1022 tos 16 ttl 255 \ - vlan 255 flexbytes (FLEXBYTES) fwd pf queue 3 fd_id 3 - - rule_4:: - - flow_director_filter 0 mode IP add flow ipv4-udp src 192.168.1.1 1021 dst 192.168.1.2 1022 tos 16 ttl 255 \ - vlan 4095 flexbytes (FLEXBYTES) fwd pf queue 4 fd_id 4 - -4. send packet to DUT, - - packet_1:: - - 'sendp([Ether(dst="%s")/Dot1Q(id=0x8100,vlan=16)/Dot1Q(id=0x8100,vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2", \ - tos=16, ttl=255)/UDP(sport="1021",dport="1022")/Raw(%s)], iface="%s")' % (dst_mac, payload, itf) - - packet_1 should be received by queue 1. - - packet_2:: - - 'sendp([Ether(dst="%s")/Dot1Q(id=0x8100,vlan=16)/Dot1Q(id=0x8100,vlan=15)/IP(src="192.168.0.1",dst="192.168.0.2", \ - tos=16, ttl=255)/UDP(sport="1021",dport="1022")/Raw(%s)], iface="%s")' % (dst_mac, payload, itf) - - packet_2 should be received by queue 2. - - packet_3:: - - 'sendp([Ether(dst="%s")/Dot1Q(id=0x8100,vlan=16)/Dot1Q(id=0x8100,vlan=255)/IP(src="192.168.0.1",dst="192.168.0.2", \ - tos=16, ttl=255)/UDP(sport="1021",dport="1022")/Raw(%s)], iface="%s")' % (dst_mac, payload, itf) - - packet_3 should be received by queue 3. - - packet_4:: - - 'sendp([Ether(dst="%s")/Dot1Q(id=0x8100,vlan=16)/Dot1Q(id=0x8100,vlan=4095)/IP(src="192.168.0.1",dst="192.168.0.2", \ - tos=16, ttl=255)/UDP(sport="1021",dport="1022")/Raw(%s)], iface="%s")' % (dst_mac, payload, itf) - - packet_4 should be received by queue 4. - - * Delete rule_1, send packet_1 again, packet_1 should be received by queue 0. - * Delete rule_2, send packet_2 again, packet_2 should be received by queue 0. - * Delete rule_3, send packet_3 again, packet_3 should be received by queue 0. - * Delete rule_4, send packet_4 again, packet_4 should be received by queue 0. - -5. removed all entry of fdir:: - - testpmd>flush_flow_director 0 - testpmd>show port fdir 0 From patchwork Fri Dec 3 10:13:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Xia X-Patchwork-Id: 104843 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 011FDA0C41; Fri, 3 Dec 2021 03:13:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E13F341C27; Fri, 3 Dec 2021 03:13:12 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id E4CF340041 for ; Fri, 3 Dec 2021 03:13:10 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="235629870" X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="235629870" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:09 -0800 X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="610220006" Received: from unknown (HELO dpdk.lan) ([10.240.183.77]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:07 -0800 From: Yan Xia To: dts@dpdk.org Cc: Yan Xia Subject: [dts][PATCH V1 2/3] test_plans/index: delete fdir Date: Fri, 3 Dec 2021 10:13:10 +0000 Message-Id: <20211203101311.148370-2-yanx.xia@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211203101311.148370-1-yanx.xia@intel.com> References: <20211203101311.148370-1-yanx.xia@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org delete fdir dpdk commit-id: 1be514fbc ethdev: remove legacy FDIR filter type support Signed-off-by: Yan Xia --- test_plans/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/test_plans/index.rst b/test_plans/index.rst index ab5a1d31..f9b6fbc7 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -83,7 +83,6 @@ The following are the test plans for the DPDK DTS automated test system. eeprom_dump_test_plan external_memory_test_plan external_mempool_handler_test_plan - fdir_test_plan firmware_version_test_plan floating_veb_test_plan flow_classify_softnic_test_plan From patchwork Fri Dec 3 10:13:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Xia X-Patchwork-Id: 104844 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 198A1A0548; Fri, 3 Dec 2021 03:13:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 123B5426FB; Fri, 3 Dec 2021 03:13:16 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 289A3426FA for ; Fri, 3 Dec 2021 03:13:13 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="235629874" X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="235629874" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:12 -0800 X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="610220014" Received: from unknown (HELO dpdk.lan) ([10.240.183.77]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 18:13:10 -0800 From: Yan Xia To: dts@dpdk.org Cc: Yan Xia Subject: [dts][PATCH V1 3/3] tests/fdir: delete fdir Date: Fri, 3 Dec 2021 10:13:11 +0000 Message-Id: <20211203101311.148370-3-yanx.xia@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211203101311.148370-1-yanx.xia@intel.com> References: <20211203101311.148370-1-yanx.xia@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org delete fdir dpdk commit-id: 1be514fbc ethdev: remove legacy FDIR filter type support Signed-off-by: Yan Xia --- tests/TestSuite_fdir.py | 1335 --------------------------------------- 1 file changed, 1335 deletions(-) delete mode 100644 tests/TestSuite_fdir.py diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py deleted file mode 100644 index b418b68d..00000000 --- a/tests/TestSuite_fdir.py +++ /dev/null @@ -1,1335 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2010-2014 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 82599 and fortville Flow Director Support in DPDK -""" - -import imp -import re -import string -import sys -import time -from time import sleep - -from scapy.utils import PcapWriter, socket, struct - -import framework.utils as utils -from framework.pktgen import PacketGeneratorHelper -from framework.pmd_output import PmdOutput -from framework.settings import HEADER_SIZE -from framework.test_case import TestCase - - -class TestFdir(TestCase): - - # - # - # Utility methods and other non-test code. - # - ########################################################################### - scapyCmds = [] - - def start_scapy(self): - self.tester.scapy_foreground() - self.tester.send_expect('scapy', '>>> ', 10) - sleep(2) - - def end_scapy(self): - self.tester.send_expect("exit()", "#") - - def scapy_execute(self, timeout=60): - for cmd in self.scapyCmds: - self.tester.send_expect(cmd, ">>> ", timeout) - - self.scapyCmds = [] - - def send_and_verify(self, condition, packet, queueid = -2): - """ - Send packages and verify behavior. - """ - self.scapyCmds.append(packet) - self.dut.send_expect("start", "testpmd>") - - self.pmd_output = PmdOutput(self.dut) - res = self.pmd_output.wait_link_status_up('all', timeout=15) - self.verify(res is True, 'there have port link is down') - - self.scapy_execute() - time.sleep(.5) - out = self.dut.get_session_output() - self.dut.send_expect("stop", "testpmd>") - - if(self.nic in ["kawela", "niantic", "fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - if ("fwd" == self.fdir_type): - if condition: - self.queue = 2 - else: - self.queue = 0 - elif("drop" == self.fdir_type): - if condition: - self.queue = 0 - else: - self.queue = -1 - else: - self.queue = queueid - - result_scanner = r"port ([0-9]+)/queue ([0-9]+): received ([0-9]+) packets\s*src=[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2} - dst=[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - - print("**************Print sub-case result****************") - if m: - m.groups() - if (self.queue == int(m.group(2))): - print(utils.GREEN("Pass: queue id is " + m.group(2))) - self.verify(1, "Pass") - else: - print(utils.RED("Fail: queue id is " + m.group(2))) - self.verify(0, "Fail") - print(out) - else: - print("not match") - if (-1 == self.queue): - print(utils.GREEN("Pass: fdir should not match ")) - self.verify(1, "Pass") - else: - print(utils.RED("Fail")) - self.verify(0, "Fail") - print(out) - print("**************Print sub-case result****************") - - # - # - # - # Test cases. - # - def set_up_all(self): - """ - Run at the start of each test suite. - - PMD prerequisites. - """ - #self.verify('bsdapp' not in self.path, "FDIR not support freebsd") - # this feature support Fortville, Niantic - #self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", - # "82540EM", "springfountain", "fortville_eagle", - # "fortville_spirit", "fortville_spirit_single"], - # "NIC Unsupported: " + str(self.nic)) - - # Based on h/w type, choose how many ports to use - 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 - self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) - cores = self.dut.get_core_list("1S/5C/1T") - self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = utils.create_mask(cores) - self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) - self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.dut_rx_port = self.tester.get_local_port(self.dut_ports[0]) - self.dut_rx_interface = self.tester.get_interface(self.dut_rx_port) - self.dut_tx_port = self.tester.get_local_port(self.dut_ports[1]) - self.dut_tx_interface = self.tester.get_interface(self.dut_rx_port) - self.path=self.dut.apps_name['test-pmd'] - - self.blocklist = "" - - self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[ - 'ip'] + HEADER_SIZE['udp'] - self.src_ip = "192.168.1.1" - self.dst_ip = "192.168.2.1" - self.default_queue = 2 - - # performance test parameter - # self.frame_sizes = [1500] - self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1500] - self.rxfreet_values = [0, 8, 16, 32, 64, 128] - """ - self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/2C/1T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/2C/2T', 'Mpps': {}, 'pct': {}}, - {'cores': '1S/4C/2T', 'Mpps': {}, 'pct': {}} - ] - """ - self.test_cycles = [{'cores': '1S/4C/2T', 'Mpps': {}, 'pct': {}}] - - # Niantic only support 2bytes payload, Fortville support 16 bytes - self.flexbytes = [{'length': 2, 'flexbytes': '0x11,0x11', 'payload': '\\x11\\x11'}, - {'length': 16, 'flexbytes': '0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x88,0x88', 'payload': '\\x11\\x11\\x22\\x22\\x33\\x33\\x44\\x44\\x55\\x55\\x66\\x66\\x77\\x77\\x88\\x88'} - ] - - # self.test_types = ['fdir_2flexbytes'] - self.test_types = ['fdir_disable', 'fdir_enable', 'fdir_noflexbytes', 'fdir_2flexbytes', 'fdir_16flexbytes'] - """ - self.flows= [{"flows":1, "rules":1}, - {"flows":64, "rules":16}, - {"flows":64, "rules":512} - #{"flows":8192, "rules":8192} - ] - """ - self.flows = [{"flows": 8192, "rules": 8192}] - # performance report head line - self.table_header = ['Frame Size'] - for test_cycle in self.test_cycles: - self.table_header.append("%s Mpps" % test_cycle['cores']) - self.table_header.append("% linerate") - # create an instance to set stream field setting - self.pktgen_helper = PacketGeneratorHelper() - - def set_up(self): - """ - Run before each test case. - """ - self.start_scapy() - - def fdir_set_rule(self): - """ - Fdir Performance Benchmarking set rules - """ - self.dut.send_expect("port stop %s" % self.dut_ports[0], "testpmd>") - if(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_flex_payload %s l2 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_payload %s l3 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_payload %s l4 (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_mask %s flow all (0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff)" % self.dut_ports[0], "testpmd>") - elif (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_flex_payload %s raw (12,13)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_flex_mask %s flow raw (0xff,0xff)" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("port start %s" % self.dut_ports[0], "testpmd>") - - def fdir_get_flexbytes(self, sctp=False): - - """ - Fdir get flexbytes and payload according NIC - """ - - if(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville", "foxville"]): - if not sctp: - self.flexbytes = "0x11,0x11,0x22,0x22,0x33,0x33,0x44,0x44,0x55,0x55,0x66,0x66,0x77,0x77,0x77,0x77" - else: - self.flexbytes = '0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0' - self.payload = b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x77\x77' - self.flexlength = 16 - elif (self.nic in ["niantic", "sagepond", "sageville"]): - self.flexbytes = "0x00,0x00" - self.payload = b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x77\x77' - self.flexlength = 2 - self.payload = str(self.payload) - self.payload = self.payload.split("'")[1] - - def test_fdir_noflexword_fwd_ipv4(self): - """ - FDir signature matching mode. - """ - - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd command testing - self.fdir_type = "fwd" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # update command only work in niantic - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_fwd_ipv6(self): - """ - FDir signature matching mode. - """ - - self.dut.kill_all() - if self.nic in ["niantic", "sagepond", "sageville"]: - # Niantic ipv6 only support signature mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]: - # Fortville ipv6 support perfect mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "fwd" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - #ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter 0 mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter 0 mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter 0 mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(1,1), "testpmd>") - self.dut.send_expect("flow_director_filter 0 mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter 0 mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d "%(2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_drop_ipv4(self): - # drop command testing - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "drop" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2")/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support in fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"),dst="00:1B:21:8E:B2:30")/IP(src="192.168.0.1", dst="192.168.0.2", frag=1, flags="MF")/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_noflexword_drop_ipv6(self): - # drop not support signature mode, niantic only can work in signature mode with ipv6 - # Niantic is not support in drop ipv6 - if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]: - # drop command testing - self.dut.kill_all() - - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # fwd comand testing - self.fdir_type = "drop" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1024,dport=1024)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=32,dport=32)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - # ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],1,1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d "%(self.dut_ports[0],2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(False, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes () drop pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888", nh=44)/IPv6ExtHdrFragment()/Raw(load="X"*46)], iface="%s")' % (self.dut_rx_interface, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_fwd_ipv4(self): - """ - FDir signature matching mode. - """ - # fwd comand testing - self.fdir_type = "fwd" - - self.dut.kill_all() - # fwd testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv4 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.fdir_get_flexbytes() - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_fwd_ipv6(self): - """ - FDir signature matching mode. - """ - # fwd comand testing - self.fdir_type = "fwd" - - self.dut.kill_all() - # fwd testing with flexword - if self.nic in ["niantic", "sagepond", "sageville"]: - # Niantic ipv6 only support signature mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]: - # fortville ipv6 support perfect mode - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 1, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - #ipv6 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - if (self.nic in ["niantic"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,1,1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP update flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=132)/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-sctp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 verify_tag 1 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes,2,1), "testpmd>") - self.fdir_get_flexbytes() - - # ipv6 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_drop_ipv4(self): - - # drop testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = "drop" - - # ipv4 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-udp src 192.168.0.1 1024 dst 192.168.0.2 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-tcp src 192.168.0.1 32 dst 192.168.0.2 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv4 sctp - self.fdir_get_flexbytes(sctp=True) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-sctp src 192.168.0.1 32 dst 192.168.0.2 32 verify_tag 1 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d "%(self.dut_ports[0],self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2')/SCTP(sport=32, dport=32, tag=1)/SCTPChunkData(data='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.fdir_get_flexbytes() - - # ipv4 frag - # ip-frag only support fortville - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV","fortpark_BASE-T", "fortville_25g", "carlsville"]): - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv4-frag src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'),dst='00:1B:21:8E:B2:30')/IP(src='192.168.0.1', dst='192.168.0.2', frag=1, flags='MF')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_fdir_flexword_drop_ipv6(self): - # drop not support signature mode, niantic only can work in signature mode with ipv6 - # Niantic is not support in drop ipv6 - if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "carlsville"]): - # drop testing with flexword - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = "drop" - - # ipv6 ip - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 udp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-udp src FE80:0:0:0:200:1FF:FE00:200 1024 dst 3555:5555:6666:6666:7777:7777:8888:8888 1024 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/UDP(sport=1024,dport=1024)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 tcp - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-tcp src FE80:0:0:0:200:1FF:FE00:200 32 dst 3555:5555:6666:6666:7777:7777:8888:8888 32 tos 2 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888')/TCP(sport=32,dport=32)/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - # ipv6 frag - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(False, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-other src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 3, 1), "testpmd>") - self.dut.send_expect("flow_director_filter %s mode IP del flow ipv6-frag src FE80:0:0:0:200:1FF:FE00:200 dst 3555:5555:6666:6666:7777:7777:8888:8888 tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) drop pf queue %d fd_id %d " % (self.dut_ports[0], self.flexbytes, 2, 1), "testpmd>") - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30')/IPv6(src='FE80:0:0:0:200:1FF:FE00:200', dst='3555:5555:6666:6666:7777:7777:8888:8888', nh=44)/IPv6ExtHdrFragment()/Raw(load='%s')], iface='%s')" % (self.dut_rx_interface, self.payload, self.dut_rx_interface)) - - self.dut.send_expect("quit", "# ", 30) - - def test_ipv4_tos_proto_ttl(self): - """ - Expand Flow Director for fortville to support ipv4 TOS, ipv4 PROTO, ipv4 TTL - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv4-other none select" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv4-other src-ipv4 add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv4-other dst-ipv4 add" % self.dut_ports[0], "testpmd>") - - # test add and remove tso rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-tos add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=8, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=8, proto=255, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove proto rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-proto add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=253, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=254, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=253, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=254, ttl=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ttl rule - self.dut.send_expect("set_fdir_input_set %d ipv4-other ipv4-ttl add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-other src 192.168.1.1 dst 192.168.1.2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IP(src='192.168.1.1', dst='192.168.1.2', tos=16, proto=255, ttl=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - def test_fdir_ipv6_tc(self): - """ - Expand Flow Director for fortville to support ipv6 TC, next-header, hop-limits - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_set_rule() - self.fdir_get_flexbytes() - # fwd comand testing - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv6-other none select" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv6-other src-ipv6 add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("set_fdir_input_set %d ipv6-other dst-ipv6 add" % self.dut_ports[0], "testpmd>") - - # test add and remove ipv6 tc rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-tc add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=8, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 8 proto 255 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=8, nh=255, hlim=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ipv6-next-header rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-next-header add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=253, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=254, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 253 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 254 ttl 255 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=253, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=254, hlim=255) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - # test add and remove ipv6-hop-limits rule - self.dut.send_expect("set_fdir_input_set %d ipv6-other ipv6-hop-limits add" % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 1) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 2) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 32 vlan 0 flexbytes (%s) fwd pf queue 1 fd_id 1" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv6-other src 2000::1 dst 2000::2 \ - tos 16 proto 255 ttl 64 vlan 0 flexbytes (%s) fwd pf queue 2 fd_id 2" - % (self.dut_ports[0], self.flexbytes), "testpmd>") - - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=32) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, "sendp([Ether(src=get_if_hwaddr('%s'), dst='00:1B:21:8E:B2:30') \ - /IPv6(src='2000::1', dst='2000::2', tc=16, nh=255, hlim=64) \ - /Raw(load='%s')], iface='%s')" \ - % (self.dut_rx_interface, self.payload, self.dut_rx_interface), queueid = 0) - - def test_fdir_ivlan(self): - """ - Expand Flow Director for fortville to support ipv4 TOS, ipv4 PROTO, ipv4 TTL - """ - if not self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g", "carlsville", "foxville"]: - self.verify(False, "This case only support fortville nic") - self.dut.kill_all() - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.path, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - self.fdir_type = " " - self.dut.send_expect("set_fdir_input_set %d ipv4-udp ivlan add" % self.dut_ports[0], "testpmd>") - - - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002 \ - tos 2 ttl 40 vlan 1 flexbytes () fwd pf queue 1 fd_id 1" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 15 flexbytes () fwd pf queue 2 fd_id 2" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 255 flexbytes () fwd pf queue 3 fd_id 3" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP add flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 4095 flexbytes () fwd pf queue 3 fd_id 4" - % self.dut_ports[0], "testpmd>") - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=1) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 1) - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=15) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 2) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=255) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 3) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=4095) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 3) - - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 1 flexbytes () fwd pf queue 1 fd_id 1" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 15 flexbytes () fwd pf queue 2 fd_id 2" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 255 flexbytes () fwd pf queue 3 fd_id 3" - % self.dut_ports[0], "testpmd>") - self.dut.send_expect("flow_director_filter %d mode IP del flow ipv4-udp src 192.168.1.1 1001 dst 192.168.1.2 1002\ - tos 2 ttl 40 vlan 4095 flexbytes () fwd pf queue 3 fd_id 4" - % self.dut_ports[0], "testpmd>") - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=1) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=15) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=255) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - self.send_and_verify(True, 'sendp([Ether(src=get_if_hwaddr("%s"), dst="00:1B:21:8E:B2:30") \ - /Dot1Q(id=0x8100,vlan=4095) \ - /IP(src="192.168.1.1", dst="192.168.1.2", tos=2, proto=17, ttl=40) \ - /UDP(sport=1001,dport=1002) \ - /Raw(load="X"*20)], iface="%s")' \ - % (self.dut_rx_interface, self.dut_rx_interface), queueid = 0) - - - - def failed_test_fdir_flush(self): - """ - FDir flush in Fortville. - """ - - self.dut.kill_all() - - self.dut.send_expect("%s -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.path, self.all_cores_mask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) - - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd rxonly", "testpmd>") - - # set up a fdir rule and check guarant_count - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src 192.168.0.1 dst 192.168.0.2 tos 2 proto 20 ttl 40 vlan 0 flexbytes () fwd pf queue %d fd_id %d " % (self.dut_ports[0], 2, 1), "testpmd>") - out = self.dut.send_expect("show port fdir all", "testpmd>") - result_scanner = r"guarant_count: 1" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - if m: - self.verify(1, "Pass") - else: - self.verify(0, "Fail") - - # flush all fdir rule and check guarant_count - out = self.dut.send_expect("flush_flow_director %s" % self.dut_ports[0], "testpmd>") - result_scanner = r"guarant_count: 1" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out) - if m: - self.verify(0, "Fail") - else: - self.verify(1, "Pass") - - def increment_ip_address(self, addr, val): - """ - Returns the IP address from a given one, like - 192.168.1.1 ->193.168.1.1 - If disable ip hw chksum, csum routine will increase ip - """ - ip2int = lambda ipstr: struct.unpack('!I', socket.inet_aton(ipstr))[0] - x = ip2int(addr) - int2ip = lambda n: socket.inet_ntoa(struct.pack('!I', n)) - return int2ip(x + 1) - - def fdir_perf_set_rules(self, num_rules): - - src_ip_temp = self.src_ip - dst_ip_temp = self.dst_ip - for i in range(num_rules): - src_ip_temp = self.increment_ip_address(src_ip_temp, 1) - dst_ip_temp = self.increment_ip_address(dst_ip_temp, 1) - self.dut.send_expect("flow_director_filter %s mode IP add flow ipv4-other src %s dst %s tos 2 proto 20 ttl 40 vlan 0 flexbytes (%s) fwd pf queue %d fd_id %d " % (self.dut_ports[0], src_ip_temp, dst_ip_temp, self.flexbytes, i % self.queue, i), "testpmd>") - - def fdir_perf_set_flows(self, num_flows, frame_size): - """ - Fdir Performance Benchmarking set Ixia flows - """ - flows = [] - src_ip_temp = self.src_ip - dst_ip_temp = self.dst_ip - print("*src_ip_temp = " + src_ip_temp + "dst_ip_temp = " + dst_ip_temp) - flows.append("Ether(src='52:00:00:00:00:00', dst='00:1B:21:8E:B2:30')/IP(src='%s',dst='%s')/UDP(sport=%d,dport=%d)/Raw(load='%s' + 'X'*(%d - 42 - %d))" % (src_ip_temp, dst_ip_temp, 1021, 1021, self.payload, frame_size, self.flexlength)) - self.scapyCmds.append('wrpcap("/root/test1.pcap", [%s])' % ','.join(flows)) - flows = [] - flows.append("Ether(src='52:00:00:00:00:01', dst='00:1B:21:8E:B2:31')/IP(src='%s',dst='%s')/UDP(sport=%d,dport=%d)/Raw(load='%s' + 'X'*(%d - 42 - %d))" % (src_ip_temp, dst_ip_temp, 1021, 1021, self.payload, frame_size, self.flexlength)) - self.scapyCmds.append('wrpcap("/root/test2.pcap", [%s])' % ','.join(flows)) - - def perf_fdir_performance_2ports(self, test_type, num_rules, num_flows): - """ - fdir Performance Benchmarking with 2 ports. - """ - # prepare traffic generator input - tgen_input = [] - - tgen_input.append((self.tester.get_local_port(self.dut_ports[0]), - self.tester.get_local_port(self.dut_ports[1]), - "/root/test1.pcap")) - tgen_input.append((self.tester.get_local_port(self.dut_ports[1]), - self.tester.get_local_port(self.dut_ports[0]), - "/root/test2.pcap")) - - print("self.ports_socket=%s" % (self.ports_socket)) - # run testpmd for each core config - for test_cycle in self.test_cycles: - print("******************test cycles*********************\n") - core_config = test_cycle['cores'] - - core_list = self.dut.get_core_list(core_config, socket=self.ports_socket) - - if len(core_list) > 2: - self.queues = len(core_list) / 2 - else: - self.queues = 1 - - core_mask = utils.create_mask(core_list) - port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) - - if test_type == "fdir_disable": - command_line = "%s -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \ - --portmask=%s --nb-cores=4 --nb-ports=2 --rss-ip\ - " % (self.path, self.dut.get_memory_channels(), port_mask) - else: - command_line = "%s -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \ - --portmask=%s --nb-cores=4 --nb-ports=2 --rss-ip\ - --pkt-filter-mode=perfect" % (self.path, self.dut.get_memory_channels(), port_mask) - - info = "Executing PMD using %s\n" % test_cycle['cores'] - self.logger.info(info) - self.rst_report(info, annex=True) - self.rst_report(command_line + "\n\n", frame=True, annex=True) - - out = self.dut.send_expect(command_line, "testpmd> ", 100) - print(out) - - self.fdir_get_flexbytes() - - if test_type in ["fdir_noflex", "fdir_2flex", "fdir_16flex"]: - self.fdir_set_rule() - self.fdir_perf_set_rules(num_rules) - out = self.dut.send_expect("start", "testpmd> ") - print(out) - for frame_size in self.frame_sizes: - print("******************frame size = %d*********************\n" % (frame_size)) - wirespeed = self.wirespeed(self.nic, frame_size, 2) - # create pcap file - self.logger.info("Running with frame size %d " % frame_size) - self.fdir_perf_set_flows(num_flows, frame_size) - - self.scapy_execute() - - """ - tgen_input.append([self.tester.get_local_port(self.dut_ports[0]), - self.tester.get_local_port(self.dut_ports[1]), - "test.pcap", (512.00 / wirespeed * 100.00), 1]) - tgen_input.append([self.tester.get_local_port(self.dut_ports[1]), - self.tester.get_local_port(self.dut_ports[0]), - "test.pcap", (512.00 / wirespeed * 100.00), 1]) - """ - - """ - # create pcap file - self.logger.info("Running with frame size %d " % frame_size) - self.fdir_perf_set_flows(num_flows, frame_size) - - self.tester.scapy_execute() - """ - - # run traffic generator - streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, - None, self.tester.pktgen) - _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) - """ - _, pps, _ = self.throughputRate(tgen_input) - """ - - out = self.dut.send_expect("show port stats all", "testpmd> ", timeout=60) - print(out) - - pps /= 1000000.0 - test_cycle['Mpps'][frame_size] = pps - test_cycle['pct'][frame_size] = pps * 100 / wirespeed - - self.dut.send_expect("stop", "testpmd> ") - self.dut.send_expect("quit", "# ", 30) - sleep(5) - - for n in range(len(self.test_cycles)): - for frame_size in self.frame_sizes: - self.verify(self.test_cycles[n]['Mpps'][ - frame_size] > 0, "No traffic detected") - - # Print results - self.result_table_create(self.table_header) - for frame_size in self.frame_sizes: - table_row = [frame_size] - for test_cycle in self.test_cycles: - table_row.append(test_cycle['Mpps'][frame_size]) - table_row.append(test_cycle['pct'][frame_size]) - - self.result_table_add(table_row) - - self.result_table_print() - - def test_perf_fdir_performance_2ports(self): - """ - fdir Performance Benchmarking with 2 ports. - """ - for test_type in self.test_types: - print("***************\n") - print(test_type) - print("***************\n") - if test_type in ["fdir_enable", "fdir_disable"]: - num_rules = 0 - num_flows = 64 - print("************%d rules/%d flows********************" % (num_rules, num_flows)) - self.perf_fdir_performance_2ports(test_type, num_rules, num_flows) - elif test_type in ["fdir_noflexbytes", "fdir_2flexbytes", "fdir_16flexbytes"]: - for flows in self.flows: - num_rules = flows["rules"] - num_flows = flows["flows"] - print("************%d rules/%d flows********************" % (num_rules, num_flows)) - self.perf_fdir_performance_2ports(test_type, num_rules, num_flows) - - def tear_down(self): - """ - Run after each test case. - """ - self.end_scapy() - - def tear_down_all(self): - """ - Run after each test suite. - """ - pass