From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB628A0C51; Wed, 4 Aug 2021 08:52:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABAC04121E; Wed, 4 Aug 2021 08:52:17 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 8023D4014F for ; Wed, 4 Aug 2021 08:52:14 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10065"; a="299451062" X-IronPort-AV: E=Sophos;i="5.84,293,1620716400"; d="scan'208";a="299451062" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2021 23:52:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,293,1620716400"; d="scan'208";a="479985081" Received: from unknown (HELO dpdk-lijuan.sh.intel.com) ([10.67.119.192]) by fmsmga008.fm.intel.com with ESMTP; 03 Aug 2021 23:52:09 -0700 From: Lijuan Tu To: dts@dpdk.org Cc: Lijuan Tu Date: Wed, 4 Aug 2021 22:41:55 +0800 Message-Id: <1628088115-756-6-git-send-email-lijuan.tu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628088115-756-1-git-send-email-lijuan.tu@intel.com> References: <1628088115-756-1-git-send-email-lijuan.tu@intel.com> Subject: [dts] [v2, 5/5] remove cloud_filter as it is no longer maintained 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 Sender: "dts" Signed-off-by: Lijuan Tu --- test_plans/cloud_filter_test_plan.rst | 326 ------------------------ test_plans/index.rst | 1 - tests/TestSuite_cloud_filter.py | 463 ---------------------------------- 3 files changed, 790 deletions(-) delete mode 100644 test_plans/cloud_filter_test_plan.rst delete mode 100644 tests/TestSuite_cloud_filter.py diff --git a/test_plans/cloud_filter_test_plan.rst b/test_plans/cloud_filter_test_plan.rst deleted file mode 100644 index 500e131..0000000 --- a/test_plans/cloud_filter_test_plan.rst +++ /dev/null @@ -1,326 +0,0 @@ -.. Copyright (c) <2016-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. - -========================================== -Cloud filter Support through Ethtool Tests -========================================== - -This feature based on X710 to classify VxLan/Geneve packets and put those into -a specified queue in VF for further processing from virtual switch. - -Prerequisites -============= -Cloud filter feature based on latest i40e out of tree driver. Should also -update ethtool and XL710 firmware: - -* Ethtool version: 3.18 -* i40e driver: i40e-1.5.13_rc1 -* Kernel version: 4.2.2 -* Xl710 DA2 firmware: 5.02 0x80002282 - -BIOS setting: - -* Enable VT-d and VT-x - -Kernel command line: - -* Enable Intel IOMMU with below arguments -* intel_iommu=on iommu=pt - -Create two VFs from kernel driver:: - - echo 2 > /sys/bus/pci/devices/0000\:82\:00.0/sriov_numvfs - ifconfig $PF_INTF up - -Add vxlan network interface based on PF device:: - - ip li add vxlan0 type vxlan id 1 group 239.1.1.1 local 127.0.0.1 dev $PF_INTF - ifconfig vxlan0 up - -Allocate hugepage for dpdk:: - - echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - -Bind vf device to igb_uio driver and start testpmd with multiple queues:: - - cd dpdk - modprobe uio - insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko - ./tools/dpdk_nic_bind.py --bind=igb_uio 82:02.0 82:02.1 - ./x86_64-native-linuxapp-gcc/app/testpmd -c ffff -n 4 -- -i --rxq=4 --txq=4 --disable-rss - testpmd> set nbcore 8 - testpmd> set fwd rxonly - testpmd> set verbose 1 - testpmd> start - - -Test case: cloud filter rule(inner ip) --------------------------------------- - -1. Add cloud filter with inner ip address rule. Flow type ip4 mean this rule - only match inner destination ip address. User define field higher 32bit is - all 0xf mean vni id is not in the rule. Lower 32bit is 1 mean packet will - be forwarded to VF1. Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ip4 dst-ip 192.168.1.1 user-def 0xffffffff00000001 action 3 loc 1 - -2. Send vxlan packet with inner ip matched rule:: - - Ether()/IP()/UDP()/Vxlan()/Ether()/IP(dst="192.168.1.1")/TCP()/Raw('x' * 20) - -3. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=106 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: UDP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -Test case: cloud filter rule(inner mac) ---------------------------------------- -1. Add cloud filter with Inner mac rule. Dst mac mask ff:ff:ff:ff:ff:ff mean - outer mac address is not in the rule. Src mac mask 00:00:00:00:00:00 mean - inner mac address is in the rule. User define field higher 32bit is all - 0xf mean vni id is not in the rule. Lower 32bit is 1 mean packet will be - forwarded to VF1. Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:00:00 m \ - ff:ff:ff:ff:ff:ff src 00:00:00:00:09:00 m 00:00:00:00:00:00 \ - user-def 0xffffffff00000001 action 3 loc 1 - -2. Send vxlan packet with inner mac matched rule:: - - Ether()/IP()/UDP()/Vxlan()/Ether(dst="00:00:00:00:09:00")/IP()/TCP()/Raw('x' * 20) - -3. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=120 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER - Inner L3 type: - IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 0 - Receive queue=0x3 - -Test case: cloud filter rule(inner mac + outer mac + vni) ---------------------------------------------------------- - -1. Add cloud filter with Inner mac + outer mac + vni rule. Dst mac mask - 00:00:00:00:00:00 mean outer mac address is in the rule. Src mac mask - 00:00:00:00:00:00 mean inner mac address is in the rule. User define field - higher 32bit is 0x1 mean vni match 1 is in the rule. Lower 32bit is 1 mean - packet will be forwarded to VF1. Action 3 mean packet will be redirected - to queue 3:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:10:00 m \ - 00:00:00:00:00:00 src 00:00:00:00:09:00 m 00:00:00:00:00:00 \ - user-def 0x100000001 action 3 loc 1 - -2. Send vxlan packet with inner mac match rule:: - - Ether(dst="00:00:00:00:10:00")/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:09:00")/IP()/TCP()/Raw('x' * 20) - -3. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=120 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 0 - Receive queue=0x3 - -Test case: cloud filter rule(inner mac + inner vlan + vni) ----------------------------------------------------------- - -1. Add cloud filter with Inner mac + inner vlan + vni rule. Dst mac mask - ff:ff:ff:ff:ff:ff mean outer mac address is not in the rule. Src mac mask - 00:00:00:00:00:00 mean inner mac address is in the rule. Vlan 1 mean vlan - match is in the rule. User define field higher 32bit is 0x1 mean vni match - 1 is in the rule. Lower 32bit is 1 mean packet will be forwarded to VF1. - Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:00:00 m \ - ff:ff:ff:ff:ff:ff src 00:00:00:00:09:00 m 00:00:00:00:00:00 \ - vlan 1 user-def 0x100000001 action 3 loc 1 - -2. Send vxlan packet with inner mac match rule:: - - Ether()/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:09:00")/Dot1Q(vlan=1)/IP()/TCP()/Raw('x' * 20) - -3. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=124 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER_VLAN - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -Test case: cloud filter rule(inner mac + inner vlan) ----------------------------------------------------- - -1. Add cloud filter with Inner mac + inner vlan rule. Dst mac mask - ff:ff:ff:ff:ff:ff mean outer mac address is not in the rule. Src mac mask - 00:00:00:00:00:00 mean inner mac address is in the rule. Vlan 1 mean vlan - match is in the rule. User define field higher 32bit is all 0xf mean vni - id is not in the rule. Lower 32bit is 1 mean packet will be forwarded to - VF1. Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:00:00 m \ - ff:ff:ff:ff:ff:ff src 00:00:00:00:09:00 m 00:00:00:00:00:00 \ - vlan 1 user-def 0xffffffff00000001 action 3 loc 1 - -2. Send vxlan packet with inner mac match rule:: - - Ether()/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:09:00")/Dot1Q(vlan=1)/IP()/TCP()/Raw('x' * 20) - -3. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=124 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER_VLAN - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -Test case: Remove cloud filter rule ------------------------------------ - -Remove cloud filter rule in location 1:: - - ethtool -N $PF_INTF delete 1 - -Dump rule and check there's no rule listed:: - - ethtool -n $PF_INTF - Total 0 rules - -Send packet match last rule:: - - Ether(dst not match PF&VF)/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:09:00")/Dot1Q(vlan=1)/IP()/TCP()/Raw('x' * 20) - -Check packet only received on PF device. - -Test case: Multiple cloud filter rules --------------------------------------- - -1. Add cloud filter with Inner mac + inner vlan rule. Dst mac mask - ff:ff:ff:ff:ff:ff mean outer mac address is not in the rule. Src mac mask - 00:00:00:00:00:00 mean inner mac address is in the rule. Vlan 1 mean vlan - match is in the rule. User define field higher 32bit is all 0xf mean vni - id is not in the rule. Lower 32bit is 1 mean packet will be forwarded to - VF1. Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:00:00 m \ - ff:ff:ff:ff:ff:ff src 00:00:00:00:09:00 m 00:00:00:00:00:00 \ - vlan 1 user-def 0xffffffff00000001 action 3 loc 1 - -2. Add another cloud filter with Inner mac + inner vlan rule. Dst mac mask - ff:ff:ff:ff:ff:ff mean outer mac address is not in the rule. Src mac mask - 00:00:00:00:00:00 mean inner mac address is in the rule. Vlan 2 mean vlan - match is in the rule. User define field higher 32bit is all 0xf mean vni - id is not in the rule. Lower 32bit is 0 mean packet will be forwarded to - VF0. Action 3 mean packet will be redirected to queue 3. Locate 2 mean - this rule will be added to index 2:: - - ethtool -N $PF_INTF flow-type ether dst 00:00:00:00:00:00 m \ - ff:ff:ff:ff:ff:ff src 00:00:00:00:10:00 m 00:00:00:00:00:00 \ - vlan 2 user-def 0xffffffff00000000 action 3 loc 2 - -3. Dump cloud filter rules:: - - ethtool -n $PF_INTF - 64 RX rings available - Total 2 rules - -4. Send packet match rule 1:: - - Ether()/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:09:00")/Dot1Q(vlan=1)/IP()/TCP()/Raw('x' * 20) - -5. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=124 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER_VLAN - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -6. Send packet match rule 2:: - - Ether()/IP()/UDP()/Vxlan(vni=1)/Ether(dst="00:00:00:00:10:00")/Dot1Q(vlan=2)/IP()/TCP()/Raw('x' * 20) - -7. verify packet received by queue3 of VF0, verify packet type is correct:: - - testpmd> port 0/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=124 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - Tunnel type: GRENAT - - Inner L2 type: ETHER_VLAN - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: TCP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -Test case: Bifurcated between kernel VF and dpdk VF ---------------------------------------------------- - -1. Add cloud filter with inner ip address rule. Flow type ip4 mean this rule - only match inner destination ip address. User define field higher 32bit is - all 0xf mean vni id is not in the rule. Lower 32bit is 1 mean packet will - be forwarded to VF1. Action 3 mean packet will be redirected to queue 3:: - - ethtool -N $PF_INTF flow-type ip4 dst-ip 192.168.1.1 user-def 0xffffffff00000001 action 3 loc 1 - -2. Add cloud filter with inner ip address rule. Flow type ip4 mean this rule - only match inner destination ip address. User define field higher 32bit is - all 0xf mean vni id is not in the rule. Lower 32bit is 0 mean packet will - be forwarded to VF0. Action 0 mean packet will be redirected to queue 0:: - - ethtool -N $PF_INTF flow-type ip4 dst-ip 192.168.2.1 user-def 0xffffffff00000000 action 0 loc 2 - -3. Send vxlan packet which matched first rule:: - - Ether()/IP()/UDP()/Vxlan()/Ether()/IP(dst="192.168.1.1")/UDP()/Raw('x' * 20) - -4. verify packet received by queue3 of VF1, verify packet type is correct:: - - testpmd> port 1/queue 3: received 1 packets - src=00:00:00:00:00:00 - dst=00:00:00:00:09:00 - type=0x0800 - length=106 - nb_segs=1 - - - (outer) L2 type: ETHER - (outer) L3 type: IPV4_EXT_UNKNOWN - (outer) L4 type: Unknown - - Tunnel type: GRENAT - Inner L2 type: ETHER - Inner L3 type: IPV4_EXT_UNKNOWN - Inner L4 type: UDP - - VXLAN packet: packet type =24721, Destination UDP port =8472, VNI = 1 - Receive queue=0x3 - -5. Send vxlan packet which matched second rule:: - - Ether()/IP()/UDP()/Vxlan()/Ether()/IP(dst="192.168.2.1")/UDP()/Raw('x' * 20) - -6. verify packet received by VF0, verify packet content is correct diff --git a/test_plans/index.rst b/test_plans/index.rst index 55d3297..0208a22 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -40,7 +40,6 @@ The following are the test plans for the DPDK DTS automated test system. ABI_stable_test_plan blocklist_test_plan checksum_offload_test_plan - cloud_filter_test_plan coremask_test_plan cvl_advanced_rss_test_plan cvl_advanced_rss_gtpu_test_plan diff --git a/tests/TestSuite_cloud_filter.py b/tests/TestSuite_cloud_filter.py deleted file mode 100644 index abc474f..0000000 --- a/tests/TestSuite_cloud_filter.py +++ /dev/null @@ -1,463 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2020 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 Cloud Filters features in DPDK. - -""" - -import string -import re -import time -import os -from test_case import TestCase -from pmd_output import PmdOutput -from settings import HEADER_SIZE -from packet import Packet - -from scapy.layers.inet import UDP, IP -from scapy.layers.vxlan import VXLAN -from scapy.packet import split_layers, bind_layers - -VXLAN_PORT = 4789 -CLOUD_PORT = 8472 -split_layers(UDP, VXLAN, dport=VXLAN_PORT) -bind_layers(UDP, VXLAN, dport=CLOUD_PORT) - -# -# -# Test class. -# - - -class CloudFilterConfig(object): - - """ - Module for config/verify cloud filter rule - """ - - RULE_TYPE = [ - 'iip', 'imac', 'omac+imac+vni', 'imac+ivlan+vni', 'imac+ivlan'] - - def __init__(self, test_case, pf_intf=""): - self.case = test_case - # make sure pf existed - out = self.case.dut.send_expect( - 'ifconfig %s' % pf_intf, "#", alt_session=True) - self.case.verify("Device not found" not in out, - "Cloud filter need PF interface!!!") - self.pf_intf = pf_intf - self.pkt = Packet() - - def config_rule(self, **kwargs): - """ - Configure cloud filter rule settings, must check rule format - """ - self.rule_idx = 1 - self.case.verify( - 'type' in kwargs, "Cloud filter rule must configure filter type") - rule_type = kwargs['type'] - self.case.verify( - rule_type in self.RULE_TYPE, "Cloud filter rule type not correct") - self.case.verify( - 'vf' in kwargs, "Cloud filter rule must configure device!!!") - self.case.verify( - 'queue' in kwargs, "Cloud filter rule must configure queue index") - if 'loc' in kwargs: - self.rule_idx = kwargs['loc'] - - self.cf_rule = {} - self.cf_rule['type'] = rule_type - self.cf_rule['vf'] = kwargs['vf'] - self.cf_rule['queue'] = kwargs['queue'] - - required_args = rule_type.split('+') - for required_arg in required_args: - self.case.verify(required_arg in kwargs, - "Argument for [%s] missing!!!" % required_arg) - self.cf_rule[required_arg] = kwargs[required_arg] - - if 'ivlan' in self.cf_rule: - self.pkt.assign_layers(['ether', 'ipv4', 'udp', - 'vxlan', 'inner_mac', 'inner_vlan', - 'inner_ipv4', 'inner_tcp', 'raw']) - else: - self.pkt.assign_layers(['ether', 'ipv4', 'udp', - 'vxlan', 'inner_mac', - 'inner_ipv4', 'inner_tcp', 'raw']) - - def ethtool_add(self): - """ - Add cloud filter rule by ethtool and return rule index - """ - ip_fmt = "ethtool -N %(PF)s flow-type ip4 dst-ip %(IP)s user-def " + \ - "%(VNI_VF)s action %(QUEUE)d loc %(ID)d" - ether_fmt = "ethtool -N %(PF)s flow-type ether dst %(OMAC)s m " + \ - "%(OMASK)s src %(IMAC)s m %(IMASK)s user-def %(VNI_VF)s " + \ - "action %(QUEUE)d loc %(ID)d" - ether_vlan_fmt = "ethtool -N %(PF)s flow-type ether dst %(OMAC)s m " + \ - "%(OMASK)s src %(IMAC)s m %(IMASK)s vlan %(VLAN)d " + \ - "user-def %(VNI_VF)s action %(QUEUE)d loc %(ID)d" - - - # generate user define field - vni_vf = '0x' - if 'vni' in self.cf_rule: - vni_str = hex(self.cf_rule['vni'])[2:] - else: - vni_str = 'ffffffff' # without vni - vni_vf += vni_str - vf_str = "%08x" % self.cf_rule['vf'] - vni_vf += vf_str - - if 'omac' in self.cf_rule: - omac_str = self.cf_rule['omac'] - omac_mask = '00:00:00:00:00:00' - else: - omac_str = '00:00:00:00:00:00' - omac_mask = 'ff:ff:ff:ff:ff:ff' - - if 'imac' in self.cf_rule: - imac_str = self.cf_rule['imac'] - imac_mask = '00:00:00:00:00:00' - else: - imac_str = '00:00:00:00:00:00' - imac_mask = 'ff:ff:ff:ff:ff:ff' - - if 'iip' in self.cf_rule: - ip_str = self.cf_rule['iip'] - - if self.cf_rule['type'] == 'iip': - ethtool_cmd = ip_fmt % {'PF': self.pf_intf, - 'IP': ip_str, - 'VNI_VF': vni_vf, - 'QUEUE': self.cf_rule['queue'], - 'ID': self.rule_idx} - elif 'ivlan' in self.cf_rule: - ethtool_cmd = ether_vlan_fmt % {'PF': self.pf_intf, - 'OMAC': omac_str, - 'OMASK': omac_mask, - 'IMAC': imac_str, - 'IMASK': imac_mask, - 'VLAN': self.cf_rule['ivlan'], - 'VNI_VF': vni_vf, - 'QUEUE': self.cf_rule['queue'], - 'ID': self.rule_idx} - else: - ethtool_cmd = ether_fmt % {'PF': self.pf_intf, - 'OMAC': omac_str, - 'OMASK': omac_mask, - 'IMAC': imac_str, - 'IMASK': imac_mask, - 'VNI_VF': vni_vf, - 'QUEUE': self.cf_rule['queue'], - 'ID': self.rule_idx} - - print(ethtool_cmd) - out = self.case.dut.send_expect(ethtool_cmd, "# ", alt_session=True) - self.case.verify("ethtool" not in out, "Add cloud filter failed!!!") - - return self.rule_idx - - def ethtool_delete(self): - """ - Delete cloud filter rule by index and return whether success - """ - self.case.dut.send_expect("ethtool -N %s delete %d" % (self.pf_intf, - self.rule_idx), - "# ", alt_session=True) - - def ethtool_dumprule(self): - """ - Dump cloud filter rule according to index value - """ - pass - - def transmit_packet(self, match=True): - """ - Send packet match or not matched cloud filter rules - """ - ether_cfg = {'src': self.case.tester_mac} - if match: - if 'iip' in list(self.cf_rule.keys()): - self.pkt.config_layer( - 'inner_ipv4', {'dst': self.cf_rule['iip']}) - if 'imac' in list(self.cf_rule.keys()): - self.pkt.config_layer( - 'inner_mac', {'dst': self.cf_rule['imac']}) - if 'omac' in list(self.cf_rule.keys()): - ether_cfg['dst'] = self.cf_rule['omac'] - if 'ivlan' in list(self.cf_rule.keys()): - self.pkt.config_layer( - 'inner_vlan', {'vlan': self.cf_rule['ivlan']}) - if 'vni' in list(self.cf_rule.keys()): - self.pkt.config_layer('vxlan', {'vni': self.cf_rule['vni']}) - - self.pkt.config_layer('ether', ether_cfg) - self.pkt.config_layer('raw', {'payload': ['01'] * 18}) - self.pkt.send_pkt(crb=self.case.tester, tx_port=self.case.tester_intf) - - -class TestCloudFilter(TestCase): - - def set_up_all(self): - """ - vxlan Prerequisites - """ - # this feature only enable in FVL now - self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single"], - "Cloud filter only supported by Fortville") - # Based on h/w type, choose how many ports to use - self.dut_ports = self.dut.get_ports() - - # Verify that enough ports are available - self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") - - # required setting test environment - self.env_done = False - self.vf_queues = 4 - - def setup_vf_env(self): - """ - Create testing environment with 2VFs generated from PF - """ - if self.env_done: - return - - # get PF interface name and opposite tester interface name - self.pf_port = self.dut_ports[0] - self.bind_nics_driver([self.pf_port], driver="i40e") - self.pf_intf = self.dut.ports_info[self.pf_port]['intf'] - tester_port = self.tester.get_local_port(self.pf_port) - self.tester_intf = self.tester.get_interface(tester_port) - self.tester_mac = self.tester.get_mac(tester_port) - pf_numa = self.dut.get_numa_id(self.pf_port) - - self.dut.generate_sriov_vfs_by_port(self.pf_port, 2, driver="default") - - # enable vxlan on PF - self.dut.send_expect("ip li add vxlan0 type vxlan id 1 group " + - "239.1.1.1 local 127.0.0.1 dev %s" % self.pf_intf, - "# ") - self.dut.send_expect("ifconfig vxlan0 up", "# ") - - self.vf_port0 = self.dut.ports_info[self.pf_port]['vfs_port'][0] - self.vf_port1 = self.dut.ports_info[self.pf_port]['vfs_port'][1] - - # bind one vf device to dpdk - self.vf_port0.bind_driver(driver='igb_uio') - self.vf_port1.bind_driver(driver='i40evf') - self.vf_intf = self.vf_port1.intf_name - - # bind vf0 to igb_uio and start testpmd - core_num = self.vf_queues + 1 - cores = "1S/%dC/1T" % core_num - - self.pmdout = PmdOutput(self.dut) - self.pmdout.start_testpmd( - cores, "--rxq=%d --txq=%d --portmask=0x1 --enable-rx-cksum" % - (self.vf_queues, self.vf_queues), socket=pf_numa) - - # rxonly and verbose enabled - self.pmdout.execute_cmd("set nbcore %d" % self.vf_queues) - self.pmdout.execute_cmd("set fwd rxonly") - self.pmdout.execute_cmd("set verbose 1") - self.pmdout.execute_cmd("start") - - self.env_done = True - - def destroy_vf_env(self): - - if getattr(self, 'pmd_output', None): - self.dut.kill_all() - - if getattr(self, 'pf_port', None): - self.dut.destroy_sriov_vfs_by_port(self.pf_port) - self.bind_nics_driver([self.pf_port], driver="igb_uio") - - self.env_done = False - - def bind_nics_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - - def send_and_verify(self, cloud_cfg=None, dpdk=True): - """ - Send packet match cloud filter rule and verify packet received - """ - self.logger.info("Verifying vxlan %s filter" % cloud_cfg.cf_rule['type']) - if dpdk: - cloud_cfg.transmit_packet() - out = self.pmdout.get_output() - queue = cloud_cfg.cf_rule['queue'] - self.verify("queue %d" % - queue in out, "Vxlan not received in queue %d" % queue) - self.verify("VXLAN packet" in out, "Vxlan packet not detected") - self.verify("Inner L4 type: TCP" in out, - "Vxlan inner L4 type not detected") - if 'vni' in list(cloud_cfg.cf_rule.keys()): - vni = cloud_cfg.cf_rule['vni'] - self.verify("VNI = %d" % - vni in out, "Vxlan vni value not correct") - if 'ivlan' in list(cloud_cfg.cf_rule.keys()): - self.verify("Inner L2 type: ETHER_VLAN" in out, - "Vxlan inner vlan not detected") - else: - # packet received on dut VF device - tmp_file = '/tmp/cloud_filter_%s.pcap' % self.vf_intf - sniff_cmd = ('tcpdump -w ' + tmp_file + - ' -i {0} 2>tcpdump_{0}.out &').format(self.vf_intf) - rm_cmd = 'rm -f ' + tmp_file - self.dut.send_expect(rm_cmd, '#', alt_session=True) - self.dut.send_expect(sniff_cmd, '#', alt_session=True) - # wait for interface promisc enable - time.sleep(2) - cloud_cfg.transmit_packet() - self.dut.send_expect('killall tcpdump', '#', alt_session=True) - # wait for pcap file saved - time.sleep(2) - # copy pcap to tester and then analyze - self.dut.session.copy_file_from(tmp_file) - pkt = Packet() - pkt.read_pcapfile(filename="cloud_filter_%s.pcap" % self.vf_intf) - self.verify( - len(pkt) == 1, "%d packet recevied on kernel VF" % len(pkt)) - cap_pkt = pkt[0] - try: - dport = cap_pkt[UDP].dport - self.verify(dport == CLOUD_PORT, - "Captured packet is not vxlan packet") - inner_ip = cap_pkt['VXLAN'][IP].dst - self.verify(inner_ip == cloud_cfg.cf_rule['iip'], - "Inner ip not matched") - except: - print("Kernel VF captured packet not match rule") - raise - - self.logger.info("Verified vxlan %s filter pass" % cloud_cfg.cf_rule['type']) - - def test_cloud_filter(self): - """ - Verify dpdk work with linux driver added cloud filter rule - """ - # setting for cloud filter rule - queue = self.vf_queues - 1 - vni = 1 - vlan = 1 - # add cloud filter rule - rules = [ - {'type': 'iip', 'iip': '192.168.1.1', - 'vf': 0, 'queue': queue, 'loc': 1}, - {'type': 'imac', 'imac': '00:00:00:00:09:00', - 'vf': 0, 'queue': queue, 'loc': 1}, - {'type': 'omac+imac+vni', 'omac': '00:00:00:00:10:00', - 'imac': '00:00:00:00:09:00', 'vni': vni, 'vf': 0, 'queue': queue, - 'loc': 1}, - {'type': 'imac+ivlan+vni', 'imac': '00:00:00:00:09:00', - 'ivlan': vlan, 'vni': vni, 'vf': 0, 'queue': queue, 'loc': 1}, - {'type': 'imac+ivlan', 'imac': '00:00:00:00:09:00', - 'ivlan': vlan, 'vf': 0, 'queue': queue, 'loc': 1}, - ] - cf_cfg = CloudFilterConfig(self, self.pf_intf) - for rule in rules: - cf_cfg.config_rule(**rule) - cf_cfg.ethtool_add() - - self.send_and_verify(cf_cfg) - - cf_cfg.ethtool_delete() - - def test_bifurcated_driver(self): - """ - Verify bifurcated driver work with dpdk VF and kernel VF - """ - rules = [ - {'type': 'iip', 'iip': '192.168.1.1', 'vf': 0, - 'queue': self.vf_queues - 1, 'loc': 1}, - {'type': 'iip', 'iip': '192.168.2.1', 'vf': 1, 'queue': 0, - 'loc': 2}] - - dpdk_cfg = CloudFilterConfig(self, self.pf_intf) - # fdir rule for dpdk VF - dpdk_cfg.config_rule(**rules[0]) - dpdk_cfg.ethtool_add() - self.send_and_verify(dpdk_cfg) - # fdir rule for kernel VF - kernel_cfg = CloudFilterConfig(self, self.pf_intf) - kernel_cfg.config_rule(**rules[1]) - kernel_cfg.ethtool_add() - self.send_and_verify(kernel_cfg, dpdk=False) - - pass - - def set_up(self): - """ - Run before each test case. - """ - self.setup_vf_env() - pass - - def tear_down(self): - """ - Run after each test case. - """ - pass - - def tear_down_all(self): - """ - Run after each test suite. - """ - self.destroy_vf_env() - pass -- 1.8.3.1