DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 14/15] ethdev: Support VFs on the different PCI domains
From: Kamil Rytarowski @ 2016-10-10 13:01 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: maciej.czekaj, zyta.szpak, slawomir.rosek, rad, jerin.jacob,
	john.mcnamara, Kamil Rytarowski
In-Reply-To: <90a90355-4f83-1def-081b-070924dd60d0@intel.com>



W dniu 10.10.2016 o 12:19, Ferruh Yigit pisze:
> Hi Kamil,
>
> On 9/30/2016 1:05 PM, Kamil Rytarowski wrote:
>> It's possible to have the same numbers for bus, device id and function,
>> therefore we need to differentiate on domain.
>>
>> This enables DPDK with multiple VFs on ThunderX 2-socket hardware.
>>
>> Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
>> Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
>> Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
>> Signed-off-by: Slawomir Rosek <slawomir.rosek@semihalf.com>
>> Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
>> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>> ---
>>   lib/librte_ether/rte_ethdev.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
>> index 382c959..01d5fb0 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -225,7 +225,7 @@ rte_eth_dev_create_unique_device_name(char *name, size_t size,
>>   {
>>   	int ret;
>>   
>> -	ret = snprintf(name, size, "%d:%d.%d",
>> +	ret = snprintf(name, size, "%d:%d:%d.%d", pci_dev->addr.domain,
>>   			pci_dev->addr.bus, pci_dev->addr.devid,
>>   			pci_dev->addr.function);
>>   	if (ret < 0)
>>
> Is it possible to separate this patch from patchset, this is a ethdev
> patch and it seems not directly related to the rest of the patchset?
>
> Thanks,
> ferruh

This patch is directly related with secondary queue set support on 
ThunderX, but it can be skipped in this chain of patches and applied as 
a standalone diff.

Is disabling this one on patch work sufficient? Of course unless there 
are no more comments to produce v3 of the original patch chain "Add 
support for secondary queue set in nicvf thunderx driver".

Should I resubmit it as a new standalone patch?

^ permalink raw reply

* Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
From: Neil Horman @ 2016-10-10 12:56 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: Thomas Monjalon, david.marchand@6wind.com, dev@dpdk.org
In-Reply-To: <DB5PR0401MB2054FAD862EBAD3373F4B27890D90@DB5PR0401MB2054.eurprd04.prod.outlook.com>

On Sat, Oct 08, 2016 at 01:00:59PM +0000, Shreyansh Jain wrote:
> Hi Thomas,
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Friday, October 07, 2016 7:22 PM
> > To: Shreyansh Jain <shreyansh.jain@nxp.com>
> > Cc: david.marchand@6wind.com; dev@dpdk.org
> > Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
> > 
> > 2016-10-07 19:11, Shreyansh Jain:
> > > --- a/mk/internal/rte.compile-pre.mk
> > > +++ b/mk/internal/rte.compile-pre.mk
> > > @@ -87,7 +87,7 @@ endif
> > >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> > >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> > >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> > >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> > >          $(PMDINFO_GEN) && \
> > >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> > >
> > > --->8---
> > >    CC eal_pci_vfio.o
> > >    PMDINFO eal_pci_vfio.o.pmd.c
> > > /bin/sh: 1:
> > > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> > pmdinfogen:
> > > not found
> > > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> > > recipe for target 'eal_pci_vfio.o' failed
> > > --->8---
> > >
> > > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> > 
> > Every files are scanned for the pattern.
>  
> Sorry, I should have been clearer in my statement.
> I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
> I understand that PMDINFO would run on all files.
> 
Thats incorrect, the Makefile does a REGEX search for appropriate registration
macros that imply the need for pmdinfo to run.  If its running on an
inappropriate file its because your new macros inadvertently match the current
regex, hence my suggestion that the regex should be tuned to be more specific

Neil

> > 
> > > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
> > > as well?
> > 
> > Probably.
> > That's another argument in favor of good prefixes.
> > I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
>  
> I thought of EAL_PMD_REGISTER_* but dropped it because for PCI_TABLE like macros, the name got really long (EAL_PMD_REGISTER_PCI_TABLE()).
> Anyways, I will use RTE_PMD_REGISTER_* now and send another version.
> 
> > >
> > > I am not very well versed with how PMDINFO is linking with the build
> > > system so any hints/insight into this would be really helpful.
> > >
> > > One I get more clarity on this, I will push a new version of this patch.
> > 
> > Thanks
> 
> -
> Shreyansh
> 

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 1/2] vhost: enable any layout feature
From: Maxime Coquelin @ 2016-10-10 12:40 UTC (permalink / raw)
  To: Yuanhan Liu, Michael S. Tsirkin; +Cc: Stephen Hemminger, dev, qemu-devel
In-Reply-To: <20161010042209.GB1597@yliu-dev.sh.intel.com>



On 10/10/2016 06:22 AM, Yuanhan Liu wrote:
> On Mon, Oct 10, 2016 at 07:17:06AM +0300, Michael S. Tsirkin wrote:
>> On Mon, Oct 10, 2016 at 12:05:31PM +0800, Yuanhan Liu wrote:
>>> On Fri, Sep 30, 2016 at 10:16:43PM +0300, Michael S. Tsirkin wrote:
>>>>>> And the same is done is done in DPDK:
>>>>>>
>>>>>> static inline int __attribute__((always_inline))
>>>>>> copy_desc_to_mbuf(struct virtio_net *dev, struct vring_desc *descs,
>>>>>>           uint16_t max_desc, struct rte_mbuf *m, uint16_t desc_idx,
>>>>>>           struct rte_mempool *mbuf_pool)
>>>>>> {
>>>>>> ...
>>>>>>     /*
>>>>>>      * A virtio driver normally uses at least 2 desc buffers
>>>>>>      * for Tx: the first for storing the header, and others
>>>>>>      * for storing the data.
>>>>>>      */
>>>>>>     if (likely((desc->len == dev->vhost_hlen) &&
>>>>>>            (desc->flags & VRING_DESC_F_NEXT) != 0)) {
>>>>>>         desc = &descs[desc->next];
>>>>>>         if (unlikely(desc->flags & VRING_DESC_F_INDIRECT))
>>>>>>             return -1;
>>>>>>
>>>>>>         desc_addr = gpa_to_vva(dev, desc->addr);
>>>>>>         if (unlikely(!desc_addr))
>>>>>>             return -1;
>>>>>>
>>>>>>         rte_prefetch0((void *)(uintptr_t)desc_addr);
>>>>>>
>>>>>>         desc_offset = 0;
>>>>>>         desc_avail  = desc->len;
>>>>>>         nr_desc    += 1;
>>>>>>
>>>>>>         PRINT_PACKET(dev, (uintptr_t)desc_addr, desc->len, 0);
>>>>>>     } else {
>>>>>>         desc_avail  = desc->len - dev->vhost_hlen;
>>>>>>         desc_offset = dev->vhost_hlen;
>>>>>>     }
>>>>>
>>>>> Actually, the header is parsed in DPDK vhost implementation.
>>>>> But as Virtio PMD provides a zero'ed header, we could just parse
>>>>> the header only if VIRTIO_NET_F_NO_TX_HEADER is not negotiated.
>>>>
>>>> host can always skip the header parse if it wants to.
>>>> It didn't seem worth it to add branches there but
>>>> if I'm wrong, by all means code it up.
>>>
>>> It's added by following commit, which yields about 10% performance
>>> boosts for PVP case (with 64B packet size).
>>>
>>> At that time, a packet always use 2 descs. Since indirect desc is
>>> enabled (by default) now, the assumption is not true then. What's
>>> worse, it might even slow things a bit down. That should also be
>>> part of the reason why performance is slightly worse than before.
>>>
>>> 	--yliu
>>
>> I'm not sure I get what you are saying
>>
>>> commit 1d41d77cf81c448c1b09e1e859bfd300e2054a98
>>> Author: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>>> Date:   Mon May 2 17:46:17 2016 -0700
>>>
>>>     vhost: optimize dequeue for small packets
>>>
>>>     A virtio driver normally uses at least 2 desc buffers for Tx: the
>>>     first for storing the header, and the others for storing the data.
>>>
>>>     Therefore, we could fetch the first data desc buf before the main
>>>     loop, and do the copy first before the check of "are we done yet?".
>>>     This could save one check for small packets that just have one data
>>>     desc buffer and need one mbuf to store it.
>>>
>>>     Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>>>     Acked-by: Huawei Xie <huawei.xie@intel.com>
>>>     Tested-by: Rich Lane <rich.lane@bigswitch.com>
>>
>> This fast-paths the 2-descriptors format but it's not active
>> for indirect descriptors. Is this what you mean?
>
> Yes. It's also not active when ANY_LAYOUT is actually turned on.
>> Should be a simple matter to apply this optimization for indirect.
>
> Might be.

If I understand the code correctly, indirect descs also benefit from 
this optimization, or am I missing something?

Maxime

^ permalink raw reply

* Re: [PATCH 00/19] KNI checkpatch cleanup
From: Ferruh Yigit @ 2016-10-10 12:37 UTC (permalink / raw)
  To: Pattan, Reshma, dev@dpdk.org; +Cc: Stephen Hemminger, Ferruh Yigit
In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F010ACD40@IRSMSX109.ger.corp.intel.com>

Hi Pattan,

On 10/5/2016 11:38 AM, Pattan, Reshma wrote:
> Hi Ferruh,
> 
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
>> Sent: Thursday, September 15, 2016 4:46 PM
>> To: dev@dpdk.org
>> Cc: Stephen Hemminger <stephen@networkplumber.org>; Ferruh Yigit
>> <ferruh.yigit@itnel.com>
>> Subject: [dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup
>>
>> KNI checkpatch cleanup, mostly non-functional but cosmetic modifications.
>> Only functional change is related logging, switched to kernel dynamic logging
>> and compile time KNI debug options removed, some log message levels
>> updated.
>>
>> Ferruh Yigit (19):
>>   kni: move externs to the header file
>>   kni: uninitialize global variables
>>   kni: make static struct const
>>   kni: whitespace, indentation, long line corrections
>>   kni: prefer unsigned int to unsigned
>>   kni: remove useless return
>>   kni: comparisons should place the constant on the right
>>   kni: trailing statements should be on next line
>>   kni: do not use assignment in if condition
>>   kni: macros with complex values should be enclosed in parentheses
>>   kni: prefer min_t to min
>>   kni: prefer ether_addr_copy to memcpy
>>   kni: update kernel logging
>>   kni: remove unnecessary 'out of memory' message
>>   kni: move functions to eliminate function declarations
>>   kni: remove compile time debug configuration
>>   kni: updated log messages
>>   kni: prefer uint32_t to unsigned int
>>   kni: move kernel version ifdefs to compat header
>>
> 
> Patches 4,5,11 and 13-19 are failed to apply.
> 

The patchset v3 has a dependency, mentioned in cover letter, I tested
with that patch and patches applied well for me,
would you mind trying again with that dependent patch applied please?

Thanks,
ferruh

^ permalink raw reply

* Re: [PATCH] examples/ipsec-secgw: Update checksum while decrementing ttl
From: Sergio Gonzalez Monroy @ 2016-10-10 12:05 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Akhil Goyal, dev@dpdk.org
In-Reply-To: <E115CCD9D858EF4F90C690B0DCB4D8973CA05DDD@IRSMSX108.ger.corp.intel.com>

On 07/10/2016 21:53, De Lara Guarch, Pablo wrote:
>> -----Original Message-----
>> From: Akhil Goyal [mailto:akhil.goyal@nxp.com]
>> Sent: Tuesday, October 04, 2016 11:33 PM
>> To: De Lara Guarch, Pablo; Gonzalez Monroy, Sergio; dev@dpdk.org
>> Subject: Re: [PATCH] examples/ipsec-secgw: Update checksum while
>> decrementing ttl
>>
>> On 10/5/2016 6:04 AM, De Lara Guarch, Pablo wrote:
>>>
>>>> -----Original Message-----
>>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
>>>> Monroy
>>>> Sent: Monday, September 26, 2016 6:28 AM
>>>> To: akhil.goyal@nxp.com; dev@dpdk.org
>>>> Subject: Re: [dpdk-dev] [PATCH] examples/ipsec-secgw: Update checksum
>>>> while decrementing ttl
>>>>
>>>> Hi Akhil,
>>>>
>>>> This application relies on checksum offload in both outbound and
>> inbound
>>>> paths (PKT_TX_IP_CKSUM flag).
>> [Akhil]Agreed that the application relies on checksum offload, but here
>> we are talking about the inner ip header. Inner IP checksum will be
>> updated on the next end point after decryption. This would expect that
>> the next end point must have checksum offload capability. What if we are
>> capturing the encrypted packets on wireshark or say send it to some
>> other machine which does not run DPDK and do not know about checksum
>> offload, then wireshark/other machine will not be able to get the
>> correct the checksum and will show error.

Understood, we need to have a valid inner checksum.
RFC1624 states that the computation would be incorrect in 
corner/boundary case.
I reckon you are basing your incremental update on RFC1141?

Also I think you should take care of endianess and increment the 
checksum with
host_to_be(0x0100) instead of +1.

>>>> Because we assume that we always forward the packet in both paths, we
>>>> decrement the ttl in both inbound and outbound.
>>>> You seem to only increment (recalculate) the checksum of the inner IP
>>>> header in the outbound path but not the inbound path.
>> [Akhil]Correct I missed out the inbound path.
>>>> Also, in the inbound path you have to consider a possible ECN value
>> update.
>> [Akhil]If I take care of the ECN then it would mean I need to calculate
>> the checksum completely, incremental checksum wont give correct results.
>> This would surely impact performance. Any suggestion on how should we
>> take care of ECN update. Should I recalculate the checksum and send the
>> patch for ECN update? Or do we have a better solution.

If I am understanding the RFCs mentioned above correctly, you should be 
able to do
incremental checksum update for any 16bit field/value of the IP header.
I don't see no reason why you couldn't do something like that, except 
that you would
have to follow the full equation instead of just adding 0x0100, which 
would be always
the case when decrementing TTL.

What do you think?

Sergio

>>> Any further comments here, Akhil?
>>>
>>> Thanks,
>>> Pablo
>>>
>> [Akhil] Sorry I missed out the previous reply from Sergio.
> Any more comments, Sergio?
>
> Pablo
>> Thanks,
>> Akhil

^ permalink raw reply

* Re: [PATCH v2 4/7] vhost: add dequeue zero copy
From: Maxime Coquelin @ 2016-10-10 11:48 UTC (permalink / raw)
  To: Xu, Qian Q, Yuanhan Liu; +Cc: dev@dpdk.org
In-Reply-To: <82F45D86ADE5454A95A89742C8D1410E39200616@shsmsx102.ccr.corp.intel.com>



On 10/10/2016 12:22 PM, Xu, Qian Q wrote:
> Oh, thx for the info, it's better to have some documentation update in R16.11 release notes.
I'm not the author of this change, just faced the same situation as
yours a a user.
But I agree that if documentation is not aligned, it should be updated.

Maxime

>
> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Monday, October 10, 2016 11:14 AM
> To: Xu, Qian Q <qian.q.xu@intel.com>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy
>
> Hi Xu,
>
> On 10/10/2016 12:12 PM, Xu, Qian Q wrote:
>> Good to know. I will try v3. BTW, on the master branch, seems vhost PMD is broken. When we run --vdev 'eth_vhost0,xxxx', then it will report the error that the driver is not supported.  V16.07 is OK, but I haven't got time to do git bisect.
> Name has been chenged to net_vhost0 for consistency with other PMDs.
>
> Maxime
>

^ permalink raw reply

* OpenSSL libcrypto PMD name
From: Thomas Monjalon @ 2016-10-10 11:36 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty; +Cc: dev

Hi,

I would like to raise a naming issue in crypto.

In the crypto side of DPDK, we have a library (similar to ethdev)
for crypto API and device interface:
	http://dpdk.org/browse/dpdk/tree/lib/librte_cryptodev
There are also some drivers (which are some libraries):
	http://dpdk.org/browse/dpdk/tree/drivers/crypto
Most of them (6/8) are some DPDK wrappers for external libraries.

Recently was introduced the libcrypto PMD which is a wrapper for
the OpenSSL libcrypto.
As we already have a lot of crypto libraries, I'm afraid the name
libcrypto is really confusing. Why not call it openssl PMD?

PS: I know OpenSSL has 2 libraries - ssl and crypto - but I do not
expect any high-level SSL feature in a crypto driver.
So drivers/crypto/openssl should not be confusing.

^ permalink raw reply

* Re: [PATCH v7] net/virtio: add set_mtu in virtio
From: Kavanagh, Mark B @ 2016-10-10 10:49 UTC (permalink / raw)
  To: Yuanhan Liu, Dey; +Cc: stephen@networkplumber.org, dev@dpdk.org
In-Reply-To: <20161009035251.GN1597@yliu-dev.sh.intel.com>

>
>On Thu, Sep 29, 2016 at 04:31:30PM -0400, Dey wrote:
>>  /*
>>   * dev_ops for virtio, bare necessities for basic operation
>>   */
>> @@ -677,7 +685,6 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
>>  	.allmulticast_enable     = virtio_dev_allmulticast_enable,
>>  	.allmulticast_disable    = virtio_dev_allmulticast_disable,
>> +	.mtu_set                 = virtio_mtu_set,
>>  	.dev_infos_get           = virtio_dev_info_get,
>>  	.stats_get               = virtio_dev_stats_get,
>>  	.xstats_get              = virtio_dev_xstats_get,
>> --
>> 2.9.3.windows.1
>
>Your patch is malformed: I got an error while trying to apply it.
>
>    patch: **** malformed patch at line 167:   * dev_ops for virtio,
>    bare necessities for basic operation
>
>Seems like the way you were generating the patch is wrong.
>
>Anyway, I applied it manually, with the "- frame_size" fix as well
>as few more minor coding style fixes.
>
>So applied to dpdk-next-virtio.

Hi Yuanhan/Souvik,

Given my contributions to this patch (and in particular since comments from here - http://dpdk.org/ml/archives/dev/2016-September/047208.html - were copied directly into the commit message), I think that I should have been added as co-author of the patch? 

Let me know if you think that I am mistaken.

Thanks in advance,
Mark
>
>	--yliu

^ permalink raw reply

* Re: DPDK Community Survey - about to close
From: Glynn, Michael J @ 2016-10-10 10:42 UTC (permalink / raw)
  To: users@dpdk.org, dev@dpdk.org, announce@dpdk.org
In-Reply-To: <6A5E04BECFB4144EAFCF9EAE3B739A5355B4265D@IRSMSX106.ger.corp.intel.com>



-----Original Message-----
From: users [mailto:users-bounces@dpdk.org] On Behalf Of Glynn, Michael J
Sent: Monday, August 29, 2016 6:14 PM
To: users@dpdk.org; dev@dpdk.org; announce@dpdk.org
Subject: [dpdk-users] FW: DPDK Community Survey - about to close

> ... 
>
> Regarding improvement areas, the main feedback was:
> * Release Support (stable releases, LTS)
> * Documentation - certain aspects are outdated and need attention (particularly the Programmers Guide)
> * No specific hotspots but performance bottlenecks seen in certain areas
> * Need for a continuous integration and test environment

Hi all - I just want to draw your attention to day 2 of the DPDK Userspace event in Dublin next week in which there will be a discussion on 'Usability (including packaging, stable releases, LTS releases etc.)' led by John McNamara (Intel), Christian Ehrhardt (Canonical), and Luca Boccassi (Brocade), and a presentation on 'Testing and Continuous Integration improvements in DPDK' by Qian Xu and Yuanhan Liu (both Intel). In addition, Bruce Richardson (Intel) will be giving a presentation on 'Identifying and Fixing Performance Bottlenecks in DPDK' using an example from the i40e driver illustrate the process.

The full planned agenda is located here https://dpdksummit.com/  

^ permalink raw reply

* Re: [PATCH v2 4/7] vhost: add dequeue zero copy
From: Xu, Qian Q @ 2016-10-10 10:40 UTC (permalink / raw)
  To: Xu, Qian Q, Maxime Coquelin, Yuanhan Liu; +Cc: dev@dpdk.org
In-Reply-To: <82F45D86ADE5454A95A89742C8D1410E39200616@shsmsx102.ccr.corp.intel.com>

I'm a little concerned if it's a correct way to change the name from release to release, some users may use eth_vhost for the driver, and found it was not working. Do we need also make the consistency b/w releases?  
What's the name difference b/w eth and net? Other PMDs are not virtual devices. Virtio_user is also a virtual device, do we need to change the name,too? 


-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xu, Qian Q
Sent: Monday, October 10, 2016 11:23 AM
To: Maxime Coquelin <maxime.coquelin@redhat.com>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

Oh, thx for the info, it's better to have some documentation update in R16.11 release notes. 

-----Original Message-----
From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] 
Sent: Monday, October 10, 2016 11:14 AM
To: Xu, Qian Q <qian.q.xu@intel.com>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

Hi Xu,

On 10/10/2016 12:12 PM, Xu, Qian Q wrote:
> Good to know. I will try v3. BTW, on the master branch, seems vhost PMD is broken. When we run --vdev 'eth_vhost0,xxxx', then it will report the error that the driver is not supported.  V16.07 is OK, but I haven't got time to do git bisect.
Name has been chenged to net_vhost0 for consistency with other PMDs.

Maxime

^ permalink raw reply

* Re: [PATCH v2 4/7] vhost: add dequeue zero copy
From: Xu, Qian Q @ 2016-10-10 10:22 UTC (permalink / raw)
  To: Maxime Coquelin, Yuanhan Liu; +Cc: dev@dpdk.org
In-Reply-To: <0eb01ddf-533c-9348-9091-292690070cb2@redhat.com>

Oh, thx for the info, it's better to have some documentation update in R16.11 release notes. 

-----Original Message-----
From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] 
Sent: Monday, October 10, 2016 11:14 AM
To: Xu, Qian Q <qian.q.xu@intel.com>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

Hi Xu,

On 10/10/2016 12:12 PM, Xu, Qian Q wrote:
> Good to know. I will try v3. BTW, on the master branch, seems vhost PMD is broken. When we run --vdev 'eth_vhost0,xxxx', then it will report the error that the driver is not supported.  V16.07 is OK, but I haven't got time to do git bisect.
Name has been chenged to net_vhost0 for consistency with other PMDs.

Maxime

^ permalink raw reply

* Re: [PATCH v2 14/15] ethdev: Support VFs on the different PCI domains
From: Ferruh Yigit @ 2016-10-10 10:19 UTC (permalink / raw)
  To: Kamil Rytarowski, dev
  Cc: maciej.czekaj, zyta.szpak, slawomir.rosek, rad, jerin.jacob,
	john.mcnamara, Kamil Rytarowski
In-Reply-To: <1475237154-25388-15-git-send-email-krytarowski@caviumnetworks.com>

Hi Kamil,

On 9/30/2016 1:05 PM, Kamil Rytarowski wrote:
> It's possible to have the same numbers for bus, device id and function,
> therefore we need to differentiate on domain.
> 
> This enables DPDK with multiple VFs on ThunderX 2-socket hardware.
> 
> Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
> Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
> Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
> Signed-off-by: Slawomir Rosek <slawomir.rosek@semihalf.com>
> Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 382c959..01d5fb0 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -225,7 +225,7 @@ rte_eth_dev_create_unique_device_name(char *name, size_t size,
>  {
>  	int ret;
>  
> -	ret = snprintf(name, size, "%d:%d.%d",
> +	ret = snprintf(name, size, "%d:%d:%d.%d", pci_dev->addr.domain,
>  			pci_dev->addr.bus, pci_dev->addr.devid,
>  			pci_dev->addr.function);
>  	if (ret < 0)
> 

Is it possible to separate this patch from patchset, this is a ethdev
patch and it seems not directly related to the rest of the patchset?

Thanks,
ferruh

^ permalink raw reply

* Re: [PATCH v2 4/7] vhost: add dequeue zero copy
From: Maxime Coquelin @ 2016-10-10 10:14 UTC (permalink / raw)
  To: Xu, Qian Q, Yuanhan Liu; +Cc: dev@dpdk.org
In-Reply-To: <82F45D86ADE5454A95A89742C8D1410E392005B2@shsmsx102.ccr.corp.intel.com>

Hi Xu,

On 10/10/2016 12:12 PM, Xu, Qian Q wrote:
> Good to know. I will try v3. BTW, on the master branch, seems vhost PMD is broken. When we run --vdev 'eth_vhost0,xxxx', then it will report the error that the driver is not supported.  V16.07 is OK, but I haven't got time to do git bisect.
Name has been chenged to net_vhost0 for consistency with other PMDs.

Maxime

^ permalink raw reply

* Re: [PATCH v2 4/7] vhost: add dequeue zero copy
From: Xu, Qian Q @ 2016-10-10 10:12 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev@dpdk.org, Maxime Coquelin
In-Reply-To: <20161009020305.GM1597@yliu-dev.sh.intel.com>

Good to know. I will try v3. BTW, on the master branch, seems vhost PMD is broken. When we run --vdev 'eth_vhost0,xxxx', then it will report the error that the driver is not supported.  V16.07 is OK, but I haven't got time to do git bisect. 

-----Original Message-----
From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] 
Sent: Sunday, October 9, 2016 3:03 AM
To: Xu, Qian Q <qian.q.xu@intel.com>
Cc: dev@dpdk.org; Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

On Thu, Oct 06, 2016 at 02:37:27PM +0000, Xu, Qian Q wrote:
> this function copy_desc_to_mbuf has changed on the dpdk-next-virtio repo. Based on current dpdk-next-virtio repo, the commit ID is as below: 
> commit b4f7b43cd9d3b6413f41221051d03a23bc5f5fbe
> Author: Zhiyong Yang <zhiyong.yang@intel.com>
> Date:   Thu Sep 29 20:35:49 2016 +0800
> 
> Then you will find the parameter "struct vhost_virtqueue *vq" is removed, so if apply your patch on that commit ID, the build will fail, since no vq definition but we used it in the function. 
> Could you check? Thx. 

I knew that: a rebase is needed, and I have done the rebase (locally); just haven't sent it out yet.

	--yliu

> 
> == Build lib/librte_table
> /home/qxu10/dpdk-zero/lib/librte_vhost/virtio_net.c: In function 'copy_desc_to_mbuf':
> /home/qxu10/dpdk-zero/lib/librte_vhost/virtio_net.c:745:21: error: 'vq' undeclared (first use in this function)
>    zmbuf = get_zmbuf(vq);
>                      ^
> /home/qxu10/dpdk-zero/lib/librte_vhost/virtio_net.c:745:21: note: each 
> undeclared identifier is reported only once for each function it 
> appears in
> /home/qxu10/dpdk-zero/mk/internal/rte.compile-pre.mk:138: recipe for 
> target 'virtio_net.o' failed
> make[5]: *** [virtio_net.o] Error 1
> /home/qxu10/dpdk-zero/mk/rte.subdir.mk:61: recipe for target 
> 'librte_vhost' failed
> make[4]: *** [librte_vhost] Error 2
> make[4]: *** Waiting for unfinished jobs....
> 

^ permalink raw reply

* Re: [PATCH 1/2] ethdev: fix hotplug attach
From: Thomas Monjalon @ 2016-10-10  9:52 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, danielx.t.mrzyglod, shreyansh.jain
In-Reply-To: <1475845276-25527-1-git-send-email-david.marchand@6wind.com>

2016-10-07 15:01, David Marchand:
> If a pci probe operation creates a port but, for any reason, fails to
> finish this operation and decides to delete the newly created port, then
> the last created port id can not be trusted anymore and any subsequent
> attach operations will fail.
> 
> This problem was noticed while working on a vm that had a virtio-net
> management interface bound to the virtio-net kernel driver and no port
> whitelisted in the commandline:
[...]
> Two solutions:
> - either update the last created port index to something invalid
>   (when freeing a ethdev port),
> - or rely on the port count, before and after the eal attach.
> 
> The latter solution seems (well not really more robust but at least)
> less fragile than the former.
> We still have some issues with drivers that create multiple ethdev
> ports with a single probe operation, but this was already the case.
> 
> Fixes: b0fb26685570 ("ethdev: convert to EAL hotplug")
> 
> Reported-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>

Series applied, thanks

^ permalink raw reply

* Re: [RFC v2] Generic flow director/filtering/classification API
From: Zhao1, Wei @ 2016-10-10  9:42 UTC (permalink / raw)
  To: Adrien Mazarguil, dev@dpdk.org

Hi Adrien Mazarguil,

In your v2 version of rte_flow.txt , there is an action type RTE_FLOW_ACTION_TYPE_MARK,  but there is no definition of struct rte_flow_action_mark.
And there is  an definition of struct rte_flow_action_id. Is it a typo or other usage?

Thank you.

struct rte_flow_action_id {
	uint32_t id; /**< 32 bit value to return with packets. */
};

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil
> Sent: Saturday, August 20, 2016 3:33 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [RFC v2] Generic flow director/filtering/classification API
> 
> Hi All,
> 
> Thanks to many for the positive and constructive feedback I've received so
> far. Here is the updated specification (v0.7) at last.
> 
> I've attempted to address as many comments as possible but could not
> process them all just yet. A new section "Future evolutions" has been
> added for the remaining topics.
> 
> This series adds rte_flow.h to the DPDK tree. Next time I will attempt to
> convert the specification as a documentation commit part of the patchset
> and actually implement API functions.
> 
> I think including the entire document here makes it easier to annotate on
> the ML, apologies in advance for the resulting traffic.
> 
> Finally I'm off for the next two weeks, do not expect replies from me in
> the meantime.
> 
> Updates are also available online:
> 
> HTML version:
>  https://rawgit.com/6WIND/rte_flow/master/rte_flow.html
> 
> PDF version:
>  https://rawgit.com/6WIND/rte_flow/master/rte_flow.pdf
> 
> Related draft header file (also in the next patch):
>  https://raw.githubusercontent.com/6WIND/rte_flow/master/rte_flow.h
> 
> Git tree:
>  https://github.com/6WIND/rte_flow
> 
> Changes from v1:
> 
>  Specification:
> 
>  - Settled on [generic] "flow interface" / "flow API" as the name of this
>    framework, matches the rte_flow prefix better.
>  - Minor wording changes in several places.
>  - Partially added egress (TX) support.
>  - Added "unrecoverable errors" as another consequence of overlapping
>    rules.
>  - Described flow rules groups and their interaction with flow rule
>    priorities.
>  - Fully described PF and VF meta pattern items so they are not open to
>    interpretation anymore.
>  - Removed the SIGNATURE meta pattern item as its description was too
>    vague, may be re-added later if necessary.
>  - Added the PORT pattern item to apply rules to non-default physical
>    ports.
>  - Entirely redefined the RAW pattern item.
>  - Fixed tag error in the ETH item definition.
>  - Updated protocol definitions (IPV4, IPV6, ICMP, UDP).
>  - Added missing protocols (SCTP, VXLAN).
>  - Converted ID action to MARK and FLAG actions, described interaction
>    with the RSS hash result in mbufs.
>  - Updated COUNT query structure to retrieve the number of bytes.
>  - Updated VF action.
>  - Documented negative item and action types, those will be used for
>    dynamic types generated at run-time.
>  - Added blurb about IPv4 options and IPv6 extension headers matching.
>  - Updated function definitions.
>  - Documented a flush method to remove all rules on a given port at once.
>  - Documented the verbose error reporting interface.
>  - Documented how the private interface for PMD use will work.
>  - Documented expected behavior between successive port initializations.
>  - Documented expected behavior for ports not under DPDK control.
>  - Updated API migration section.
>  - Added future evolutions section.
> 
>  Header file:
> 
>  - Not a draft anymore and can be used as-is for preliminary
>    implementations.
>  - Flow rule attributes (group, priority, etc) now have their own
>    structure provided separately to API functions (struct rte_flow_attr).
>  - Group and priority interactions have been documented.
>  - Added PORT item.
>  - Removed SIGNATURE item.
>  - Defined ICMP, SCTP and VXLAN items.
>  - Redefined PF, VF, RAW, IPV4, IPV6, UDP and TCP items.
>  - Fixed tag error in the ETH item definition.
>  - Converted ID action to MARK and FLAG actions.
>    hash result in mbufs.
>  - Updated COUNT query structure.
>  - Updated VF action.
>  - Added verbose errors interface.
>  - Updated function prototypes according to the above.
>  - Defined rte_flow_flush().
> 
> --------
> 
> ======================
> Generic flow interface
> ======================
> 
> .. footer::
> 
>    v0.7
> 
> .. contents::
> .. sectnum::
> .. raw:: pdf
> 
>    PageBreak
> 
> Overview
> ========
> 
> DPDK provides several competing interfaces added over time to perform
> packet
> matching and related actions such as filtering and classification.
> 
> They must be extended to implement the features supported by newer
> devices
> in order to expose them to applications, however the current design has
> several drawbacks:
> 
> - Complicated filter combinations which have not been hard-coded cannot be
>   expressed.
> - Prone to API/ABI breakage when new features must be added to an
> existing
>   filter type, which frequently happens.
> 
> From an application point of view:
> 
> - Having disparate interfaces, all optional and lacking in features does not
>   make this API easy to use.
> - Seemingly arbitrary built-in limitations of filter types based on the
>   device they were initially designed for.
> - Undefined relationship between different filter types.
> - High complexity, considerable undocumented and/or undefined behavior.
> 
> Considering the growing number of devices supported by DPDK, adding a
> new
> filter type each time a new feature must be implemented is not sustainable
> in the long term. Applications not written to target a specific device
> cannot really benefit from such an API.
> 
> For these reasons, this document defines an extensible unified API that
> encompasses and supersedes these legacy filter types.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Current API
> ===========
> 
> Rationale
> ---------
> 
> The reason several competing (and mostly overlapping) filtering APIs are
> present in DPDK is due to its nature as a thin layer between hardware and
> software.
> 
> Each subsequent interface has been added to better match the capabilities
> and limitations of the latest supported device, which usually happened to
> need an incompatible configuration approach. Because of this, many ended
> up
> device-centric and not usable by applications that were not written for that
> particular device.
> 
> This document is not the first attempt to address this proliferation issue,
> in fact a lot of work has already been done both to create a more generic
> interface while somewhat keeping compatibility with legacy ones through a
> common call interface (``rte_eth_dev_filter_ctrl()`` with the
> ``.filter_ctrl`` PMD callback in ``rte_ethdev.h``).
> 
> Today, these previously incompatible interfaces are known as filter types
> (``RTE_ETH_FILTER_*`` from ``enum rte_filter_type`` in ``rte_eth_ctrl.h``).
> 
> However while trivial to extend with new types, it only shifted the
> underlying problem as applications still need to be written for one kind of
> filter type, which, as described in the following sections, is not
> necessarily implemented by all PMDs that support filtering.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Filter types
> ------------
> 
> This section summarizes the capabilities of each filter type.
> 
> Although the following list is exhaustive, the description of individual
> types may contain inaccuracies due to the lack of documentation or usage
> examples.
> 
> Note: names are prefixed with ``RTE_ETH_FILTER_``.
> 
> ``MACVLAN``
> ~~~~~~~~~~~
> 
> Matching:
> 
> - L2 source/destination addresses.
> - Optional 802.1Q VLAN ID.
> - Masking individual fields on a rule basis is not supported.
> 
> Action:
> 
> - Packets are redirected either to a given VF device using its ID or to the
>   PF.
> 
> ``ETHERTYPE``
> ~~~~~~~~~~~~~
> 
> Matching:
> 
> - L2 source/destination addresses (optional).
> - Ethertype (no VLAN ID?).
> - Masking individual fields on a rule basis is not supported.
> 
> Action:
> 
> - Receive packets on a given queue.
> - Drop packets.
> 
> ``FLEXIBLE``
> ~~~~~~~~~~~~
> 
> Matching:
> 
> - At most 128 consecutive bytes anywhere in packets.
> - Masking is supported with byte granularity.
> - Priorities are supported (relative to this filter type, undefined
>   otherwise).
> 
> Action:
> 
> - Receive packets on a given queue.
> 
> ``SYN``
> ~~~~~~~
> 
> Matching:
> 
> - TCP SYN packets only.
> - One high priority bit can be set to give the highest possible priority to
>   this type when other filters with different types are configured.
> 
> Action:
> 
> - Receive packets on a given queue.
> 
> ``NTUPLE``
> ~~~~~~~~~~
> 
> Matching:
> 
> - Source/destination IPv4 addresses (optional in 2-tuple mode).
> - Source/destination TCP/UDP port (mandatory in 2 and 5-tuple modes).
> - L4 protocol (2 and 5-tuple modes).
> - Masking individual fields is supported.
> - TCP flags.
> - Up to 7 levels of priority relative to this filter type, undefined
>   otherwise.
> - No IPv6.
> 
> Action:
> 
> - Receive packets on a given queue.
> 
> ``TUNNEL``
> ~~~~~~~~~~
> 
> Matching:
> 
> - Outer L2 source/destination addresses.
> - Inner L2 source/destination addresses.
> - Inner VLAN ID.
> - IPv4/IPv6 source (destination?) address.
> - Tunnel type to match (VXLAN, GENEVE, TEREDO, NVGRE, IP over GRE,
> 802.1BR
>   E-Tag).
> - Tenant ID for tunneling protocols that have one.
> - Any combination of the above can be specified.
> - Masking individual fields on a rule basis is not supported.
> 
> Action:
> 
> - Receive packets on a given queue.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``FDIR``
> ~~~~~~~~
> 
> Queries:
> 
> - Device capabilities and limitations.
> - Device statistics about configured filters (resource usage, collisions).
> - Device configuration (matching input set and masks)
> 
> Matching:
> 
> - Device mode of operation: none (to disable filtering), signature
>   (hash-based dispatching from masked fields) or perfect (either MAC VLAN
> or
>   tunnel).
> - L2 Ethertype.
> - Outer L2 destination address (MAC VLAN mode).
> - Inner L2 destination address, tunnel type (NVGRE, VXLAN) and tunnel ID
>   (tunnel mode).
> - IPv4 source/destination addresses, ToS, TTL and protocol fields.
> - IPv6 source/destination addresses, TC, protocol and hop limits fields.
> - UDP source/destination IPv4/IPv6 and ports.
> - TCP source/destination IPv4/IPv6 and ports.
> - SCTP source/destination IPv4/IPv6, ports and verification tag field.
> - Note, only one protocol type at once (either only L2 Ethertype, basic
>   IPv6, IPv4+UDP, IPv4+TCP and so on).
> - VLAN TCI (extended API).
> - At most 16 bytes to match in payload (extended API). A global device
>   look-up table specifies for each possible protocol layer (unknown, raw,
>   L2, L3, L4) the offset to use for each byte (they do not need to be
>   contiguous) and the related bit-mask.
> - Whether packet is addressed to PF or VF, in that case its ID can be
>   matched as well (extended API).
> - Masking most of the above fields is supported, but simultaneously affects
>   all filters configured on a device.
> - Input set can be modified in a similar fashion for a given device to
>   ignore individual fields of filters (i.e. do not match the destination
>   address in a IPv4 filter, refer to **RTE_ETH_INPUT_SET_**
>   macros). Configuring this also affects RSS processing on **i40e**.
> - Filters can also provide 32 bits of arbitrary data to return as part of
>   matched packets.
> 
> Action:
> 
> - **RTE_ETH_FDIR_ACCEPT**: receive (accept) packet on a given queue.
> - **RTE_ETH_FDIR_REJECT**: drop packet immediately.
> - **RTE_ETH_FDIR_PASSTHRU**: similar to accept for the last filter in list,
>   otherwise process it with subsequent filters.
> - For accepted packets and if requested by filter, either 32 bits of
>   arbitrary data and four bytes of matched payload (only in case of flex
>   bytes matching), or eight bytes of matched payload (flex also) are added
>   to meta data.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``HASH``
> ~~~~~~~~
> 
> Not an actual filter type. Provides and retrieves the global device
> configuration (per port or entire NIC) for hash functions and their
> properties.
> 
> Hash function selection: "default" (keep current), XOR or Toeplitz.
> 
> This function can be configured per flow type (**RTE_ETH_FLOW_**
> definitions), supported types are:
> 
> - Unknown.
> - Raw.
> - Fragmented or non-fragmented IPv4.
> - Non-fragmented IPv4 with L4 (TCP, UDP, SCTP or other).
> - Fragmented or non-fragmented IPv6.
> - Non-fragmented IPv6 with L4 (TCP, UDP, SCTP or other).
> - L2 payload.
> - IPv6 with extensions.
> - IPv6 with L4 (TCP, UDP) and extensions.
> 
> ``L2_TUNNEL``
> ~~~~~~~~~~~~~
> 
> Matching:
> 
> - All packets received on a given port.
> 
> Action:
> 
> - Add tunnel encapsulation (VXLAN, GENEVE, TEREDO, NVGRE, IP over GRE,
>   802.1BR E-Tag) using the provided Ethertype and tunnel ID (only E-Tag
>   is implemented at the moment).
> - VF ID to use for tag insertion (currently unused).
> - Destination pool for tag based forwarding (pools are IDs that can be
>   affected to ports, duplication occurs if the same ID is shared by several
>   ports of the same NIC).
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Driver support
> --------------
> 
> ======== ======= ========= ======== === ====== ====== ==== ====
> =========
> Driver   MACVLAN ETHERTYPE FLEXIBLE SYN NTUPLE TUNNEL FDIR HASH
> L2_TUNNEL
> ======== ======= ========= ======== === ====== ====== ==== ====
> =========
> bnx2x
> cxgbe
> e1000            yes       yes      yes yes
> ena
> enic                                                  yes
> fm10k
> i40e     yes     yes                           yes    yes  yes
> ixgbe            yes                yes yes           yes       yes
> mlx4
> mlx5                                                  yes
> szedata2
> ======== ======= ========= ======== === ====== ====== ==== ====
> =========
> 
> Flow director
> -------------
> 
> Flow director (FDIR) is the name of the most capable filter type, which
> covers most features offered by others. As such, it is the most widespread
> in PMDs that support filtering (i.e. all of them besides **e1000**).
> 
> It is also the only type that allows an arbitrary 32 bits value provided by
> applications to be attached to a filter and returned with matching packets
> instead of relying on the destination queue to recognize flows.
> 
> Unfortunately, even FDIR requires applications to be aware of low-level
> capabilities and limitations (most of which come directly from **ixgbe** and
> **i40e**):
> 
> - Bit-masks are set globally per device (port?), not per filter.
> - Configuration state is not expected to be saved by the driver, and
>   stopping/restarting a port requires the application to perform it again
>   (API documentation is also unclear about this).
> - Monolithic approach with ABI issues as soon as a new kind of flow or
>   combination needs to be supported.
> - Cryptic global statistics/counters.
> - Unclear about how priorities are managed; filters seem to be arranged as a
>   linked list in hardware (possibly related to configuration order).
> 
> Packet alteration
> -----------------
> 
> One interesting feature is that the L2 tunnel filter type implements the
> ability to alter incoming packets through a filter (in this case to
> encapsulate them), thus the **mlx5** flow encap/decap features are not a
> foreign concept.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Proposed API
> ============
> 
> Terminology
> -----------
> 
> - **Flow API**: overall framework affecting the fate of selected packets,
>   covers everything described in this document.
> - **Filtering API**: an alias for *Flow API*.
> - **Matching pattern**: properties to look for in packets, a combination of
>   any number of items.
> - **Pattern item**: part of a pattern that either matches packet data
>   (protocol header, payload or derived information), or specifies properties
>   of the pattern itself.
> - **Actions**: what needs to be done when a packet is matched by a
> pattern.
> - **Flow rule**: this is the result of combining a *matching pattern* with
>   *actions*.
> - **Filter rule**: a less generic term than *flow rule*, can otherwise be
>   used interchangeably.
> - **Hit**: a flow rule is said to be *hit* when processing a matching
>   packet.
> 
> Requirements
> ------------
> 
> As described in the previous section, there is a growing need for a common
> method to configure filtering and related actions in a hardware independent
> fashion.
> 
> The flow API should not disallow any filter combination by design and must
> remain as simple as possible to use. It can simply be defined as a method to
> perform one or several actions on selected packets.
> 
> PMDs are aware of the capabilities of the device they manage and should be
> responsible for preventing unsupported or conflicting combinations.
> 
> This approach is fundamentally different as it places most of the burden on
> the software side of the PMD instead of having device capabilities directly
> mapped to API functions, then expecting applications to work around
> ensuing
> compatibility issues.
> 
> Requirements for a new API:
> 
> - Flexible and extensible without causing API/ABI problems for existing
>   applications.
> - Should be unambiguous and easy to use.
> - Support existing filtering features and actions listed in `Filter types`_.
> - Support packet alteration.
> - In case of overlapping filters, their priority should be well documented.
> - Support filter queries (for example to retrieve counters).
> - Support egress (TX) matching and specific actions.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> High level design
> -----------------
> 
> The chosen approach to make filtering as generic as possible is by
> expressing matching patterns through lists of items instead of the flat
> structures used in DPDK today, enabling combinations that are not
> predefined
> and thus being more versatile.
> 
> Flow rules can have several distinct actions (such as counting,
> encapsulating, decapsulating before redirecting packets to a particular
> queue, etc.), instead of relying on several rules to achieve this and having
> applications deal with hardware implementation details regarding their
> order.
> 
> Support for different priority levels on a rule basis is provided, for
> example in order to force a more specific rule come before a more generic
> one for packets matched by both, however hardware support for more than
> a
> single priority level cannot be guaranteed. When supported, the number of
> available priority levels is usually low, which is why they can also be
> implemented in software by PMDs (e.g. missing priority levels may be
> emulated by reordering rules).
> 
> In order to remain as hardware agnostic as possible, by default all rules
> are considered to have the same priority, which means that the order
> between
> overlapping rules (when a packet is matched by several filters) is
> undefined, packet duplication or unrecoverable errors may even occur as a
> result.
> 
> PMDs may refuse to create overlapping rules at a given priority level when
> they can be detected (e.g. if a pattern matches an existing filter).
> 
> Thus predictable results for a given priority level can only be achieved
> with non-overlapping rules, using perfect matching on all protocol layers.
> 
> Flow rules can also be grouped, the flow rule priority is specific to the
> group they belong to. All flow rules in a given group are thus processed
> either before or after another group.
> 
> Support for multiple actions per rule may be implemented internally on top
> of non-default hardware priorities, as a result both features may not be
> simultaneously available to applications.
> 
> Considering that allowed pattern/actions combinations cannot be known in
> advance and would result in an unpractically large number of capabilities to
> expose, a method is provided to validate a given rule from the current
> device configuration state without actually adding it (akin to a "dry run"
> mode).
> 
> This enables applications to check if the rule types they need is supported
> at initialization time, before starting their data path. This method can be
> used anytime, its only requirement being that the resources needed by a
> rule
> must exist (e.g. a target RX queue must be configured first).
> 
> Each defined rule is associated with an opaque handle managed by the PMD,
> applications are responsible for keeping it. These can be used for queries
> and rules management, such as retrieving counters or other data and
> destroying them.
> 
> To avoid resource leaks on the PMD side, handles must be explicitly
> destroyed by the application before releasing associated resources such as
> queues and ports.
> 
> Integration
> -----------
> 
> To avoid ABI breakage, this new interface will be implemented through the
> existing filtering control framework (``rte_eth_dev_filter_ctrl()``) using
> **RTE_ETH_FILTER_GENERIC** as a new filter type.
> 
> However a public front-end API described in `Rules management`_ will
> be added as the preferred method to use it.
> 
> Once discussions with the community have converged to a definite API,
> legacy
> filter types should be deprecated and a deadline defined to remove their
> support entirely.
> 
> PMDs will have to be gradually converted to **RTE_ETH_FILTER_GENERIC**
> or
> drop filtering support entirely. Less maintained PMDs for older hardware
> may
> lose support at this point.
> 
> The notion of filter type will then be deprecated and subsequently dropped
> to avoid confusion between both frameworks.
> 
> Implementation details
> ======================
> 
> Flow rule
> ---------
> 
> A flow rule is the combination a matching pattern with a list of actions,
> and is the basis of this API.
> 
> They also have several other attributes described in the following sections.
> 
> Groups
> ~~~~~~
> 
> Flow rules can be grouped by assigning them a common group number.
> Lower
> values have higher priority. Group 0 has the highest priority.
> 
> Although optional, applications are encouraged to group similar rules as
> much as possible to fully take advantage of hardware capabilities
> (e.g. optimized matching) and work around limitations (e.g. a single pattern
> type possibly allowed in a given group).
> 
> Note that support for more than a single group is not guaranteed.
> 
> Priorities
> ~~~~~~~~~~
> 
> A priority level can be assigned to a flow rule. Like groups, lower values
> denote higher priority, with 0 as the maximum.
> 
> A rule with priority 0 in group 8 is always matched after a rule with
> priority 8 in group 0.
> 
> Group and priority levels are arbitrary and up to the application, they do
> not need to be contiguous nor start from 0, however the maximum number
> varies between devices and may be affected by existing flow rules.
> 
> If a packet is matched by several rules of a given group for a given
> priority level, the outcome is undefined. It can take any path, may be
> duplicated or even cause unrecoverable errors.
> 
> Note that support for more than a single priority level is not guaranteed.
> 
> Traffic direction
> ~~~~~~~~~~~~~~~~~
> 
> Flow rules can apply to inbound and/or outbound traffic (ingress/egress).
> 
> Several pattern items and actions are valid and can be used in both
> directions. Those valid for only one direction are described as such.
> 
> Specifying both directions at once is not recommended but may be valid in
> some cases, such as incrementing the same counter twice.
> 
> Not specifying any direction is currently an error.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Matching pattern
> ~~~~~~~~~~~~~~~~
> 
> A matching pattern comprises any number of items of various types.
> 
> Items are arranged in a list to form a matching pattern for packets. They
> fall in two categories:
> 
> - Protocol matching (ANY, RAW, ETH, IPV4, IPV6, ICMP, UDP, TCP, SCTP,
> VXLAN
>   and so on), usually associated with a specification structure. These must
>   be stacked in the same order as the protocol layers to match, starting
>   from L2.
> 
> - Affecting how the pattern is processed (END, VOID, INVERT, PF, VF, PORT
>   and so on), often without a specification structure. Since they are meta
>   data that does not match packet contents, these can be specified anywhere
>   within item lists without affecting the protocol matching items.
> 
> Most item specifications can be optionally paired with a mask to narrow the
> specific fields or bits to be matched.
> 
> - Items are defined with ``struct rte_flow_item``.
> - Patterns are defined with ``struct rte_flow_pattern``.
> 
> Example of an item specification matching an Ethernet header:
> 
> +-----------------------------------------+
> | Ethernet                                |
> +==========+=========+====================+
> | ``spec`` | ``src`` | ``00:01:02:03:04`` |
> |          +---------+--------------------+
> |          | ``dst`` | ``00:2a:66:00:01`` |
> +----------+---------+--------------------+
> | ``mask`` | ``src`` | ``00:ff:ff:ff:00`` |
> |          +---------+--------------------+
> |          | ``dst`` | ``00:00:00:00:ff`` |
> +----------+---------+--------------------+
> 
> Non-masked bits stand for any value, Ethernet headers with the following
> properties are thus matched:
> 
> - ``src``: ``??:01:02:03:??``
> - ``dst``: ``??:??:??:??:01``
> 
> Except for meta types that do not need one, ``spec`` must be a valid pointer
> to a structure of the related item type. A ``mask`` of the same type can be
> provided to tell which bits in ``spec`` are to be matched.
> 
> A mask is normally only needed for ``spec`` fields matching packet data,
> ignored otherwise. See individual item types for more information.
> 
> A ``NULL`` mask pointer is allowed and is similar to matching with a full
> mask (all ones) ``spec`` fields supported by hardware, the remaining fields
> are ignored (all zeroes), there is thus no error checking for unsupported
> fields.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Matching pattern items for packet data must be naturally stacked (ordered
> from lowest to highest protocol layer), as in the following examples:
> 
> +--------------+
> | TCPv4 as L4  |
> +===+==========+
> | 0 | Ethernet |
> +---+----------+
> | 1 | IPv4     |
> +---+----------+
> | 2 | TCP      |
> +---+----------+
> 
> +----------------+
> | TCPv6 in VXLAN |
> +===+============+
> | 0 | Ethernet   |
> +---+------------+
> | 1 | IPv4       |
> +---+------------+
> | 2 | UDP        |
> +---+------------+
> | 3 | VXLAN      |
> +---+------------+
> | 4 | Ethernet   |
> +---+------------+
> | 5 | IPv6       |
> +---+------------+
> | 6 | TCP        |
> +---+------------+
> 
> +-----------------------------+
> | TCPv4 as L4 with meta items |
> +===+=========================+
> | 0 | VOID                    |
> +---+-------------------------+
> | 1 | Ethernet                |
> +---+-------------------------+
> | 2 | VOID                    |
> +---+-------------------------+
> | 3 | IPv4                    |
> +---+-------------------------+
> | 4 | TCP                     |
> +---+-------------------------+
> | 5 | VOID                    |
> +---+-------------------------+
> | 6 | VOID                    |
> +---+-------------------------+
> 
> The above example shows how meta items do not affect packet data
> matching
> items, as long as those remain stacked properly. The resulting matching
> pattern is identical to "TCPv4 as L4".
> 
> +----------------+
> | UDPv6 anywhere |
> +===+============+
> | 0 | IPv6       |
> +---+------------+
> | 1 | UDP        |
> +---+------------+
> 
> If supported by the PMD, omitting one or several protocol layers at the
> bottom of the stack as in the above example (missing an Ethernet
> specification) enables hardware to look anywhere in packets.
> 
> This is an alias for specifying `ANY`_ with ``min = 0`` and ``max = 0``
> properties as the first item.
> 
> It is unspecified whether the payload of supported encapsulations
> (e.g. VXLAN inner packet) is matched by such a pattern, which may apply to
> inner, outer or both packets.
> 
> +---------------------+
> | Invalid, missing L3 |
> +===+=================+
> | 0 | Ethernet        |
> +---+-----------------+
> | 1 | UDP             |
> +---+-----------------+
> 
> The above pattern is invalid due to a missing L3 specification between L2
> and L4. It is only allowed at the bottom and at the top of the stack.
> 
> Meta item types
> ~~~~~~~~~~~~~~~
> 
> These do not match packet data but affect how the pattern is processed,
> most
> of them do not need a specification structure. This particularity allows
> them to be specified anywhere without affecting other item types.
> 
> ``END``
> ^^^^^^^
> 
> End marker for item lists. Prevents further processing of items, thereby
> ending the pattern.
> 
> - Its numeric value is **0** for convenience.
> - PMD support is mandatory.
> - Both ``spec`` and ``mask`` are ignored.
> 
> +--------------------+
> | END                |
> +==========+=========+
> | ``spec`` | ignored |
> +----------+---------+
> | ``mask`` | ignored |
> +----------+---------+
> 
> ``VOID``
> ^^^^^^^^
> 
> Used as a placeholder for convenience. It is ignored and simply discarded by
> PMDs.
> 
> - PMD support is mandatory.
> - Both ``spec`` and ``mask`` are ignored.
> 
> +--------------------+
> | VOID               |
> +==========+=========+
> | ``spec`` | ignored |
> +----------+---------+
> | ``mask`` | ignored |
> +----------+---------+
> 
> One usage example for this type is generating rules that share a common
> prefix quickly without reallocating memory, only by updating item types:
> 
> +------------------------+
> | TCP, UDP or ICMP as L4 |
> +===+====================+
> | 0 | Ethernet           |
> +---+--------------------+
> | 1 | IPv4               |
> +---+------+------+------+
> | 2 | UDP  | VOID | VOID |
> +---+------+------+------+
> | 3 | VOID | TCP  | VOID |
> +---+------+------+------+
> | 4 | VOID | VOID | ICMP |
> +---+------+------+------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``INVERT``
> ^^^^^^^^^^
> 
> Inverted matching, i.e. process packets that do not match the pattern.
> 
> - Both ``spec`` and ``mask`` are ignored.
> 
> +--------------------+
> | INVERT             |
> +==========+=========+
> | ``spec`` | ignored |
> +----------+---------+
> | ``mask`` | ignored |
> +----------+---------+
> 
> Usage example in order to match non-TCPv4 packets only:
> 
> +--------------------+
> | Anything but TCPv4 |
> +===+================+
> | 0 | INVERT         |
> +---+----------------+
> | 1 | Ethernet       |
> +---+----------------+
> | 2 | IPv4           |
> +---+----------------+
> | 3 | TCP            |
> +---+----------------+
> 
> ``PF``
> ^^^^^^
> 
> Matches packets addressed to the physical function of the device.
> 
> If the underlying device function differs from the one that would normally
> receive the matched traffic, specifying this item prevents it from reaching
> that device unless the flow rule contains a `PF (action)`_. Packets are not
> duplicated between device instances by default.
> 
> - Likely to return an error or never match any traffic if applied to a VF
>   device.
> - Can be combined with any number of `VF`_ items to match both PF and VF
>   traffic.
> - Both ``spec`` and ``mask`` are ignored.
> 
> +--------------------+
> | PF                 |
> +==========+=========+
> | ``spec`` | ignored |
> +----------+---------+
> | ``mask`` | ignored |
> +----------+---------+
> 
> ``VF``
> ^^^^^^
> 
> Matches packets addressed to a virtual function ID of the device.
> 
> If the underlying device function differs from the one that would normally
> receive the matched traffic, specifying this item prevents it from reaching
> that device unless the flow rule contains a `VF (action)`_. Packets are not
> duplicated between device instances by default.
> 
> - Likely to return an error or never match any traffic if this causes a VF
>   device to match traffic addressed to a different VF.
> - Can be specified multiple times to match traffic addressed to several VFs.
> - Can be combined with a `PF`_ item to match both PF and VF traffic.
> - Only ``spec`` needs to be defined, ``mask`` is ignored.
> 
> +-------------------------------------------------+
> | VF                                              |
> +==========+=========+============================+
> | ``spec`` | ``any`` | ignore the specified VF ID |
> |          +---------+----------------------------+
> |          | ``vf``  | destination VF ID          |
> +----------+---------+----------------------------+
> | ``mask`` | ignored                              |
> +----------+--------------------------------------+
> 
> ``PORT``
> ^^^^^^^^
> 
> Matches packets coming from the specified physical port of the underlying
> device.
> 
> The first PORT item overrides the physical port normally associated with the
> specified DPDK input port (port_id). This item can be provided several times
> to match additional physical ports.
> 
> Note that physical ports are not necessarily tied to DPDK input ports
> (port_id) when those are not under DPDK control. Possible values are
> specific to each device, they are not necessarily indexed from zero and may
> not be contiguous.
> 
> As a device property, the list of allowed values as well as the value
> associated with a port_id should be retrieved by other means.
> 
> - Only ``spec`` needs to be defined, ``mask`` is ignored.
> 
> +--------------------------------------------+
> | PORT                                       |
> +==========+===========+=====================+
> | ``spec`` | ``index`` | physical port index |
> +----------+-----------+---------------------+
> | ``mask`` | ignored                         |
> +----------+---------------------------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Data matching item types
> ~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Most of these are basically protocol header definitions with associated
> bit-masks. They must be specified (stacked) from lowest to highest protocol
> layer.
> 
> The following list is not exhaustive as new protocols will be added in the
> future.
> 
> ``ANY``
> ^^^^^^^
> 
> Matches any protocol in place of the current layer, a single ANY may also
> stand for several protocol layers.
> 
> This is usually specified as the first pattern item when looking for a
> protocol anywhere in a packet.
> 
> - A maximum value of **0** requests matching any number of protocol
> layers
>   above or equal to the minimum value, a maximum value lower than the
>   minimum one is otherwise invalid.
> - Only ``spec`` needs to be defined, ``mask`` is ignored.
> 
> +-----------------------------------------------------------------------+
> | ANY                                                                   |
> +==========+=========+====================================
> ==============+
> | ``spec`` | ``min`` | minimum number of layers covered                 |
> |          +---------+--------------------------------------------------+
> |          | ``max`` | maximum number of layers covered, 0 for infinity |
> +----------+---------+--------------------------------------------------+
> | ``mask`` | ignored                                                    |
> +----------+------------------------------------------------------------+
> 
> Example for VXLAN TCP payload matching regardless of outer L3 (IPv4 or IPv6)
> and L4 (UDP) both matched by the first ANY specification, and inner L3 (IPv4
> or IPv6) matched by the second ANY specification:
> 
> +----------------------------------+
> | TCP in VXLAN with wildcards      |
> +===+==============================+
> | 0 | Ethernet                     |
> +---+-----+----------+---------+---+
> | 1 | ANY | ``spec`` | ``min`` | 2 |
> |   |     |          +---------+---+
> |   |     |          | ``max`` | 2 |
> +---+-----+----------+---------+---+
> | 2 | VXLAN                        |
> +---+------------------------------+
> | 3 | Ethernet                     |
> +---+-----+----------+---------+---+
> | 4 | ANY | ``spec`` | ``min`` | 1 |
> |   |     |          +---------+---+
> |   |     |          | ``max`` | 1 |
> +---+-----+----------+---------+---+
> | 5 | TCP                          |
> +---+------------------------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``RAW``
> ^^^^^^^
> 
> Matches a byte string of a given length at a given offset.
> 
> Offset is either absolute (using the start of the packet) or relative to the
> end of the previous matched item in the stack, in which case negative values
> are allowed.
> 
> If search is enabled, offset is used as the starting point. The search area
> can be delimited by setting limit to a nonzero value, which is the maximum
> number of bytes after offset where the pattern may start.
> 
> Matching a zero-length pattern is allowed, doing so resets the relative
> offset for subsequent items.
> 
> - ``mask`` only affects the pattern field.
> 
> +---------------------------------------------------------------------------+
> | RAW                                                                       |
> +==========+==============+===============================
> ==================+
> | ``spec`` | ``relative`` | look for pattern after the previous item        |
> |          +--------------+-------------------------------------------------+
> |          | ``search``   | search pattern from offset (see also ``limit``) |
> |          +--------------+-------------------------------------------------+
> |          | ``reserved`` | reserved, must be set to zero                   |
> |          +--------------+-------------------------------------------------+
> |          | ``offset``   | absolute or relative offset for ``pattern``     |
> |          +--------------+-------------------------------------------------+
> |          | ``limit``    | search area limit for start of ``pattern``      |
> |          +--------------+-------------------------------------------------+
> |          | ``length``   | ``pattern`` length                              |
> |          +--------------+-------------------------------------------------+
> |          | ``pattern``  | byte string to look for                         |
> +----------+--------------+-------------------------------------------------+
> | ``mask`` | ``relative`` | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``search``   | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``reserved`` | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``offset``   | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``limit``    | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``length``   | ignored                                         |
> |          +--------------+-------------------------------------------------+
> |          | ``pattern``  | bit-mask of the same byte length as ``pattern`` |
> +----------+--------------+-------------------------------------------------+
> 
> Example pattern looking for several strings at various offsets of a UDP
> payload, using combined RAW items:
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> +-------------------------------------------+
> | UDP payload matching                      |
> +===+=======================================+
> | 0 | Ethernet                              |
> +---+---------------------------------------+
> | 1 | IPv4                                  |
> +---+---------------------------------------+
> | 2 | UDP                                   |
> +---+-----+----------+--------------+-------+
> | 3 | RAW | ``spec`` | ``relative`` | 1     |
> |   |     |          +--------------+-------+
> |   |     |          | ``search``   | 1     |
> |   |     |          +--------------+-------+
> |   |     |          | ``offset``   | 10    |
> |   |     |          +--------------+-------+
> |   |     |          | ``limit``    | 0     |
> |   |     |          +--------------+-------+
> |   |     |          | ``length``   | 3     |
> |   |     |          +--------------+-------+
> |   |     |          | ``pattern``  | "foo" |
> +---+-----+----------+--------------+-------+
> | 4 | RAW | ``spec`` | ``relative`` | 1     |
> |   |     |          +--------------+-------+
> |   |     |          | ``search``   | 0     |
> |   |     |          +--------------+-------+
> |   |     |          | ``offset``   | 20    |
> |   |     |          +--------------+-------+
> |   |     |          | ``limit``    | 0     |
> |   |     |          +--------------+-------+
> |   |     |          | ``length``   | 3     |
> |   |     |          +--------------+-------+
> |   |     |          | ``pattern``  | "bar" |
> +---+-----+----------+--------------+-------+
> | 5 | RAW | ``spec`` | ``relative`` | 1     |
> |   |     |          +--------------+-------+
> |   |     |          | ``search``   | 0     |
> |   |     |          +--------------+-------+
> |   |     |          | ``offset``   | -29   |
> |   |     |          +--------------+-------+
> |   |     |          | ``limit``    | 0     |
> |   |     |          +--------------+-------+
> |   |     |          | ``length``   | 3     |
> |   |     |          +--------------+-------+
> |   |     |          | ``pattern``  | "baz" |
> +---+-----+----------+--------------+-------+
> 
> This translates to:
> 
> - Locate "foo" at least 10 bytes deep inside UDP payload.
> - Locate "bar" after "foo" plus 20 bytes.
> - Locate "baz" after "bar" minus 29 bytes.
> 
> Such a packet may be represented as follows (not to scale)::
> 
>  0                     >= 10 B           == 20 B
>  |                  |<--------->|     |<--------->|
>  |                  |           |     |           |
>  |-----|------|-----|-----|-----|-----|-----------|-----|------|
>  | ETH | IPv4 | UDP | ... | baz | foo | ......... | bar | .... |
>  |-----|------|-----|-----|-----|-----|-----------|-----|------|
>                           |                             |
>                           |<--------------------------->|
>                                       == 29 B
> 
> Note that matching subsequent pattern items would resume after "baz", not
> "bar" since matching is always performed after the previous item of the
> stack.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``ETH``
> ^^^^^^^
> 
> Matches an Ethernet header.
> 
> - ``dst``: destination MAC.
> - ``src``: source MAC.
> - ``type``: EtherType.
> - ``tags``: number of 802.1Q/ad tags defined.
> - ``tag[]``: 802.1Q/ad tag definitions, outermost first. For each one:
> 
>  - ``tpid``: Tag protocol identifier.
>  - ``tci``: Tag control information.
> 
> ``IPV4``
> ^^^^^^^^
> 
> Matches an IPv4 header.
> 
> Note: IPv4 options are handled by dedicated pattern items.
> 
> - ``hdr``: IPv4 header definition (``rte_ip.h``).
> 
> ``IPV6``
> ^^^^^^^^
> 
> Matches an IPv6 header.
> 
> Note: IPv6 options are handled by dedicated pattern items.
> 
> - ``hdr``: IPv6 header definition (``rte_ip.h``).
> 
> ``ICMP``
> ^^^^^^^^
> 
> Matches an ICMP header.
> 
> - ``hdr``: ICMP header definition (``rte_icmp.h``).
> 
> ``UDP``
> ^^^^^^^
> 
> Matches a UDP header.
> 
> - ``hdr``: UDP header definition (``rte_udp.h``).
> 
> ``TCP``
> ^^^^^^^
> 
> Matches a TCP header.
> 
> - ``hdr``: TCP header definition (``rte_tcp.h``).
> 
> ``SCTP``
> ^^^^^^^^
> 
> Matches a SCTP header.
> 
> - ``hdr``: SCTP header definition (``rte_sctp.h``).
> 
> ``VXLAN``
> ^^^^^^^^^
> 
> Matches a VXLAN header (RFC 7348).
> 
> - ``flags``: normally 0x08 (I flag).
> - ``rsvd0``: reserved, normally 0x000000.
> - ``vni``: VXLAN network identifier.
> - ``rsvd1``: reserved, normally 0x00.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Actions
> ~~~~~~~
> 
> Each possible action is represented by a type. Some have associated
> configuration structures. Several actions combined in a list can be affected
> to a flow rule. That list is not ordered.
> 
> At least one action must be defined in a filter rule in order to do
> something with matched packets.
> 
> - Actions are defined with ``struct rte_flow_action``.
> - A list of actions is defined with ``struct rte_flow_actions``.
> 
> They fall in three categories:
> 
> - Terminating actions (such as QUEUE, DROP, RSS, PF, VF) that prevent
>   processing matched packets by subsequent flow rules, unless overridden
>   with PASSTHRU.
> 
> - Non terminating actions (PASSTHRU, DUP) that leave matched packets up
> for
>   additional processing by subsequent flow rules.
> 
> - Other non terminating meta actions that do not affect the fate of packets
>   (END, VOID, MARK, FLAG, COUNT).
> 
> When several actions are combined in a flow rule, they should all have
> different types (e.g. dropping a packet twice is not possible). The defined
> behavior is for PMDs to only take into account the last action of a given
> type found in the list. PMDs still perform error checking on the entire
> list.
> 
> *Note that PASSTHRU is the only action having the ability to override a
> terminating rule.*
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Example of an action that redirects packets to queue index 10:
> 
> +----------------+
> | QUEUE          |
> +===========+====+
> | ``queue`` | 10 |
> +-----------+----+
> 
> Action lists examples, their order is not significant, applications must
> consider all actions to be performed simultaneously:
> 
> +----------------+
> | Count and drop |
> +=======+========+
> | COUNT |        |
> +-------+--------+
> | DROP  |        |
> +-------+--------+
> 
> +--------------------------+
> | Tag, count and redirect  |
> +=======+===========+======+
> | MARK  | ``mark``  | 0x2a |
> +-------+-----------+------+
> | COUNT |                  |
> +-------+-----------+------+
> | QUEUE | ``queue`` | 10   |
> +-------+-----------+------+
> 
> +-----------------------+
> | Redirect to queue 5   |
> +=======+===============+
> | DROP  |               |
> +-------+-----------+---+
> | QUEUE | ``queue`` | 5 |
> +-------+-----------+---+
> 
> In the above example, considering both actions are performed
> simultaneously,
> its end result is that only QUEUE has any effect.
> 
> +-----------------------+
> | Redirect to queue 3   |
> +=======+===========+===+
> | QUEUE | ``queue`` | 5 |
> +-------+-----------+---+
> | VOID  |               |
> +-------+-----------+---+
> | QUEUE | ``queue`` | 3 |
> +-------+-----------+---+
> 
> As previously described, only the last action of a given type found in the
> list is taken into account. The above example also shows that VOID is
> ignored.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Action types
> ~~~~~~~~~~~~
> 
> Common action types are described in this section. Like pattern item types,
> this list is not exhaustive as new actions will be added in the future.
> 
> ``END`` (action)
> ^^^^^^^^^^^^^^^^
> 
> End marker for action lists. Prevents further processing of actions, thereby
> ending the list.
> 
> - Its numeric value is **0** for convenience.
> - PMD support is mandatory.
> - No configurable property.
> 
> +---------------+
> | END           |
> +===============+
> | no properties |
> +---------------+
> 
> ``VOID`` (action)
> ^^^^^^^^^^^^^^^^^
> 
> Used as a placeholder for convenience. It is ignored and simply discarded by
> PMDs.
> 
> - PMD support is mandatory.
> - No configurable property.
> 
> +---------------+
> | VOID          |
> +===============+
> | no properties |
> +---------------+
> 
> ``PASSTHRU``
> ^^^^^^^^^^^^
> 
> Leaves packets up for additional processing by subsequent flow rules. This
> is the default when a rule does not contain a terminating action, but can be
> specified to force a rule to become non-terminating.
> 
> - No configurable property.
> 
> +---------------+
> | PASSTHRU      |
> +===============+
> | no properties |
> +---------------+
> 
> Example to copy a packet to a queue and continue processing by subsequent
> flow rules:
> 
> +--------------------------+
> | Copy to queue 8          |
> +==========+===============+
> | PASSTHRU |               |
> +----------+-----------+---+
> | QUEUE    | ``queue`` | 8 |
> +----------+-----------+---+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``MARK``
> ^^^^^^^^
> 
> Attaches a 32 bit value to packets.
> 
> This value is arbitrary and application-defined. For compatibility with FDIR
> it is returned in the ``hash.fdir.hi`` mbuf field. ``PKT_RX_FDIR_ID`` is
> also set in ``ol_flags``.
> 
> +------------------------------------------------+
> | MARK                                           |
> +==========+=====================================+
> | ``mark`` | 32 bit value to return with packets |
> +----------+-------------------------------------+
> 
> ``FLAG``
> ^^^^^^^^
> 
> Flag packets. Similar to `MARK`_ but only affects ``ol_flags``.
> 
> Note: a distinctive flag must be defined for it.
> 
> +---------------+
> | FLAG          |
> +===============+
> | no properties |
> +---------------+
> 
> ``QUEUE``
> ^^^^^^^^^
> 
> Assigns packets to a given queue index.
> 
> - Terminating by default.
> 
> +--------------------------------+
> | QUEUE                          |
> +===========+====================+
> | ``queue`` | queue index to use |
> +-----------+--------------------+
> 
> ``DROP``
> ^^^^^^^^
> 
> Drop packets.
> 
> - No configurable property.
> - Terminating by default.
> - PASSTHRU overrides this action if both are specified.
> 
> +---------------+
> | DROP          |
> +===============+
> | no properties |
> +---------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``COUNT``
> ^^^^^^^^^
> 
> Enables counters for this rule.
> 
> These counters can be retrieved and reset through ``rte_flow_query()``, see
> ``struct rte_flow_query_count``.
> 
> - Counters can be retrieved with ``rte_flow_query()``.
> - No configurable property.
> 
> +---------------+
> | COUNT         |
> +===============+
> | no properties |
> +---------------+
> 
> Query structure to retrieve and reset flow rule counters:
> 
> +---------------------------------------------------------+
> | COUNT query                                             |
> +===============+=====+===================================
> +
> | ``reset``     | in  | reset counter after query         |
> +---------------+-----+-----------------------------------+
> | ``hits_set``  | out | ``hits`` field is set             |
> +---------------+-----+-----------------------------------+
> | ``bytes_set`` | out | ``bytes`` field is set            |
> +---------------+-----+-----------------------------------+
> | ``hits``      | out | number of hits for this rule      |
> +---------------+-----+-----------------------------------+
> | ``bytes``     | out | number of bytes through this rule |
> +---------------+-----+-----------------------------------+
> 
> ``DUP``
> ^^^^^^^
> 
> Duplicates packets to a given queue index.
> 
> This is normally combined with QUEUE, however when used alone, it is
> actually similar to QUEUE + PASSTHRU.
> 
> - Non-terminating by default.
> 
> +------------------------------------------------+
> | DUP                                            |
> +===========+====================================+
> | ``queue`` | queue index to duplicate packet to |
> +-----------+------------------------------------+
> 
> ``RSS``
> ^^^^^^^
> 
> Similar to QUEUE, except RSS is additionally performed on packets to spread
> them among several queues according to the provided parameters.
> 
> Note: RSS hash result is normally stored in the ``hash.rss`` mbuf field,
> however it conflicts with the `MARK`_ action as they share the same
> space. When both actions are specified, the RSS hash is discarded and
> ``PKT_RX_RSS_HASH`` is not set in ``ol_flags``. MARK has priority. The mbuf
> structure should eventually evolve to store both.
> 
> - Terminating by default.
> 
> +---------------------------------------------+
> | RSS                                         |
> +==============+==============================+
> | ``rss_conf`` | RSS parameters               |
> +--------------+------------------------------+
> | ``queues``   | number of entries in queue[] |
> +--------------+------------------------------+
> | ``queue[]``  | queue indices to use         |
> +--------------+------------------------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``PF`` (action)
> ^^^^^^^^^^^^^^^
> 
> Redirects packets to the physical function (PF) of the current device.
> 
> - No configurable property.
> - Terminating by default.
> 
> +---------------+
> | PF            |
> +===============+
> | no properties |
> +---------------+
> 
> ``VF`` (action)
> ^^^^^^^^^^^^^^^
> 
> Redirects packets to a virtual function (VF) of the current device.
> 
> Packets matched by a VF pattern item can be redirected to their original VF
> ID instead of the specified one. This parameter may not be available and is
> not guaranteed to work properly if the VF part is matched by a prior flow
> rule or if packets are not addressed to a VF in the first place.
> 
> - Terminating by default.
> 
> +-----------------------------------------------+
> | VF                                            |
> +==============+================================+
> | ``original`` | use original VF ID if possible |
> +--------------+--------------------------------+
> | ``vf``       | VF ID to redirect packets to   |
> +--------------+--------------------------------+
> 
> Negative types
> ~~~~~~~~~~~~~~
> 
> All specified pattern items (``enum rte_flow_item_type``) and actions
> (``enum rte_flow_action_type``) use positive identifiers.
> 
> The negative space is reserved for dynamic types generated by PMDs during
> run-time, PMDs may encounter them as a result but do not have to accept
> the
> negative types they did not generate.
> 
> The method to generate them has not been specified yet.
> 
> Planned types
> ~~~~~~~~~~~~~
> 
> Pattern item types will be added as new protocols are implemented.
> 
> Variable headers support through dedicated pattern items, for example in
> order to match specific IPv4 options and IPv6 extension headers, these
> would
> be stacked behind IPv4/IPv6 items.
> 
> Other action types are planned but not defined yet. These actions will add
> the ability to alter matched packets in several ways, such as performing
> encapsulation/decapsulation of tunnel headers on specific flows.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Rules management
> ----------------
> 
> A simple API with few functions is provided to fully manage flows.
> 
> Each created flow rule is associated with an opaque, PMD-specific handle
> pointer. The application is responsible for keeping it until the rule is
> destroyed.
> 
> Flows rules are represented by ``struct rte_flow`` objects.
> 
> Validation
> ~~~~~~~~~~
> 
> Given that expressing a definite set of device capabilities with this API is
> not practical, a dedicated function is provided to check if a flow rule is
> supported and can be created.
> 
> ::
> 
>  int
>  rte_flow_validate(uint8_t port_id,
>                    const struct rte_flow_attr *attr,
>                    const struct rte_flow_pattern *pattern,
>                    const struct rte_flow_actions *actions,
>                    struct rte_flow_error *error);
> 
> While this function has no effect on the target device, the flow rule is
> validated against its current configuration state and the returned value
> should be considered valid by the caller for that state only.
> 
> The returned value is guaranteed to remain valid only as long as no
> successful calls to rte_flow_create() or rte_flow_destroy() are made in the
> meantime and no device parameter affecting flow rules in any way are
> modified, due to possible collisions or resource limitations (although in
> such cases ``EINVAL`` should not be returned).
> 
> Arguments:
> 
> - ``port_id``: port identifier of Ethernet device.
> - ``attr``: flow rule attributes.
> - ``pattern``: pattern specification.
> - ``actions``: actions associated with the flow definition.
> - ``error``: perform verbose error reporting if not NULL.
> 
> Return value:
> 
> - **0** if flow rule is valid and can be created. A negative errno value
>   otherwise (``rte_errno`` is also set), the following errors are defined.
> - ``-ENOSYS``: underlying device does not support this functionality.
> - ``-EINVAL``: unknown or invalid rule specification.
> - ``-ENOTSUP``: valid but unsupported rule specification (e.g. partial
>   bit-masks are unsupported).
> - ``-EEXIST``: collision with an existing rule.
> - ``-ENOMEM``: not enough resources.
> - ``-EBUSY``: action cannot be performed due to busy device resources, may
>   succeed if the affected queues or even the entire port are in a stopped
>   state (see ``rte_eth_dev_rx_queue_stop()`` and ``rte_eth_dev_stop()``).
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Creation
> ~~~~~~~~
> 
> Creating a flow rule is similar to validating one, except the rule is
> actually created and a handle returned.
> 
> ::
> 
>  struct rte_flow *
>  rte_flow_create(uint8_t port_id,
>                  const struct rte_flow_attr *attr,
>                  const struct rte_flow_pattern *pattern,
>                  const struct rte_flow_actions *actions,
>                  struct rte_flow_error *error);
> 
> Arguments:
> 
> - ``port_id``: port identifier of Ethernet device.
> - ``attr``: flow rule attributes.
> - ``pattern``: pattern specification.
> - ``actions``: actions associated with the flow definition.
> - ``error``: perform verbose error reporting if not NULL.
> 
> Return value:
> 
> A valid handle in case of success, NULL otherwise and ``rte_errno`` is set
> to the positive version of one of the error codes defined for
> ``rte_flow_validate()``.
> 
> Destruction
> ~~~~~~~~~~~
> 
> Flow rules destruction is not automatic, and a queue or a port should not be
> released if any are still attached to them. Applications must take care of
> performing this step before releasing resources.
> 
> ::
> 
>  int
>  rte_flow_destroy(uint8_t port_id,
>                   struct rte_flow *flow,
>                   struct rte_flow_error *error);
> 
> 
> Failure to destroy a flow rule handle may occur when other flow rules
> depend
> on it, and destroying it would result in an inconsistent state.
> 
> This function is only guaranteed to succeed if handles are destroyed in
> reverse order of their creation.
> 
> Arguments:
> 
> - ``port_id``: port identifier of Ethernet device.
> - ``flow``: flow rule handle to destroy.
> - ``error``: perform verbose error reporting if not NULL.
> 
> Return value:
> 
> - **0** on success, a negative errno value otherwise and ``rte_errno`` is
>   set.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Flush
> ~~~~~
> 
> Convenience function to destroy all flow rule handles associated with a
> port. They are released as with successive calls to ``rte_flow_destroy()``.
> 
> ::
> 
>  int
>  rte_flow_flush(uint8_t port_id,
>                 struct rte_flow_error *error);
> 
> In the unlikely event of failure, handles are still considered destroyed and
> no longer valid but the port must be assumed to be in an inconsistent state.
> 
> Arguments:
> 
> - ``port_id``: port identifier of Ethernet device.
> - ``error``: perform verbose error reporting if not NULL.
> 
> Return value:
> 
> - **0** on success, a negative errno value otherwise and ``rte_errno`` is
>   set.
> 
> Query
> ~~~~~
> 
> Query an existing flow rule.
> 
> This function allows retrieving flow-specific data such as counters. Data
> is gathered by special actions which must be present in the flow rule
> definition.
> 
> ::
> 
>  int
>  rte_flow_query(uint8_t port_id,
>                 struct rte_flow *flow,
>                 enum rte_flow_action_type action,
>                 void *data,
>                 struct rte_flow_error *error);
> 
> Arguments:
> 
> - ``port_id``: port identifier of Ethernet device.
> - ``flow``: flow rule handle to query.
> - ``action``: action type to query.
> - ``data``: pointer to storage for the associated query data type.
> - ``error``: perform verbose error reporting if not NULL.
> 
> Return value:
> 
> - **0** on success, a negative errno value otherwise and ``rte_errno`` is
>   set.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Verbose error reporting
> ~~~~~~~~~~~~~~~~~~~~~~~
> 
> The defined *errno* values may not be accurate enough for users or
> application developers who want to investigate issues related to flow rules
> management. A dedicated error object is defined for this purpose::
> 
>  enum rte_flow_error_type {
>      RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
>      RTE_FLOW_ERROR_TYPE_UNDEFINED, /**< Cause is undefined. */
>      RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
>      RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
>      RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
>      RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< field. */
>      RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< field. */
>      RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure itself. */
>      RTE_FLOW_ERROR_TYPE_PATTERN_MAX, /**< Pattern length (max field).
> */
>      RTE_FLOW_ERROR_TYPE_PATTERN_ITEM, /**< Specific pattern item. */
>      RTE_FLOW_ERROR_TYPE_PATTERN, /**< Pattern structure itself. */
>      RTE_FLOW_ERROR_TYPE_ACTION_MAX, /**< Number of actions (max
> field). */
>      RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
>      RTE_FLOW_ERROR_TYPE_ACTIONS, /**< Actions structure itself. */
>  };
> 
>  struct rte_flow_error {
>      enum rte_flow_error_type type; /**< Cause field and error types. */
>      void *cause; /**< Object responsible for the error. */
>      const char *message; /**< Human-readable error message. */
>  };
> 
> Error type ``RTE_FLOW_ERROR_TYPE_NONE`` stands for no error, in which
> case
> the remaining fields can be ignored. Other error types describe the object
> type pointed to by ``cause``.
> 
> If non-NULL, ``cause`` points to the object responsible for the error. For a
> flow rule, this may be a pattern item or an individual action.
> 
> If non-NULL, ``message`` provides a human-readable error message.
> 
> This object is normally allocated by applications and set by PMDs, the
> message points to a constant string which does not need to be freed by the
> application, however its pointer can be considered valid only as long as its
> associated DPDK port remains configured. Closing the underlying device or
> unloading the PMD invalidates it.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> PMD interface
> ~~~~~~~~~~~~~
> 
> This specification focuses on the public-facing interface, which must be
> fully defined from the start to avoid a re-design later as it is subject to
> API and ABI versioning constraints.
> 
> No such issue exists with the internal interface for use by poll-mode
> drivers which can evolve independently, hence this section only outlines how
> requests are processed by PMDs.
> 
> Public functions are mapped more or less directly to PMD operation
> callbacks, thus:
> 
> - Public API functions do not process flow rules definitions at all before
>   calling PMD callbacks (no basic error checking, no validation
>   whatsoever). They only make sure these callbacks are non-NULL or return
>   the ``ENOSYS`` (function not supported) error.
> 
> - DPDK does not keep track of flow rules definitions or flow rule objects
>   automatically. Applications may keep track of the former and must keep
>   track of the latter. PMDs may also do it for internal needs, however this
>   cannot be relied on by applications.
> 
> The private interface will provide helper functions to perform common tasks
> such as parsing, validating and keeping track of flow rule specifications to
> avoid redundant code in PMDs and ease implementation.
> 
> Its contents are currently largely undefined since at least one PMD
> implementation is necessary first. PMD maintainers are encouraged to share
> as much generic code as possible.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Caveats
> -------
> 
> - Flow rules are not maintained between successive port initializations. An
>   application exiting without releasing them and restarting must re-create
>   them from scratch.
> 
> - API operations are synchronous and blocking (``EAGAIN`` cannot be
>   returned).
> 
> - There is no provision for reentrancy/multi-thread safety, although nothing
>   should prevent different devices from being configured at the same
>   time. PMDs may protect their control path functions accordingly.
> 
> - Stopping the data path (TX/RX) should not be necessary when managing
> flow
>   rules. If this cannot be achieved naturally or with workarounds (such as
>   temporarily replacing the burst function pointers), an appropriate error
>   code must be returned (``EBUSY``).
> 
> - PMDs, not applications, are responsible for maintaining flow rules
>   configuration when stopping and restarting a port or performing other
>   actions which may affect them. They can only be destroyed explicitly.
> 
> For devices exposing multiple ports sharing global settings affected by flow
> rules:
> 
> - All ports under DPDK control must behave consistently, PMDs are
>   responsible for making sure that existing flow rules on a port are not
>   affected by other ports.
> 
> - Ports not under DPDK control (unaffected or handled by other applications)
>   are user's responsibility. They may affect existing flow rules and cause
>   undefined behavior. PMDs aware of this may prevent flow rules creation
>   altogether in such cases.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Compatibility
> -------------
> 
> No known hardware implementation supports all the features described in
> this
> document.
> 
> Unsupported features or combinations are not expected to be fully
> emulated
> in software by PMDs for performance reasons. Partially supported features
> may be completed in software as long as hardware performs most of the
> work
> (such as queue redirection and packet recognition).
> 
> However PMDs are expected to do their best to satisfy application requests
> by working around hardware limitations as long as doing so does not affect
> the behavior of existing flow rules.
> 
> The following sections provide a few examples of such cases, they are based
> on limitations built into the previous APIs.
> 
> Global bit-masks
> ~~~~~~~~~~~~~~~~
> 
> Each flow rule comes with its own, per-layer bit-masks, while hardware may
> support only a single, device-wide bit-mask for a given layer type, so that
> two IPv4 rules cannot use different bit-masks.
> 
> The expected behavior in this case is that PMDs automatically configure
> global bit-masks according to the needs of the first created flow rule.
> 
> Subsequent rules are allowed only if their bit-masks match those, the
> ``EEXIST`` error code should be returned otherwise.
> 
> Unsupported layer types
> ~~~~~~~~~~~~~~~~~~~~~~~
> 
> Many protocols can be simulated by crafting patterns with the `RAW`_ type.
> 
> PMDs can rely on this capability to simulate support for protocols with
> fixed headers not directly recognized by hardware.
> 
> ``ANY`` pattern item
> ~~~~~~~~~~~~~~~~~~~~
> 
> This pattern item stands for anything, which can be difficult to translate
> to something hardware would understand, particularly if followed by more
> specific types.
> 
> Consider the following pattern:
> 
> +---+--------------------------------+
> | 0 | ETHER                          |
> +---+--------------------------------+
> | 1 | ANY (``min`` = 1, ``max`` = 1) |
> +---+--------------------------------+
> | 2 | TCP                            |
> +---+--------------------------------+
> 
> Knowing that TCP does not make sense with something other than IPv4 and
> IPv6
> as L3, such a pattern may be translated to two flow rules instead:
> 
> +---+--------------------+
> | 0 | ETHER              |
> +---+--------------------+
> | 1 | IPV4 (zeroed mask) |
> +---+--------------------+
> | 2 | TCP                |
> +---+--------------------+
> 
> +---+--------------------+
> | 0 | ETHER              |
> +---+--------------------+
> | 1 | IPV6 (zeroed mask) |
> +---+--------------------+
> | 2 | TCP                |
> +---+--------------------+
> 
> Note that as soon as a ANY rule covers several layers, this approach may
> yield a large number of hidden flow rules. It is thus suggested to only
> support the most common scenarios (anything as L2 and/or L3).
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Unsupported actions
> ~~~~~~~~~~~~~~~~~~~
> 
> - When combined with a `QUEUE`_ action, packet counting (`COUNT`_) and
>   tagging (`MARK`_ or `FLAG`_) may be implemented in software as long as
> the
>   target queue is used by a single rule.
> 
> - A rule specifying both `DUP`_ + `QUEUE`_ may be translated to two hidden
>   rules combining `QUEUE`_ and `PASSTHRU`_.
> 
> - When a single target queue is provided, `RSS`_ can also be implemented
>   through `QUEUE`_.
> 
> Flow rules priority
> ~~~~~~~~~~~~~~~~~~~
> 
> While it would naturally make sense, flow rules cannot be assumed to be
> processed by hardware in the same order as their creation for several
> reasons:
> 
> - They may be managed internally as a tree or a hash table instead of a
>   list.
> - Removing a flow rule before adding another one can either put the new
> rule
>   at the end of the list or reuse a freed entry.
> - Duplication may occur when packets are matched by several rules.
> 
> For overlapping rules (particularly in order to use the `PASSTHRU`_ action)
> predictable behavior is only guaranteed by using different priority levels.
> 
> Priority levels are not necessarily implemented in hardware, or may be
> severely limited (e.g. a single priority bit).
> 
> For these reasons, priority levels may be implemented purely in software by
> PMDs.
> 
> - For devices expecting flow rules to be added in the correct order, PMDs
>   may destroy and re-create existing rules after adding a new one with
>   a higher priority.
> 
> - A configurable number of dummy or empty rules can be created at
>   initialization time to save high priority slots for later.
> 
> - In order to save priority levels, PMDs may evaluate whether rules are
>   likely to collide and adjust their priority accordingly.
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> API migration
> =============
> 
> Exhaustive list of deprecated filter types and how to convert them to
> generic flow rules.
> 
> ``MACVLAN`` to ``ETH`` → ``VF``, ``PF``
> ---------------------------------------
> 
> `MACVLAN`_ can be translated to a basic `ETH`_ flow rule with a `VF
> (action)`_ or `PF (action)`_ terminating action.
> 
> +------------------------------------+
> | MACVLAN                            |
> +--------------------------+---------+
> | Pattern                  | Actions |
> +===+=====+==========+=====+=========+
> | 0 | ETH | ``spec`` | any | VF,     |
> |   |     +----------+-----+ PF      |
> |   |     | ``mask`` | any |         |
> +---+-----+----------+-----+---------+
> 
> ``ETHERTYPE`` to ``ETH`` → ``QUEUE``, ``DROP``
> ----------------------------------------------
> 
> `ETHERTYPE`_ is basically an `ETH`_ flow rule with `QUEUE`_ or `DROP`_ as
> a terminating action.
> 
> +------------------------------------+
> | ETHERTYPE                          |
> +--------------------------+---------+
> | Pattern                  | Actions |
> +===+=====+==========+=====+=========+
> | 0 | ETH | ``spec`` | any | QUEUE,  |
> |   |     +----------+-----+ DROP    |
> |   |     | ``mask`` | any |         |
> +---+-----+----------+-----+---------+
> 
> ``FLEXIBLE`` to ``RAW`` → ``QUEUE``
> -----------------------------------
> 
> `FLEXIBLE`_ can be translated to one `RAW`_ pattern with `QUEUE`_ as the
> terminating action and a defined priority level.
> 
> +------------------------------------+
> | FLEXIBLE                           |
> +--------------------------+---------+
> | Pattern                  | Actions |
> +===+=====+==========+=====+=========+
> | 0 | RAW | ``spec`` | any | QUEUE   |
> |   |     +----------+-----+         |
> |   |     | ``mask`` | any |         |
> +---+-----+----------+-----+---------+
> 
> ``SYN`` to ``TCP`` → ``QUEUE``
> ------------------------------
> 
> `SYN`_ is a `TCP`_ rule with only the ``syn`` bit enabled and masked, and
> `QUEUE`_ as the terminating action.
> 
> Priority level can be set to simulate the high priority bit.
> 
> +---------------------------------------------+
> | SYN                                         |
> +-----------------------------------+---------+
> | Pattern                           | Actions |
> +===+======+==========+=============+=========+
> | 0 | ETH  | ``spec`` | empty       | QUEUE   |
> |   |      +----------+-------------+         |
> |   |      | ``mask`` | empty       |         |
> +---+------+----------+-------------+         |
> | 1 | IPV4 | ``spec`` | empty       |         |
> |   |      +----------+-------------+         |
> |   |      | ``mask`` | empty       |         |
> +---+------+----------+-------------+         |
> | 2 | TCP  | ``spec`` | ``syn`` = 1 |         |
> |   |      +----------+-------------+         |
> |   |      | ``mask`` | ``syn`` = 1 |         |
> +---+------+----------+-------------+---------+
> 
> ``NTUPLE`` to ``IPV4``, ``TCP``, ``UDP`` → ``QUEUE``
> ----------------------------------------------------
> 
> `NTUPLE`_ is similar to specifying an empty L2, `IPV4`_ as L3 with `TCP`_ or
> `UDP`_ as L4 and `QUEUE`_ as the terminating action.
> 
> A priority level can be specified as well.
> 
> +---------------------------------------+
> | NTUPLE                                |
> +-----------------------------+---------+
> | Pattern                     | Actions |
> +===+======+==========+=======+=========+
> | 0 | ETH  | ``spec`` | empty | QUEUE   |
> |   |      +----------+-------+         |
> |   |      | ``mask`` | empty |         |
> +---+------+----------+-------+         |
> | 1 | IPV4 | ``spec`` | any   |         |
> |   |      +----------+-------+         |
> |   |      | ``mask`` | any   |         |
> +---+------+----------+-------+         |
> | 2 | TCP, | ``spec`` | any   |         |
> |   | UDP  +----------+-------+         |
> |   |      | ``mask`` | any   |         |
> +---+------+----------+-------+---------+
> 
> ``TUNNEL`` to ``ETH``, ``IPV4``, ``IPV6``, ``VXLAN`` (or other) → ``QUEUE``
> ---------------------------------------------------------------------------
> 
> `TUNNEL`_ matches common IPv4 and IPv6 L3/L4-based tunnel types.
> 
> In the following table, `ANY`_ is used to cover the optional L4.
> 
> +------------------------------------------------+
> | TUNNEL                                         |
> +--------------------------------------+---------+
> | Pattern                              | Actions |
> +===+=========+==========+=============+=========+
> | 0 | ETH     | ``spec`` | any         | QUEUE   |
> |   |         +----------+-------------+         |
> |   |         | ``mask`` | any         |         |
> +---+---------+----------+-------------+         |
> | 1 | IPV4,   | ``spec`` | any         |         |
> |   | IPV6    +----------+-------------+         |
> |   |         | ``mask`` | any         |         |
> +---+---------+----------+-------------+         |
> | 2 | ANY     | ``spec`` | ``min`` = 0 |         |
> |   |         |          +-------------+         |
> |   |         |          | ``max`` = 0 |         |
> |   |         +----------+-------------+         |
> |   |         | ``mask`` | N/A         |         |
> +---+---------+----------+-------------+         |
> | 3 | VXLAN,  | ``spec`` | any         |         |
> |   | GENEVE, +----------+-------------+         |
> |   | TEREDO, | ``mask`` | any         |         |
> |   | NVGRE,  |          |             |         |
> |   | GRE,    |          |             |         |
> |   | ...     |          |             |         |
> +---+---------+----------+-------------+---------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``FDIR`` to most item types → ``QUEUE``, ``DROP``, ``PASSTHRU``
> ---------------------------------------------------------------
> 
> `FDIR`_ is more complex than any other type, there are several methods to
> emulate its functionality. It is summarized for the most part in the table
> below.
> 
> A few features are intentionally not supported:
> 
> - The ability to configure the matching input set and masks for the entire
>   device, PMDs should take care of it automatically according to the
>   requested flow rules.
> 
>   For example if a device supports only one bit-mask per protocol type,
>   source/address IPv4 bit-masks can be made immutable by the first created
>   rule. Subsequent IPv4 or TCPv4 rules can only be created if they are
>   compatible.
> 
>   Note that only protocol bit-masks affected by existing flow rules are
>   immutable, others can be changed later. They become mutable again after
>   the related flow rules are destroyed.
> 
> - Returning four or eight bytes of matched data when using flex bytes
>   filtering. Although a specific action could implement it, it conflicts
>   with the much more useful 32 bits tagging on devices that support it.
> 
> - Side effects on RSS processing of the entire device. Flow rules that
>   conflict with the current device configuration should not be
>   allowed. Similarly, device configuration should not be allowed when it
>   affects existing flow rules.
> 
> - Device modes of operation. "none" is unsupported since filtering cannot be
>   disabled as long as a flow rule is present.
> 
> - "MAC VLAN" or "tunnel" perfect matching modes should be automatically
> set
>   according to the created flow rules.
> 
> - Signature mode of operation is not defined but could be handled through a
>   specific item type if needed.
> 
> +----------------------------------------------+
> | FDIR                                         |
> +---------------------------------+------------+
> | Pattern                         | Actions    |
> +===+============+==========+=====+============+
> | 0 | ETH,       | ``spec`` | any | QUEUE,     |
> |   | RAW        +----------+-----+ DROP,      |
> |   |            | ``mask`` | any | PASSTHRU   |
> +---+------------+----------+-----+------------+
> | 1 | IPV4,      | ``spec`` | any | MARK       |
> |   | IPV6       +----------+-----+ (optional) |
> |   |            | ``mask`` | any |            |
> +---+------------+----------+-----+            |
> | 2 | TCP,       | ``spec`` | any |            |
> |   | UDP,       +----------+-----+            |
> |   | SCTP       | ``mask`` | any |            |
> +---+------------+----------+-----+            |
> | 3 | VF,        | ``spec`` | any |            |
> |   | PF         +----------+-----+            |
> |   | (optional) | ``mask`` | any |            |
> +---+------------+----------+-----+------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> ``HASH``
> ~~~~~~~~
> 
> There is no counterpart to this filter type because it translates to a
> global device setting instead of a pattern item. Device settings are
> automatically set according to the created flow rules.
> 
> ``L2_TUNNEL`` to ``VOID`` → ``VXLAN`` (or others)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> All packets are matched. This type alters incoming packets to encapsulate
> them in a chosen tunnel type, optionally redirect them to a VF as well.
> 
> The destination pool for tag based forwarding can be emulated with other
> flow rules using `DUP`_ as the action.
> 
> +----------------------------------------+
> | L2_TUNNEL                              |
> +---------------------------+------------+
> | Pattern                   | Actions    |
> +===+======+==========+=====+============+
> | 0 | VOID | ``spec`` | N/A | VXLAN,     |
> |   |      |          |     | GENEVE,    |
> |   |      |          |     | ...        |
> |   |      +----------+-----+------------+
> |   |      | ``mask`` | N/A | VF         |
> |   |      |          |     | (optional) |
> +---+------+----------+-----+------------+
> 
> .. raw:: pdf
> 
>    PageBreak
> 
> Future evolutions
> =================
> 
> - Describing dedicated testpmd commands to control and validate this API.
> 
> - A method to optimize generic flow rules with specific pattern items and
>   action types generated on the fly by PMDs. DPDK will assign negative
>   numbers to these in order to not collide with the existing types. See
>   `Negative types`_.
> 
> - Adding specific egress pattern items and actions as described in `Traffic
>   direction`_.
> 
> - Optional software fallback when PMDs are unable to handle requested flow
>   rules so applications do not have to implement their own.
> 
> - Ranges in addition to bit-masks. Ranges are more generic in many ways as
>   they interpret values. For instance only ranges make sense to cover
>   several TCP or UDP ports. These will probably be defined on a pattern item
>   basis.
> 
> --------
> 
> Adrien Mazarguil (1):
>   ethdev: introduce generic flow API
> 
>  lib/librte_ether/Makefile   |   2 +
>  lib/librte_ether/rte_flow.h | 941
> +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 943 insertions(+)
>  create mode 100644 lib/librte_ether/rte_flow.h
> 
> --
> 2.1.4


^ permalink raw reply

* Project Governance and Linux Foundation
From: O'Driscoll, Tim @ 2016-10-10  8:33 UTC (permalink / raw)
  To: dev@dpdk.org, users@dpdk.org

This email is being sent on behalf of: Cavium, Cisco, Intel, NXP & Red Hat.


Since its creation as an open source project in 2013, DPDK has grown significantly. The number of DPDK users, contributors, commercial products that use DPDK and open source projects that depend on it have all increased consistently over that time. DPDK is now a key ingredient in networking and NFV, and we need to ensure that the project structure and governance are appropriate for such a critical project, and that they facilitate the project's continued growth.

For over a year now we've been discussing moving DPDK to the Linux Foundation. We believe it's now time to conclude that discussion and make the move. The benefits of doing this would include:
- The infrastructure for a project like DPDK should not be owned and controlled by any single company.
- Remove any remaining perception that DPDK is not truly open.
- Allow the project to avail of the infrastructure and services provided by the Linux Foundation. These include things like: Ability to host infrastructure for integration and testing (the FD.io CSIT lab is an example of this - see https://wiki.fd.io/view/CSIT/CSIT_LF_testbed); Support for legal issues including trademarks and branding, and the ability to sign agreements on behalf of the project; Ability to pool resources for events and brand promotion; Safe haven for community IP resources.

We don't propose to debate the details here. Instead, an open discussion session on DPDK Project Growth has been included in the agenda for the DPDK Summit Userspace 2016 event in Dublin. We propose using that session to agree that the DPDK project will move to the Linux Foundation, and then to move on to discussing the specifics. Things that we'll need to consider include:
- Whether DPDK moves to the Linux Foundation as an independent project or as part of a larger project like FD.io.
- Creation of a project charter similar to those created for FD.io (https://fd.io/governance/technical-community-charter) and Open vSwitch (see http://openvswitch.org/pipermail/discuss/attachments/20160619/5a2df53e/attachment-0001.pdf).
- Agreement on budget, membership levels etc. A draft budget was created by the LF during previous discussions (https://docs.google.com/spreadsheets/d/1-3686Xb_jf4FtxdX8Mus9UwIxUb2vI_ppmJV5GnXcLg/edit#gid=302618256), but it is possible to adopt an even more lightweight model.

We could look at alternatives to the Linux Foundation, but a) we've been talking to the LF for over a year now, and b) the preponderance of networking projects in LF, like ODL, FD.io, and OVS, makes it a natural destination for DPDK.

As highlighted in previous discussions on this topic, it's important to stress that the intent is not to make significant changes to the technical governance and decision making of the project. The project has a strong set of maintainers and a Technical Board in place already. What's required is to supplement that with an open governance structure taking advantage of the services offered by the Linux Foundation.

The purpose of this email is to outline what we want to achieve during that discussion session in Dublin, and to allow people to consider the issue and prepare in advance. If people want to comment via email on the mailing list, that's obviously fine, but we believe that an open and frank discussion when people meet in person in Dublin is the best way to progress this.


For reference, below is a brief history of the previous discussions on this topic:

September 2015:
- A DPDK community call was held to discuss project growth and possible improvements. This was the first public discussion on possible governance changes. The agreed next step was to discuss this in more detail at the 2015 DPDK Summit Userspace event Dublin. Minutes of the call are at: http://dpdk.org/ml/archives/dev/2015-September/024120.html.

October 2015:
- An open discussion session on project governance was held at the 2015 DPDK Summit Userspace event. For technical governance, we agreed to investigate creating a technical steering committee. For non-technical governance (including things like event planning, legal and trademark issues, hosting of the website etc.), we agreed to work with the Linux Foundation on a proposal for a lightweight governance model for DPDK. Minutes of the discussion are at: http://dpdk.org/ml/archives/dev/2015-October/024825.html.

- The proposal for a technical steering committee was subsequently discussed on the mailing list (http://dpdk.org/ml/archives/dev/2015-October/026598.html) and agreed, leading to the creation of the DPDK Technical Board (http://dpdk.org/dev#board).

December 2015:
- A community call was held to discuss migration to the Linux Foundation. Mike Dolan (VP of Strategic Programs at The Linux Foundation) gave an overview of the LF and the services they can provide. We agreed to form a small sub-team (Dave Neary, Thomas Monjalon, Stephen Hemminger, Tim O'Driscoll) to work with the LF on a more detailed proposal. Minutes of the call are at: http://dpdk.org/ml/archives/dev/2015-December/030532.html.

February 2016:
- A community call was held to discuss the LF budget proposal (see https://docs.google.com/spreadsheets/d/1-3686Xb_jf4FtxdX8Mus9UwIxUb2vI_ppmJV5GnXcLg/edit#gid=302618256). We agreed to discuss this further on the dev mailing list due to limited attendance on the call. Minutes of the call are at: http://dpdk.org/ml/archives/dev/2016-February/032720.html.

- A request was made on the dev and announce mailing lists too determine who supported the proposal to move to the Linux Foundation (http://dpdk.org/ml/archives/dev/2016-February/033192.html). There was public support from Intel (http://dpdk.org/ml/archives/dev/2016-February/033297.html) and Brocade (http://dpdk.org/ml/archives/dev/2016-February/033359.html). 6WIND requested postponing the move for a few months (http://dpdk.org/ml/archives/dev/2016-February/033299.html).

- The Fast Data (FD.io) project was established under the Linux Foundation (https://fd.io/news/announcement/2016/02/linux-foundation-forms-open-source-effort-advance-io-services).

June 2016:
- The Open vSwitch project proposed moving to the Linux Foundation (http://openvswitch.org/pipermail/discuss/2016-June/021761.html).

August 2016:
- The Open vSwitch project moved to the Linux Foundation (https://www.linuxfoundation.org/announcements/open-vswitch-joins-linux-foundation-open-networking-ecosystem).

^ permalink raw reply

* [PATCH 1/1] fix the number of operations in libcrypto test
From: Marcin Kerlin @ 2016-10-10  8:07 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, michalx.k.jastrzebski, Marcin Kerlin

This patch reduce the number of total operations from 1M to 10K, because
test is taking too long time now.

Fixes: ffbe3be0d4b5 ("app/test: add libcrypto")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
 app/test/test_cryptodev_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
index 4aee9af..43a7166 100644
--- a/app/test/test_cryptodev_perf.c
+++ b/app/test/test_cryptodev_perf.c
@@ -3420,7 +3420,7 @@ test_perf_snow3G_vary_pkt_size(void)
 static int
 test_perf_libcrypto_vary_pkt_size(void)
 {
-	unsigned int total_operations = 1000000;
+	unsigned int total_operations = 10000;
 	unsigned int burst_size = { 64 };
 	unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
 			1792, 2048 };
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH 0/6] vhost: add Tx zero copy support
From: Yuanhan Liu @ 2016-10-10  8:03 UTC (permalink / raw)
  To: linhaifeng; +Cc: dev, Maxime Coquelin
In-Reply-To: <57FA2014.1020904@huawei.com>

On Sun, Oct 09, 2016 at 06:46:44PM +0800, linhaifeng wrote:
> 在 2016/8/23 16:10, Yuanhan Liu 写道:
> > The basic idea of Tx zero copy is, instead of copying data from the
> > desc buf, here we let the mbuf reference the desc buf addr directly.
> 
> Is there problem when push vlan to the mbuf which reference the desc buf addr directly?

Yes, you can't do that when zero copy is enabled, due to following code
piece:

    +               if (unlikely(dev->dequeue_zero_copy && (hpa = gpa_to_hpa(dev,
    +                                       desc->addr + desc_offset, cpy_len)))) {
    +                       cur->data_len = cpy_len;
==> +                       cur->data_off = 0;
    +                       cur->buf_addr = (void *)(uintptr_t)desc_addr;
    +                       cur->buf_physaddr = hpa;

The marked line basically makes the mbuf has no headroom to use.

	--yliu

> We know if guest use virtio_net(kernel) maybe skb has no headroom.

^ permalink raw reply

* [PATCH 3/3] app/testpmd: fix wrong flow director mask
From: Wenzhuo Lu @ 2016-10-10  7:46 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1476085594-32325-1-git-send-email-wenzhuo.lu@intel.com>

In mac-vlan mode, MAC address mask is not supported by HW.
The MAC address mask should not be set in mac-vlan mode.
Remove this parameter from the CLI.

Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/cmdline.c                      | 5 +----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 3 +--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 39e6d59..7c5c5e7 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -720,7 +720,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"    Set flow director IP mask.\n\n"
 
 			"flow_director_mask (port_id) mode MAC-VLAN"
-			" vlan (vlan_value) mac (mac_value)\n"
+			" vlan (vlan_value)\n"
 			"    Set flow director MAC-VLAN mask.\n\n"
 
 			"flow_director_mask (port_id) mode Tunnel"
@@ -9075,7 +9075,6 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 		}
 
 		mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask);
-		mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
 	} else if (fdir_conf.mode ==  RTE_FDIR_MODE_PERFECT_TUNNEL) {
 		if (strcmp(res->mode_value, "Tunnel")) {
 			printf("Please set mode to Tunnel.\n");
@@ -9206,8 +9205,6 @@ cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
 		(void *)&cmd_flow_director_mask_mode_mac_vlan,
 		(void *)&cmd_flow_director_mask_vlan,
 		(void *)&cmd_flow_director_mask_vlan_value,
-		(void *)&cmd_flow_director_mask_mac,
-		(void *)&cmd_flow_director_mask_mac_value,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f87e0c2..ed04532 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1844,8 +1844,7 @@ Set flow director's input masks::
                       src_mask (ipv4_src) (ipv6_src) (src_port) \
                       dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
 
-   flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value) \
-                      mac (mac_value)
+   flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
 
    flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
                       mac (mac_value) tunnel-type (tunnel_type_value) \
-- 
1.9.3

^ permalink raw reply related

* [PATCH 2/3] app/testpmd: fix flow director endian issue
From: Wenzhuo Lu @ 2016-10-10  7:46 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1476085594-32325-1-git-send-email-wenzhuo.lu@intel.com>

The vlan mask and tunnel id mask of flow director
are defined as big endian. So they should be
converted.
When the mask is printed, the parameters are not
converted either.

Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/cmdline.c |  6 +++---
 app/test-pmd/config.c  | 43 +++++++++++++++++++++++++------------------
 2 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6e95ca2..39e6d59 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9074,7 +9074,7 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 			return;
 		}
 
-		mask->vlan_tci_mask = res->vlan_mask;
+		mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask);
 		mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
 	} else if (fdir_conf.mode ==  RTE_FDIR_MODE_PERFECT_TUNNEL) {
 		if (strcmp(res->mode_value, "Tunnel")) {
@@ -9082,9 +9082,9 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 			return;
 		}
 
-		mask->vlan_tci_mask = res->vlan_mask;
+		mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask);
 		mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
-		mask->tunnel_id_mask = res->tunnel_id_mask;
+		mask->tunnel_id_mask = rte_cpu_to_be_32(res->tunnel_id_mask);
 		mask->tunnel_type_mask = res->tunnel_type_mask;
 	} else {
 		if (strcmp(res->mode_value, "IP")) {
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 83bebfe..742a8d8 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2045,26 +2045,33 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
-	printf("\n    vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+	printf("\n    vlan_tci: 0x%04x", rte_be_to_cpu_16(mask->vlan_tci_mask));
 
-	if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
-		printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask);
-	else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
-		printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+	if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+		printf(", mac_addr: 0x%02x, tunnel_type: 0x%01x,"
+			" tunnel_id: 0x%08x",
 			mask->mac_addr_byte_mask, mask->tunnel_type_mask,
-			mask->tunnel_id_mask);
-	else {
-		printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
-			" src_port: 0x%04x, dst_port: 0x%04x",
-			mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
-			mask->src_port_mask, mask->dst_port_mask);
-
-		printf("\n    src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
-			" dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
-			mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
-			mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
-			mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
-			mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+			rte_be_to_cpu_32(mask->tunnel_id_mask));
+	else if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+		printf(", src_ipv4: 0x%08x, dst_ipv4: 0x%08x",
+			rte_be_to_cpu_32(mask->ipv4_mask.src_ip),
+			rte_be_to_cpu_32(mask->ipv4_mask.dst_ip));
+
+		printf("\n    src_port: 0x%04x, dst_port: 0x%04x",
+			rte_be_to_cpu_16(mask->src_port_mask),
+			rte_be_to_cpu_16(mask->dst_port_mask));
+
+		printf("\n    src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+			rte_be_to_cpu_32(mask->ipv6_mask.src_ip[0]),
+			rte_be_to_cpu_32(mask->ipv6_mask.src_ip[1]),
+			rte_be_to_cpu_32(mask->ipv6_mask.src_ip[2]),
+			rte_be_to_cpu_32(mask->ipv6_mask.src_ip[3]));
+
+		printf("\n    dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+			rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[0]),
+			rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[1]),
+			rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[2]),
+			rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[3]));
 	}
 
 	printf("\n");
-- 
1.9.3

^ permalink raw reply related

* [PATCH 1/3] ixgbe: fix wrong flow director mask
From: Wenzhuo Lu @ 2016-10-10  7:46 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1476085594-32325-1-git-send-email-wenzhuo.lu@intel.com>

In mac-vlan mode, MAC address mask is not supported by HW.
The MAC address mask should not be set in mac-vlan mode.
Instead, only set it in tunnel mode.

Fixes: 82fb702077f6 ("ixgbe: support new flow director modes for X550")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_fdir.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 861c7cb..4b81ee3 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -432,12 +432,12 @@ fdir_set_input_mask_x550(struct rte_eth_dev *dev,
 		fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
 				IXGBE_FDIRIP6M_TNI_VNI;
 
-	mac_mask = input_mask->mac_addr_byte_mask;
-	fdiripv6m |= (mac_mask << IXGBE_FDIRIP6M_INNER_MAC_SHIFT)
-			& IXGBE_FDIRIP6M_INNER_MAC;
-	info->mask.mac_addr_byte_mask = input_mask->mac_addr_byte_mask;
-
 	if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+		mac_mask = input_mask->mac_addr_byte_mask;
+		fdiripv6m |= (mac_mask << IXGBE_FDIRIP6M_INNER_MAC_SHIFT)
+				& IXGBE_FDIRIP6M_INNER_MAC;
+		info->mask.mac_addr_byte_mask = input_mask->mac_addr_byte_mask;
+
 		switch (input_mask->tunnel_type_mask) {
 		case 0:
 			/* Mask turnnel type */
-- 
1.9.3

^ permalink raw reply related

* [PATCH 0/3] fix flow director mask issues
From: Wenzhuo Lu @ 2016-10-10  7:46 UTC (permalink / raw)
  To: dev

There're 2 issues about flow director mask.
1, MAC address mask is not supported in mac-vlan mode.
2, All the parameter are defined as big endian, but
   they're not treated approriately.
This patch set is used to fix these 2 issues.

Wenzhuo Lu (3):
  ixgbe: fix wrong flow director mask
  app/testpmd: fix flow director endian issue
  app/testpmd: fix wrong flow director mask

 app/test-pmd/cmdline.c                      | 11 +++-----
 app/test-pmd/config.c                       | 43 +++++++++++++++++------------
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  3 +-
 drivers/net/ixgbe/ixgbe_fdir.c              | 10 +++----
 4 files changed, 35 insertions(+), 32 deletions(-)

-- 
1.9.3

^ permalink raw reply

* Re: [PATCH v3 0/5] vhost: optimize enqueue
From: Wang, Zhihong @ 2016-10-10  7:25 UTC (permalink / raw)
  To: Jianbo Liu; +Cc: Yuanhan Liu, Maxime Coquelin, dev@dpdk.org
In-Reply-To: <CAP4Qi3-5_5aAATEqnHhNtH0j6Q_VkzF4xbZQGZYbN5KA6oEX_g@mail.gmail.com>



> -----Original Message-----
> From: Jianbo Liu [mailto:jianbo.liu@linaro.org]
> Sent: Monday, October 10, 2016 2:58 PM
> To: Wang, Zhihong <zhihong.wang@intel.com>
> Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/5] vhost: optimize enqueue
> 
> On 10 October 2016 at 14:22, Wang, Zhihong <zhihong.wang@intel.com>
> wrote:
> >
> >
> >> -----Original Message-----
> >> From: Jianbo Liu [mailto:jianbo.liu@linaro.org]
> >> Sent: Monday, October 10, 2016 1:32 PM
> >> To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> >> Cc: Wang, Zhihong <zhihong.wang@intel.com>; Maxime Coquelin
> >> <maxime.coquelin@redhat.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [PATCH v3 0/5] vhost: optimize enqueue
> >>
> >> On 10 October 2016 at 10:44, Yuanhan Liu <yuanhan.liu@linux.intel.com>
> >> wrote:
> >> > On Sun, Oct 09, 2016 at 12:09:07PM +0000, Wang, Zhihong wrote:
> >> >> > > > Tested with testpmd, host: txonly, guest: rxonly
> >> >> > > > size (bytes)     improvement (%)
> >> >> > > > 64                    4.12
> >> >> > > > 128                   6
> >> >> > > > 256                   2.65
> >> >> > > > 512                   -1.12
> >> >> > > > 1024                 -7.02
> >> >> > >
> >> >> > > There is a difference between Zhihong's code and the old I spotted
> in
> >> >> > > the first time: Zhihong removed the avail_idx prefetch. I
> understand
> >> >> > > the prefetch becomes a bit tricky when mrg-rx code path is
> >> considered;
> >> >> > > thus, I didn't comment on that.
> >> >> > >
> >> >> > > That's one of the difference that, IMO, could drop a regression. I
> then
> >> >> > > finally got a chance to add it back.
> >> >> > >
> >> >> > > A rough test shows it improves the performance of 1400B packet
> size
> >> >> > greatly
> >> >> > > in the "txonly in host and rxonly in guest" case: +33% is the number
> I
> >> get
> >> >> > > with my test server (Ivybridge).
> >> >> >
> >> >> > Thanks Yuanhan! I'll validate this on x86.
> >> >>
> >> >> Hi Yuanhan,
> >> >>
> >> >> Seems your code doesn't perform correctly. I write a new version
> >> >> of avail idx prefetch but didn't see any perf benefit.
> >> >>
> >> >> To be honest I doubt the benefit of this idea. The previous mrg_off
> >> >> code has this method but doesn't give any benefits.
> >> >
> >> > Good point. I thought of that before, too. But you know that I made it
> >> > in rush, that I didn't think further and test more.
> >> >
> >> > I looked the code a bit closer this time, and spotted a bug: the prefetch
> >> > actually didn't happen, due to following code piece:
> >> >
> >> >         if (vq->next_avail_idx >= NR_AVAIL_IDX_PREFETCH) {
> >> >                 prefetch_avail_idx(vq);
> >> >                 ...
> >> >         }
> >> >
> >> > Since vq->next_avail_idx is set to 0 at the entrance of enqueue path,
> >> > prefetch_avail_idx() will be called. The fix is easy though: just put
> >> > prefetch_avail_idx before invoking enqueue_packet.
> >> >
> >> > In summary, Zhihong is right, I see no more gains with that fix :(
> >> >
> >> > However, as stated, that's kind of the only difference I found between
> >> > yours and the old code, that maybe it's still worthwhile to have a
> >> > test on ARM, Jianbo?
> >> >
> >> I haven't tested it, but I think it could be no improvement for ARM either.
> >>
> >> A smalll suggestion for enqueue_packet:
> >>
> >> .....
> >> +       /* start copy from mbuf to desc */
> >> +       while (mbuf_avail || mbuf->next) {
> >> .....
> >>
> >> Considering pkt_len is in the first cache line (same as data_len),
> >> while next pointer is in the second cache line,
> >> is it better to check the total packet len, instead of the last mbuf's
> >> next pointer to jump out of while loop and avoid possible cache miss?
> >
> > Jianbo,
> >
> > Thanks for the reply!
> >
> > This idea sounds good, but it won't help the general perf in my
> > opinion, since the 2nd cache line is accessed anyway prior in
> > virtio_enqueue_offload.
> >
> Yes, you are right. I'm thinking of prefetching beforehand.
> And if it's a chained mbuf, virtio_enqueue_offload will not be called
> in next loop.
> 
> > Also this would bring a NULL check when actually access mbuf->next.
> >
> > BTW, could you please publish the number of:
> >
> >  1. mrg_rxbuf=on, comparison between original and original + this patch
> >
> >  2. mrg_rxbuf=off, comparison between original and original + this patch
> >
> > So we can have a whole picture of how this patch impact on ARM platform.
> >
> I think you already have got many results in my previous emails.
> Sorry I can't test right now and busy with other things.

We're still missing mrg on data.


^ permalink raw reply

* Re: [PATCH v3 0/5] vhost: optimize enqueue
From: Jianbo Liu @ 2016-10-10  6:57 UTC (permalink / raw)
  To: Wang, Zhihong; +Cc: Yuanhan Liu, Maxime Coquelin, dev@dpdk.org
In-Reply-To: <8F6C2BD409508844A0EFC19955BE09414E7BC1BD@SHSMSX103.ccr.corp.intel.com>

On 10 October 2016 at 14:22, Wang, Zhihong <zhihong.wang@intel.com> wrote:
>
>
>> -----Original Message-----
>> From: Jianbo Liu [mailto:jianbo.liu@linaro.org]
>> Sent: Monday, October 10, 2016 1:32 PM
>> To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>> Cc: Wang, Zhihong <zhihong.wang@intel.com>; Maxime Coquelin
>> <maxime.coquelin@redhat.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 0/5] vhost: optimize enqueue
>>
>> On 10 October 2016 at 10:44, Yuanhan Liu <yuanhan.liu@linux.intel.com>
>> wrote:
>> > On Sun, Oct 09, 2016 at 12:09:07PM +0000, Wang, Zhihong wrote:
>> >> > > > Tested with testpmd, host: txonly, guest: rxonly
>> >> > > > size (bytes)     improvement (%)
>> >> > > > 64                    4.12
>> >> > > > 128                   6
>> >> > > > 256                   2.65
>> >> > > > 512                   -1.12
>> >> > > > 1024                 -7.02
>> >> > >
>> >> > > There is a difference between Zhihong's code and the old I spotted in
>> >> > > the first time: Zhihong removed the avail_idx prefetch. I understand
>> >> > > the prefetch becomes a bit tricky when mrg-rx code path is
>> considered;
>> >> > > thus, I didn't comment on that.
>> >> > >
>> >> > > That's one of the difference that, IMO, could drop a regression. I then
>> >> > > finally got a chance to add it back.
>> >> > >
>> >> > > A rough test shows it improves the performance of 1400B packet size
>> >> > greatly
>> >> > > in the "txonly in host and rxonly in guest" case: +33% is the number I
>> get
>> >> > > with my test server (Ivybridge).
>> >> >
>> >> > Thanks Yuanhan! I'll validate this on x86.
>> >>
>> >> Hi Yuanhan,
>> >>
>> >> Seems your code doesn't perform correctly. I write a new version
>> >> of avail idx prefetch but didn't see any perf benefit.
>> >>
>> >> To be honest I doubt the benefit of this idea. The previous mrg_off
>> >> code has this method but doesn't give any benefits.
>> >
>> > Good point. I thought of that before, too. But you know that I made it
>> > in rush, that I didn't think further and test more.
>> >
>> > I looked the code a bit closer this time, and spotted a bug: the prefetch
>> > actually didn't happen, due to following code piece:
>> >
>> >         if (vq->next_avail_idx >= NR_AVAIL_IDX_PREFETCH) {
>> >                 prefetch_avail_idx(vq);
>> >                 ...
>> >         }
>> >
>> > Since vq->next_avail_idx is set to 0 at the entrance of enqueue path,
>> > prefetch_avail_idx() will be called. The fix is easy though: just put
>> > prefetch_avail_idx before invoking enqueue_packet.
>> >
>> > In summary, Zhihong is right, I see no more gains with that fix :(
>> >
>> > However, as stated, that's kind of the only difference I found between
>> > yours and the old code, that maybe it's still worthwhile to have a
>> > test on ARM, Jianbo?
>> >
>> I haven't tested it, but I think it could be no improvement for ARM either.
>>
>> A smalll suggestion for enqueue_packet:
>>
>> .....
>> +       /* start copy from mbuf to desc */
>> +       while (mbuf_avail || mbuf->next) {
>> .....
>>
>> Considering pkt_len is in the first cache line (same as data_len),
>> while next pointer is in the second cache line,
>> is it better to check the total packet len, instead of the last mbuf's
>> next pointer to jump out of while loop and avoid possible cache miss?
>
> Jianbo,
>
> Thanks for the reply!
>
> This idea sounds good, but it won't help the general perf in my
> opinion, since the 2nd cache line is accessed anyway prior in
> virtio_enqueue_offload.
>
Yes, you are right. I'm thinking of prefetching beforehand.
And if it's a chained mbuf, virtio_enqueue_offload will not be called
in next loop.

> Also this would bring a NULL check when actually access mbuf->next.
>
> BTW, could you please publish the number of:
>
>  1. mrg_rxbuf=on, comparison between original and original + this patch
>
>  2. mrg_rxbuf=off, comparison between original and original + this patch
>
> So we can have a whole picture of how this patch impact on ARM platform.
>
I think you already have got many results in my previous emails.
Sorry I can't test right now and busy with other things.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox