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 20806A0093; Tue, 8 Nov 2022 16:16:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16E0342D3B; Tue, 8 Nov 2022 16:16:39 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id F283A400D4 for ; Tue, 8 Nov 2022 16:16:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667920596; x=1699456596; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/QJLB01/X451eneHSj0qGhCamK8wJDjSzPX86F8KQ70=; b=ZT4THohP27ho2v/fobWgiDDtSRELv5gNINE6QxSnjYlaYQ8AvdrmSZxp bdbX8P1WPeT/yk5M+iueUltc7NbWoS/fGWTeamSemxkQ0Vx5O/y3hKcQG 9GSc0EA7bwe6PqeZ+gvWhb1Bml/tTD8onnR1mzO1HBQQp02LUZBJuqZ3R 7zOH3OlU/7kYMAS+Gusnsxe6VvxUMN9uPM8ifY8wJmY13QV5VCGtdbcDf E+fnWw0vbsuF49A4G4W6Y/xcFTGVJt3WqMT1Bd3d/oeGpkPn86LcHSx4g HqekAxt8AdbwckJyvzM8d9QKbHL43yGD0cRoJEc36FdAcm6xM4PExaHCA Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="310715299" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="310715299" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 07:06:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="638816586" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="638816586" Received: from ena3-s2600wft.iind.intel.com ([10.235.221.73]) by fmsmga007.fm.intel.com with ESMTP; 08 Nov 2022 07:06:46 -0800 From: Yogesh Jangra To: dts@dpdk.org Cc: cristian.dumitrescu@intel.com, kamalakannan.r@intel.com, harshad.suresh.narayane@intel.com Subject: [PATCH 2/3] test/flow_classify_softnic: removed the test suite as per dpdk changes Date: Tue, 8 Nov 2022 20:36:35 +0530 Message-Id: <20221108150636.2459852-3-yogesh.jangra@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221108150636.2459852-1-yogesh.jangra@intel.com> References: <20221108150636.2459852-1-yogesh.jangra@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Flow classify softnic testsuite used the Soft NIC driver. In dpdk 22.11 release Soft NIC driver is using rte_swx_pipeline_xxx library. Support for the flow CLI has been removed. So removed the test suite and dependencies related to that. Signed-off-by: Yogesh Jangra --- dep/flow_classify_softnic.tar.gz | Bin 1610 -> 0 bytes .../flow_classify_softnic_test_plan.rst | 1261 ------- test_plans/index.rst | 1 - tests/TestSuite_flow_classify_softnic.py | 3003 ----------------- 4 files changed, 4265 deletions(-) delete mode 100644 dep/flow_classify_softnic.tar.gz delete mode 100644 test_plans/flow_classify_softnic_test_plan.rst delete mode 100644 tests/TestSuite_flow_classify_softnic.py diff --git a/dep/flow_classify_softnic.tar.gz b/dep/flow_classify_softnic.tar.gz deleted file mode 100644 index bbcfe73918dd2eb4efc68ec6662ef610c52bdd7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1610 zcmaLV`CF3t0tIky=1Lna)MSXJWj0hUqY3D6uT}%2q2pwRsTlfbO^zmuqmK2)&5_ax z+?QNiOf;9w(8=Xu<)oNvYNkn=;-H}^4Hyu--|61@{hrT1aL)4_OuDH-*f=@Zz;G$# zIJ1bfNktXWd95ZT;d`SJjSXW4+a>$W` z&h*8P4n2)cr28l7W#=W+TwL<~+uXNMV`Z3I+|$Y^0_)9n_hu?a zY~)&zyrgBOHz>6TVJY)UkF#ehZti%oS|!>|6D8~7;c+x>xEm+3Bn-bQ`Hhl5hP7Hn za51#9NR_Uu>oy@Km`Ofy)y+f8Dc`S_2K$D0eJ_97v2p2@s`3g)M!|?>a#8HQF9<{u zBk@pG9C?9oqp2a;!eZT;!xwTmUa|{`)o5o)R_pwB zWO0Oc19U0y89RFXMbp{Eftg&kQWsJSS4QxU+OQ8cT$JHDE%(sO%sio)>febXzpP%t z91a=tol~M^>>{J#Z8n;3NpezL{nL3bzaQaP5oF=fFKYBH%bL<(c0H1`k~P_Pj8EBx zjC_;Pt)CNIX`_}r#E&=sOs|+tJ2=pgJkr3HTRjp^aPCnERv&K?5hHisE5Byly1G^5 z6ht3rdKDG*;>W&1*69MY*zZ4*9n19-QbOa^TKKDECtoT{Y`)A_5S!>p!<6DdEV}*M^ z*`I3-X3?@ef{p8aZG{4o{Mj4 zQq|C5dNzAVT`Ei+QfVD3N>}gvi#J%Jt0J++HLZWNo zqpZ=Q2X1_pYRjA`yYm@?`h8~vNX_u$* zbw9yn#)=}=BeKr8)Fy#9jl;7?W&lqPiGB2k4%QykA2QU{8%~2+85m(d*a$DTh3_-@ zj9Xg%HCPTct4Rad^s@8tVU12R_2f?x>N42a3+i_?I?dAmRh!Pr64SS)NNhu>a!kC83oXi~uBNtjoA4&JEd2Hb-V6ct tester_port_0 - dut_port_1 <---> tester_port_1 - dut_port_2 <---> tester_port_2 - dut_port_3 <---> tester_port_3 - -Assume four DUT 10G Ethernet ports' pci device id is as the following:: - - dut_port_0 : "0000:05:00.0" - dut_port_1 : "0000:05:00.1" - dut_port_2 : "0000:05:00.2" - dut_port_3 : "0000:05:00.3" - -Bind them to dpdk igb_uio driver:: - - ./usertools/dpdk-devbind.py -b igb_uio 05:00.0 05:00.1 05:00.2 05:00.3 - -Change ./drivers/net/softnic/firmware.cli to meet the specific test environment. -Change ports info to your actual ports info:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - link LINK2 dev 0000:05:00.2 - link LINK3 dev 0000:05:00.3 - -Other changes are shown in each case. - -Start softnic with following command line:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 \ - --vdev 'net_softnic0,firmware=./drivers/net/softnic/firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --portmask=0x10 - testpmd> start - -Test Case: ipv4 ACL table -========================= -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_acl_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Validate a rule:: - - flow validate 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 17 / udp src mask \ - 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 3 / end - -4. Add rules to table:: - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 17 / udp src mask \ - 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 3 / end - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask - 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 2 / end - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.192.0.0 \ - dst mask 0.0.0.0 src spec 2.128.0.0 dst spec 0.0.0.0 proto spec 132 / sctp src mask \ - 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 4.0.0.0 proto spec 17 / udp src mask \ - 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end - testpmd> start - -5. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.64.0.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='2.128.0.0', dst='0.0.0.0',proto=132)/SCTP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='4.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='3.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.64.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='2.128.0.0', dst='0.0.0.0',proto=132)/SCTP(sport=101, dport=200)/('X'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last 3 packets weren't forwarded. - -6. Query the rule:: - - testpmd> flow query 4 3 queue - Cannot query action type 6 (QUEUE) - -7. destroy and flush the rule:: - - testpmd> flow list 4 - ID Group Prio Attr Rule - 0 0 0 i-- ETH IPV4 UDP => QUEUE - 1 0 0 i-- ETH IPV4 TCP => QUEUE - 2 0 0 i-- ETH IPV4 SCTP => QUEUE - 3 0 0 i-- ETH IPV4 UDP => QUEUE - - testpmd> flow destroy 4 rule 1 - Flow rule #1 destroyed - testpmd> flow list 4 - ID Group Prio Attr Rule - 0 0 0 i-- ETH IPV4 UDP => QUEUE - 2 0 0 i-- ETH IPV4 SCTP => QUEUE - 3 0 0 i-- ETH IPV4 UDP => QUEUE - -8. Send packets, pkt1 to port3, pkt2 can't be forwarded, pkt3 to port1, pkt4 to port0:: - - testpmd> flow flush 4 - testpmd> flow list 4 - - No rule listed. - Send the first 4 packets, none of them was forwarded. - -9. Shutdown the port, the rules will be flushed. - Re-add the four rules, then start forward. - The first 4 packets can be forwarded to port3/2/1/0. - Then:: - - testpmd> stop - testpmd> port stop 4 - testpmd> port start 4 - testpmd> start - - Send the first 4 packets, none of them was forwarded. - -Notes: The IPv4 header source address mask must be set from high bits to low bits. -255.255.192.0 is legal. -255.192.255.0 is illegal. - -Test Case: ipv4-5tuple hash table -================================= -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF \ - offset 278 buckets 16K size 64K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 6 / udp src mask \ - 65535 dst mask 65535 src spec 101 dst spec 201 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 100.0.0.2 dst spec 200.0.0.2 proto spec 17 / udp src mask \ - 65535 dst mask 65535 src spec 102 dst spec 202 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 100.0.0.3 dst spec 200.0.0.3 proto spec 132 / udp src mask \ - 65535 dst mask 65535 src spec 103 dst spec 203 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 100.0.0.4 dst spec 200.0.0.4 proto spec 17 / udp src mask \ - 65535 dst mask 65535 src spec 104 dst spec 204 / end actions queue index 0 / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.0.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.0.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.0.4',proto=17)/UDP(sport=104, dport=204)/('X'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - Change any parameter of the 5 tuple, the packet can't forwarded to any port. - -Test Case: ipv4-addr hash table -=============================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv4 offset 270 fwd - -a) Match ipv4 src_addr:: - - pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0 - -b) Match ipv4 dst_addr:: - - pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0 - -c) Match UDP SPORT:: - - pipeline RX table match hash ext key 8 mask FFFF000000000000 offset 290 buckets 16K size 64K action AP0 - - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table. - -a) Match the table a:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \ - 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \ - 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.2 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \ - 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.3 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \ - 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.4 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end - -b) Match the table b:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.1.1 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.2.1 proto spec 132 / sctp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.3.1 / end actions queue index 0 / end - -c) Match the table c:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 65535 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 6 / tcp src mask 65535 \ - dst mask 0 src spec 101 dst spec 200 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 132 / sctp src mask 65535 \ - dst mask 0 src spec 102 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 65535 \ - dst mask 0 src spec 103 dst spec 200 / end actions queue index 0 / end - - testpmd> start - - Notes: The added rule must be consistent with the match table format defined in firmware.cli - -4. Sent packet, verify the packets were forwarded to the expected ports. - -a) Match ipv4 src_addr:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.0.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.0.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.0.4')/('X'*48), iface="enp131s0f3") - - The 4 packets were forwarded to port3/2/1/0. - Change the ipv4 src address, the packet can't forwarded to any port. - -b) Match ipv4 dst_addr:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.2.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.3.4')/('X'*48), iface="enp131s0f3") - - The 4 packets were forwarded to port3/2/1/0. - Change the ipv4 first 6 bytes of dst address, the packet can't forwarded to any port. - -c) Match sport:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=100, dport=201)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=101, dport=202)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.2.3',proto=132)/SCTP(sport=102, dport=203)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=103, dport=202)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.3.4')/('X'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last packet can't forwarded to any port. - Change the udp/tcp/sctp sport, the packet can't forwarded to any port. - -Test Case: ipv6 ACL table -========================= -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_acl_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src \ - mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src \ - mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 dst spec 0:0:0:0:0:0:0:0 proto spec 6 \ - / tcp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src \ - mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:7789 dst spec 0:0:0:0:0:0:0:0 proto spec 132 \ - / sctp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src \ - mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:8789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 65535 dst mask 0 src spec 101 dst spec 0 / end actions queue index 0 / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2",nh=6)/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2",nh=132)/SCTP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2",nh=17)/UDP(sport=101, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2",nh=17)/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last 3 packets weren't forwarded. - -Test Case: ipv6-addr hash table -=============================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv6 offset 270 fwd - -a) Match ipv6 src_addr:: - - pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0 - -b) Match ipv6 dst_addr:: - - pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0 - - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table. - -a) Match ipv6 src_addr:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:7789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:8789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 0 / end - -b) Match ipv6 dst_addr:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \ - dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \ - dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \ - dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:7789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \ - dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:8789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 0 / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports. - -a) Match ipv6 src_addr:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - -b) Match ipv6 dst_addr:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last packet weren't be forwarded to any port. - -Test Case: ipv6-5tuple hash table -================================= -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 65535 dst mask 65535 src spec 31 dst spec 41 \ - / end actions queue index 3 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::2 dst spec 0::2 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 32 dst spec 42 - / end actions queue index 2 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::3 dst spec 0::3 proto spec 132 / sctp src mask 65535 dst mask 65535 src spec 33 dst spec 43 \ - / end actions queue index 1 / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::4 dst spec 0::4 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 34 dst spec 44 \ - / end actions queue index 0 / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="0::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::3", dst="0::3",nh=132)/SCTP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::4", dst="0::4")/TCP(sport=34, dport=44)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last packet weren't be forwarded to any port. - -Test Case: ipv4 rule item inconsistent with table match format -============================================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv4 offset 270 fwd - -a) Match ipv4 src_addr:: - - pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0 - -b) Match ipv4 dst_addr:: - - pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0 - - Map the flowapi to softnic table:: - - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table. - -a) Map the table a:: - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end - - Error reported, rule item is inconsistent with the table match. - Table with hask key mask for src addr, but the rule added is for dst addr. - -b) Map the table b:: - - flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \ - dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end - - Error reported, rule item is inconsistent with the table match. - Table with hask key mask for dst addr 255.255.255.0, but the rule added is 255.255.255.255. - -Test Case: ipv6 rule item inconsistent with table match format -============================================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv6 offset 270 fwd - -a) Match ipv6 5tuple:: - - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -b) Match ipv6 dst_addr:: - - pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table. - -a) Map the table a:: - - flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src mask \ - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 0 dst mask 65535 \ - src spec 31 dst spec 41 / end actions queue index 3 / end - - Error reported, rule item is inconsistent with the table match. - Table with hask key mask for 5 tuple, but the rule added mask udp src with 0. - -b) Map the table b:: - - flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 src mask \ - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 src spec \ - ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \ - / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end - - Error reported, rule item is inconsistent with the table match. - Table with hask key mask for dst addr, but the rule added is for src addr. - -Test Case: ipv4 hash table rss action -===================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv4 offset 270 fwd balance offset 278 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF outoffset 256 - -a) Table a:: - - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0 - -b) Table b:: - - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFF00FFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0 - -c) Table c:: - - pipeline RX table match hash ext key 8 mask FFFF0000FFFFFFFF offset 282 buckets 16K size 64K action AP0 - - Map the flowapi to softnic table:: - - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_rss_firmware.cli,cpu_id=1,conn_port=8086' - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table. - -a) Map the table a:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 17 / udp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 2 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.2 dst spec 2.20.21.2 proto spec 132 / sctp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 1 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.3 dst spec 2.20.21.3 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 end / end - -b) Map the table b:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.0 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 1 2 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.0 \ - dst mask 255.255.255.255 src spec 1.10.12.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 1 2 3 end / end - -c) Map the table c:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions rss queues 0 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions rss queues 2 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \ - dst mask 255.255.255.255 src spec 2.10.11.0 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions rss queues 1 2 end / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports. - -a) Match the table a:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.1", dst="2.20.21.1")/UDP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.2", dst="2.20.21.2")/SCTP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.3", dst="2.20.21.3")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.3", dst="2.20.21.3")/TCP(sport=101, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last packet weren't be forwarded to any port. - -b) Match the table b:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - Set the src address from 1.10.11.0 to 1.10.11.255, and other parameters keep constant, - The packets were distributed from port0 to port3 according to RSS table.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.12.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - Set the src address from 1.10.12.0 to 1.10.12.255, and other parameters keep constant, - The packets were distributed from port0 to port3 according to RSS table.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.13.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The packet was not be forwarded to any port. - -c) Match the table c:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - Set the IP src address from 1.10.0.0 to 1.10.255.255, the packet was forwarded to port0.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - Set the IP src address from 1.10.0.0 to 1.10.255.255, or set sport or dport to 0-65535, the packet was forwarded to port2 or port3.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="2.10.11.0", dst="2.20.21.1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - Set the IP src address from 1.10.0.0 to 1.10.255.255, or set sport or dport to 0-65535, the packet was forwarded to port1 or port2.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The packet weren't be forwarded to any port. - -Test Case: ipv6 hash table rss action -===================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below:: - - table action profile AP0 ipv6 offset 270 fwd balance offset 274 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 outoffset 256 - -a) Table a:: - - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - -b) Table b:: - - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - -c) Table c:: - - pipeline RX table match hash ext key 64 mask 00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - - Map the flowapi to softnic table:: - - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_rss_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10 - -3. Add rules to table, - -a) Map the table a:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 65535 dst mask 65535 \ - src spec 31 dst spec 41 / end actions rss queues 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::2 dst spec 0::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 32 dst spec 42 / end actions rss queues 2 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::3 dst spec 0::3 proto spec 132 / sctp src mask 65535 dst mask 65535 \ - src spec 33 dst spec 43 / end actions rss queues 1 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 2001::4 dst spec 0::4 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 34 dst spec 44 / end actions rss queues 0 end / end - -b) Map the table b:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:0 dst spec 0::1 proto spec 17 / udp src mask 65535 \ - dst mask 65535 src spec 31 dst spec 41 / end actions rss queues 0 1 2 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec ABCD:EF01:2345:6789:ABCD:EF01:2346:0 dst spec 0::1 proto spec 17 / udp src mask 65535 \ - dst mask 65535 src spec 31 dst spec 41 / end actions rss queues 0 1 2 3 end / end - -c) Map the table c:: - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \ - src spec 2001::1 dst spec 1001::1 proto spec 17 / udp src mask 65535 dst mask 65535 \ - src spec 31 dst spec 41 / end actions rss queues 0 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \ - src spec 2001::2 dst spec 1001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 32 dst spec 42 / end actions rss queues 2 3 end / end - - testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \ - src spec 2001::1 dst spec 2001::3 proto spec 132 / sctp src mask 65535 dst mask 65535 \ - src spec 33 dst spec 43 / end actions rss queues 1 2 end / end - - testpmd> start - -4. Sent packet, verify the packets were forwarded to the expected ports. - -a) Match the table a:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="0::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::3", dst="0::3",nh=132)/SCTP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::4", dst="0::4")/TCP(sport=34, dport=44)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - The first 4 packets were forwarded to port3/2/1/0. - The last packet weren't be forwarded to any port. - -b) Match the table b:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - Set the src address from ABCD:EF01:2345:6789:ABCD:EF01:2345:0 to ABCD:EF01:2345:6789:ABCD:EF01:2345:FFFF, and other parameters keep constant, - The packets were distributed from port0 to port3 according to RSS table.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2346:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - Set the src address from ABCD:EF01:2345:6789:ABCD:EF01:2346:0 to ABCD:EF01:2345:6789:ABCD:EF01:2346:FFFF, and other parameters keep constant, - The packets were distributed from port0 to port3 according to RSS table.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2347:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - The packet was not be forwarded to any port. - -c) Match the table c:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="1001::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - Set the IPv6 dst address from 1001::0 to 1001::FFFF, the packet was forwarded to port0.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="1001::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3") - - Set the IPv6 dst address from 1001::0 to 1001::FFFF, the packet was forwarded to port2 or port3.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="2001::3")/TCP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3") - - Set the IPv6 dst address from 2001::0 to 2001::FFFF, the packet was forwarded to port1 or port2.:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3") - - The packet weren't be forwarded to any port. - -Test Case: ipv4 ACL table jump action -===================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \ - dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="0.0.0.0", dst="2.0.0.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IP(src="0.0.0.0", dst="2.64.0.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - If change the TCP sport or dport, the packet can't be forwarded to any port. - -Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created. -So the packets can't be forwarded. - -Test Case: ipv4 HASH table jump action -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFF00000000 offset 278 buckets 16K size 64K action AP0 - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFF00000000 offset 278 buckets 16K size 64K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 \ - src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 \ - / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 \ - src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 \ - / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 \ - src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 \ - / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 \ - src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 \ - / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - If change the IPv4 dst address or src address, the packet can't be forwarded to any port. - -Notes: when only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created. -So the packets can't be forwarded. - -Test Case: ipv4 ACL jump to HASH table -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - Group 0 with ACL table jump to group 1 with HASH table:: - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_acl_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - If change the IPv4 dst address or src address, the packet can't be forwarded to any port:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=101, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=201)/('X'*48), iface="enp131s0f3") - - The two packets can't be forwarded to any port. - -Test Case: ipv4 HASH jump to ACL table -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - Group 0 with ACL table jump to group 1 with HASH table:: - - table action profile AP0 ipv4 offset 270 fwd - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFF00FFFFFFFF offset 278 buckets 16K size 64K action AP0 - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv4_hash_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \ - dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.0 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \ - dst mask 255.255.255.0 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 65535 \ - dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.2',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.3',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - The last two packets can't be forwarded to any ports. - -Test Case: ipv6 ACL table jump action -===================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \ - / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask \ - ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::1 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \ - / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::2 proto spec 6 \ - / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - The third packet was forwarded to port 0, the fourth packet can't be forwarded to any port. - -Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created. -So the packets can't be forwarded. - -Test Case: ipv6 HASH table jump action -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::2 dst spec 2001::2 proto spec 17 / udp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::2 dst spec 2001::2 proto spec 17 / udp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/UDP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - If change the IPv6 dst address or src address, the packet can't be forwarded to any port. - -Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created. -So the packets can't be forwarded. - -Test Case: ipv6 ACL jump to HASH table -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - Group 0 with ACL table jump to group 1 with HASH table:: - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_acl_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \ - src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask 0:0:0:0:0:0:0:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 \ - dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask 0:0:0:0:0:0:0:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::2 dst spec 2001::2 proto spec 6 \ - / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::3", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::4", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - The last two packets can't be forwarded to any ports. - -Test Case: ipv6 HASH jump to ACL table -====================================== -1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below, - Just two links:: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - - Group 0 with ACL table jump to group 1 with HASH table:: - - table action profile AP0 ipv6 offset 270 fwd - pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0 - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - flowapi map group 0 ingress pipeline RX table 0 - flowapi map group 1 ingress pipeline RX table 1 - -2. Start softnic:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \ - firmware=./drivers/net/softnic/flow_ipv6_hash_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \ - -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4 - -3. Add rules to table:: - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \ - dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \ - / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end - - testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 0 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \ - src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ - src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end - -4. Sent packet, verify the packets were forwarded to the expected ports:: - - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=201)/Raw('x'*48), iface="enp131s0f3") - sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=202)/Raw('x'*48), iface="enp131s0f3") - - The first packet was forwarded to port 0, the second was forwarded to port 1. - The last two packets can't be forwarded to any ports. diff --git a/test_plans/index.rst b/test_plans/index.rst index dc782fdf..a47e5eaf 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -70,7 +70,6 @@ The following are the test plans for the DPDK DTS automated test system. external_mempool_handler_test_plan firmware_version_test_plan floating_veb_test_plan - flow_classify_softnic_test_plan i40e_rss_input_test_plan generic_flow_api_test_plan hotplug_mp_test_plan diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py deleted file mode 100644 index a3a0eed5..00000000 --- a/tests/TestSuite_flow_classify_softnic.py +++ /dev/null @@ -1,3003 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2018 Intel Corporation -# - -import os -import random -import re -import time -from time import sleep - -import scapy.layers.inet -from scapy.arch import get_if_hwaddr -from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import ARP, GRE, Dot1Q -from scapy.layers.sctp import SCTP, SCTPChunkData -from scapy.packet import Raw, bind_layers -from scapy.route import * -from scapy.sendrecv import sendp, sniff -from scapy.utils import hexstr, rdpcap, wrpcap - -import framework.utils as utils -from framework.crb import Crb -from framework.dut import Dut -from framework.exception import VerifyFailure -from framework.packet import Packet -from framework.pmd_output import PmdOutput -from framework.project_dpdk import DPDKdut -from framework.settings import DRIVERS, HEADER_SIZE -from framework.test_case import TestCase -from framework.virt_dut import VirtDut - - -class TestFlowClassifySoftnic(TestCase): - def copy_config_files_to_dut(self): - """ - Copy firmware.cli from tester to DUT. - """ - file = "flow_classify_softnic.tar.gz" - src_file = r"./dep/%s" % file - dst1 = "/tmp" - dst2 = "/root/dpdk/drivers/net/softnic" - self.dut.session.copy_file_to(src_file, dst1) - self.dut.send_expect("tar xf %s/%s -C %s" % (dst1, file, dst2), "#", 30) - - def start_testpmd(self, filename, port_num): - """ - Start testpmd. - """ - self.cores = self.dut.get_core_list("all") - self.set_ports(filename, port_num) - TESTPMD = self.dut.apps_name["test-pmd"] - cmd = "cat /sys/bus/pci/devices/%s/numa_node" % self.dut_p0_pci - numa_node = int(self.dut.send_expect(cmd, "# ", 60)) - cpu_id = numa_node if numa_node > 0 else 0 - ports_info = [] - for i in range(port_num): - ports_info.append(i) - eal_params = self.dut.create_eal_parameters(cores=self.cores, ports=ports_info) - VDEV = ( - "--vdev 'net_softnic0,firmware=./drivers/net/softnic/flow_classify_softnic/%s,cpu_id=%s,conn_port=8086'" - % (filename, cpu_id) - ) - if port_num == 4: - cmd = "{0} {1} {2} -s 0x10 -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10".format( - TESTPMD, VDEV, eal_params - ) - elif port_num == 2: - cmd = "{0} {1} {2} -s 0x4 -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4".format( - TESTPMD, VDEV, eal_params - ) - else: - raise Exception("The number of port is wrong!") - self.dut.send_expect(cmd, "testpmd> ", 60) - - def set_ports(self, filename, port_num): - """ - Set actual ports. - """ - self.dut.send_expect( - "sed -i '/^link LINK/d' ./drivers/net/softnic/flow_classify_softnic/%s" - % filename, - "# ", - 20, - ) - cmd = ( - "sed -i '1i\link LINK0 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s" - % (self.dut_p0_pci, filename) - ) - self.dut.send_expect(cmd, "# ", 20) - cmd = ( - "sed -i '2i\link LINK1 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s" - % (self.dut_p1_pci, filename) - ) - self.dut.send_expect(cmd, "# ", 20) - if port_num == 4: - cmd = ( - "sed -i '3i\link LINK2 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s" - % (self.dut_p2_pci, filename) - ) - self.dut.send_expect(cmd, "# ", 20) - cmd = ( - "sed -i '4i\link LINK3 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s" - % (self.dut_p3_pci, filename) - ) - self.dut.send_expect(cmd, "# ", 20) - self.dut.send_expect( - "sed -i 's/^thread 4 pipeline/thread %d pipeline/g' ./drivers/net/softnic/flow_classify_softnic/%s" - % (self.port_num, filename), - "# ", - 20, - ) - - def set_table(self, cmd, filename): - """ - Set pipeline table. - """ - self.dut.send_expect( - "sed -i '/^pipeline RX table match/d' ./drivers/net/softnic/flow_classify_softnic/%s" - % filename, - "# ", - 20, - ) - command = ( - "sed -i '/^table action/a" - + cmd - + "' ./drivers/net/softnic/flow_classify_softnic/%s" % filename - ) - self.dut.send_expect(command, "# ", 20) - - def get_flow_direction_param_of_tcpdump(self): - """ - get flow dirction param depend on tcpdump version - """ - param = "" - direct_param = r"(\s+)\[ (\S+) in\|out\|inout \]" - out = self.tester.send_expect("tcpdump -h", "# ", trim_whitespace=False) - for line in out.split("\n"): - m = re.match(direct_param, line) - if m: - opt = re.search("-Q", m.group(2)) - if opt: - param = "-Q" + " in" - else: - opt = re.search("-P", m.group(2)) - if opt: - param = "-P" + " in" - if len(param) == 0: - self.logger.info("tcpdump not support direction choice!!!") - return param - - def tcpdump_start_sniff(self, interface, filters=""): - """ - Starts tcpdump in the background to sniff packets that received by interface. - """ - command = "rm -f /tmp/tcpdump_{0}.pcap".format(interface) - self.tester.send_expect(command, "#") - command = "tcpdump -n -e {0} -w /tmp/tcpdump_{1}.pcap -i {1} {2} 2>/tmp/tcpdump_{1}.out &".format( - self.param_flow_dir, interface, filters - ) - self.tester.send_expect(command, "# ") - - def tcpdump_stop_sniff(self): - """ - Stops the tcpdump process running in the background. - """ - self.tester.send_expect("killall tcpdump", "# ") - # For the [pid]+ Done tcpdump... message after killing the process - sleep(1) - self.tester.send_expect('echo "Cleaning buffer"', "# ") - sleep(3) - - def write_pcap_file(self, pcap_file, pkts): - try: - wrpcap(pcap_file, pkts) - except: - raise Exception("write pcap error") - - def read_pcap_file(self, pcap_file): - pcap_pkts = [] - try: - pcap_pkts = rdpcap(pcap_file) - except: - raise Exception("write pcap error") - - return pcap_pkts - - def send_and_sniff_pkts(self, from_port, to_port, pcap_file, filters="", count=1): - """ - Sent pkts that read from the pcap_file. - Return the sniff pkts. - """ - self.pmdout.wait_link_status_up("all") - tx_port = self.tester.get_local_port(self.dut_ports[from_port % self.port_num]) - rx_port = self.tester.get_local_port(self.dut_ports[to_port % self.port_num]) - - tx_interface = self.tester.get_interface(tx_port) - rx_interface = self.tester.get_interface(rx_port) - # check tester's link status before send packet - for iface in [tx_interface, rx_interface]: - self.verify( - self.tester.is_interface_up(intf=iface), - "Wrong link status, should be up", - ) - - self.tcpdump_start_sniff(rx_interface, filters) - - # Prepare the pkts to be sent - self.tester.scapy_foreground() - self.tester.scapy_append('pkt = rdpcap("%s")' % (pcap_file)) - self.tester.scapy_append( - 'sendp(pkt, iface="%s", count=%d)' % (tx_interface, count) - ) - self.tester.scapy_execute() - - self.tcpdump_stop_sniff() - - return self.read_pcap_file("/tmp/tcpdump_%s.pcap" % rx_interface) - - def send_pkts(self, from_port, pcap_file, count=1): - """ - Sent pkts that read from the pcap_file. - """ - tx_port = self.tester.get_local_port(self.dut_ports[from_port]) - tx_interface = self.tester.get_interface(tx_port) - - # Prepare the pkts to be sent - self.tester.scapy_foreground() - self.tester.scapy_append('pkt = rdpcap("%s")' % (pcap_file)) - self.tester.scapy_append( - 'sendp(pkt, iface="%s", count=%d)' % (tx_interface, count) - ) - self.tester.scapy_execute() - - def send_and_check_packets( - self, pcap_file, pkt, ltype, src_dst, addr_port, from_port, to_port - ): - """ - Sent pkts that read from the pcap_file. - Check if the rule works. - """ - self.write_pcap_file(pcap_file, pkt) - checklist = [] - if ltype in ["udp", "tcp", "sctp"]: - filters = "%s %s port %d" % (ltype, src_dst, addr_port) - sniff_pkts = self.send_and_sniff_pkts( - from_port, to_port, pcap_file, filters - ) - for packet in sniff_pkts: - if src_dst == "src": - checklist.append(packet.getlayer(2).sport) - elif src_dst == "dst": - checklist.append(packet.getlayer(2).dport) - elif ltype in ["ipv4", "ipv6"]: - filters = "%s host %s" % (src_dst, addr_port) - sniff_pkts = self.send_and_sniff_pkts( - from_port, to_port, pcap_file, filters - ) - - for packet in sniff_pkts: - if src_dst == "src": - checklist.append(packet.getlayer(1).src) - elif src_dst == "dst": - checklist.append(packet.getlayer(1).dst) - addr_port = str.lower(addr_port) - self.verify(addr_port in checklist, "rule test fail") - - def check_status(self, rx_pkt_num, tx_pkt_num, port): - """ - Check port status - """ - rx_num = 0 - tx_num = 0 - for i in range(port): - stats = self.pmdout.get_pmd_stats(self.dut_ports[i]) - rx_num = rx_num + stats["RX-packets"] - tx_num = tx_num + stats["TX-packets"] - self.verify( - (rx_num == rx_pkt_num) and (tx_num == tx_pkt_num), "The rule failed to work" - ) - - def generate_rules( - self, - operation="create", - port=4, - group=0, - iptype="ipv4", - src_mask="0.0.0.0", - dst_mask="0.0.0.0", - src_spec="0.0.0.0", - dst_spec="0.0.0.0", - protomask=0, - protospec=17, - l4type="udp", - sportmask=0, - dportmask=0, - sportspec=0, - dportspec=0, - action="queue", - index=[], - ): - """ - Generate flow rules - """ - if port == 4: - port = self.port_num - if iptype == "ipv6": - if src_mask == "0.0.0.0": - src_mask = "0:0:0:0:0:0:0:0" - if dst_mask == "0.0.0.0": - dst_mask = "0:0:0:0:0:0:0:0" - if src_spec == "0.0.0.0": - src_spec = "0:0:0:0:0:0:0:0" - if dst_spec == "0.0.0.0": - dst_spec = "0:0:0:0:0:0:0:0" - if action == "queue": - actions = "queue index %d" % (index[0] % port) - elif action == "jump": - actions = "jump group %d" % (index[0] % port) - elif action == "rss": - queue_idx = "" - for queue in index: - queue_idx = queue_idx + str(queue % port) + " " - actions = "rss queues %s end" % queue_idx - - if l4type == "": - self.dut.send_expect( - "flow %s %d group %d ingress pattern eth / %s proto mask %d src mask %s dst mask %s src spec %s dst spec %s / end actions %s / end" - % ( - operation, - port, - group, - iptype, - protomask, - src_mask, - dst_mask, - src_spec, - dst_spec, - actions, - ), - operation, - 60, - ) - else: - self.dut.send_expect( - "flow %s %d group %d ingress pattern eth / %s proto mask %d src mask %s dst mask %s src spec %s dst spec %s proto spec %d / %s src mask %d dst mask %d src spec %d dst spec %d / end actions %s / end" - % ( - operation, - port, - group, - iptype, - protomask, - src_mask, - dst_mask, - src_spec, - dst_spec, - protospec, - l4type, - sportmask, - dportmask, - sportspec, - dportspec, - actions, - ), - operation, - 60, - ) - - def send_continuous_packet(self, ptype, src_dst, src_addr, dst_addr, itf): - """ - Sends continuous packets. - """ - self.pmdout.wait_link_status_up("all") - self.verify( - self.tester.is_interface_up(intf=itf), "Wrong link status, should be up" - ) - self.tester.scapy_foreground() - if src_dst == "src": - if ptype == "ipv4": - var = src_addr.split(".") - string = "." - ipaddr = string.join(var[0:3]) - for i in range(32): - packet = ( - r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="%s.%d", dst="%s", proto=17)/UDP(sport=100, dport=200)], iface="%s")' - % (self.dut_p0_mac, itf, ipaddr, i, dst_addr, itf) - ) - self.tester.scapy_append(packet) - self.tester.scapy_execute() - elif ptype == "ipv6": - var = src_addr.split(":") - string = ":" - if len(var) == 8: - ipaddr = string.join(var[0:7]) - else: - ipaddr = string.join(var[0 : (len(var) - 1)]) - for i in range(16): - packet = ( - r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="%s:%d", dst="%s", nh=17)/UDP(sport=100, dport=200)], iface="%s")' - % (self.dut_p0_mac, itf, ipaddr, i, dst_addr, itf) - ) - self.tester.scapy_append(packet) - self.tester.scapy_execute() - - elif src_dst == "dst": - if ptype == "ipv4": - var = dst_addr.split(".") - string = "." - ipaddr = string.join(var[0:3]) - for i in range(32): - packet = ( - r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="%s", dst="%s.%d", proto=17)/UDP(sport=100, dport=100)], iface="%s")' - % (self.dut_p0_mac, itf, src_addr, ipaddr, i, itf) - ) - self.tester.scapy_append(packet) - self.tester.scapy_execute() - elif ptype == "ipv6": - var = dst_addr.split(":") - string = ":" - if len(var) == 8: - ipaddr = string.join(var[0:7]) - else: - ipaddr = string.join(var[0 : (len(var) - 1)]) - for i in range(16): - packet = ( - r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="%s", dst="%s:%d", nh=17)/UDP(sport=100, dport=200)], iface="%s")' - % (self.dut_p0_mac, itf, src_addr, ipaddr, i, itf) - ) - self.tester.scapy_append(packet) - self.tester.scapy_execute() - - def check_packet_queue(self, queues=[], out=""): - """ - Get the queue which packet enter. - """ - time.sleep(2) - for queue in queues: - self.verify( - "Queue= %d" % (queue % self.port_num) in out, - "There is some queues doesn't work.", - ) - lines = out.split("\r\n") - reta_line = {} - queue_flag = 0 - # collect the hash result and the queue id - for line in lines: - line = line.strip() - if queue_flag == 1: - result_scanner = r"RX-packets:\s?([0-9]+)" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(line) - rxpkt_num = m.group(1) - result_scanner = r"TX-packets:\s?([0-9]+)" - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(line) - txpkt_num = m.group(1) - self.verify( - rxpkt_num == txpkt_num, "There are some packets failed to forward." - ) - queue_flag = 0 - elif line.strip().startswith("------- Forward"): - queue_flag = 1 - - def set_up_all(self): - """ - Run at the start of each test suite. - """ - self.dut_ports = self.dut.get_ports() - self.port_num = len(self.dut_ports) - self.verify( - self.port_num == 2 or self.port_num == 4, - "Insufficient ports for speed testing", - ) - - self.dut_p0_pci = self.dut.get_port_pci(self.dut_ports[0]) - self.dut_p1_pci = self.dut.get_port_pci(self.dut_ports[1]) - self.dut_p0_mac = self.dut.get_mac_address(self.dut_ports[0]) - self.dut_p1_mac = self.dut.get_mac_address(self.dut_ports[1]) - self.pf0_interface = self.dut.ports_info[self.dut_ports[0]]["intf"] - self.pf1_interface = self.dut.ports_info[self.dut_ports[1]]["intf"] - - if self.port_num == 4: - self.dut_p2_pci = self.dut.get_port_pci(self.dut_ports[2]) - self.dut_p3_pci = self.dut.get_port_pci(self.dut_ports[3]) - self.dut_p2_mac = self.dut.get_mac_address(self.dut_ports[2]) - self.dut_p3_mac = self.dut.get_mac_address(self.dut_ports[3]) - self.pf2_interface = self.dut.ports_info[self.dut_ports[2]]["intf"] - self.pf3_interface = self.dut.ports_info[self.dut_ports[3]]["intf"] - - self.ipv4_mask = "255.255.255.255" - self.ipv6_mask = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" - self.portmask = 65535 - self.protomask = 255 - - self.pmdout = PmdOutput(self.dut) - localPort = self.tester.get_local_port(self.dut_ports[0]) - self.tester_itf = self.tester.get_interface(localPort) - self.copy_config_files_to_dut() - - self.param_flow_dir = self.get_flow_direction_param_of_tcpdump() - - def set_up(self): - """ - Run before each test case. - """ - pass - - def test_ipv4_acl_table(self): - """ - Ipv4 ACL table - """ - filename = "flow_ipv4_acl_firmware.cli" - self.start_testpmd(filename, self.port_num) - - # validate rule - self.generate_rules( - operation="validate", - dst_mask="255.192.0.0", - dst_spec="2.0.0.0", - sportspec=100, - dportspec=200, - index=[3], - ) - - # create rule - self.generate_rules( - dst_mask="255.192.0.0", - dst_spec="2.0.0.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[3], - ) - self.generate_rules( - dst_mask="255.192.0.0", - dst_spec="2.64.0.0", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[2], - ) - self.generate_rules( - src_mask="255.192.0.0", - src_spec="2.128.0.0", - protomask=self.protomask, - protospec=132, - l4type="sctp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - dst_mask="255.192.0.0", - dst_spec="4.0.0.0", - protomask=self.protomask, - sportspec=100, - sportmask=self.portmask, - dportmask=self.portmask, - dportspec=200, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.0.0.0", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.64.0.0", proto=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.64.0.0", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="2.128.0.0", dst="0.0.0.0", proto=132) - / SCTP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "2.128.0.0", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="4.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "4.0.0.0", 0, 0) - - # send another 3 packets - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="3.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.64.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="2.128.0.0", dst="0.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(7, 4, self.port_num) - - # query rule - out = self.dut.send_expect("flow query %d 3 queue" % self.port_num, "QUEUE", 60) - - # destroy rule 1 - self.dut.send_expect( - "flow destroy %d rule 1" % self.port_num, "Flow rule #1 destroyed", 60 - ) - destroy_out = self.dut.send_expect( - "flow list %d" % self.port_num, "testpmd> ", 60 - ) - self.verify("1" not in destroy_out, "destroy rule fail") - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.64.0.0", proto=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 2.64.0.0" - sniff_pkts = self.send_and_sniff_pkts(0, 2, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("2.64.0.0" not in dst_ip_list, "rule 1 test fail") - - # flush rules - self.dut.send_expect("flow flush %d" % self.port_num, "testpmd> ", 60) - flush_out = self.dut.send_expect( - "flow list %d" % self.port_num, "testpmd> ", 60 - ) - self.verify("Rule" not in flush_out, "flush rule fail") - self.dut.send_expect("clear port stats all", "testpmd> ", 60) - - # test all the rules - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="2.64.0.0", proto=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="2.128.0.0", dst="0.0.0.0", proto=132) - / SCTP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="4.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 0, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_5tuple_hash_table(self): - """ - Ipv4 5tuple hash table - """ - filename = "flow_ipv4_5tuple_hash_firmware.cli" - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=101, - dportspec=201, - index=[3], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.2", - dst_spec="200.0.0.2", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=102, - dportspec=202, - index=[2], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.3", - dst_spec="200.0.0.3", - protomask=self.protomask, - protospec=132, - l4type="sctp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=103, - dportspec=203, - index=[1], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.4", - dst_spec="200.0.0.4", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=104, - dportspec=204, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="200.0.0.1", proto=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.0.2", proto=17) - / UDP(sport=102, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.3", dst="200.0.0.3", proto=132) - / SCTP(sport=103, dport=203) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.0.4", proto=17) - / UDP(sport=104, dport=204) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.4", 0, 0) - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_addr_hash_table(self): - """ - Ipv4 addr hash table - """ - filename = "flow_ipv4_addr_hash_firmware.cli" - - # match ipv4 src_addr - cmd = "pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - src_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - index=[3], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - src_spec="100.0.0.2", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - index=[2], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - src_spec="100.0.0.3", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - src_spec="100.0.0.4", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="200.0.0.1", proto=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.0.2", proto=17) - / UDP(sport=102, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.3", dst="200.0.0.3", proto=132) - / SCTP(sport=103, dport=203) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.0.4") - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.4", 0, 0) - self.dut.send_expect("quit", "# ", 60) - - # match ipv4 dst_addr - cmd = "pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - dst_mask="255.255.255.0", - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - index=[3], - ) - self.generate_rules( - dst_mask="255.255.255.0", - src_spec="100.0.0.1", - dst_spec="200.0.1.1", - protospec=6, - l4type="tcp", - sportspec=100, - dportspec=200, - index=[2], - ) - self.generate_rules( - dst_mask="255.255.255.0", - src_spec="100.0.0.1", - dst_spec="200.0.2.1", - protospec=132, - l4type="sctp", - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - dst_mask="255.255.255.0", - src_spec="100.0.0.1", - dst_spec="200.0.3.1", - l4type="", - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="200.0.0.1", proto=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.1.2", proto=17) - / UDP(sport=102, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.1.2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.3", dst="200.0.2.3", proto=132) - / SCTP(sport=103, dport=203) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.2.3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.3.4") - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.3.4", 0, 0) - self.dut.send_expect("quit", "# ", 60) - - # match sport - cmd = "pipeline RX table match hash ext key 8 mask FFFF000000000000 offset 290 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - sportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[3], - ) - self.generate_rules( - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - protospec=6, - l4type="tcp", - sportmask=self.portmask, - sportspec=101, - dportspec=200, - index=[2], - ) - self.generate_rules( - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - protospec=132, - l4type="sctp", - sportmask=self.portmask, - sportspec=102, - dportspec=200, - index=[1], - ) - self.generate_rules( - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - sportmask=self.portmask, - sportspec=103, - dportspec=200, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="200.0.0.1", proto=6) - / TCP(sport=100, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "tcp", "src", 100, 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.1.2", proto=17) - / UDP(sport=101, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "udp", "src", 101, 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.3", dst="200.0.2.3", proto=132) - / SCTP(sport=102, dport=203) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "sctp", "src", 102, 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.1.2", proto=17) - / UDP(sport=103, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "udp", "src", 103, 0, 0) - - # send a packet without l4 info - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.3.4") - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_acl_table(self): - """ - Ipv6 acl table - """ - filename = "flow_ipv6_acl_firmware.cli" - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - protomask=self.protomask, - index=[3], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - protomask=self.protomask, - protospec=6, - l4type="tcp", - index=[2], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - protomask=self.protomask, - protospec=132, - l4type="sctp", - index=[1], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", - protomask=self.protomask, - sportmask=self.portmask, - sportspec=100, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - 0, - 3, - ) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - 0, - 2, - ) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2", nh=132) - / SCTP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - 0, - 1, - ) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17) - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "udp", "src", 100, 0, 0) - - # send another 3 packets - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=17) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(7, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_addr_hash_table(self): - """ - Ipv6 addr hash table - """ - filename = "flow_ipv6_addr_hash_firmware.cli" - - # match ipv6 src_addr - cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - index=[3], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - index=[2], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - index=[1], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - 0, - 3, - ) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - 0, - 2, - ) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2", nh=132) - / SCTP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - 0, - 1, - ) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17) - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", - 0, - 0, - ) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - # match ipv6 dst_addr - cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - dst_mask=self.ipv6_mask, - dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - index=[3], - ) - self.generate_rules( - iptype="ipv6", - dst_mask=self.ipv6_mask, - dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - index=[2], - ) - self.generate_rules( - iptype="ipv6", - dst_mask=self.ipv6_mask, - dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - index=[1], - ) - self.generate_rules( - iptype="ipv6", - dst_mask=self.ipv6_mask, - dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", src="2001::2", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "dst", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", - 0, - 3, - ) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", src="2001::2", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "dst", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", - 0, - 2, - ) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", src="2001::2", nh=132) - / SCTP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "dst", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", - 0, - 1, - ) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", src="2001::2", nh=17) - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets( - pcap_file, - pkt, - "ipv6", - "dst", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", - 0, - 0, - ) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", src="2001::2", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_5tuple_hash_table(self): - """ - Ipv6 5tuple hash table - """ - filename = "flow_ipv6_5tuple_hash_firmware.cli" - cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::1", - dst_spec="0::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=101, - dportspec=201, - index=[3], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::2", - dst_spec="0::2", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=102, - dportspec=202, - index=[2], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::3", - dst_spec="0::3", - protomask=self.protomask, - protospec=132, - l4type="sctp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=103, - dportspec=203, - index=[1], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::4", - dst_spec="0::4", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=104, - dportspec=204, - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::1", dst="0::1", nh=17) - / UDP(sport=101, dport=201) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::2", dst="0::2", nh=6) - / TCP(sport=102, dport=202) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::3", dst="0::3", nh=132) - / SCTP(sport=103, dport=203) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::4", dst="0::4", nh=17) - / UDP(sport=104, dport=204) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::4", 0, 0) - - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::1", dst="0::1", nh=6) - / TCP(sport=101, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_inconsistent_rules(self): - """ - Flow rule item is inconsistent with table match format - """ - # ipv4 - filename = "flow_ipv4_addr_hash_firmware.cli" - cmd = "pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.dut.send_expect( - "flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end", - "error", - 60, - ) - self.dut.send_expect("quit", "# ", 60) - - cmd = "pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - self.dut.send_expect( - "flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end", - "error", - 60, - ) - self.dut.send_expect("quit", "# ", 60) - - # ipv6 - filename = "flow_ipv6_5tuple_hash_firmware.cli" - cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - self.dut.send_expect( - "flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 0 dst mask 65535 src spec 31 dst spec 41 / end actions queue index 3 / end", - "error", - 60, - ) - self.dut.send_expect("quit", "# ", 60) - - cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - self.dut.send_expect( - "flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end", - "error", - 60, - ) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_hash_rss_action(self): - """ - Set rss action using acl table. - """ - filename = "flow_ipv4_rss_firmware.cli" - - # match ipv4 src_addr - cmd = "pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[3], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.2", - dst_spec="200.0.0.2", - protomask=self.protomask, - protospec=17, - l4type="udp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[2], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.3", - dst_spec="200.0.0.3", - protomask=self.protomask, - protospec=132, - l4type="sctp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[1], - ) - self.generate_rules( - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="100.0.0.4", - dst_spec="200.0.0.4", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="200.0.0.1", proto=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.2", dst="200.0.0.2", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.3", dst="200.0.0.3", proto=132) - / SCTP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.0.4", proto=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.4", 0, 0) - - # not match test - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.4", dst="200.0.0.4", proto=6) - / TCP(sport=101, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - # match ipv4 src_addr - cmd = "pipeline RX table match hash ext key 16 mask 00FF0000FFFFFF00FFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - self.generate_rules( - src_mask="255.255.255.0", - dst_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0, 1, 2, 3], - ) - self.generate_rules( - src_mask="255.255.255.0", - dst_mask=self.ipv4_mask, - src_spec="100.0.1.2", - dst_spec="200.0.0.1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0, 1, 2, 3], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - self.send_continuous_packet( - "ipv4", "src", "100.0.0.1", "200.0.0.1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0, 1, 2, 3], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv4", "src", "100.0.1.2", "200.0.0.1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0, 1, 2, 3], out) - self.dut.send_expect("quit", "# ", 60) - - # match ipv4 src_addr - cmd = "pipeline RX table match hash ext key 8 mask FFFF0000FFFFFFFF offset 282 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - self.generate_rules( - src_mask="255.255.0.0", - dst_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.1", - sportspec=100, - dportspec=200, - action="rss", - index=[0], - ) - self.generate_rules( - src_mask="255.255.0.0", - dst_mask=self.ipv4_mask, - src_spec="100.0.0.1", - dst_spec="200.0.0.2", - sportspec=100, - dportspec=200, - action="rss", - index=[2, 3], - ) - self.generate_rules( - src_mask="255.255.0.0", - dst_mask=self.ipv4_mask, - src_spec="200.0.0.1", - dst_spec="200.0.0.2", - sportspec=100, - dportspec=200, - action="rss", - index=[1, 2], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - self.send_continuous_packet( - "ipv4", "src", "100.0.0.1", "200.0.0.1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv4", "src", "100.0.1.1", "200.0.0.2", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([2, 3], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv4", "src", "200.0.0.1", "200.0.0.2", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([1, 2], out) - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_hash_rss_action(self): - """ - Set rss action using hash table. - """ - filename = "flow_ipv6_rss_firmware.cli" - - # match ipv6 src_addr - cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::1", - dst_spec="1001::1", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[3], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::2", - dst_spec="1001::2", - protomask=self.protomask, - protospec=17, - l4type="udp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[2], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::3", - dst_spec="1001::3", - protomask=self.protomask, - protospec=132, - l4type="sctp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[1], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="2001::4", - dst_spec="1001::4", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::1", dst="1001::1", nh=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::1", 0, 3) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::2", dst="1001::2", nh=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::2", 0, 2) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::3", dst="1001::3", nh=132) - / SCTP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::3", 0, 1) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::4", dst="1001::4", nh=6) - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::4", 0, 0) - - # not match test - pcap_file = "/tmp/route_4.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="2001::1", dst="1001::1", nh=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - self.check_status(5, 4, self.port_num) - self.dut.send_expect("quit", "# ", 60) - - cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", - dst_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:0", - dst_spec="0::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0, 1, 2, 3], - ) - self.generate_rules( - iptype="ipv6", - src_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", - dst_mask=self.ipv6_mask, - src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2346:0", - dst_spec="0::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0, 1, 2, 3], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - self.send_continuous_packet( - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2345:0", - "0::1", - self.tester_itf, - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0, 1, 2, 3], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv6", - "src", - "ABCD:EF01:2345:6789:ABCD:EF01:2346:0", - "0::1", - self.tester_itf, - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0, 1, 2, 3], out) - self.dut.send_expect("quit", "# ", 60) - - cmd = "pipeline RX table match hash ext key 64 mask 00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0" - self.set_table(cmd, filename) - self.start_testpmd(filename, self.port_num) - - # create rule - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", - src_spec="2001::1", - dst_spec="1001::1", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[0], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", - src_spec="2001::2", - dst_spec="1001::1", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[2, 3], - ) - self.generate_rules( - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", - src_spec="2001::1", - dst_spec="1002::1", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="rss", - index=[1, 2], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - self.send_continuous_packet( - "ipv6", "dst", "2001::1", "1001::1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([0], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv6", "dst", "2001::2", "1001::1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([2, 3], out) - self.dut.send_expect("start", "testpmd> ", 120) - self.send_continuous_packet( - "ipv6", "dst", "2001::1", "1002::1", self.tester_itf - ) - out = self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue([1, 2], out) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_acl_jump(self): - """ - Set jump action using acl table. - """ - filename = "flow_ipv4_acl_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - dst_mask="255.192.0.0", - dst_spec="200.0.0.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - dst_mask="255.192.0.0", - dst_spec="200.64.0.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - dst_mask="255.192.0.0", - dst_spec="200.0.0.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - dst_mask="255.192.0.0", - dst_spec="200.64.0.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="200.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.0", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="200.64.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.64.0.0", 0, 1) - - # destroy rules of group 1 - self.dut.send_expect("flow destroy 2 rule 0", "testpmd> ", 60) - self.dut.send_expect("flow destroy 2 rule 1", "testpmd> ", 60) - destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60) - self.verify("QUEUE" not in destroy_out, "destroy rule fail") - - # rule 2 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="0.0.0.0", dst="200.0.0.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 200.0.0.0" - sniff_pkts = self.send_and_sniff_pkts(0, 0, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("200.0.0.0" not in dst_ip_list, "rule 2 test fail") - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_hash_jump(self): - """ - Set jump action using hash table. - """ - filename = "flow_ipv4_hash_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.0", dst="2.20.21.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.1", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1) - - # destroy rules of group 1 - self.dut.send_expect("flow destroy 2 rule 0", "Flow rule #0 destroyed", 60) - self.dut.send_expect("flow destroy 2 rule 1", "Flow rule #1 destroyed", 60) - destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60) - self.verify("QUEUE" not in destroy_out, "destroy rule fail") - - # rule 2 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.1", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 2.20.21.1" - sniff_pkts = self.send_and_sniff_pkts(0, 1, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("2.20.21.1" not in dst_ip_list, "rule 3 test fail") - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_acl_hash_jump(self): - """ - Set jump action from acl table to hash table. - """ - filename = "flow_ipv4_acl_hash_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.0", dst="2.20.21.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.1", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.0", dst="2.20.21.0", proto=17) - / UDP(sport=101, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.1", proto=17) - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 2, port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv4_hash_acl_jump(self): - """ - Set jump action from hash table to acl table. - """ - filename = "flow_ipv4_hash_acl_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - src_mask=self.ipv4_mask, - dst_mask=self.ipv4_mask, - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask="255.255.255.0", - src_spec="1.10.11.0", - dst_spec="2.20.21.0", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - src_mask=self.ipv4_mask, - dst_mask="255.255.255.0", - src_spec="1.10.11.1", - dst_spec="2.20.21.1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.0", dst="2.20.21.0", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.1", proto=17) - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1) - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.0", dst="2.20.21.2", proto=17) - / UDP(sport=101, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - # rule 3 test - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="1.10.11.1", dst="2.20.21.3", proto=17) - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 2, port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_acl_jump(self): - """ - Set jump action with ipv6 acl table. - """ - filename = "flow_ipv6_acl_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::2", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::2", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::2") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1) - - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0) - - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::2") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 3, port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_hash_jump(self): - """ - Set jump action with ipv6 hash table. - """ - filename = "flow_ipv6_hash_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - protospec=6, - l4type="tcp", - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::2") - / TCP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1) - - # destroy rules of group 1 - self.dut.send_expect("flow destroy 2 rule 0", "Flow rule #0 destroyed", 60) - self.dut.send_expect("flow destroy 2 rule 1", "Flow rule #1 destroyed", 60) - destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60) - self.verify("QUEUE" not in destroy_out, "destroy rule fail") - - # rule 2 test - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 2001::1" - sniff_pkts = self.send_and_sniff_pkts(0, 0, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("2001::1" not in dst_ip_list, "rule 2 test fail") - - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_acl_hash_jump(self): - """ - Set jump action from ipv6 acl table to hash table. - """ - filename = "flow_ipv6_acl_hash_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::2") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1) - - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::3", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::4", dst="2001::2") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 2, port_num) - self.dut.send_expect("quit", "# ", 60) - - def test_ipv6_hash_acl_jump(self): - """ - Set jump action from ipv6 hash table to acl table. - """ - filename = "flow_ipv6_hash_acl_jump_firmware.cli" - port_num = 2 - self.start_testpmd(filename, port_num) - - # create rule - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[0], - ) - self.generate_rules( - port=port_num, - group=1, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - dportmask=self.portmask, - sportspec=100, - dportspec=200, - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::1", - dst_spec="2001::1", - protomask=self.protomask, - sportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.generate_rules( - port=port_num, - iptype="ipv6", - src_mask=self.ipv6_mask, - dst_mask=self.ipv6_mask, - src_spec="1001::2", - dst_spec="2001::2", - protomask=self.protomask, - sportmask=self.portmask, - sportspec=100, - dportspec=200, - action="jump", - index=[1], - ) - self.dut.send_expect("start", "testpmd> ", 60) - - # rule 0 test - pcap_file = "/tmp/route_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0) - - # rule 1 test - pcap_file = "/tmp/route_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::2") - / UDP(sport=100, dport=200) - / ("X" * 48) - ] - self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1) - - pcap_file = "/tmp/route_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::1", dst="2001::1") - / UDP(sport=100, dport=201) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - pcap_file = "/tmp/route_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IPv6(src="1001::2", dst="2001::2") - / UDP(sport=100, dport=202) - / ("X" * 48) - ] - self.write_pcap_file(pcap_file, pkt) - self.send_pkts(0, pcap_file) - - self.check_status(4, 2, port_num) - self.dut.send_expect("quit", "# ", 60) - - def tear_down(self): - - """ - Run after each test case. - """ - self.dut.kill_all() - - def tear_down_all(self): - """ - Run after each test suite. - """ - pass -- 2.34.1