* [dts] [dts 1/4] [PATCH V1] add generic_filter test for niantic NIC @ 2015-05-25 8:54 huilong,xu 2015-05-25 8:54 ` [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC huilong,xu ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: huilong,xu @ 2015-05-25 8:54 UTC (permalink / raw) To: dts From: huilong xu <huilongx.xu@intel.com> Signed-off-by: huilong xu <huilongx.xu@intel.com> --- execution.cfg | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/execution.cfg b/execution.cfg index 3d38026..73d70f6 100644 --- a/execution.cfg +++ b/execution.cfg @@ -17,7 +17,8 @@ test_suites= vlan, ip_pipeline, pmd_bonded, - dynamic_config + dynamic_config, + generic_filter targets= x86_64-native-linuxapp-gcc parameters=nic_type=cfg:func=true -- 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC 2015-05-25 8:54 [dts] [dts 1/4] [PATCH V1] add generic_filter test for niantic NIC huilong,xu @ 2015-05-25 8:54 ` huilong,xu 2015-05-25 8:59 ` Liu, Yong 2015-05-25 8:54 ` [dts] [dts 3/4] [PATCH V1] add generic_filter test plan huilong,xu 2015-05-25 8:54 ` [dts] [dts 4/4] [PATCH V1] add generic filter huilong,xu 2 siblings, 1 reply; 9+ messages in thread From: huilong,xu @ 2015-05-25 8:54 UTC (permalink / raw) To: dts From: huilong xu <huilongx.xu@intel.com> Signed-off-by: huilong xu <huilongx.xu@intel.com> --- execution_FVL.cfg | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/execution_FVL.cfg b/execution_FVL.cfg index c57f33d..7e5151b 100644 --- a/execution_FVL.cfg +++ b/execution_FVL.cfg @@ -3,7 +3,8 @@ crbs=<CRB IP Address> drivername=<driver name igb_uio or vfio-pci> test_suites= checksum_offload, - dynamic_config + dynamic_config, + generic_filter targets= x86_64-native-linuxapp-gcc parameters=nic_type=cfg:func=true -- 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC 2015-05-25 8:54 ` [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC huilong,xu @ 2015-05-25 8:59 ` Liu, Yong 2015-05-25 9:15 ` Xu, HuilongX 0 siblings, 1 reply; 9+ messages in thread From: Liu, Yong @ 2015-05-25 8:59 UTC (permalink / raw) To: Xu, HuilongX, dts Huilong, You can make specified folder named "executions" to save different types of execution files. There will be several different kinds execution files, it will left chaos if we put all files in dts root folder. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilong,xu > Sent: Monday, May 25, 2015 4:54 PM > To: dts@dpdk.org > Subject: [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville > NIC > > From: huilong xu <huilongx.xu@intel.com> > > > Signed-off-by: huilong xu <huilongx.xu@intel.com> > --- > execution_FVL.cfg | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/execution_FVL.cfg b/execution_FVL.cfg > index c57f33d..7e5151b 100644 > --- a/execution_FVL.cfg > +++ b/execution_FVL.cfg > @@ -3,7 +3,8 @@ crbs=<CRB IP Address> > drivername=<driver name igb_uio or vfio-pci> > test_suites= > checksum_offload, > - dynamic_config > + dynamic_config, > + generic_filter > targets= > x86_64-native-linuxapp-gcc > parameters=nic_type=cfg:func=true > -- > 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC 2015-05-25 8:59 ` Liu, Yong @ 2015-05-25 9:15 ` Xu, HuilongX 2015-05-26 1:29 ` Liu, Yong 0 siblings, 1 reply; 9+ messages in thread From: Xu, HuilongX @ 2015-05-25 9:15 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, Yes, this is a good suggest. I will great a folder, and move the FVL execution file to it at next patch. Would you agree? > -----Original Message----- > From: Liu, Yong > Sent: Monday, May 25, 2015 4:59 PM > To: Xu, HuilongX; dts@dpdk.org > Subject: RE: [dts] [dts 2/4] [PATCH V1] add generic_filter test for > fortville NIC > > Huilong, > > You can make specified folder named "executions" to save different types > of execution files. > There will be several different kinds execution files, it will left chaos > if we put all files in dts root folder. > > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilong,xu > > Sent: Monday, May 25, 2015 4:54 PM > > To: dts@dpdk.org > > Subject: [dts] [dts 2/4] [PATCH V1] add generic_filter test for > fortville > > NIC > > > > From: huilong xu <huilongx.xu@intel.com> > > > > > > Signed-off-by: huilong xu <huilongx.xu@intel.com> > > --- > > execution_FVL.cfg | 3 ++- > > 1 files changed, 2 insertions(+), 1 deletions(-) > > > > diff --git a/execution_FVL.cfg b/execution_FVL.cfg > > index c57f33d..7e5151b 100644 > > --- a/execution_FVL.cfg > > +++ b/execution_FVL.cfg > > @@ -3,7 +3,8 @@ crbs=<CRB IP Address> > > drivername=<driver name igb_uio or vfio-pci> > > test_suites= > > checksum_offload, > > - dynamic_config > > + dynamic_config, > > + generic_filter > > targets= > > x86_64-native-linuxapp-gcc > > parameters=nic_type=cfg:func=true > > -- > > 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC 2015-05-25 9:15 ` Xu, HuilongX @ 2015-05-26 1:29 ` Liu, Yong 0 siblings, 0 replies; 9+ messages in thread From: Liu, Yong @ 2015-05-26 1:29 UTC (permalink / raw) To: Xu, HuilongX, dts Agree with you. > -----Original Message----- > From: Xu, HuilongX > Sent: Monday, May 25, 2015 5:16 PM > To: Liu, Yong; dts@dpdk.org > Subject: RE: [dts] [dts 2/4] [PATCH V1] add generic_filter test for > fortville NIC > > Hi yong, > Yes, this is a good suggest. > I will great a folder, and move the FVL execution file to it at next patch. > Would you agree? > > > -----Original Message----- > > From: Liu, Yong > > Sent: Monday, May 25, 2015 4:59 PM > > To: Xu, HuilongX; dts@dpdk.org > > Subject: RE: [dts] [dts 2/4] [PATCH V1] add generic_filter test for > > fortville NIC > > > > Huilong, > > > > You can make specified folder named "executions" to save different types > > of execution files. > > There will be several different kinds execution files, it will left > chaos > > if we put all files in dts root folder. > > > > > -----Original Message----- > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilong,xu > > > Sent: Monday, May 25, 2015 4:54 PM > > > To: dts@dpdk.org > > > Subject: [dts] [dts 2/4] [PATCH V1] add generic_filter test for > > fortville > > > NIC > > > > > > From: huilong xu <huilongx.xu@intel.com> > > > > > > > > > Signed-off-by: huilong xu <huilongx.xu@intel.com> > > > --- > > > execution_FVL.cfg | 3 ++- > > > 1 files changed, 2 insertions(+), 1 deletions(-) > > > > > > diff --git a/execution_FVL.cfg b/execution_FVL.cfg > > > index c57f33d..7e5151b 100644 > > > --- a/execution_FVL.cfg > > > +++ b/execution_FVL.cfg > > > @@ -3,7 +3,8 @@ crbs=<CRB IP Address> > > > drivername=<driver name igb_uio or vfio-pci> > > > test_suites= > > > checksum_offload, > > > - dynamic_config > > > + dynamic_config, > > > + generic_filter > > > targets= > > > x86_64-native-linuxapp-gcc > > > parameters=nic_type=cfg:func=true > > > -- > > > 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dts] [dts 3/4] [PATCH V1] add generic_filter test plan 2015-05-25 8:54 [dts] [dts 1/4] [PATCH V1] add generic_filter test for niantic NIC huilong,xu 2015-05-25 8:54 ` [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC huilong,xu @ 2015-05-25 8:54 ` huilong,xu 2015-05-26 2:11 ` Liu, Yong 2015-05-25 8:54 ` [dts] [dts 4/4] [PATCH V1] add generic filter huilong,xu 2 siblings, 1 reply; 9+ messages in thread From: huilong,xu @ 2015-05-25 8:54 UTC (permalink / raw) To: dts From: huilong xu <huilongx.xu@intel.com> Signed-off-by: huilong xu <huilongx.xu@intel.com> --- test_plans/generic_filter_test_plan.rst | 516 +++++++++++++++++++++++++++++++ 1 files changed, 516 insertions(+), 0 deletions(-) create mode 100644 test_plans/generic_filter_test_plan.rst diff --git a/test_plans/generic_filter_test_plan.rst b/test_plans/generic_filter_test_plan.rst new file mode 100644 index 0000000..b106180 --- /dev/null +++ b/test_plans/generic_filter_test_plan.rst @@ -0,0 +1,516 @@ + .. Copyright (c) <2015>, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + + +Description +===================================================== +This document provides the plan for testing the generic filter feature of 10GbE and 1GbE Ethernet Controller.In `testpmd`, app provides Generic Filter API to manage filter rules for kinds of packets, and calls the API to manage HW filters in HW, or SW filters in SW table. + +* A generic filter provides an ability to identify specific flows or sets of flows and routes them to dedicated queues. +* Based on the Generic Filter mechanism, all the SYN packets are placed in an assigned queue. +* Based on the Generic Filter mechanism, all packets belonging to L3/L4 flows to be placed in a specific HW queue.Each filter consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port) and routes packets into one of the Rx queues +* L2 Ethertype Filters provides an ability to identify packets by their L2 Ethertype and assigns them to receive queues. +`Testpmd` app is used to test all types of HW filters. Case 1~9 are the function test for the above app while case 11,12 are the performance test for Niantic, I350, 82580 and 82576. + + +Prerequisites +=================================================== +Assuming that ports ``0`` and ``1`` are connected to a traffic generator's port ``A`` and ``B``. + +Setup for ``testpmd`` +----------------------------------------------------------------- +Launch the app ``testpmd`` with the following arguments:: + + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=16 --nb-ports=2 + +The -n command is used to select the number of memory channels. It should be matched with the number of memory channels on that setup. The value of rxq and txq is 1 by default, it's necessary to increase them, and make sure rxq and txq more than one. At the same time rss is enable by default, so disable it. Map port queues to statistic counter registers.:: + + testpmd>set stat_qmap rx 0 0 0 + testpmd>set stat_qmap rx 0 1 1 + testpmd>set stat_qmap rx 0 2 2 + testpmd>set stat_qmap rx 0 3 3 +Setup for receive all packet and disable vlan strip function:: + + testpmd>vlan set strip off 0 + testpmd>vlan set strip off 1 + testpmd>vlan set filter off 0 + testpmd>vlan set filter off 1 + testpmd>set flush_rx on + + +Test Case 1: SYN filter +=================================================================== +SYN filters might routes TCP packets with their SYN flag set into an assigned queue. By filtering such packets to an assigned queue, security software can monitor and +act on SYN attacks. + +Enable SYN filters with queue 2 on port 0.:: + + testpmd> add_syn_filter 0 priority high queue 2 + testpmd> get_syn_filter 0 +If SYN Filter is added successfully, it displays:: + + syn filter: on, priority: high, queue: 2 +Then setup for receive:: + + testpmd> start +Configure the traffic generator to send 5 SYN packets and 5 non-SYN packets . +Reading the stats for port 0 after sending packets.:: + + testpmd> stop +Verify that the packets are received (RX-packets incremented)on the queue 2. +Set off SYN filter:: + + testpmd>remove_syn_filter 0 + testpmd>start +Send 5 SYN packets, then reading the stats for port 0 after sending packets.:: + + testpmd> stop +Verify that the packets are not received (RX-packets do not increased)on the queue 2 and syn filter is removed. + + +Test Case 2: 5-tuple Filter +=================================================================== +This filter identifies specific L3/L4 flows or sets of L3/L4 flows and routes them to dedicated queues. Each filter consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port) and routes packets into one of the Rx queues. +The 5-tuple filters are configured via `dst_ip`, `src_ip`, `dst_port`, `src_port`, `protocol` and Mask.This case supports two type NIC(niantic, 82576), and their command line are different. +Enable the 5-tuple Filter with queue 3 on port 0 for niantic. :: + + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 3 index 1 + testpmd> get_5tuple_filter 0 index 1 + +Enable the 5-tuple Filter with queue 3 on port 0 for 82576. :: + + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 + testpmd> get_5tuple_filter 0 index 1 + +If L3/L4 5-tuple Filter is added successfully, it displays:: + + filter[1]: + Destination IP: 0x02020205 mask: 1 + Source IP: 0x02020204 mask: 1 + Destination Port: 0x0001 mask: 1 + Source Port: 0x0000 mask: 1 + protocol_type: tcp mask: 1 + priority: 3 +Then setup for receive:: + + testpmd> start +If the NIC type is niantic, then send different type packets such as (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_por`t=1 `src_port`=1 `protocol`=tcp) and arp. :: + + testpmd> stop +Verify that the packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol` `tcp`)or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp, `flags`=0x2) are received (RX-packets doesn't incremented)on the queue 3.Remove L3/L4 5-tuple filter. +Disable 5-tuple Filters:: + + testpmd>remove_5tuple_filter 0 index 1 + testpmd>start +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp) or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp `flags`=0x2) .Then reading the stats for port 0 after sending packets.:: + + testpmd> stop +Verify that the packets are not received (RX-packets do not increased)on the queue 3. A 5-bit field that masks each of the fields in the 5-tuple (L4 protocol, IP addresses, TCP/UDP ports). +If 5-tuple fields are masked with 0x0 (`mask`=0x0), the filter will routes all the packets(ip) on the assigned queue.For instance, enable the 5-tuple Filters with queue 3 on port 0 for niantic. however, the value of mask is set 0x0:: + + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol tcp mask 0x0 flags 0x0 priority 3 queue 3 index 1 + + +Test Case 3: ethertype filter +=================================================================== +Enable the receipt of ARP packets with queue 2 on port 0:: + + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 2 index 1 + testpmd> get_ethertype_filter 0 index 1 +If ethertype Filters is added successfully, it displays:: + + filter[1]: + ethertype: 0x0806 + priority: disable, 0 + queue: 2 +Then setup for receive:: + + testpmd> start +Configure the traffic generator to send 15 ARP packets and 15 non ARP packets. + + testpmd> stop +Verify that the arp packets are received (RX-packets incremented)on the queue 2 . +remove ethertype filter:: + + testpmd> remove_ethertype_filter 0 index 1 + testpmd> start +Configure the traffic generator to send 15 ARP packets. + + testpmd> stop +Also, you can change the value of priority to set a new filter except the case the value of ethertype is 0x0800 with priority enable .The rest of steps are same. +For instance, enable priority filter(just support niantic):: + + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority enable 1 queue 2 index 1 + +Test Case 4: 10GB Multiple filters +=================================================================== +Enable ethertype filter, SYN filter and 5-tuple Filter on the port 0 at same time. Assigning different filters to different queues on port 0:: + + testpmd> add_syn_filter 0 priority high queue 1 + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 3 index 1 + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol tcp mask 0x1f priority 3 queue 3 index 1 + testpmd> start + +Configure the traffic generator to send different packets. Such as,SYN packets, ARP packets, IP packets and packets with(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp):: + + testpmd> stop +Verify that different packets are received (RX-packets incremented)on the assigned queue. +Remove ethertype filter:: + + testpmd> remove_ethertype_filter 0 index 1 + testpmd>start +Send SYN packets, ARP packets and packets with (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp).:: + + testpmd> stop +Verify that all packets are received (RX-packets incremented)on the assigned queue except arp packets, remove 5-tuple filter:: + + testpmd>remove_5tuple_filter 0 index 1 + testpmd> start +Send different packets such as,SYN packets, ARP packets, packets with (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp):: + + testpmd>stop +Verify that only SYN packets are received (RX-packets incremented)on the assigned queue +set off SYN filter:: + + testpmd>remove_syn_filter 0 + testpmd>start +Configure the traffic generator to send 5 SYN packets. + + testpmd>stop +Verify that the packets are not received (RX-packets do not increased)on the queue 1. + + +Test Case 5: 2-tuple filter +=================================================================== +This case is designed for NIC type:I350, 82580. +Enable the receipt of udp packets with queue 1 on port 0:: + + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 priority 3 queue 1 index 1 + testpmd> get_2tuple_filter 0 index 1 +If 2-tuple Filter is added successfully, it displays:: + + filter[1]: + Destination Port: 0x0040 mask: 1 + protocol: 0x11 mask:1 tcp_flags: 0x00 + priority: 3 queue: 1 +Then setup for receive:: + + testpmd> start +Send 15 udp packets(`dst_port`=15, `protocol`=udp) and 15 non udp packets.Reading the stats for port 0 after sending packets:: + + testpmd> stop + +Verify that the udp packets are received (RX-packets incremented)on the queue 1. +Remove 2tuple filter:: + + testpmd> remove_2tuple_filter 0 index 1 + testpmd> start +Configure the traffic generator to send udp packets(`dst_port`=15, `protocol`=udp). +Reading the stats for port 0 after sending packets:: + + testpmd> stop +Verify that the packets are not received (RX-packets do not increased)on the queue 1. +Also, you can change the value of protocol or dstport or flags to set a new filter.the rest of steps are same.For example:: + +Enable the receipt of UDP packets with queue 1 on port 1:: + + testpmd> add_2tuple_filter 1 protocol 0x011 1 dst_port 64 1 flags 0 priority 3 queue 2 index 2 + +Enable the receipt of TCP packets with flags on queue 1 of port 1:: + + testpmd> add_2tuple_filter 1 protocol 0x06 1 dst_port 64 1 flags 0x3F priority 3 queue 3 index 3 + + +Test Case 6: flex filter +=================================================================== +This case is designed for NIC type:I350, 82576,82580. +Enable the receipt of packets(context) with queue 1 on port 0:: + + testpmd> add_flex_filter 0 len 16 bytes 0x0123456789abcdef0000000008060000 mask 000C priority 3 queue 1 index 0 + testpmd> get_flex_filter 0 index 0 + +If flex Filter is added successfully, it displays:: + filter[0]: + length: 16 + dword[]: 0x01234567 89abcdef 00000000 08060000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 + mask[]: 0b00000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + priority: 3 queue: 1 +Then setup for receive:: + + testpmd> start +Configure the traffic generator to send packets(context) and arp packtes. +Reading the stats for port 0 after sending packets:: + + testpmd> stop +Verify that the arp packets are received (RX-packets incremented)on the queue 1. +Remove flex filter:: + + testpmd> remove_flex_filter 0 index 0 + testpmd> start +Configure the traffic generator to send packets(context).Reading the stats for port 0 after sending packets:: + + testpmd> stop +Verify that the packets are not received (RX-packets do not increased)on the queue 1. Also, you can change the value of length or context or mask to set a new filter.the rest of steps are same.:: + + testpmd> add_flex_filter 0 len 32 bytes 0x0123456789abcdef00000000080600000123456789abcdef0000000008060000 mask 000C000C priority 1 queue 2 index 7 + +Test Case 7: priority filter +=================================================================== +This case is designed for NIC (niantic,I350, 82576 and 82580). If packets are match on different filters with same type, the filter with high priority will be receive packets. For example, packets are match on two five-tuple filters with different priority, the filter with high priority will be receive packets. if packets are match on different filters with different type, packets based on the above criteria and the following order.when syn set priority high, syn filter has highest priority than others filter. And flex filter has higher priority than 2-tuple filter. +If the Nic is niantic, enable the 5-tuple filter:: + + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 2 queue 2 index 1 + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 2 src_port 2 protocol 0x06 mask 0x18 flags 0x0 priority 3 queue 3 index 2 + testpmd> start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp). + + testpmd> stop +packets are received (RX-packets be increased)on the queue 2. +Remove the 5tuple filter with high priority:: + + testpmd>remove_5tuple_filter 0 index 1 + testpmd> start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp) + + testpmd> stop +packets are received (RX-packets be increased)on the queue 3. +If the Nic is I350 or 82580, enable the 2-tuple and flex filters:: + + testpmd> add_flex_filter 0 len 16 bytes 0x0123456789abcdef0000000008000000 mask 000C priority 2 queue 1 index 0 + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 priority 3 queue 2 index 1 + testpmd> start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp). + + testpmd> stop +packets are received (RX-packets be increased)on the queue 2. +Remove the 2tuple filter with high priority:: + + testpmd>remove_2tuple_filter 0 index 1 + testpmd> start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp), + + testpmd> stop +packets are received (RX-packets be increased)on the queue 1. +If the Nic is 82576, enable the syn and 2-tuple filter:: + + testpmd>add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 + testpmd>add_syn_filter 0 priority high queue 2 + testpmd> start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp `flags`="S"). + + testpmd>stop +packets are received (RX-packets be increased)on the queue 2. +Remove the syn filter with high priority:: + + testpmd>remove_syn_filter 0 + testpmd>start +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=tcp `flags`="S"). + + testpmd> stop +packets are received (RX-packets be increased)on the queue 3. + + + +Test Case 8: 1GB Multiple filters +=================================================================== +This case is designed for NIC(I350, 82576,82580). Enable syn filter and ethertype filter on the port 0 at the same time. Assigning different filters to different queues on port 0.Enable the filters:: + + testpmd> add_syn_filter 0 priority high queue 1 + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 3 index 1 + testpmd> start + +Configure the traffic generator to send ethertype packets and arp packets . :: + + testpmd> stop +Then Verify that the packet are received on the queue 1,queue 3. +Remove all the filter:: + + testpmd> remove_syn_filter 0 + testpmd> remove_ethertype_filter 0 index 1 + +Configure the traffic generator to send udp packets and arp packets. Then Verify that the packet are not received on the queue 1 and queue 3 :: + + testpmd> quit + +Test Case 9: jumbo framesize filter +=================================================================== + This case is designed for NIC (niantic,I350, 82576 and 82580). Since ``Testpmd`` could transmits packets with jumbo frame size , it also could transmit above packets on assigned queue. +Launch the app ``testpmd`` with the following arguments:: + + testpmd -c ffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=8 --nb-ports=2 --rxd=1024 --txd=1024 --burst=144 --txpt=32 --txht=8 --txwt=0 --txfreet=0 --rxfreet=64 --mbcache=200 --mbuf-size=2048 --max-pkt-len=9600 + + testpmd>set stat_qmap rx 0 0 0 + testpmd>set stat_qmap rx 0 1 1 + testpmd>set stat_qmap rx 0 2 2 + testpmd>vlan set strip off 0 + testpmd>vlan set strip off 1 + testpmd>vlan set filter off 0 + testpmd>vlan set filter off 1 +Enable the syn filters with large size:: + + testpmd> add_syn_filter 0 priority high queue 1 + testpmd> start + +Configure the traffic generator to send syn packets(framesize=2000) . :: + + testpmd> stop +Then Verify that the packet are received on the queue 1. +Remove the filter:: + + testpmd> remove_syn_filter 0 + +Configure the traffic generator to send syn packets and s. Then Verify that the packet are not received on the queue 1 :: + + testpmd> quit + +Test Case 10: 128 queues +=================================================================== +This case is designed for NIC(niantic). Since NIC(niantic) has 128 transmit queues, it should be supports 128 kinds of filter if Hardware have enough cores. +Launch the app ``testpmd`` with the following arguments:: + + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=128 --txq=128 --nb-cores=16 --nb-ports=2 --total-num-mbufs=60000 + + testpmd>set stat_qmap rx 0 0 0 + testpmd>set stat_qmap rx 0 64 1 + testpmd>set stat_qmap rx 0 64 2 + testpmd>vlan set strip off 0 + testpmd>vlan set strip off 1 + testpmd>vlan set filter off 0 + testpmd>vlan set filter off 1 +Enable the 5-tuple Filters with different queues (64,127) on port 0 for niantic. :: + + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 64 index 1 + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 2 src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 127 index 1 +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp) and (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=2 `src_port`=1 `protocol`=tcp ) . Then reading the stats for port 0 after sending packets. packets are received on the queue 64 and queue 127 + When setting 5-tuple Filter with queue(128), it will display failure because the number of queues no more than 128. + + + +Test Case 11: 10G NIC Performance +=================================================================== +This case is designed for Niantic. It provides the performance data with and without generic filter. :: +Launch app without filter: + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=16 --nb-ports=2 + testpmd> start + +Send the packets stream from packet generator:: + + testpmd> quit +Enable the filters on app:: + + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=16 --nb-ports=2 + + testpmd>set stat_qmap rx 0 0 0 + testpmd>set stat_qmap rx 0 1 1 + testpmd>set stat_qmap rx 0 2 2 + testpmd>set stat_qmap rx 0 3 3 + testpmd>set flush_rx on + testpmd> add_syn_filter 0 priority high queue 1 + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 2 index 1 + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 + testpmd> start + +Send the packets stream from packet generator:: + + testpmd> quit + + + ++-------+---------+---------+ +| Frame | disable | enable | +| Size | filter | filter | ++-------+---------+---------+ +| 64 | | | ++-------+---------+---------+ +| 128 | | | ++-------+---------+---------+ +| 256 | | | ++-------+---------+---------+ +| 512 | | | ++-------+---------+---------+ +| 1024 | | | ++-------+---------+---------+ +| 1280 | | | ++-------+---------+---------+ +| 1518 | | | ++-------+---------+---------+ + + +Test Case 12: 1G NIC Performance +=================================================================== +This case is designed for NIC (I350, 82580, and 82576). It provides the performance data with and without generic filter.:: + + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=16 --nb-ports=2 + testpmd> start + +Send the packets stream from packet generator:: + + testpmd> quit + +Enable the filter :: + + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=16 --nb-ports=2 + + testpmd>set stat_qmap rx 0 0 0 + testpmd>set stat_qmap rx 0 1 1 + testpmd>set stat_qmap rx 0 2 2 + testpmd>set stat_qmap rx 0 3 3 + testpmd>set flush_rx on + testpmd> add_syn_filter 0 priority high queue 1 + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 2 index 1 + testpmd> start + + +Send the packets stream from packet generator:: + + testpmd> quit + + + ++-------+---------+---------+ +| Frame | disable | enable | +| Size | filter | filter | ++-------+---------+---------+ +| 64 | | | ++-------+---------+---------+ +| 128 | | | ++-------+---------+---------+ +| 256 | | | ++-------+---------+---------+ +| 512 | | | ++-------+---------+---------+ +| 1024 | | | ++-------+---------+---------+ +| 1280 | | | ++-------+---------+---------+ +| 1518 | | | ++-------+---------+---------+ -- 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dts] [dts 3/4] [PATCH V1] add generic_filter test plan 2015-05-25 8:54 ` [dts] [dts 3/4] [PATCH V1] add generic_filter test plan huilong,xu @ 2015-05-26 2:11 ` Liu, Yong 2015-05-26 5:33 ` Xu, HuilongX 0 siblings, 1 reply; 9+ messages in thread From: Liu, Yong @ 2015-05-26 2:11 UTC (permalink / raw) To: Xu, HuilongX, dts Huilong, please see my comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilong,xu > Sent: Monday, May 25, 2015 4:54 PM > To: dts@dpdk.org > Subject: [dts] [dts 3/4] [PATCH V1] add generic_filter test plan > > From: huilong xu <huilongx.xu@intel.com> > > > Signed-off-by: huilong xu <huilongx.xu@intel.com> > --- > test_plans/generic_filter_test_plan.rst | 516 > +++++++++++++++++++++++++++++++ > 1 files changed, 516 insertions(+), 0 deletions(-) > create mode 100644 test_plans/generic_filter_test_plan.rst > > diff --git a/test_plans/generic_filter_test_plan.rst > b/test_plans/generic_filter_test_plan.rst > new file mode 100644 > index 0000000..b106180 > --- /dev/null > +++ b/test_plans/generic_filter_test_plan.rst > @@ -0,0 +1,516 @@ > + .. Copyright (c) <2015>, Intel Corporation > + All rights reserved. > + > + Redistribution and use in source and binary forms, with or without > + modification, are permitted provided that the following conditions > + are met: > + > + - Redistributions of source code must retain the above copyright > + notice, this list of conditions and the following disclaimer. > + > + - Redistributions in binary form must reproduce the above copyright > + notice, this list of conditions and the following disclaimer in > + the documentation and/or other materials provided with the > + distribution. > + > + - Neither the name of Intel Corporation nor the names of its > + contributors may be used to endorse or promote products derived > + from this software without specific prior written permission. > + > + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED > + OF THE POSSIBILITY OF SUCH DAMAGE. > + > + > +Description > +===================================================== > +This document provides the plan for testing the generic filter feature of > 10GbE and 1GbE Ethernet Controller. This feature should also cover 40GE FVL card. In `testpmd`, app provides Generic > Filter API to manage filter rules for kinds of packets, and calls the API > to manage HW filters in HW, or SW filters in SW table. > + > +* A generic filter provides an ability to identify specific flows or > sets of flows and routes them to dedicated queues. > +* Based on the Generic Filter mechanism, all the SYN packets are placed > in an assigned queue. > +* Based on the Generic Filter mechanism, all packets belonging to L3/L4 > flows to be placed in a specific HW queue.Each filter consists of a 5- > tuple (protocol, source and destination IP addresses, source and > destination TCP/UDP/SCTP port) and routes packets into one of the Rx > queues > +* L2 Ethertype Filters provides an ability to identify packets by their > L2 Ethertype and assigns them to receive queues. > +`Testpmd` app is used to test all types of HW filters. Case 1~9 are the > function test for the above app while case 11,12 are the performance test > for Niantic, I350, 82580 and 82576. > + > + > +Prerequisites > +=================================================== > +Assuming that ports ``0`` and ``1`` are connected to a traffic > generator's port ``A`` and ``B``. > + > +Setup for ``testpmd`` > +----------------------------------------------------------------- > +Launch the app ``testpmd`` with the following arguments:: > + > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=16 --nb-ports=2 > + > +The -n command is used to select the number of memory channels. It should > be matched with the number of memory channels on that setup. The value of > rxq and txq is 1 by default, it's necessary to increase them, and make > sure rxq and txq more than one. At the same time rss is enable by default, > so disable it. Map port queues to statistic counter registers.:: > + > + testpmd>set stat_qmap rx 0 0 0 > + testpmd>set stat_qmap rx 0 1 1 > + testpmd>set stat_qmap rx 0 2 2 > + testpmd>set stat_qmap rx 0 3 3 > +Setup for receive all packet and disable vlan strip function:: > + > + testpmd>vlan set strip off 0 > + testpmd>vlan set strip off 1 > + testpmd>vlan set filter off 0 > + testpmd>vlan set filter off 1 > + testpmd>set flush_rx on > + > + > +Test Case 1: SYN filter > +=================================================================== > +SYN filters might routes TCP packets with their SYN flag set into an > assigned queue. By filtering such packets to an assigned queue, security > software can monitor and > +act on SYN attacks. > + > +Enable SYN filters with queue 2 on port 0.:: > + > + testpmd> add_syn_filter 0 priority high queue 2 > + testpmd> get_syn_filter 0 > +If SYN Filter is added successfully, it displays:: > + > + syn filter: on, priority: high, queue: 2 > +Then setup for receive:: > + > + testpmd> start > +Configure the traffic generator to send 5 SYN packets and 5 non-SYN > packets . > +Reading the stats for port 0 after sending packets.:: > + > + testpmd> stop > +Verify that the packets are received (RX-packets incremented)on the queue > 2. > +Set off SYN filter:: > + > + testpmd>remove_syn_filter 0 > + testpmd>start > +Send 5 SYN packets, then reading the stats for port 0 after sending > packets.:: > + > + testpmd> stop > +Verify that the packets are not received (RX-packets do not increased)on > the queue 2 and syn filter is removed. > + > + > +Test Case 2: 5-tuple Filter > +=================================================================== > +This filter identifies specific L3/L4 flows or sets of L3/L4 flows and > routes them to dedicated queues. Each filter consists of a 5-tuple > (protocol, source and destination IP addresses, source and destination > TCP/UDP/SCTP port) and routes packets into one of the Rx queues. > +The 5-tuple filters are configured via `dst_ip`, `src_ip`, `dst_port`, > `src_port`, `protocol` and Mask.This case supports two type NIC(niantic, > 82576), and their command line are different. > +Enable the 5-tuple Filter with queue 3 on port 0 for niantic. :: > + 5-tuple case should cover udp and sctp packets. > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 3 index 1 > + testpmd> get_5tuple_filter 0 index 1 > + > +Enable the 5-tuple Filter with queue 3 on port 0 for 82576. :: > + > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > + testpmd> get_5tuple_filter 0 index 1 > + Please explain why flags for 82576 and Niantic have different values. > +If L3/L4 5-tuple Filter is added successfully, it displays:: > + > + filter[1]: > + Destination IP: 0x02020205 mask: 1 > + Source IP: 0x02020204 mask: 1 > + Destination Port: 0x0001 mask: 1 > + Source Port: 0x0000 mask: 1 > + protocol_type: tcp mask: 1 > + priority: 3 > +Then setup for receive:: > + > + testpmd> start > +If the NIC type is niantic, then send different type packets such as > (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_por`t=1 `src_port`=1 > `protocol`=tcp) and arp. :: > + > + testpmd> stop > +Verify that the packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > `src_port`=1 `protocol` `tcp`)or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 > `dst_port`=1 `src_port`=1 `protocol`=tcp, `flags`=0x2) are received (RX- > packets doesn't incremented)on the queue 3.Remove L3/L4 5-tuple filter. > +Disable 5-tuple Filters:: > + > + testpmd>remove_5tuple_filter 0 index 1 > + testpmd>start > +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 > `protocol`=tcp) or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > `src_port`=1 `protocol`=tcp `flags`=0x2) .Then reading the stats for port > 0 after sending packets.:: > + > + testpmd> stop > +Verify that the packets are not received (RX-packets do not increased)on > the queue 3. A 5-bit field that masks each of the fields in the 5-tuple > (L4 protocol, IP addresses, TCP/UDP ports). > +If 5-tuple fields are masked with 0x0 (`mask`=0x0), the filter will > routes all the packets(ip) on the assigned queue.For instance, enable the > 5-tuple Filters with queue 3 on port 0 for niantic. however, the value of > mask is set 0x0:: > + > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol tcp mask 0x0 flags 0x0 priority 3 queue 3 index 1 > + > + > +Test Case 3: ethertype filter > +=================================================================== > +Enable the receipt of ARP packets with queue 2 on port 0:: > + > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > queue 2 index 1 > + testpmd> get_ethertype_filter 0 index 1 > +If ethertype Filters is added successfully, it displays:: > + > + filter[1]: > + ethertype: 0x0806 > + priority: disable, 0 > + queue: 2 > +Then setup for receive:: > + > + testpmd> start > +Configure the traffic generator to send 15 ARP packets and 15 non ARP > packets. > + > + testpmd> stop > +Verify that the arp packets are received (RX-packets incremented)on the > queue 2 . > +remove ethertype filter:: > + > + testpmd> remove_ethertype_filter 0 index 1 > + testpmd> start > +Configure the traffic generator to send 15 ARP packets. > + > + testpmd> stop > +Also, you can change the value of priority to set a new filter except > the case the value of ethertype is 0x0800 with priority enable .The rest > of steps are same. > +For instance, enable priority filter(just support niantic):: > + > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority enable 1 > queue 2 index 1 > + > +Test Case 4: 10GB Multiple filters > +=================================================================== > +Enable ethertype filter, SYN filter and 5-tuple Filter on the port 0 at > same time. Assigning different filters to different queues on port 0:: > + > + testpmd> add_syn_filter 0 priority high queue 1 > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > queue 3 index 1 > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol tcp mask 0x1f priority 3 queue 3 index 1 > + testpmd> start > + Maybe it will be better that each filter redirect packets into different queues. It will help us check whether each queue act as we expected. Is there any case cover the maximum number of queues? We should know the value. > +Configure the traffic generator to send different packets. Such as,SYN > packets, ARP packets, IP packets and packets with(`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp):: > + > + testpmd> stop > +Verify that different packets are received (RX-packets incremented)on the > assigned queue. > +Remove ethertype filter:: > + > + testpmd> remove_ethertype_filter 0 index 1 > + testpmd>start > +Send SYN packets, ARP packets and packets with (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp).:: > + > + testpmd> stop > +Verify that all packets are received (RX-packets incremented)on the > assigned queue except arp packets, remove 5-tuple filter:: > + > + testpmd>remove_5tuple_filter 0 index 1 > + testpmd> start > +Send different packets such as,SYN packets, ARP packets, packets with > (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 > `protocol`=tcp):: > + > + testpmd>stop > +Verify that only SYN packets are received (RX-packets incremented)on the > assigned queue > +set off SYN filter:: > + > + testpmd>remove_syn_filter 0 > + testpmd>start > +Configure the traffic generator to send 5 SYN packets. > + > + testpmd>stop > +Verify that the packets are not received (RX-packets do not increased)on > the queue 1. > + > + > +Test Case 5: 2-tuple filter > +=================================================================== > +This case is designed for NIC type:I350, 82580. > +Enable the receipt of udp packets with queue 1 on port 0:: > + > + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 > priority 3 queue 1 index 1 > + testpmd> get_2tuple_filter 0 index 1 > +If 2-tuple Filter is added successfully, it displays:: > + > + filter[1]: > + Destination Port: 0x0040 mask: 1 > + protocol: 0x11 mask:1 tcp_flags: 0x00 > + priority: 3 queue: 1 > +Then setup for receive:: > + > + testpmd> start > +Send 15 udp packets(`dst_port`=15, `protocol`=udp) and 15 non udp > packets.Reading the stats for port 0 after sending packets:: > + > + testpmd> stop > + > +Verify that the udp packets are received (RX-packets incremented)on the > queue 1. > +Remove 2tuple filter:: > + > + testpmd> remove_2tuple_filter 0 index 1 > + testpmd> start > +Configure the traffic generator to send udp packets(`dst_port`=15, > `protocol`=udp). > +Reading the stats for port 0 after sending packets:: > + > + testpmd> stop > +Verify that the packets are not received (RX-packets do not increased)on > the queue 1. > +Also, you can change the value of protocol or dstport or flags to set a > new filter.the rest of steps are same.For example:: > + Please take care of language syntax. > +Enable the receipt of UDP packets with queue 1 on port 1:: > + > + testpmd> add_2tuple_filter 1 protocol 0x011 1 dst_port 64 1 flags 0 > priority 3 queue 2 index 2 > + > +Enable the receipt of TCP packets with flags on queue 1 of port 1:: > + > + testpmd> add_2tuple_filter 1 protocol 0x06 1 dst_port 64 1 flags 0x3F > priority 3 queue 3 index 3 > + > + > +Test Case 6: flex filter > +=================================================================== > +This case is designed for NIC type:I350, 82576,82580. > +Enable the receipt of packets(context) with queue 1 on port 0:: > + > + testpmd> add_flex_filter 0 len 16 bytes > 0x0123456789abcdef0000000008060000 mask 000C priority 3 queue 1 index 0 Please explain the relation of len and mask. Has this case been covered the max length of flex filter? > + testpmd> get_flex_filter 0 index 0 > + > +If flex Filter is added successfully, it displays:: > + filter[0]: > + length: 16 > + dword[]: 0x01234567 89abcdef 00000000 08060000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 > + mask[]: > 0b000000000000110000000000000000000000000000000000000000000000000000000000 > 00000000000000000000000000000000000000000000000000000000 > + priority: 3 queue: 1 > +Then setup for receive:: > + > + testpmd> start > +Configure the traffic generator to send packets(context) and arp packtes. > +Reading the stats for port 0 after sending packets:: > + > + testpmd> stop > +Verify that the arp packets are received (RX-packets incremented)on the > queue 1. > +Remove flex filter:: > + > + testpmd> remove_flex_filter 0 index 0 > + testpmd> start > +Configure the traffic generator to send packets(context).Reading the > stats for port 0 after sending packets:: > + > + testpmd> stop > +Verify that the packets are not received (RX-packets do not increased)on > the queue 1. Also, you can change the value of length or context or mask > to set a new filter.the rest of steps are same.:: > + > + testpmd> add_flex_filter 0 len 32 bytes > 0x0123456789abcdef00000000080600000123456789abcdef0000000008060000 mask > 000C000C priority 1 queue 2 index 7 > + > +Test Case 7: priority filter > +=================================================================== > +This case is designed for NIC (niantic,I350, 82576 and 82580). If packets > are match on different filters with same type, the filter with high > priority will be receive packets. For example, packets are match on two > five-tuple filters with different priority, the filter with high priority > will be receive packets. if packets are match on different filters with > different type, packets based on the above criteria and the following > order.when syn set priority high, syn filter has highest priority than > others filter. And flex filter has higher priority than 2-tuple filter. > +If the Nic is niantic, enable the 5-tuple filter:: > + > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 2 queue 2 index 1 > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 2 > src_port 2 protocol 0x06 mask 0x18 flags 0x0 priority 3 queue 3 index 2 > + testpmd> start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp). > + > + testpmd> stop > +packets are received (RX-packets be increased)on the queue 2. > +Remove the 5tuple filter with high priority:: > + > + testpmd>remove_5tuple_filter 0 index 1 > + testpmd> start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp) > + > + testpmd> stop > +packets are received (RX-packets be increased)on the queue 3. > +If the Nic is I350 or 82580, enable the 2-tuple and flex filters:: > + > + testpmd> add_flex_filter 0 len 16 bytes > 0x0123456789abcdef0000000008000000 mask 000C priority 2 queue 1 index 0 > + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 > priority 3 queue 2 index 1 > + testpmd> start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp). > + > + testpmd> stop > +packets are received (RX-packets be increased)on the queue 2. > +Remove the 2tuple filter with high priority:: > + > + testpmd>remove_2tuple_filter 0 index 1 > + testpmd> start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp), > + > + testpmd> stop > +packets are received (RX-packets be increased)on the queue 1. > +If the Nic is 82576, enable the syn and 2-tuple filter:: > + > + testpmd>add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > + testpmd>add_syn_filter 0 priority high queue 2 > + testpmd> start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp `flags`="S"). > + > + testpmd>stop > +packets are received (RX-packets be increased)on the queue 2. > +Remove the syn filter with high priority:: > + > + testpmd>remove_syn_filter 0 > + testpmd>start > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=tcp `flags`="S"). > + > + testpmd> stop > +packets are received (RX-packets be increased)on the queue 3. > + > + > + > +Test Case 8: 1GB Multiple filters > +=================================================================== > +This case is designed for NIC(I350, 82576,82580). Enable syn filter and > ethertype filter on the port 0 at the same time. Assigning different > filters to different queues on port 0.Enable the filters:: > + > + testpmd> add_syn_filter 0 priority high queue 1 > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > queue 3 index 1 > + testpmd> start > + > +Configure the traffic generator to send ethertype packets and arp > packets . :: > + > + testpmd> stop > +Then Verify that the packet are received on the queue 1,queue 3. > +Remove all the filter:: > + > + testpmd> remove_syn_filter 0 > + testpmd> remove_ethertype_filter 0 index 1 > + > +Configure the traffic generator to send udp packets and arp packets. Then > Verify that the packet are not received on the queue 1 and queue 3 :: > + > + testpmd> quit > + > +Test Case 9: jumbo framesize filter > +=================================================================== > + This case is designed for NIC (niantic,I350, 82576 and 82580). Since > ``Testpmd`` could transmits packets with jumbo frame size , it also could > transmit above packets on assigned queue. > +Launch the app ``testpmd`` with the following arguments:: > + > + testpmd -c ffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb-cores=8 > --nb-ports=2 --rxd=1024 --txd=1024 --burst=144 --txpt=32 --txht=8 --txwt=0 > --txfreet=0 --rxfreet=64 --mbcache=200 --mbuf-size=2048 --max-pkt-len=9600 > + > + testpmd>set stat_qmap rx 0 0 0 > + testpmd>set stat_qmap rx 0 1 1 > + testpmd>set stat_qmap rx 0 2 2 > + testpmd>vlan set strip off 0 > + testpmd>vlan set strip off 1 > + testpmd>vlan set filter off 0 > + testpmd>vlan set filter off 1 > +Enable the syn filters with large size:: > + > + testpmd> add_syn_filter 0 priority high queue 1 > + testpmd> start > + > +Configure the traffic generator to send syn packets(framesize=2000) . :: > + > + testpmd> stop > +Then Verify that the packet are received on the queue 1. > +Remove the filter:: > + > + testpmd> remove_syn_filter 0 > + > +Configure the traffic generator to send syn packets and s. Then Verify > that the packet are not received on the queue 1 :: > + > + testpmd> quit > + > +Test Case 10: 128 queues > +=================================================================== > +This case is designed for NIC(niantic). Since NIC(niantic) has 128 > transmit queues, it should be supports 128 kinds of filter if Hardware > have enough cores. > +Launch the app ``testpmd`` with the following arguments:: > + > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=128 --txq=128 --nb- > cores=16 --nb-ports=2 --total-num-mbufs=60000 > + > + testpmd>set stat_qmap rx 0 0 0 > + testpmd>set stat_qmap rx 0 64 1 > + testpmd>set stat_qmap rx 0 64 2 Here should be queue 127? > + testpmd>vlan set strip off 0 > + testpmd>vlan set strip off 1 > + testpmd>vlan set filter off 0 > + testpmd>vlan set filter off 1 > +Enable the 5-tuple Filters with different queues (64,127) on port 0 for > niantic. :: > + > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 64 index 1 > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 2 > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 127 index 1 > +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 > `protocol`=tcp) and (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=2 > `src_port`=1 `protocol`=tcp ) . Then reading the stats for port 0 after > sending packets. packets are received on the queue 64 and queue 127 > + When setting 5-tuple Filter with queue(128), it will display failure > because the number of queues no more than 128. > + > + > + > +Test Case 11: 10G NIC Performance > +=================================================================== > +This case is designed for Niantic. It provides the performance data with > and without generic filter. :: > +Launch app without filter: > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=16 --nb-ports=2 > + testpmd> start > + > +Send the packets stream from packet generator:: > + > + testpmd> quit > +Enable the filters on app:: > + > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=16 --nb-ports=2 > + > + testpmd>set stat_qmap rx 0 0 0 > + testpmd>set stat_qmap rx 0 1 1 > + testpmd>set stat_qmap rx 0 2 2 > + testpmd>set stat_qmap rx 0 3 3 > + testpmd>set flush_rx on > + testpmd> add_syn_filter 0 priority high queue 1 > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > queue 2 index 1 > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > + testpmd> start > + Please explain why add three filters here. This case mixed three different types of filter, it's hard to measure performance drop of every filter. It's better to enlarge performance measure scope as list below. Disable all generic filter Enable sync filter Enable ethertype filter Enable one 5tuple filter ... Several samples between maximum. ... Enable maximum 5tuple filter > +Send the packets stream from packet generator:: > + > + testpmd> quit > + > + > + > ++-------+---------+---------+ > +| Frame | disable | enable | > +| Size | filter | filter | > ++-------+---------+---------+ > +| 64 | | | > ++-------+---------+---------+ > +| 128 | | | > ++-------+---------+---------+ > +| 256 | | | > ++-------+---------+---------+ > +| 512 | | | > ++-------+---------+---------+ > +| 1024 | | | > ++-------+---------+---------+ > +| 1280 | | | > ++-------+---------+---------+ > +| 1518 | | | > ++-------+---------+---------+ > + > + > +Test Case 12: 1G NIC Performance > +=================================================================== > +This case is designed for NIC (I350, 82580, and 82576). It provides the > performance data with and without generic filter.:: > + > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=16 --nb-ports=2 > + testpmd> start > + > +Send the packets stream from packet generator:: > + > + testpmd> quit > + > +Enable the filter :: > + > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=16 --nb-ports=2 > + > + testpmd>set stat_qmap rx 0 0 0 > + testpmd>set stat_qmap rx 0 1 1 > + testpmd>set stat_qmap rx 0 2 2 > + testpmd>set stat_qmap rx 0 3 3 > + testpmd>set flush_rx on > + testpmd> add_syn_filter 0 priority high queue 1 > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > queue 2 index 1 > + testpmd> start > + > + > +Send the packets stream from packet generator:: > + > + testpmd> quit > + Same as above. It's better to enlarge performance measure scope. > + > + > ++-------+---------+---------+ > +| Frame | disable | enable | > +| Size | filter | filter | > ++-------+---------+---------+ > +| 64 | | | > ++-------+---------+---------+ > +| 128 | | | > ++-------+---------+---------+ > +| 256 | | | > ++-------+---------+---------+ > +| 512 | | | > ++-------+---------+---------+ > +| 1024 | | | > ++-------+---------+---------+ > +| 1280 | | | > ++-------+---------+---------+ > +| 1518 | | | > ++-------+---------+---------+ > -- > 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dts] [dts 3/4] [PATCH V1] add generic_filter test plan 2015-05-26 2:11 ` Liu, Yong @ 2015-05-26 5:33 ` Xu, HuilongX 0 siblings, 0 replies; 9+ messages in thread From: Xu, HuilongX @ 2015-05-26 5:33 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, For your comments, I check with as below. > -----Original Message----- > From: Liu, Yong > Sent: Tuesday, May 26, 2015 10:11 AM > To: Xu, HuilongX; dts@dpdk.org > Subject: RE: [dts] [dts 3/4] [PATCH V1] add generic_filter test plan > > Huilong, please see my comments below. > > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of huilong,xu > > Sent: Monday, May 25, 2015 4:54 PM > > To: dts@dpdk.org > > Subject: [dts] [dts 3/4] [PATCH V1] add generic_filter test plan > > > > From: huilong xu <huilongx.xu@intel.com> > > > > > > Signed-off-by: huilong xu <huilongx.xu@intel.com> > > --- > > test_plans/generic_filter_test_plan.rst | 516 > > +++++++++++++++++++++++++++++++ > > 1 files changed, 516 insertions(+), 0 deletions(-) > > create mode 100644 test_plans/generic_filter_test_plan.rst > > > > diff --git a/test_plans/generic_filter_test_plan.rst > > b/test_plans/generic_filter_test_plan.rst > > new file mode 100644 > > index 0000000..b106180 > > --- /dev/null > > +++ b/test_plans/generic_filter_test_plan.rst > > @@ -0,0 +1,516 @@ > > + .. Copyright (c) <2015>, Intel Corporation > > + All rights reserved. > > + > > + Redistribution and use in source and binary forms, with or without > > + modification, are permitted provided that the following conditions > > + are met: > > + > > + - Redistributions of source code must retain the above copyright > > + notice, this list of conditions and the following disclaimer. > > + > > + - Redistributions in binary form must reproduce the above copyright > > + notice, this list of conditions and the following disclaimer in > > + the documentation and/or other materials provided with the > > + distribution. > > + > > + - Neither the name of Intel Corporation nor the names of its > > + contributors may be used to endorse or promote products derived > > + from this software without specific prior written permission. > > + > > + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > > + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > > + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > > + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > > + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > > + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > > + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > > + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > > + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > > + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED > > + OF THE POSSIBILITY OF SUCH DAMAGE. > > + > > + > > +Description > > +===================================================== > > +This document provides the plan for testing the generic filter feature > of > > 10GbE and 1GbE Ethernet Controller. > > This feature should also cover 40GE FVL card. > I will update the NIC info as next version patch > In `testpmd`, app provides Generic > > Filter API to manage filter rules for kinds of packets, and calls the > API > > to manage HW filters in HW, or SW filters in SW table. > > + > > +* A generic filter provides an ability to identify specific flows or > > sets of flows and routes them to dedicated queues. > > +* Based on the Generic Filter mechanism, all the SYN packets are placed > > in an assigned queue. > > +* Based on the Generic Filter mechanism, all packets belonging to L3/L4 > > flows to be placed in a specific HW queue.Each filter consists of a 5- > > tuple (protocol, source and destination IP addresses, source and > > destination TCP/UDP/SCTP port) and routes packets into one of the Rx > > queues > > +* L2 Ethertype Filters provides an ability to identify packets by their > > L2 Ethertype and assigns them to receive queues. > > +`Testpmd` app is used to test all types of HW filters. Case 1~9 are the > > function test for the above app while case 11,12 are the performance > test > > for Niantic, I350, 82580 and 82576. > > + > > + > > +Prerequisites > > +=================================================== > > +Assuming that ports ``0`` and ``1`` are connected to a traffic > > generator's port ``A`` and ``B``. > > + > > +Setup for ``testpmd`` > > +----------------------------------------------------------------- > > +Launch the app ``testpmd`` with the following arguments:: > > + > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > > cores=16 --nb-ports=2 > > + > > +The -n command is used to select the number of memory channels. It > should > > be matched with the number of memory channels on that setup. The value > of > > rxq and txq is 1 by default, it's necessary to increase them, and make > > sure rxq and txq more than one. At the same time rss is enable by > default, > > so disable it. Map port queues to statistic counter registers.:: > > + > > + testpmd>set stat_qmap rx 0 0 0 > > + testpmd>set stat_qmap rx 0 1 1 > > + testpmd>set stat_qmap rx 0 2 2 > > + testpmd>set stat_qmap rx 0 3 3 > > +Setup for receive all packet and disable vlan strip function:: > > + > > + testpmd>vlan set strip off 0 > > + testpmd>vlan set strip off 1 > > + testpmd>vlan set filter off 0 > > + testpmd>vlan set filter off 1 > > + testpmd>set flush_rx on > > + > > + > > +Test Case 1: SYN filter > > +=================================================================== > > +SYN filters might routes TCP packets with their SYN flag set into an > > assigned queue. By filtering such packets to an assigned queue, > security > > software can monitor and > > +act on SYN attacks. > > + > > +Enable SYN filters with queue 2 on port 0.:: > > + > > + testpmd> add_syn_filter 0 priority high queue 2 > > + testpmd> get_syn_filter 0 > > +If SYN Filter is added successfully, it displays:: > > + > > + syn filter: on, priority: high, queue: 2 > > +Then setup for receive:: > > + > > + testpmd> start > > +Configure the traffic generator to send 5 SYN packets and 5 non-SYN > > packets . > > +Reading the stats for port 0 after sending packets.:: > > + > > + testpmd> stop > > +Verify that the packets are received (RX-packets incremented)on the > queue > > 2. > > +Set off SYN filter:: > > + > > + testpmd>remove_syn_filter 0 > > + testpmd>start > > +Send 5 SYN packets, then reading the stats for port 0 after sending > > packets.:: > > + > > + testpmd> stop > > +Verify that the packets are not received (RX-packets do not > increased)on > > the queue 2 and syn filter is removed. > > + > > + > > +Test Case 2: 5-tuple Filter > > +=================================================================== > > +This filter identifies specific L3/L4 flows or sets of L3/L4 flows and > > routes them to dedicated queues. Each filter consists of a 5-tuple > > (protocol, source and destination IP addresses, source and destination > > TCP/UDP/SCTP port) and routes packets into one of the Rx queues. > > +The 5-tuple filters are configured via `dst_ip`, `src_ip`, `dst_port`, > > `src_port`, `protocol` and Mask.This case supports two type NIC(niantic, > > 82576), and their command line are different. > > +Enable the 5-tuple Filter with queue 3 on port 0 for niantic. :: > > + > > 5-tuple case should cover udp and sctp packets. > > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 3 index 1 > > + testpmd> get_5tuple_filter 0 index 1 > > + > > +Enable the 5-tuple Filter with queue 3 on port 0 for 82576. :: > > + > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > > + testpmd> get_5tuple_filter 0 index 1 > > + > > Please explain why flags for 82576 and Niantic have different values. Niantic and 82576 the hard register not different, so 82576 need to set the TCP flags. But Niantic not need set. > > +If L3/L4 5-tuple Filter is added successfully, it displays:: > > + > > + filter[1]: > > + Destination IP: 0x02020205 mask: 1 > > + Source IP: 0x02020204 mask: 1 > > + Destination Port: 0x0001 mask: 1 > > + Source Port: 0x0000 mask: 1 > > + protocol_type: tcp mask: 1 > > + priority: 3 > > +Then setup for receive:: > > + > > + testpmd> start > > +If the NIC type is niantic, then send different type packets such as > > (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_por`t=1 `src_port`=1 > > `protocol`=tcp) and arp. :: > > + > > + testpmd> stop > > +Verify that the packets (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > > `src_port`=1 `protocol` `tcp`)or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 > > `dst_port`=1 `src_port`=1 `protocol`=tcp, `flags`=0x2) are received > (RX- > > packets doesn't incremented)on the queue 3.Remove L3/L4 5-tuple filter. > > +Disable 5-tuple Filters:: > > + > > + testpmd>remove_5tuple_filter 0 index 1 > > + testpmd>start > > +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > `src_port`=1 > > `protocol`=tcp) or (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > > `src_port`=1 `protocol`=tcp `flags`=0x2) .Then reading the stats for > port > > 0 after sending packets.:: > > + > > + testpmd> stop > > +Verify that the packets are not received (RX-packets do not > increased)on > > the queue 3. A 5-bit field that masks each of the fields in the 5-tuple > > (L4 protocol, IP addresses, TCP/UDP ports). > > +If 5-tuple fields are masked with 0x0 (`mask`=0x0), the filter will > > routes all the packets(ip) on the assigned queue.For instance, enable > the > > 5-tuple Filters with queue 3 on port 0 for niantic. however, the value > of > > mask is set 0x0:: > > + > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol tcp mask 0x0 flags 0x0 priority 3 queue 3 index 1 > > + > > + > > +Test Case 3: ethertype filter > > +=================================================================== > > +Enable the receipt of ARP packets with queue 2 on port 0:: > > + > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > > queue 2 index 1 > > + testpmd> get_ethertype_filter 0 index 1 > > +If ethertype Filters is added successfully, it displays:: > > + > > + filter[1]: > > + ethertype: 0x0806 > > + priority: disable, 0 > > + queue: 2 > > +Then setup for receive:: > > + > > + testpmd> start > > +Configure the traffic generator to send 15 ARP packets and 15 non ARP > > packets. > > + > > + testpmd> stop > > +Verify that the arp packets are received (RX-packets incremented)on the > > queue 2 . > > +remove ethertype filter:: > > + > > + testpmd> remove_ethertype_filter 0 index 1 > > + testpmd> start > > +Configure the traffic generator to send 15 ARP packets. > > + > > + testpmd> stop > > +Also, you can change the value of priority to set a new filter except > > the case the value of ethertype is 0x0800 with priority enable .The rest > > of steps are same. > > +For instance, enable priority filter(just support niantic):: > > + > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority enable 1 > > queue 2 index 1 > > + > > +Test Case 4: 10GB Multiple filters > > +=================================================================== > > +Enable ethertype filter, SYN filter and 5-tuple Filter on the port 0 > at > > same time. Assigning different filters to different queues on port 0:: > > + > > + testpmd> add_syn_filter 0 priority high queue 1 > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > > queue 3 index 1 > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol tcp mask 0x1f priority 3 queue 3 index 1 > > + testpmd> start > > + > > Maybe it will be better that each filter redirect packets into different > queues. > It will help us check whether each queue act as we expected. > > Is there any case cover the maximum number of queues? We should know the > value. > 128 queue test case for test assign max queue to received case. but this case will failed, Because, testpmd not support assign queue received package, I think, when testpmd support assign queue Received package, I can submit a new test case for test different queue receive package. > > +Configure the traffic generator to send different packets. Such as,SYN > > packets, ARP packets, IP packets and packets with(`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp):: > > + > > + testpmd> stop > > +Verify that different packets are received (RX-packets incremented)on > the > > assigned queue. > > +Remove ethertype filter:: > > + > > + testpmd> remove_ethertype_filter 0 index 1 > > + testpmd>start > > +Send SYN packets, ARP packets and packets with (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp).:: > > + > > + testpmd> stop > > +Verify that all packets are received (RX-packets incremented)on the > > assigned queue except arp packets, remove 5-tuple filter:: > > + > > + testpmd>remove_5tuple_filter 0 index 1 > > + testpmd> start > > +Send different packets such as,SYN packets, ARP packets, packets with > > (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 > > `protocol`=tcp):: > > + > > + testpmd>stop > > +Verify that only SYN packets are received (RX-packets incremented)on > the > > assigned queue > > +set off SYN filter:: > > + > > + testpmd>remove_syn_filter 0 > > + testpmd>start > > +Configure the traffic generator to send 5 SYN packets. > > + > > + testpmd>stop > > +Verify that the packets are not received (RX-packets do not > increased)on > > the queue 1. > > + > > + > > +Test Case 5: 2-tuple filter > > +=================================================================== > > +This case is designed for NIC type:I350, 82580. > > +Enable the receipt of udp packets with queue 1 on port 0:: > > + > > + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 > > priority 3 queue 1 index 1 > > + testpmd> get_2tuple_filter 0 index 1 > > +If 2-tuple Filter is added successfully, it displays:: > > + > > + filter[1]: > > + Destination Port: 0x0040 mask: 1 > > + protocol: 0x11 mask:1 tcp_flags: 0x00 > > + priority: 3 queue: 1 > > +Then setup for receive:: > > + > > + testpmd> start > > +Send 15 udp packets(`dst_port`=15, `protocol`=udp) and 15 non udp > > packets.Reading the stats for port 0 after sending packets:: > > + > > + testpmd> stop > > + > > +Verify that the udp packets are received (RX-packets incremented)on the > > queue 1. > > +Remove 2tuple filter:: > > + > > + testpmd> remove_2tuple_filter 0 index 1 > > + testpmd> start > > +Configure the traffic generator to send udp packets(`dst_port`=15, > > `protocol`=udp). > > +Reading the stats for port 0 after sending packets:: > > + > > + testpmd> stop > > +Verify that the packets are not received (RX-packets do not > increased)on > > the queue 1. > > +Also, you can change the value of protocol or dstport or flags to set a > > new filter.the rest of steps are same.For example:: > > + > > Please take care of language syntax. > Yes, I will review this doc at next version > > +Enable the receipt of UDP packets with queue 1 on port 1:: > > + > > + testpmd> add_2tuple_filter 1 protocol 0x011 1 dst_port 64 1 flags 0 > > priority 3 queue 2 index 2 > > + > > +Enable the receipt of TCP packets with flags on queue 1 of port 1:: > > + > > + testpmd> add_2tuple_filter 1 protocol 0x06 1 dst_port 64 1 flags > 0x3F > > priority 3 queue 3 index 3 > > + > > + > > +Test Case 6: flex filter > > +=================================================================== > > +This case is designed for NIC type:I350, 82576,82580. > > +Enable the receipt of packets(context) with queue 1 on port 0:: > > + > > + testpmd> add_flex_filter 0 len 16 bytes > > 0x0123456789abcdef0000000008060000 mask 000C priority 3 queue 1 index 0 > > Please explain the relation of len and mask. > Has this case been covered the max length of flex filter? > In flex filter detail info from driver displays as below: Value "dword" is a double word type so this mask match "0806" > > + testpmd> get_flex_filter 0 index 0 > > + > > +If flex Filter is added successfully, it displays:: > > + filter[0]: > > + length: 16 > > + dword[]: 0x01234567 89abcdef 00000000 08060000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 > > + mask[]: > > > 0b000000000000110000000000000000000000000000000000000000000000000000000000 > > 00000000000000000000000000000000000000000000000000000000 > > + priority: 3 queue: 1 > > +Then setup for receive:: > > + > > + testpmd> start > > +Configure the traffic generator to send packets(context) and arp > packtes. > > +Reading the stats for port 0 after sending packets:: > > + > > + testpmd> stop > > +Verify that the arp packets are received (RX-packets incremented)on the > > queue 1. > > +Remove flex filter:: > > + > > + testpmd> remove_flex_filter 0 index 0 > > + testpmd> start > > +Configure the traffic generator to send packets(context).Reading the > > stats for port 0 after sending packets:: > > + > > + testpmd> stop > > +Verify that the packets are not received (RX-packets do not > increased)on > > the queue 1. Also, you can change the value of length or context or mask > > to set a new filter.the rest of steps are same.:: > > + > > + testpmd> add_flex_filter 0 len 32 bytes > > 0x0123456789abcdef00000000080600000123456789abcdef0000000008060000 mask > > 000C000C priority 1 queue 2 index 7 > > + > > +Test Case 7: priority filter > > +=================================================================== > > +This case is designed for NIC (niantic,I350, 82576 and 82580). If > packets > > are match on different filters with same type, the filter with high > > priority will be receive packets. For example, packets are match on two > > five-tuple filters with different priority, the filter with high > priority > > will be receive packets. if packets are match on different filters with > > different type, packets based on the above criteria and the following > > order.when syn set priority high, syn filter has highest priority than > > others filter. And flex filter has higher priority than 2-tuple filter. > > +If the Nic is niantic, enable the 5-tuple filter:: > > + > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 2 queue 2 index 1 > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 2 > > src_port 2 protocol 0x06 mask 0x18 flags 0x0 priority 3 queue 3 index 2 > > + testpmd> start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp). > > + > > + testpmd> stop > > +packets are received (RX-packets be increased)on the queue 2. > > +Remove the 5tuple filter with high priority:: > > + > > + testpmd>remove_5tuple_filter 0 index 1 > > + testpmd> start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp) > > + > > + testpmd> stop > > +packets are received (RX-packets be increased)on the queue 3. > > +If the Nic is I350 or 82580, enable the 2-tuple and flex filters:: > > + > > + testpmd> add_flex_filter 0 len 16 bytes > > 0x0123456789abcdef0000000008000000 mask 000C priority 2 queue 1 index 0 > > + testpmd> add_2tuple_filter 0 protocol 0x11 1 dst_port 64 1 flags 0 > > priority 3 queue 2 index 1 > > + testpmd> start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp). > > + > > + testpmd> stop > > +packets are received (RX-packets be increased)on the queue 2. > > +Remove the 2tuple filter with high priority:: > > + > > + testpmd>remove_2tuple_filter 0 index 1 > > + testpmd> start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=udp), > > + > > + testpmd> stop > > +packets are received (RX-packets be increased)on the queue 1. > > +If the Nic is 82576, enable the syn and 2-tuple filter:: > > + > > + testpmd>add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > > + testpmd>add_syn_filter 0 priority high queue 2 > > + testpmd> start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=1 `src_port`=1 `protocol`=tcp `flags`="S"). > > + > > + testpmd>stop > > +packets are received (RX-packets be increased)on the queue 2. > > +Remove the syn filter with high priority:: > > + > > + testpmd>remove_syn_filter 0 > > + testpmd>start > > +Configure the traffic generator to send packets (`dst_ip`=2.2.2.5 > > `src_ip`=2.2.2.4 `dst_port`=64 `src_port`=1 `protocol`=tcp `flags`="S"). > > + > > + testpmd> stop > > +packets are received (RX-packets be increased)on the queue 3. > > + > > + > > + > > +Test Case 8: 1GB Multiple filters > > +=================================================================== > > +This case is designed for NIC(I350, 82576,82580). Enable syn filter and > > ethertype filter on the port 0 at the same time. Assigning different > > filters to different queues on port 0.Enable the filters:: > > + > > + testpmd> add_syn_filter 0 priority high queue 1 > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > > queue 3 index 1 > > + testpmd> start > > + > > +Configure the traffic generator to send ethertype packets and arp > > packets . :: > > + > > + testpmd> stop > > +Then Verify that the packet are received on the queue 1,queue 3. > > +Remove all the filter:: > > + > > + testpmd> remove_syn_filter 0 > > + testpmd> remove_ethertype_filter 0 index 1 > > + > > +Configure the traffic generator to send udp packets and arp packets. > Then > > Verify that the packet are not received on the queue 1 and queue 3 :: > > + > > + testpmd> quit > > + > > +Test Case 9: jumbo framesize filter > > +=================================================================== > > + This case is designed for NIC (niantic,I350, 82576 and 82580). Since > > ``Testpmd`` could transmits packets with jumbo frame size , it also > could > > transmit above packets on assigned queue. > > +Launch the app ``testpmd`` with the following arguments:: > > + > > + testpmd -c ffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > cores=8 > > --nb-ports=2 --rxd=1024 --txd=1024 --burst=144 --txpt=32 --txht=8 -- > txwt=0 > > --txfreet=0 --rxfreet=64 --mbcache=200 --mbuf-size=2048 --max-pkt- > len=9600 > > + > > + testpmd>set stat_qmap rx 0 0 0 > > + testpmd>set stat_qmap rx 0 1 1 > > + testpmd>set stat_qmap rx 0 2 2 > > + testpmd>vlan set strip off 0 > > + testpmd>vlan set strip off 1 > > + testpmd>vlan set filter off 0 > > + testpmd>vlan set filter off 1 > > +Enable the syn filters with large size:: > > + > > + testpmd> add_syn_filter 0 priority high queue 1 > > + testpmd> start > > + > > +Configure the traffic generator to send syn packets(framesize=2000) . :: > > + > > + testpmd> stop > > +Then Verify that the packet are received on the queue 1. > > +Remove the filter:: > > + > > + testpmd> remove_syn_filter 0 > > + > > +Configure the traffic generator to send syn packets and s. Then Verify > > that the packet are not received on the queue 1 :: > > + > > + testpmd> quit > > + > > +Test Case 10: 128 queues > > +=================================================================== > > +This case is designed for NIC(niantic). Since NIC(niantic) has 128 > > transmit queues, it should be supports 128 kinds of filter if Hardware > > have enough cores. > > +Launch the app ``testpmd`` with the following arguments:: > > + > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=128 --txq=128 -- > nb- > > cores=16 --nb-ports=2 --total-num-mbufs=60000 > > + > > + testpmd>set stat_qmap rx 0 0 0 > > + testpmd>set stat_qmap rx 0 64 1 > > + testpmd>set stat_qmap rx 0 64 2 > > Here should be queue 127? > > + testpmd>vlan set strip off 0 > > + testpmd>vlan set strip off 1 > > + testpmd>vlan set filter off 0 > > + testpmd>vlan set filter off 1 > > +Enable the 5-tuple Filters with different queues (64,127) on port 0 > for > > niantic. :: > > + > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 64 index 1 > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 2 > > src_port 1 protocol 0x06 mask 0x1f flags 0x0 priority 3 queue 127 index > 1 > > +Send packets(`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=1 > `src_port`=1 > > `protocol`=tcp) and (`dst_ip`=2.2.2.5 `src_ip`=2.2.2.4 `dst_port`=2 > > `src_port`=1 `protocol`=tcp ) . Then reading the stats for port 0 after > > sending packets. packets are received on the queue 64 and queue 127 > > + When setting 5-tuple Filter with queue(128), it will display failure > > because the number of queues no more than 128. > > + > > + > > + > > +Test Case 11: 10G NIC Performance > > +=================================================================== > > +This case is designed for Niantic. It provides the performance data > with > > and without generic filter. :: > > +Launch app without filter: > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > > cores=16 --nb-ports=2 > > + testpmd> start > > + > > +Send the packets stream from packet generator:: > > + > > + testpmd> quit > > +Enable the filters on app:: > > + > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > > cores=16 --nb-ports=2 > > + > > + testpmd>set stat_qmap rx 0 0 0 > > + testpmd>set stat_qmap rx 0 1 1 > > + testpmd>set stat_qmap rx 0 2 2 > > + testpmd>set stat_qmap rx 0 3 3 > > + testpmd>set flush_rx on > > + testpmd> add_syn_filter 0 priority high queue 1 > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > > queue 2 index 1 > > + testpmd> add_5tuple_filter 0 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port > 1 > > src_port 1 protocol 0x06 mask 0x1f flags 0x02 priority 3 queue 3 index 1 > > + testpmd> start > > + > > Please explain why add three filters here. This case mixed three > different types of filter, it's hard to measure performance drop of every > filter. > It's better to enlarge performance measure scope as list below. > This case compare enable and disable filter performance, we will send three stream for every filter performance compare > Disable all generic filter > Enable sync filter > Enable ethertype filter > Enable one 5tuple filter > ... > Several samples between maximum. > ... > Enable maximum 5tuple filter > > > > +Send the packets stream from packet generator:: > > + > > + testpmd> quit > > + > > + > > + > > ++-------+---------+---------+ > > +| Frame | disable | enable | > > +| Size | filter | filter | > > ++-------+---------+---------+ > > +| 64 | | | > > ++-------+---------+---------+ > > +| 128 | | | > > ++-------+---------+---------+ > > +| 256 | | | > > ++-------+---------+---------+ > > +| 512 | | | > > ++-------+---------+---------+ > > +| 1024 | | | > > ++-------+---------+---------+ > > +| 1280 | | | > > ++-------+---------+---------+ > > +| 1518 | | | > > ++-------+---------+---------+ > > + > > + > > +Test Case 12: 1G NIC Performance > > +=================================================================== > > +This case is designed for NIC (I350, 82580, and 82576). It provides the > > performance data with and without generic filter.:: > > + > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > > cores=16 --nb-ports=2 > > + testpmd> start > > + > > +Send the packets stream from packet generator:: > > + > > + testpmd> quit > > + > > +Enable the filter :: > > + > > + ./testpmd -c fffff -n 4 -- -i --disable-rss --rxq=4 --txq=4 --nb- > > cores=16 --nb-ports=2 > > + > > + testpmd>set stat_qmap rx 0 0 0 > > + testpmd>set stat_qmap rx 0 1 1 > > + testpmd>set stat_qmap rx 0 2 2 > > + testpmd>set stat_qmap rx 0 3 3 > > + testpmd>set flush_rx on > > + testpmd> add_syn_filter 0 priority high queue 1 > > + testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 > > queue 2 index 1 > > + testpmd> start > > + > > + > > +Send the packets stream from packet generator:: > > + > > + testpmd> quit > > + > > Same as above. > It's better to enlarge performance measure scope. > > > + > > + > > ++-------+---------+---------+ > > +| Frame | disable | enable | > > +| Size | filter | filter | > > ++-------+---------+---------+ > > +| 64 | | | > > ++-------+---------+---------+ > > +| 128 | | | > > ++-------+---------+---------+ > > +| 256 | | | > > ++-------+---------+---------+ > > +| 512 | | | > > ++-------+---------+---------+ > > +| 1024 | | | > > ++-------+---------+---------+ > > +| 1280 | | | > > ++-------+---------+---------+ > > +| 1518 | | | > > ++-------+---------+---------+ > > -- > > 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dts] [dts 4/4] [PATCH V1] add generic filter 2015-05-25 8:54 [dts] [dts 1/4] [PATCH V1] add generic_filter test for niantic NIC huilong,xu 2015-05-25 8:54 ` [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC huilong,xu 2015-05-25 8:54 ` [dts] [dts 3/4] [PATCH V1] add generic_filter test plan huilong,xu @ 2015-05-25 8:54 ` huilong,xu 2 siblings, 0 replies; 9+ messages in thread From: huilong,xu @ 2015-05-25 8:54 UTC (permalink / raw) To: dts From: huilong xu <huilongx.xu@intel.com> 1. generic filter type: a) 5 tuple filter b) 2 tuple filter c) syn filter d) ethertype filter e) flex filter 2.) NIC list: a) niantic b) kawela_4 c) bartonhills d) powerville e) fortville 3) test case list: a) all filter test b) filter priority test c) filter priority test d) filter jumbo_frame test e) generic_filter performance test f) niantic max queue test Signed-off-by: huilong xu <huilongx.xu@intel.com> --- tests/TestSuite_generic_filter.py | 828 +++++++++++++++++++++++++++++++++++++ 1 files changed, 828 insertions(+), 0 deletions(-) create mode 100644 tests/TestSuite_generic_filter.py diff --git a/tests/TestSuite_generic_filter.py b/tests/TestSuite_generic_filter.py new file mode 100644 index 0000000..26abea2 --- /dev/null +++ b/tests/TestSuite_generic_filter.py @@ -0,0 +1,828 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +DPDK Test suite. + +Test the support of VLAN Offload Features by Poll Mode Drivers. + +""" + +import dts +import time +import re + +from test_case import TestCase +from settings import HEADER_SIZE +from pmd_output import PmdOutput +from settings import DRIVERS + + +class TestGeneric_filter(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + + + Generic filter Prerequistites + """ + + # Based on h/w type, choose how many ports to use + ports = self.dut.get_ports(self.nic) + # Verify that enough ports are available + self.verify(len(ports) >= 2, "Insufficient ports") + cores = self.dut.get_core_list("all") + self.verify(len(cores) >= 10, "Insufficient core") + global coreMask + coreMask = dts.create_mask(cores) + # Based on h/w type, choose how many ports to use + global valports + valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] + global portMask + portMask = dts.create_mask(valports[:2]) + self.pmdout = PmdOutput(self.dut) + self.ethertype_filter = "off" + + def request_mbufs(self, queue_num): + """ + default txq/rxq descriptor is 64 + """ + return 128 * queue_num + 512 + + def port_config(self): + """ + set port queue mapping, fortville not support this function + """ + if self.nic not in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]: + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 1 1" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 1 1" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 2 2" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 2 2" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 3 3" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 3 3" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[1], "testpmd> ") + + self.dut.send_expect("set flush_rx on", "testpmd> ") + + def set_up(self): + """ + Run before each test case. + """ + pass + + def filter_send_packet(self, type): + """ + Send packet to portid + """ + + port = self.tester.get_local_port(valports[0]) + txItf = self.tester.get_interface(port) + + port = self.tester.get_local_port(valports[1]) + rxItf = self.tester.get_interface(port) + + mac = self.dut.get_mac_address(valports[0]) + self.tester.scapy_foreground() + + if (type == "syn"): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/IP(src="2.2.2.5",dst="2.2.2.4")/TCP(dport=80,flags="S")], iface="%s")' % (mac, txItf)) + elif (type == "arp"): + self.tester.scapy_append( + 'sendp([Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.1")], iface="%s")' % (txItf)) + elif (type == "arp_prio"): + self.tester.scapy_append( + 'sendp([Ether(dst="ff:ff:ff:ff:ff:ff")/Dot1Q(prio=3)/ARP(pdst="192.168.1.1")], iface="%s")' % (txItf)) + elif (type == "fivetuple"): + if self.nic == "niantic": + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/Dot1Q(prio=3)/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1,flags=0)], iface="%s")' % (mac, txItf)) + else: + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/Dot1Q(prio=3)/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1)], iface="%s")' % (mac, txItf)) + elif (type == "udp"): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/UDP(dport=64)], iface="%s")' % (mac, txItf)) + elif (type == "ip"): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=80,dport=80,flags=0)], iface="%s")' % (mac, txItf)) + elif (type == "jumbo"): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/IP(src="2.2.2.5",dst="2.2.2.4")/TCP(dport=80,flags="S")/Raw(load="\x50"*1500)], iface="%s")' % (mac, txItf)) + elif (type == "packet"): + if (filters_index == 0): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1,flags=0)], iface="%s")' % (mac, txItf)) + if (filters_index == 1): + self.tester.scapy_append( + 'sendp([Ether(dst="%s")/Dot1Q(prio=3)/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=2,flags=0)], iface="%s")' % (mac, txItf)) + self.tester.scapy_execute() + + def verify_result(self, outstring, tx_pkts, expect_queue): + + result_scanner = r"Forward Stats for RX Port= %s/Queue= ([0-9]+)" % valports[ + 0] + + scanner = re.compile(result_scanner, re.DOTALL) + m = scanner.search(outstring) + queue_id = m.group(1) + if self.nic == "niantic" and self.ethertype_filter == "on" and expect_queue == "0": + self.ethertype_filter = "off" + self.verify(queue_id == "0", "packet pass error") + if expect_queue != queue_id: + scanner = re.compile(result_scanner, re.DOTALL) + m = scanner.search(outstring) + queue_id = m.group(1) + result_scanner = r"RX-packets: ([0-9]+) \s*" + scanner = re.compile(result_scanner, re.DOTALL) + m = scanner.search(outstring) + p0tx_pkts = m.group(1) + + else: + + result_scanner = r"RX-packets: ([0-9]+) \s*" + + scanner = re.compile(result_scanner, re.DOTALL) + m = scanner.search(outstring) + p0tx_pkts = m.group(1) + + self.verify(p0tx_pkts == tx_pkts, "packet pass error") + + # TODO: failing test even in non-converted version + def test_syn_filter(self): + """ + Enable receipt of SYN packets + """ + self.verify(self.nic in ["niantic", "kawela_4", "bartonhills", "powerville"], "%s nic not support syn filter" % self.nic) + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + self.dut.send_expect( + "syn_filter %s add priority high queue 2" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + + self.filter_send_packet("syn") + time.sleep(2) + + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect("clear port stats all", "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + + self.dut.send_expect( + "syn_filter %s del priority high queue 2" % valports[0], "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("syn") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.dut.send_expect("quit", "#") + + def test_priority_filter(self): + """ + priority filter + """ + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + + if self.nic == "niantic": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority 3 queue 3 " % ( + valports[0]) + self.dut.send_expect("%s" % cmd, "testpmd> ") + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 2 src_port 1 protocol 0x06 mask 0x18 tcp_flags 0x0 priority 2 queue 2 " % ( + valports[0]) + self.dut.send_expect("%s" % cmd, "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="3") + cmd = "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority 3 queue 3 " % ( + valports[0]) + self.dut.send_expect(cmd, "testpmd> ") + + self.dut.send_expect("clear port stats all", "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + elif self.nic == "kawela_4": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x02 priority 3 queue 3" % ( + valports[0]) + self.dut.send_expect("%s" % (cmd), "testpmd> ") + self.dut.send_expect( + "syn_filter %s add priority high queue 2" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + self.dut.send_expect( + "syn_filter %s del priority high queue 2" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="3") + elif self.nic in ["bartonhills", "powerville"]: + self.dut.send_expect( + "flex_filter %s add len 16 bytes 0x0123456789abcdef0000000008000000 mask 000C priority 2 queue 1" % (valports[0]), "testpmd> ") + self.dut.send_expect( + "2tuple_filter %s add dst_port 64 protocol 0x11 mask 1 tcp_flags 0 priority 3 queue 2" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("udp") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="1") + self.dut.send_expect( + "flex_filter %s del len 16 bytes 0x0123456789abcdef0000000008000000 mask 000C priority 2 queue 1" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("udp") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + else: + self.verify(False, "%s nic not support this test" % self.nic) + + def test_five_tuple_filter(self): + """ + five tuple filter + """ + if self.nic in ["niantic", "kawela_4"]: + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + + mask = ['0x1f', '0x0'] + for case in mask: + if case == "0x1f": + if self.nic == "niantic": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x0 priority 3 queue 3" % ( + valports[0], case) + if self.nic == "kawela_4": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x02 priority 3 queue 3" % ( + valports[0], case) + else: + if self.nic == "niantic": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x0 priority 3 queue 3" % ( + valports[0], case) + if self.nic == "kawela_4": + cmd = "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x02 priority 3 queue 3" % ( + valports[0], case) + + self.dut.send_expect("%s" % (cmd), "testpmd> ") + # if case == "0x1f": + # out = self.dut.send_expect("get_5tuple_filter %s index 1" % valports[0], "testpmd> ") + # self.verify('Destination IP: 0x02020205 mask: 1' in out, "set 5-tuple filter error") + # self.verify('Source IP: 0x02020204 mask: 1' in out, "set 5-tuple filter error") + self.dut.send_expect("start", "testpmd> ", 120) + + self.filter_send_packet("fivetuple") + + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="3") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("arp") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + if case == "0x1f": + if self.nic == "niantic": + cmd = "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x0 priority 3 queue 3" % ( + valports[0], case) + if self.nic == "kawela_4": + cmd = "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x02 priority 3 queue 3" % ( + valports[0], case) + else: + if self.nic == "niantic": + cmd = "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x0 priority 3 queue 3" % ( + valports[0], case) + if self.nic == "kawela_4": + cmd = "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask %s tcp_flags 0x02 priority 3 queue 3" % ( + valports[0], case) + + self.dut.send_expect("%s" % (cmd), "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.dut.send_expect("quit", "#") + else: + self.verify(False, "%s nic not support syn filter" % self.nic) + + def test_ethertype_filter(self): + + self.verify(self.nic in ["niantic", "kawela_4", "bartonhills", + "powerville", "fortville_eagle", "fortville_spirit", + "fortville_spirit_single"], "%s nic not support syn filter" % self.nic) + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + self.ethertype_filter = "on" + ethertype = "0x0806" + self.dut.send_expect( + "ethertype_filter %s add mac_ignr 00:00:00:00:00:00 ethertype %s fwd queue 2" % + (valports[0], ethertype), "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="2") + if self.nic == "niantic": + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp_prio") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect( + "ethertype_filter %s del mac_ignr 00:00:00:00:00:00 ethertype %s fwd queue 2" % + (valports[0], ethertype), "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + + def test_multiple_filters_10GB(self): + if self.nic == "niantic": + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + self.dut.send_expect( + "syn_filter %s add priority high queue 1" % valports[0], "testpmd> ") + self.dut.send_expect( + "ethertype_filter %s add mac_ignr 00:00:00:00:00:00 ethertype 0x0806 fwd queue 2" % valports[0], "testpmd> ") + self.dut.send_expect( + "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority 3 queue 3 " % (valports[0]), "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + + self.filter_send_packet("syn") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="1") + + self.ethertype_filter = "on" + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp_prio") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="3") + + self.dut.send_expect( + "5tuple_filter %s del dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority 3 queue 3 " % (valports[0]), "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("syn") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="1") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("fivetuple") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.dut.send_expect( + "ethertype_filter %s del mac_ignr 00:00:00:00:00:00 ethertype 0x0806 fwd queue 2" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("syn") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="1") + + self.dut.send_expect( + "syn_filter %s del priority high queue 1" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("syn") + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + + else: + self.verify(False, "%s nic not support this test" % self.nic) + + def test_twotuple_filter(self): + + if self.nic in ["powerville", "bartonhills"]: + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + self.dut.send_expect( + "2tuple_filter %s add dst_port 64 protocol 0x11 mask 1 tcp_flags 0 priority 3 queue 1" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + + self.filter_send_packet("udp") + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="1") + + self.dut.send_expect("start", "testpmd> ") + + self.filter_send_packet("syn") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.dut.send_expect( + "2tuple_filter %s del dst_port 64 protocol 0x11 mask 1 tcp_flags 0 priority 3 queue 1" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("udp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.dut.send_expect("quit", "#") + else: + self.verify(False, "%s nic not support two tuple filter" % self.nic) + + def test_flex_filter(self): + self.verify(self.nic in ["powerville", "bartonhills"], '%s not support flex filter' % self.nic) + + masks = ['000C', '000C'] + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + for i in [0, 1]: + if i == 0: + self.dut.send_expect( + "flex_filter %s add len 16 bytes 0x0123456789abcdef0000000008060000 mask %s priority 3 queue 1" % + (valports[0], masks[i]), "testpmd> ") + else: + self.dut.send_expect( + "flex_filter %s add len 16 bytes 0x0123456789abcdef0000000008000000 mask %s priority 3 queue 1" % + (valports[0], masks[i]), "testpmd> ") + + self.dut.send_expect("start", "testpmd> ", 120) + + if i == 0: + self.filter_send_packet("arp") + else: + self.filter_send_packet("ip") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="1") + + self.dut.send_expect("start", "testpmd> ") + + if i == 0: + self.filter_send_packet("syn") + else: + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + if i == 0: + self.dut.send_expect( + "flex_filter %s del len 16 bytes 0x0123456789abcdef0000000008060000 mask %s priority 3 queue 1" % + (valports[0], masks[i]), "testpmd> ") + else: + self.dut.send_expect( + "flex_filter %s del len 16 bytes 0x0123456789abcdef0000000008000000 mask %s priority 3 queue 1" % + (valports[0], masks[i]), "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + if i == 0: + self.filter_send_packet("arp") + else: + self.filter_send_packet("ip") + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + + def test_multiple_filters_1GB(self): + + if self.nic in ["powerville", "kawela_4", "bartonhills"]: + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + self.dut.send_expect( + "syn_filter %s add priority high queue 1" % valports[0], "testpmd> ") + self.dut.send_expect( + "ethertype_filter %s add mac_ignr 00:00:00:00:00:00 ethertype 0x0806 fwd queue 3" % (valports[0]), "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="3") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("syn") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="1") + + # remove all filter + + self.dut.send_expect( + "syn_filter %s del priority high queue 1" % valports[0], "testpmd> ") + self.dut.send_expect( + "ethertype_filter %s del mac_ignr 00:00:00:00:00:00 ethertype 0x0806 fwd queue 3" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("arp") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + + self.dut.send_expect("start", "testpmd> ") + self.filter_send_packet("syn") + time.sleep(2) + out = self.dut.send_expect("stop", "testpmd> ") + self.verify_result(out, tx_pkts="1", expect_queue="0") + else: + self.verify(False, "%s nic not support this test" % self.nic) + def test_jumbo_frame_size(self): + + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"], "%s nic not support this test" % self.nic) + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1 --mbcache=200 --mbuf-size=2048 --max-pkt-len=9600" % portMask) + port = self.tester.get_local_port(valports[0]) + txItf = self.tester.get_interface(port) + + port = self.tester.get_local_port(valports[1]) + rxItf = self.tester.get_interface(port) + self.tester.send_expect("ifconfig %s mtu %s" % (txItf, 9200), "# ") + self.tester.send_expect("ifconfig %s mtu %s" % (rxItf, 9200), "# ") + + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 1 1" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 1 1" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 2 2" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 2 2" % valports[1], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 3 3" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 3 3" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[1], "testpmd> ") + self.dut.send_expect( + "syn_filter %s add priority high queue 2" % valports[0], "testpmd> ") + + self.dut.send_expect("start", "testpmd> ", 120) + + self.filter_send_packet("jumbo") + time.sleep(1) + + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd>") + + self.verify_result(out, tx_pkts="1", expect_queue="2") + + self.dut.send_expect("start", "testpmd> ") + + self.filter_send_packet("arp") + time.sleep(1) + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd>") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + + self.dut.send_expect( + "syn_filter %s del priority high queue 2" % valports[0], "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.filter_send_packet("jumbo") + time.sleep(1) + out = self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd>") + + self.verify_result(out, tx_pkts="1", expect_queue="0") + self.tester.send_expect("ifconfig %s mtu %s" % (txItf, 1500), "# ") + self.tester.send_expect("ifconfig %s mtu %s" % (rxItf, 1500), "# ") + + def test_128_queues(self): + # testpmd can't support assign queue to received package, so can't test + self.verify(False, "testpmd not support assign queue 127 received package") + if self.nic == "niantic": + global valports + total_mbufs = self.request_mbufs(128) * len(valports) + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=128 --txq=128 --portmask=%s --nb-cores=8 --total-num-mbufs=%d" % (portMask, total_mbufs)) + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[0], "testpmd> ") + self.dut.send_expect( + "set stat_qmap rx %s 0 0" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set strip off %s" % valports[1], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[0], "testpmd> ") + self.dut.send_expect( + "vlan set filter off %s" % valports[1], "testpmd> ") + frames_to_send = 1 + queue = ['64', '127', '128'] + + for i in [0, 1, 2]: + if i == 2: + out = self.dut.send_expect( + "set stat_qmap rx %s %s %s" % (valports[0], queue[i], (i + 1)), "testpmd> ") + self.verify('Invalid RX queue %s' % + (queue[i]) in out, "set filters error") + out = self.dut.send_expect( + "5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port %s src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority 3 queue %s " % (valports[0], (i + 1), queue[i]), "testpmd> ") + self.verify('error' in out, "set filters error") + continue + else: + self.dut.send_expect("set stat_qmap rx %s %s %s" % + (valports[0], queue[i], (i + 1)), "testpmd> ") + out = self.dut.send_expect("5tuple_filter %s add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port %s src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x0 priority %d queue %s " % ( + valports[0], (i + 1), (3 - i), queue[i]), "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + global filters_index + filters_index = i + self.filter_send_packet("packet") + time.sleep(1) + out = self.dut.send_expect("stop", "testpmd> ") + cmd = "Stats reg %s RX-packets: ([0-9]+)" % ( + i + 1) + result_scanner = r"%s" % cmd + scanner = re.compile(result_scanner, re.DOTALL) + m = scanner.search(out) + cur_pkt = m.group(1) + self.verify( + int(cur_pkt) == frames_to_send, "packet pass assert error") + + self.dut.send_expect("quit", "#") + else: + self.verify(False, "%s not support this test" % self.nic) + + def test_perf_generic_filter_perf(self): + self.pmdout.start_testpmd( + "all", "--disable-rss --rxq=4 --txq=4 --portmask=%s --nb-cores=8 --nb-ports=1" % portMask) + self.port_config() + print valports[0], valports[1] + tx_port = self.tester.get_local_port(valports[0]) + tx_mac = self.dut.get_mac_address(valports[0]) + txItf = self.tester.get_interface(tx_port) + + rx_port = self.tester.get_local_port(valports[1]) + rxItf = self.tester.get_interface(rx_port) + package_sizes = [64, 128, 256, 512, 1024, 1280, 1518] + print tx_mac + print self.dut.ports_info[valports[0]], self.dut.ports_info[valports[1]] + test_type = { + "syn": ["syn_filter add 0 priority high queue 1", "syn_filter del 0 priority high queue 1"], + "ethertype": ["add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 2 index 1", "remove_ethertype_filter 0 index 1"], + "5tuple": ["5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x02 priority 3 queue 3", "5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 1 src_port 1 protocol 0x06 mask 0x1f tcp_flags 0x02 priority 3 queue 3"] + } + stream_config = { + "syn": 'Ether(dst="%s")/IP(src="2.2.2.5",dst="2.2.2.4")/TCP(dport=80,flags="S")/("X"*64)', + "ethertype": 'Ether(dst="%s")/ARP(pdst="192.168.1.1")' % tx_mac, + "5tuple": 'flows.append(Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1,flags=0)/("X"*%d))', + } + dts.results_table_add_header( + ['pack_size', "filter_type", "enable", "disable", "perf_compare"]) + for key in test_type.keys(): + if "5tuple" != key: + pps_lists = [] + for i in range(2): + self.dut.send_expect(test_type[key][i], "testpmd> ", 15) + self.dut.send_expect("start", "testpmd> ", 120) + self.tester.scapy_append('flows = []') + self.tester.scapy_append( + 'flows.append(%s)' % stream_config[key]) + self.tester.scapy_append( + 'wrpcap("generic_firlter.pcap",flows)') + self.tester.scapy_execute() + tgen_input = [] + tgen_input.append( + (tx_port, rx_port, "generic_firlter.pcap")) + _, pps = self.tester.traffic_generator_throughput( + tgen_input) + pps_lists.append(pps) + dts.results_table_add_row( + ["defult", key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])]) + # this is a TCP/IP package, need test different payload_size + if ("5tuple" == key) and ("niantic" == self.nic): + for package_size in package_sizes: + payload_size = package_size - \ + HEADER_SIZE["tcp"] - HEADER_SIZE[ + 'ip'] - HEADER_SIZE['eth'] + pps_lists = [] + for i in range(2): + self.dut.send_expect( + test_type[key][i], "testpmd> ", 15) + self.dut.send_expect("start", "testpmd> ", 120) + self.tester.scapy_append('flows = []') + self.tester.scapy_append('flows.append(%s)' % ( + stream_config[key] % (tx_mac, payload_size))) + self.tester.scapy_append( + 'wrpcap("generic_firlter.pcap",flows)') + self.tester.scapy_execute() + tgen_input = [] + # tgen_input.append((txItf, rxItf, "generic_firlter.pcap")) + tgen_input.append( + (tx_port, rx_port, "generic_firlter.pcap")) + print tgen_input + _, pps = self.tester.traffic_generator_throughput( + tgen_input) + pps_lists.append(pps) + dts.results_table_add_row( + [package_size, key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])]) + dts.results_table_print() + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.kill_all() -- 1.7.4.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-05-26 5:33 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-05-25 8:54 [dts] [dts 1/4] [PATCH V1] add generic_filter test for niantic NIC huilong,xu 2015-05-25 8:54 ` [dts] [dts 2/4] [PATCH V1] add generic_filter test for fortville NIC huilong,xu 2015-05-25 8:59 ` Liu, Yong 2015-05-25 9:15 ` Xu, HuilongX 2015-05-26 1:29 ` Liu, Yong 2015-05-25 8:54 ` [dts] [dts 3/4] [PATCH V1] add generic_filter test plan huilong,xu 2015-05-26 2:11 ` Liu, Yong 2015-05-26 5:33 ` Xu, HuilongX 2015-05-25 8:54 ` [dts] [dts 4/4] [PATCH V1] add generic filter huilong,xu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).