[dpdk-dev] [PATCH v4] pmd/snow3g: add new SNOW 3G SW PMD

2016-03-10 Thread Thomas Monjalon
2016-03-10 16:33, Pablo de Lara:
> +SNOW 3G PMD
> +M: Pablo de Lara 
> +F: drivers/crypto/snow3g

Missing doc reference:
F: doc/guides/cryptodevs/snow3g.rst

> +To build DPDK with the SNOW3G_PMD the user is required to get
> +the export controlled libsso library, sending a request to
> +`DPDKUser_software_access at intel.com`, and compile it
> +on their user system before building DPDK:

I'm a bit concerned that this library is not freely available.
It makes testing difficult.

> +The environmental variable LIBSSO_PATH must be exported with the path
> +where you extracted and built the libsso library and finally set
> +CONFIG_RTE_LIBRTE_SNOW3G=y in config/common_base.

It is CONFIG_RTE_LIBRTE_PMD_SNOW3G.

> +# SNOW3G PMD is dependent on the LIBSSO library
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso
> +
>  endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)

This is for the static library case.
The PMD should be linked to libsso also in the shared library case.
There is the same problem with -lIPSec_MB (aesni_mb driver).


[dpdk-dev] [PATCH v2 02/10] qede: add documentation

2016-03-10 Thread Rasesh Mody
Hi Thomas,

> From: Harish Patil
> Sent: Thursday, March 10, 2016 9:18 AM
> >
> >2016-03-10 05:45, Rasesh Mody:
> >>  doc/guides/nics/index.rst |1 +
> >>  doc/guides/nics/qede.rst  |  340
> >>+
> >>  2 files changed, 341 insertions(+)
> >
> >It would be nice to see a new column in the matrix of overview.rst.
> >
> 
> Hi Thomas,
> Yes, we had updated overview.rst with two new columns, but missed this file
> while submitting patches.
> Will send a follow-on patch.

A separate patch is sent that adds new columns (qede and qedevf) in the matrix 
of overview.rst.

Thanks!
Rasesh


[dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5

2016-03-10 Thread Bruce Richardson
On Thu, Mar 03, 2016 at 03:27:33PM +0100, Adrien Mazarguil wrote:
> This patchset addresses several minor issues, release notes are updated
> accordingly.
> 
> Note: should be applied after "Performance optimizations for mlx5 and mlx4".
> 
> Changes in v2:
> - None, submitted again due to dependency with previous patchset.
> 
> Adrien Mazarguil (3):
>   mlx5: manage all special flow types at once
>   mlx5: remove redundant debugging message
>   mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows
> 
> Or Ami (2):
>   mlx5: fix possible crash during initialization
>   mlx5: check if port is configured as Ethernet device
> 
> Robin Jarry (1):
>   mlx4: make sure that number of RX queues is a power of 2
> 
> Yaacov Hazan (1):
>   mlx5: fix RX checksum offload in non L3/L4 packets
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH] e1000: fix setting of VF MAC address

2016-03-10 Thread Bruce Richardson
On Fri, Mar 04, 2016 at 01:16:51AM +, Lu, Wenzhuo wrote:
> Hi,
> 
> > > > Signed-off-by: Bernard Iremonger 
> Acked-by: Wenzhuo Lu 
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH v4 0/3] Snow3G support for Intel Quick Assist Devices

2016-03-10 Thread Thomas Monjalon
> > Deepak Kumar JAIN (3):
> >   crypto: add cipher/auth only support
> >   qat: add support for Snow3G
> >   app/test: add Snow3G tests
> 
> Series-acked-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH] enic: fix dma addr of outgoing packets

2016-03-10 Thread Bruce Richardson
On Thu, Mar 10, 2016 at 09:32:58PM +, Bruce Richardson wrote:
> On Thu, Feb 25, 2016 at 12:06:15AM +0100, Yoann Desmouceaux wrote:
> > The enic PMD driver send function uses a constant offset instead
> > of relying on the data_off in the mbuf to find the start of the packet.
> > 
> > Signed-off-by: Yoann Desmouceaux 
> > ---
> >  drivers/net/enic/enic_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> > index 07a9810..f818c32 100644
> > --- a/drivers/net/enic/enic_main.c
> > +++ b/drivers/net/enic/enic_main.c
> > @@ -166,7 +166,7 @@ void enic_send_pkt(struct enic *enic, struct vnic_wq 
> > *wq,
> > uint16_t mss = 0;
> > uint8_t vlan_tag_insert = 0;
> > uint64_t bus_addr = (dma_addr_t)
> > -   (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM);
> > +   (tx_pkt->buf_physaddr + tx_pkt->data_off);
> >  
> > if (sop) {
> > if (ol_flags & PKT_TX_VLAN_PKT)
> > -- 
> > 2.1.4
> > 
> Fixes: fefed3d1e62c ("enic: new driver")
> 
> Acked-by: Bruce Richardson 
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH] enic: fix dma addr of outgoing packets

2016-03-10 Thread Bruce Richardson
On Thu, Feb 25, 2016 at 12:06:15AM +0100, Yoann Desmouceaux wrote:
> The enic PMD driver send function uses a constant offset instead
> of relying on the data_off in the mbuf to find the start of the packet.
> 
> Signed-off-by: Yoann Desmouceaux 
> ---
>  drivers/net/enic/enic_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 07a9810..f818c32 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -166,7 +166,7 @@ void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
>   uint16_t mss = 0;
>   uint8_t vlan_tag_insert = 0;
>   uint64_t bus_addr = (dma_addr_t)
> - (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM);
> + (tx_pkt->buf_physaddr + tx_pkt->data_off);
>  
>   if (sop) {
>   if (ol_flags & PKT_TX_VLAN_PKT)
> -- 
> 2.1.4
> 
Fixes: fefed3d1e62c ("enic: new driver")

Acked-by: Bruce Richardson 



[dpdk-dev] [PATCH v3] cryptodev: add capabilities discovery mechanism

2016-03-10 Thread Trahe, Fiona


> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Thursday, March 10, 2016 7:55 PM
> To: dev at dpdk.org
> Cc: Doherty, Declan; Trahe, Fiona; De Lara Guarch, Pablo
> Subject: [PATCH v3] cryptodev: add capabilities discovery mechanism
> 
> From: Declan Doherty 
> 
> This patch add a mechanism for discovery of crypto device features and
> supported crypto operations and algorithms. It also provides a method for a
> crypto PMD to publish any data range limitations it may have for the 
> operations
> and algorithms it supports.
> 
> The parameter feature_flags added to rte_cryptodev struct is used to capture
> features such as operations supported (symmetric crypto, operation chaining
> etc) as well parameter such as whether the device is hardware accelerated or
> uses SIMD instructions.
> 
> The capabilities parameter allows a PMD to define an array of supported
> operations with any limitation which that implementation may have.
> 
> Finally the rte_cryptodev_info struct has been extended to allow retrieval of
> these parameter using the existing rte_cryptodev_info_get() API.
> 
> Signed-off-by: Declan Doherty 
> Signed-off-by: Pablo de Lara 
> ---
> 
> This patch depends on "null_crypto_pmd: PMD to support null crypto
> operations" patch
> (http://dpdk.org/dev/patchwork/patch/11428/)
> and "snow3g: Bit-wise handling for Wireless Algorithm" patch
> (http://dpdk.org/dev/patchwork/patch/11429/)
> 
> Changes in v3:
> 
> - Renamed macro to specify symmetric algo chaining
> 
> Changes in v2:
> 
> - Fixed incorrect values for sizes
> - Renamed some fields in capabilities structure
> - Added capabilities for new PMDs
> 
Acked-by: Fiona Trahe 


[dpdk-dev] [PATCH] app/test: fix qat autotest failure

2016-03-10 Thread Thomas Monjalon
> > This patch fix the QAT autotest failure when run for multiple times.
> > it was caused as mbuf was not freed.
> > 
> > Fixes: 202d375c60b (app/test: add cryptodev unit and performance tests)
> > 
> > This patch depends on following patch:
> > cryptodev API changes
> > http://dpdk.org/ml/archives/dev/2016-February/034212.html
> > 
> > Signed-off-by: Deepak Kumar JAIN 
> 
> Acked-by: Fiona Trahe 

Applied, thanks


[dpdk-dev] [PATCH, v2] mempool: avoid memory waste with large pagesize

2016-03-10 Thread Stephen Hemminger
On Thu, 10 Mar 2016 12:12:12 +0100
Olivier MATZ  wrote:

> >> It still does not work. When CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=y:
> >>
> >> mp = rte_mempool_create("test", 128,
> >>64, 0, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
> >> rte_mempool_dump(stdout, mp);
> >>
> >>   populated_size=128
> >>   header_size=64
> >>   elt_size=64
> >>   trailer_size=64
> >>   total_obj_size=192
> >>
> > With --no-huge (since patch updates that part), it gives:
> >   header_size=64
> >   elt_size=64
> >   trailer_size=0
> >   total_obj_size=128
> >   private_data_size=3904
> > 
> > 1- private_data still rounds to page size, not sure if this is a problem.
> > 2- with MEMPOOL_DEBUG=y, trailer_size is 0, comment in code says it
> > should keep cookie, not sure if this is a problem.
> 
> Yes the trailer should at least be 8 bytes to store the cookie.
> 

Ok, will fix. that.


[dpdk-dev] [PATCH] snow3g: Bit-wise handling for Wireless Algorithm

2016-03-10 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Jain, Deepak K
> Sent: Thursday, March 10, 2016 5:44 PM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Jain, Deepak K
> Subject: [PATCH] snow3g: Bit-wise handling for Wireless Algorithm
> 
> Wireless algorithms like Snow3G needs input in bits.
> In this patch, changes have been made to incorporate this requirement
> in both QAT and SW PMD.
> 
> Signed-off-by: Deepak Kumar JAIN 

Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH v3] cryptodev: add capabilities discovery mechanism

2016-03-10 Thread Pablo de Lara
From: Declan Doherty 

This patch add a mechanism for discovery of crypto device features and supported
crypto operations and algorithms. It also provides a method for a crypto PMD to
publish any data range limitations it may have for the operations and algorithms
it supports.

The parameter feature_flags added to rte_cryptodev struct is used to capture
features such as operations supported (symmetric crypto, operation chaining etc)
as well parameter such as whether the device is hardware accelerated or uses
SIMD instructions.

The capabilities parameter allows a PMD to define an array of supported 
operations
with any limitation which that implementation may have.

Finally the rte_cryptodev_info struct has been extended to allow retrieval of
these parameter using the existing rte_cryptodev_info_get() API.

Signed-off-by: Declan Doherty 
Signed-off-by: Pablo de Lara 
---

This patch depends on "null_crypto_pmd: PMD to support null crypto operations" 
patch
(http://dpdk.org/dev/patchwork/patch/11428/)
and "snow3g: Bit-wise handling for Wireless Algorithm" patch
(http://dpdk.org/dev/patchwork/patch/11429/)

Changes in v3:

- Renamed macro to specify symmetric algo chaining

Changes in v2:

- Fixed incorrect values for sizes
- Renamed some fields in capabilities structure
- Added capabilities for new PMDs


 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   |  18 +++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c   |  49 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  18 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 175 +
 drivers/crypto/null/null_crypto_pmd.c  |   3 +
 drivers/crypto/null/null_crypto_pmd_ops.c  |  47 ++
 drivers/crypto/qat/qat_crypto.c| 201 -
 drivers/crypto/qat/rte_qat_cryptodev.c |   3 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c |   3 +
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  51 +++
 lib/librte_cryptodev/rte_cryptodev.c   |  28 
 lib/librte_cryptodev/rte_cryptodev.h   | 137 +
 lib/librte_cryptodev/rte_cryptodev_version.map |   1 +
 13 files changed, 733 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 83aa272..35577bc 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -445,6 +445,24 @@ aesni_gcm_create(const char *name,
dev->dequeue_burst = aesni_gcm_pmd_dequeue_burst;
dev->enqueue_burst = aesni_gcm_pmd_enqueue_burst;

+   dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
+   RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
+   RTE_CRYPTODEV_FF_CPU_AESNI;
+
+   switch (vector_mode) {
+   case RTE_AESNI_GCM_SSE:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
+   break;
+   case RTE_AESNI_GCM_AVX:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX;
+   break;
+   case RTE_AESNI_GCM_AVX2:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX2;
+   break;
+   default:
+   break;
+   }
+
/* Set vector instructions mode supported */
internals = dev->data->dev_private;

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index f865e0d..af7907b 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -38,6 +38,55 @@

 #include "aesni_gcm_pmd_private.h"

+static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
+   {   /* AES GCM (AUTH) */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   .sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+   .auth = {
+   .algo = RTE_CRYPTO_AUTH_AES_GCM,
+   .block_size = 16,
+   .key_size = {
+   .min = 16,
+   .max = 32,
+   .increment = 8
+   },
+   .digest_size = {
+   .min = 8,
+   .max = 16,
+   .increment = 4
+   },
+   .aad_size = {
+   .min = 8,
+   .max = 12,
+   .increment = 4
+   }
+   }
+   }
+   },
+   {   /* AES GCM (CIPHER) */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   .sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+  

[dpdk-dev] [PATCH] cryptodev: fix RTE_PMD_DEBUG_TRACE redefinition

2016-03-10 Thread Thomas Monjalon
2016-03-03 00:34, Marc Sune:
> RTE_PMD_DEBUG_TRACE used RTE_FUNC_PTR_OR_ERR_RET was redefined
> in rte_cryptodev_pmd.h which produced MACRO redefinition warnings
> when including both rte_cryptodev_pmd.h and rte_ethdev.h.
> 
> This commit moves MACRO definition to rte_cryptodev.c to prevent
> this warning.

It is not the right fix.

This macro should probably be renamed with a crypto prefix or defined
only once (same thing for ethdev).
The function rte_pmd_debug_trace() and the macros
RTE_PROC_PRIMARY_OR_ERR_RET,
RTE_PROC_PRIMARY_OR_RET,
RTE_FUNC_PTR_OR_ERR_RET,
RTE_FUNC_PTR_OR_RET
should not be in lib/librte_eal/common/include/rte_dev.h.
The macros call RTE_PMD_DEBUG_TRACE which is defined elsewhere.
The rte_log.h is probably a better place.
But why these macros have no PMD prefix?



[dpdk-dev] [PATCH] doc: fill in cxgbe driver features matrix

2016-03-10 Thread Rahul Lakkireddy
Fill in the supported features matrix for CXGBE PMD.

Signed-off-by: Rahul Lakkireddy 
Signed-off-by: Kumar Sanghvi 
---
 doc/guides/nics/overview.rst | 46 ++--
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index b9f1c94..2d4f014 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -86,20 +86,20 @@ Most of these differences are summarized below.
 e   e   e   e   e  
 e
 c   c   c   c   c  
 c
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   link statusX X   X
+   link status  X X X   X
link status event  X X
Rx interrupt   X X X X
-   queue start/stop   X X X X   X
-   MTU update
-   jumbo frameX X X X
-   scattered Rx   X X X X   X
+   queue start/stop X X X X X   X
+   MTU update   X
+   jumbo frame  X X X X X
+   scattered Rx X X X X X   X
LRO
-   TSOX X X X
-   promiscuous mode   X X X X   X
-   allmulticast mode  X X X X   X
+   TSO  X X X X X
+   promiscuous mode X X X X X   X
+   allmulticast modeX X X X X   X
unicast MAC filter X X X X
multicast MAC filter   X X X X
-   RSS hash   X X X X
+   RSS hash X X X X X
RSS key update X X X X
RSS reta updateX X X X
VMDq   X X
@@ -113,35 +113,35 @@ Most of these differences are summarized below.
flexible filter
hash filterX X X X
flow director  X X
-   flow control   X X
+   flow control X X X
rate limitation
traffic mirroring  X X
-   CRC offloadX   X
-   VLAN offload   X   X
+   CRC offload  X X   X
+   VLAN offload X X   X
QinQ offload   X   X
-   L3 checksum offloadX   X
-   L4 checksum offloadX   X
+   L3 checksum offload  X X   X
+   L4 checksum offload  X X   X
inner L3 checksum  X   X
inner L4 checksum  X   X
-   packet type parsingX   X
+   packet type parsing  X X   X
timesync   X X
-   basic statsX X X X   X
+   basic stats  X X X X X   X
extended stats X X X X
-   stats per queue  X
+   stats per queue  X   X
EEPROM dump
registers dump
multiprocess aware X X X X
-   BSD nic_uioX X X X
-   Linux UIO  X X X X
-   Linux VFIO X X X X
+   BSD nic_uio  X X X X X
+   Linux UIOX X X X X
+   Linux VFIO   X X X X X
other kdrv   X
ARMv7
ARMv8
Power8
TILE-Gx
-   x86-32 X X X X
-   x86-64 X X X X   X
-   usage docX
+   x86-32   X X X X X
+   x86-64   X X X X X   X
+   usage docX   X
design doc
perf doc
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-- 
2.5.3



[dpdk-dev] [PATCH v4] aesni_gcm: PMD to support AES_GCM crypto operations

2016-03-10 Thread John Griffin
On 10/03/16 16:41, Pablo de Lara wrote:
> From: Declan Doherty 
>
> This patch provides the implementation of an AES-NI accelerated crypto PMD
> which is dependent on Intel's multi-buffer library, see the white paper
> "Fast Multi-buffer IPsec Implementations on Intel?  Architecture  Processors"
>
> This PMD supports AES_GCM authenticated encryption and authenticated 
> decryption using
> 128-bit AES keys
>
> The patch also contains the related unit tests functions for the implemented 
> functionality
>
> Signed-off-by: Declan Doherty 
> Signed-off-by: Pablo de Lara 
> --

Acked-by: John Griffin 




[dpdk-dev] [PATCH 0/3] sched: patches for 2.2

2016-03-10 Thread Dumitrescu, Cristian


From: Stephen Hemminger [mailto:step...@networkplumber.org]
Sent: Thursday, March 10, 2016 6:44 PM
To: Dumitrescu, Cristian 
Cc: Thomas Monjalon ; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2

Why does this need to be reassigned to Intel. That is not how the DPDK works.
Please leave the original copyright holders on the file.

I think you misunderstood my statement. My question is: why is Intel mentioned 
at all in the copyright header of rte_reciprocal.c in your initial patch 
submission (http://www.dpdk.org/ml/archives/dev/2015-November/029025.html)?

On Thu, Mar 10, 2016 at 10:41 AM, Dumitrescu, Cristian mailto:cristian.dumitrescu at intel.com>> wrote:


> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org at networkplumber.org>]
> Sent: Tuesday, March 8, 2016 8:41 PM
> To: Dumitrescu, Cristian  intel.com>
> Cc: Thomas Monjalon mailto:thomas.monjalon at 
> 6wind.com>>; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2
>
> On Tue, 8 Mar 2016 19:53:01 +
> "Dumitrescu, Cristian"  intel.com> wrote:
>
> >
> >
> > > -Original Message-
> > > From: Stephen Hemminger [mailto:stephen at 
> > > networkplumber.org]
> > > Sent: Tuesday, March 8, 2016 4:33 PM
> > > To: Dumitrescu, Cristian  > > intel.com>
> > > Cc: Thomas Monjalon mailto:thomas.monjalon 
> > > at 6wind.com>>; dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2
> > >
> > > On Tue, 8 Mar 2016 07:49:20 +
> > > "Dumitrescu, Cristian"  > > intel.com> wrote:
> > >
> > > > Regarding Stephen's patches, I think there is a pending issue regarding
> the
> > > legal side of the Copyright, which is attributed to Intel, although
> Stephen's
> > > code is relicensed with BSD license by permission from the original code
> > > author (which also submitted the code to Linux kernel under GPL). This
> was
> > > already flagged. This is a legal issue and I do not feel comfortable with
> ack-ing
> > > this patch until the legal resolution on this is crystal clear.
> > >
> > >
> > > I got explicit permission from the author who holds the copyright to
> relicense
> > > it.
> >
> > Did you get explicit permission from the author who holds the copyright to
> relicense it with BSD license that hands over the copyright to Intel?
>
> I got explicit permission to relicense as BSD.
>
>
> I believe DPDK does not require copyright assignment, and this is a
> standalone file.
>
Yes, I understand that you got permission from the author to relicense as BSD. 
What I am not sure of is whether it is OK to assign the copyright to Intel, 
maybe other people can comment on this as well.

As explained above, rte_reciprocal.[hc] is a standalone algorithm that is 
independent of librte_sched code. It can useful to any piece of code requiring 
division on data plane side, including any DPDK library or app, even those not 
using librte_sched library, therefor it really does not belong to librte_sched. 
My proposal is:
1. Please submit patch series 1 with rte_reciprocal.[hc] as new files to be 
added to librte_eal/common.
2. Please submit patch series 2 containing just changes to librte_sched, which 
are small.

Are you OK with this approach?

Thanks,
Cristian


>
> On Sat, Dec 20, 2014, at 01:24, Stephen Hemminger wrote:
> > The kernel implementation of reciprocal divide is GPL licensed.
> > Is there any chance of getting a BSD license version to allow using
> > it in the DPDK?
>
> I absolutely don't have a problem to give my ack to make this
> dual-license. Where do I need to sign? ;)
>
> Bye,
> Hannes
>
> >> On Sat, Dec 20, 2014, at 01:24, Stephen Hemminger wrote:
> >>> The kernel implementation of reciprocal divide is GPL licensed.
> >>> Is there any chance of getting a BSD license version to allow using
> >>> it in the DPDK?
> >>
> >> I absolutely don't have a problem to give my ack to make this
> >> dual-license. Where do I need to sign? ;)
>
> I have absolutely no problem with that. Feel free to add my
> Signed-off-by to your DPDK submission.
>
> Merry X-Mas & thanks for asking!
>
> Daniel



[dpdk-dev] DPDK library grab all the memory during start up

2016-03-10 Thread John Wei
I am setting up open-vswitch with DPDK in container, and running many this
OVS/DPDK containers on the same host.
OVS in each container will be using differ PCI deviced bound to DPDK.
I am using --file-prefix to allow sharing of same /dev/hugepages tlbfs, and
using --socket-mem to limit the memory used by each OVS.
But, DPDK library first grab all the available memory, pick the best
memory, before releasing memory not needed. It seems tat this process is
serialized.
Each DPDK app will need to wait the previous app to complete that process,
before next app can start grabing, picking, and releasing memory.
This is taking a long time when you try to start many DPDK app in parallel.
I tried to use different tlbfs for each app, and limit each tlbfs with
nr_inodes, but that does not work.

Any suggestion on addressing this issue? Is there way to tell DPDK library
not to grab so much memory?

John


[dpdk-dev] [PATCH 0/3] sched: patches for 2.2

2016-03-10 Thread Dumitrescu, Cristian


> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, March 8, 2016 8:41 PM
> To: Dumitrescu, Cristian 
> Cc: Thomas Monjalon ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2
> 
> On Tue, 8 Mar 2016 19:53:01 +
> "Dumitrescu, Cristian"  wrote:
> 
> >
> >
> > > -Original Message-
> > > From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> > > Sent: Tuesday, March 8, 2016 4:33 PM
> > > To: Dumitrescu, Cristian 
> > > Cc: Thomas Monjalon ; dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 0/3] sched: patches for 2.2
> > >
> > > On Tue, 8 Mar 2016 07:49:20 +
> > > "Dumitrescu, Cristian"  wrote:
> > >
> > > > Regarding Stephen's patches, I think there is a pending issue regarding
> the
> > > legal side of the Copyright, which is attributed to Intel, although
> Stephen's
> > > code is relicensed with BSD license by permission from the original code
> > > author (which also submitted the code to Linux kernel under GPL). This
> was
> > > already flagged. This is a legal issue and I do not feel comfortable with
> ack-ing
> > > this patch until the legal resolution on this is crystal clear.
> > >
> > >
> > > I got explicit permission from the author who holds the copyright to
> relicense
> > > it.
> >
> > Did you get explicit permission from the author who holds the copyright to
> relicense it with BSD license that hands over the copyright to Intel?
> 
> I got explicit permission to relicense as BSD.
> 
> 
> I believe DPDK does not require copyright assignment, and this is a
> standalone file.
> 

Yes, I understand that you got permission from the author to relicense as BSD. 
What I am not sure of is whether it is OK to assign the copyright to Intel, 
maybe other people can comment on this as well.

As explained above, rte_reciprocal.[hc] is a standalone algorithm that is 
independent of librte_sched code. It can useful to any piece of code requiring 
division on data plane side, including any DPDK library or app, even those not 
using librte_sched library, therefor it really does not belong to librte_sched. 
My proposal is:
1. Please submit patch series 1 with rte_reciprocal.[hc] as new files to be 
added to librte_eal/common.
2. Please submit patch series 2 containing just changes to librte_sched, which 
are small.

Are you OK with this approach?

Thanks,
Cristian


> 
> On Sat, Dec 20, 2014, at 01:24, Stephen Hemminger wrote:
> > The kernel implementation of reciprocal divide is GPL licensed.
> > Is there any chance of getting a BSD license version to allow using
> > it in the DPDK?
> 
> I absolutely don't have a problem to give my ack to make this
> dual-license. Where do I need to sign? ;)
> 
> Bye,
> Hannes
> 
> >> On Sat, Dec 20, 2014, at 01:24, Stephen Hemminger wrote:
> >>> The kernel implementation of reciprocal divide is GPL licensed.
> >>> Is there any chance of getting a BSD license version to allow using
> >>> it in the DPDK?
> >>
> >> I absolutely don't have a problem to give my ack to make this
> >> dual-license. Where do I need to sign? ;)
> 
> I have absolutely no problem with that. Feel free to add my
> Signed-off-by to your DPDK submission.
> 
> Merry X-Mas & thanks for asking!
> 
> Daniel


[dpdk-dev] [PATCH v4 2/2] examples: rework to use buffered tx

2016-03-10 Thread Tomasz Kulasek
The internal buffering of packets for TX in sample apps is no longer
needed, so this patchset also replaces this code with calls to the new
rte_eth_tx_buffer* APIs in:

* l2fwd-jobstats
* l2fwd-keepalive
* l2fwd
* l3fwd-acl
* l3fwd-power
* link_status_interrupt
* client_server_mp
* l2fwd_fork
* packet_ordering
* qos_meter

v3 changes
 - updated due to the change of callback name

v2 changes
 - rework synced with tx buffer API changes

Signed-off-by: Tomasz Kulasek 
Acked-by: Konstantin Ananyev 
---
 examples/l2fwd-jobstats/main.c |  104 +++--
 examples/l2fwd-keepalive/main.c|  100 ++--
 examples/l2fwd/main.c  |  104 +++--
 examples/l3fwd-acl/main.c  |   92 ++-
 examples/l3fwd-power/main.c|   89 ++
 examples/link_status_interrupt/main.c  |  107 +++--
 .../client_server_mp/mp_client/client.c|  101 +---
 examples/multi_process/l2fwd_fork/main.c   |   97 +++-
 examples/packet_ordering/main.c|  122 ++--
 examples/qos_meter/main.c  |   61 +++---
 10 files changed, 436 insertions(+), 541 deletions(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 6da60e0..d1e9bf7 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -97,18 +98,12 @@ static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS];

 static unsigned int l2fwd_rx_queue_per_lcore = 1;

-struct mbuf_table {
-   uint64_t next_flush_time;
-   unsigned len;
-   struct rte_mbuf *mbufs[MAX_PKT_BURST];
-};
-
 #define MAX_RX_QUEUE_PER_LCORE 16
 #define MAX_TX_QUEUE_PER_PORT 16
 struct lcore_queue_conf {
unsigned n_rx_port;
unsigned rx_port_list[MAX_RX_QUEUE_PER_LCORE];
-   struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
+   uint64_t next_flush_time[RTE_MAX_ETHPORTS];

struct rte_timer rx_timers[MAX_RX_QUEUE_PER_LCORE];
struct rte_jobstats port_fwd_jobs[MAX_RX_QUEUE_PER_LCORE];
@@ -123,6 +118,8 @@ struct lcore_queue_conf {
 } __rte_cache_aligned;
 struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];

+struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS];
+
 static const struct rte_eth_conf port_conf = {
.rxmode = {
.split_hdr_size = 0,
@@ -373,59 +370,14 @@ show_stats_cb(__rte_unused void *param)
rte_eal_alarm_set(timer_period * US_PER_S, show_stats_cb, NULL);
 }

-/* Send the burst of packets on an output interface */
-static void
-l2fwd_send_burst(struct lcore_queue_conf *qconf, uint8_t port)
-{
-   struct mbuf_table *m_table;
-   uint16_t ret;
-   uint16_t queueid = 0;
-   uint16_t n;
-
-   m_table = >tx_mbufs[port];
-   n = m_table->len;
-
-   m_table->next_flush_time = rte_get_timer_cycles() + drain_tsc;
-   m_table->len = 0;
-
-   ret = rte_eth_tx_burst(port, queueid, m_table->mbufs, n);
-
-   port_statistics[port].tx += ret;
-   if (unlikely(ret < n)) {
-   port_statistics[port].dropped += (n - ret);
-   do {
-   rte_pktmbuf_free(m_table->mbufs[ret]);
-   } while (++ret < n);
-   }
-}
-
-/* Enqueue packets for TX and prepare them to be sent */
-static int
-l2fwd_send_packet(struct rte_mbuf *m, uint8_t port)
-{
-   const unsigned lcore_id = rte_lcore_id();
-   struct lcore_queue_conf *qconf = _queue_conf[lcore_id];
-   struct mbuf_table *m_table = >tx_mbufs[port];
-   uint16_t len = qconf->tx_mbufs[port].len;
-
-   m_table->mbufs[len] = m;
-
-   len++;
-   m_table->len = len;
-
-   /* Enough pkts to be sent. */
-   if (unlikely(len == MAX_PKT_BURST))
-   l2fwd_send_burst(qconf, port);
-
-   return 0;
-}
-
 static void
 l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid)
 {
struct ether_hdr *eth;
void *tmp;
+   int sent;
unsigned dst_port;
+   struct rte_eth_dev_tx_buffer *buffer;

dst_port = l2fwd_dst_ports[portid];
eth = rte_pktmbuf_mtod(m, struct ether_hdr *);
@@ -437,7 +389,10 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid)
/* src addr */
ether_addr_copy(_ports_eth_addr[dst_port], >s_addr);

-   l2fwd_send_packet(m, (uint8_t) dst_port);
+   buffer = tx_buffer[dst_port];
+   sent = rte_eth_tx_buffer(dst_port, 0, buffer, m);
+   if (sent)
+   port_statistics[dst_port].tx += 

[dpdk-dev] [PATCH v4 1/2] ethdev: add buffered tx api

2016-03-10 Thread Tomasz Kulasek
Many sample apps include internal buffering for single-packet-at-a-time
operation. Since this is such a common paradigm, this functionality is
better suited to being implemented in the ethdev API.

The new APIs in the ethdev library are:
* rte_eth_tx_buffer_init - initialize buffer
* rte_eth_tx_buffer - buffer up a single packet for future transmission
* rte_eth_tx_buffer_flush - flush any unsent buffered packets
* rte_eth_tx_buffer_set_err_callback - set up a callback to be called in
  case transmitting a buffered burst fails. By default, we just free the
  unsent packets.

As well as these, an additional reference callbacks are provided, which
frees the packets:

* rte_eth_tx_buffer_drop_callback - silently drop packets (default
  behavior)
* rte_eth_tx_buffer_count_callback - drop and update user-provided counter
  to track the number of dropped packets

v4 changes:
 - added comments
 - chaged names of error callback and user data
 - changed order of function names in map file

v3 changes:
 - error counter removed from tx buffer structure, now default behavior is
   silent drop of unsent packets
 - some names was changed in tx buffer structure to be more descriptive
 - two default calbacks are provided: rte_eth_tx_buffer_drop_callback and
   rte_eth_tx_buffer_count_callback

Signed-off-by: Tomasz Kulasek 
Acked-by: Konstantin Ananyev 
---
 lib/librte_ether/rte_ethdev.c  |   46 +++
 lib/librte_ether/rte_ethdev.h  |  206 +++-
 lib/librte_ether/rte_ether_version.map |   10 ++
 3 files changed, 261 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 5c2b416..98587e1 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1271,6 +1271,52 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t 
tx_queue_id,
 }

 void
+rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
+   void *userdata __rte_unused)
+{
+   unsigned i;
+
+   for (i = 0; i < unsent; i++)
+   rte_pktmbuf_free(pkts[i]);
+}
+
+void
+rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
+   void *userdata)
+{
+   uint64_t *count = userdata;
+   unsigned i;
+
+   for (i = 0; i < unsent; i++)
+   rte_pktmbuf_free(pkts[i]);
+
+   *count += unsent;
+}
+
+int
+rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer,
+   buffer_tx_error_fn cbfn, void *userdata)
+{
+   buffer->error_callback = cbfn;
+   buffer->error_userdata = userdata;
+   return 0;
+}
+
+int
+rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)
+{
+   if (buffer == NULL)
+   return -EINVAL;
+
+   buffer->size = size;
+   if (buffer->error_callback == NULL)
+   rte_eth_tx_buffer_set_err_callback(buffer,
+   rte_eth_tx_buffer_drop_callback, NULL);
+
+   return 0;
+}
+
+void
 rte_eth_promiscuous_enable(uint8_t port_id)
 {
struct rte_eth_dev *dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d53e362..2062d6c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -2655,6 +2655,210 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, 
nb_pkts);
 }

+typedef void (*buffer_tx_error_fn)(struct rte_mbuf **unsent, uint16_t count,
+   void *userdata);
+
+/**
+ * Structure used to buffer packets for future TX
+ * Used by APIs rte_eth_tx_buffer and rte_eth_tx_buffer_flush
+ */
+struct rte_eth_dev_tx_buffer {
+   buffer_tx_error_fn error_callback;
+   void *error_userdata;
+   uint16_t size;   /**< Size of buffer for buffered tx */
+   uint16_t length; /**< Number of packets in the array */
+   struct rte_mbuf *pkts[];
+   /**< Pending packets to be sent on explicit flush or when full */
+};
+
+/**
+ * Calculate the size of the tx buffer.
+ *
+ * @param sz
+ *   Number of stored packets.
+ */
+#define RTE_ETH_TX_BUFFER_SIZE(sz) \
+   (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf 
*))
+
+/**
+ * Initialize default values for buffered transmitting
+ *
+ * @param buffer
+ *   Tx buffer to be initialized.
+ * @param size
+ *   Buffer size
+ * @return
+ *   0 if no error
+ */
+int
+rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
+
+/**
+ * Send any packets queued up for transmission on a port and HW queue
+ *
+ * This causes an explicit flush of packets previously buffered via the
+ * 

[dpdk-dev] [PATCH v4 0/2] add support for buffered tx to ethdev

2016-03-10 Thread Tomasz Kulasek
Many sample apps include internal buffering for single-packet-at-a-time
operation. Since this is such a common paradigm, this functionality is
better suited to being implemented in the ethdev API.

The new APIs in the ethdev library are:
* rte_eth_tx_buffer_init - initialize buffer
* rte_eth_tx_buffer - buffer up a single packet for future transmission
* rte_eth_tx_buffer_flush - flush any unsent buffered packets
* rte_eth_tx_buffer_set_err_callback - set up a callback to be called in
  case transmitting a buffered burst fails. By default, we just free the
  unsent packets.

As well as these, an additional reference callbacks are provided, which
frees the packets:

* rte_eth_tx_buffer_drop_callback - silently drop packets (default
  behavior)
* rte_eth_tx_buffer_count_callback - drop and update user-provided counter
  to track the number of dropped packets

Due to the feedback from mailing list, that buffer management facilities
in the user application are more preferable than API simplicity, we decided
to move internal buffer table, as well as callback functions and user data,
from rte_eth_dev/rte_eth_dev_data to the application space.
It prevents ABI breakage and gives some more flexibility in the buffer's
management such as allocation, dynamical size change, reuse buffers on many
ports or after fail, and so on.


The following steps illustrate how tx buffers can be used in application:

1) Initialization

a) Allocate memory for a buffer

   struct rte_eth_dev_tx_buffer *buffer = rte_zmalloc_socket("tx_buffer",
   RTE_ETH_TX_BUFFER_SIZE(MAX_PKT_BURST), 0, socket_id);

   RTE_ETH_TX_BUFFER_SIZE(size) macro computes memory required to store
   "size" packets in buffer.

b) Initialize allocated memory and set up default values. Threshold level
   must be lower than or equal to the MAX_PKT_BURST from 1a)

   rte_eth_tx_buffer_init(buffer, threshold);


c) Set error callback (optional)

   rte_eth_tx_buffer_set_err_callback(buffer, callback_fn, userdata);


2) Store packet "pkt" in buffer and send them all to the queue_id on
   port_id when number of packets reaches threshold level set up in 1b)

   rte_eth_tx_buffer(port_id, queue_id, buffer, pkt);


3) Send all stored packets to the queue_id on port_id

   rte_eth_tx_buffer_flush(port_id, queue_id, buffer);


4) Flush buffer and free memory

   rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
   ...
   rte_free(buffer);

v4 changes:
 - added comments
 - chaged names of error callback and user data
 - changed order of function names in map file

v3 changes:
 - error counter removed from tx buffer structure, now default behavior is
   silent drop of unsent packets
 - some names was changed in tx buffer structure to be more descriptive
 - two default calbacks are provided: rte_eth_tx_buffer_drop_callback and
   rte_eth_tx_buffer_count_callback

v2 changes:
 - reworked to use new buffer model
 - buffer data and callbacks are removed from rte_eth_dev/rte_eth_dev_data,
   so this patch doesn't brake an ABI anymore
 - introduced RTE_ETH_TX_BUFFER macro and rte_eth_tx_buffer_init
 - buffers are not attached to the port-queue
 - buffers can be allocated dynamically during application work
 - size of buffer can be changed without port restart

Tomasz Kulasek (2):
  ethdev: add buffered tx api
  examples: rework to use buffered tx

 examples/l2fwd-jobstats/main.c |  104 --
 examples/l2fwd-keepalive/main.c|  100 --
 examples/l2fwd/main.c  |  104 --
 examples/l3fwd-acl/main.c  |   92 -
 examples/l3fwd-power/main.c|   89 -
 examples/link_status_interrupt/main.c  |  107 --
 .../client_server_mp/mp_client/client.c|  101 ++
 examples/multi_process/l2fwd_fork/main.c   |   97 -
 examples/packet_ordering/main.c|  122 
 examples/qos_meter/main.c  |   61 ++
 lib/librte_ether/rte_ethdev.c  |   46 +
 lib/librte_ether/rte_ethdev.h  |  206 +++-
 lib/librte_ether/rte_ether_version.map |   10 +
 13 files changed, 697 insertions(+), 542 deletions(-)

-- 
1.7.9.5



[dpdk-dev] [PATCH 3/3] bnx2x: Update PMD version to 1.1.0

2016-03-10 Thread Rasesh Mody
Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 0f49fef..8e6de6c 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -31,7 +31,7 @@

 #define BNX2X_PMD_VER_PREFIX "BNX2X PMD"
 #define BNX2X_PMD_VERSION_MAJOR 1
-#define BNX2X_PMD_VERSION_MINOR 0
+#define BNX2X_PMD_VERSION_MINOR 1
 #define BNX2X_PMD_VERSION_PATCH 0

 static inline const char *
-- 
1.7.10.3



[dpdk-dev] [PATCH 2/3] bnx2x: Tx performance improvement fixes

2016-03-10 Thread Rasesh Mody
Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c|  207 +-
 drivers/net/bnx2x/bnx2x.h|4 +-
 drivers/net/bnx2x/bnx2x_ethdev.c |   53 ++
 drivers/net/bnx2x/bnx2x_rxtx.c   |   47 +
 4 files changed, 173 insertions(+), 138 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 9d640da..0f49fef 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1293,7 +1293,7 @@ bnx2x_free_tx_pkt(__rte_unused struct bnx2x_fastpath *fp, 
struct bnx2x_tx_queue
struct rte_mbuf *tx_mbuf = txq->sw_ring[TX_BD(pkt_idx, txq)];

if (likely(tx_mbuf != NULL)) {
-   rte_pktmbuf_free(tx_mbuf);
+   rte_pktmbuf_free_seg(tx_mbuf);
} else {
PMD_RX_LOG(ERR, "fp[%02d] lost mbuf %lu",
   fp->index, (unsigned long)TX_BD(pkt_idx, txq));
@@ -2113,147 +2113,128 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t 
unload_mode, uint8_t keep_link
  * the mbuf and return to the caller.
  *
  * Returns:
- *   0 = Success, !0 = Failure
+ *   Number of TX BDs used for the mbuf
  *   Note the side effect that an mbuf may be freed if it causes a problem.
  */
-int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf **m_head, int 
m_pkts)
+uint32_t
+bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0)
 {
-   struct rte_mbuf *m0;
struct eth_tx_start_bd *tx_start_bd;
uint16_t bd_prod, pkt_prod;
-   int m_tx;
struct bnx2x_softc *sc;
uint32_t nbds = 0;
-   struct bnx2x_fastpath *fp;

sc = txq->sc;
-   fp = >fp[txq->queue_id];

bd_prod = txq->tx_bd_tail;
pkt_prod = txq->tx_pkt_tail;

-   for (m_tx = 0; m_tx < m_pkts; m_tx++) {
+   txq->sw_ring[TX_BD(pkt_prod, txq)] = m0;

-   m0 = *m_head++;
+   tx_start_bd = >tx_ring[TX_BD(bd_prod, txq)].start_bd;

-   if (unlikely(txq->nb_tx_avail < 3)) {
-   PMD_TX_LOG(ERR, "no enough bds %d/%d",
-  bd_prod, txq->nb_tx_avail);
-   return -ENOMEM;
-   }
+   tx_start_bd->addr =
+   rte_cpu_to_le_64(rte_mbuf_data_dma_addr(m0));
+   tx_start_bd->nbytes = rte_cpu_to_le_16(m0->data_len);
+   tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
+   tx_start_bd->general_data =
+   (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);

-   txq->sw_ring[TX_BD(pkt_prod, txq)] = m0;
+   tx_start_bd->nbd = rte_cpu_to_le_16(2);

-   tx_start_bd = >tx_ring[TX_BD(bd_prod, txq)].start_bd;
-
-   tx_start_bd->addr =
-   rte_cpu_to_le_64(rte_mbuf_data_dma_addr(m0));
-   tx_start_bd->nbytes = rte_cpu_to_le_16(m0->data_len);
-   tx_start_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
-   tx_start_bd->general_data =
-   (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);
-
-   tx_start_bd->nbd = rte_cpu_to_le_16(2);
+   if (m0->ol_flags & PKT_TX_VLAN_PKT) {
+   tx_start_bd->vlan_or_ethertype =
+   rte_cpu_to_le_16(m0->vlan_tci);
+   tx_start_bd->bd_flags.as_bitfield |=
+   (X_ETH_OUTBAND_VLAN <<
+ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
+   } else {
+   if (IS_PF(sc))
+   tx_start_bd->vlan_or_ethertype =
+   rte_cpu_to_le_16(pkt_prod);
+   else {
+   struct ether_hdr *eh =
+   rte_pktmbuf_mtod(m0, struct ether_hdr *);

-   if (m0->ol_flags & PKT_TX_VLAN_PKT) {
tx_start_bd->vlan_or_ethertype =
-   rte_cpu_to_le_16(m0->vlan_tci);
-   tx_start_bd->bd_flags.as_bitfield |=
-   (X_ETH_OUTBAND_VLAN <<
-ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
-   } else {
-   if (IS_PF(sc))
-   tx_start_bd->vlan_or_ethertype =
-   rte_cpu_to_le_16(pkt_prod);
-   else {
-   struct ether_hdr *eh
-   = rte_pktmbuf_mtod(m0, struct ether_hdr *);
-
-   tx_start_bd->vlan_or_ethertype
-   = 
rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
-   }
+rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
}
+   }

-   bd_prod = NEXT_TX_BD(bd_prod);
-   if (IS_VF(sc)) {
-   struct eth_tx_parse_bd_e2 *tx_parse_bd;
-   const struct ether_hdr *eh = rte_pktmbuf_mtod(m0, 
struct ether_hdr *);
-   uint8_t mac_type 

[dpdk-dev] [PATCH 1/3] bnx2x: Update documentation

2016-03-10 Thread Rasesh Mody
Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
---
 doc/guides/nics/bnx2x.rst|1 +
 doc/guides/nics/overview.rst |   20 ++--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst
index ed0e5e5..df8fb47 100644
--- a/doc/guides/nics/bnx2x.rst
+++ b/doc/guides/nics/bnx2x.rst
@@ -60,6 +60,7 @@ The features not yet supported include:
 - LRO/TSO offload
 - Checksum offload
 - SR-IOV PF
+- Rx TX scatter gather

 Co-existence considerations
 ---
diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index 2d4f014..d6a14a0 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -86,8 +86,8 @@ Most of these differences are summarized below.
 e   e   e   e   e  
 e
 c   c   c   c   c  
 c
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   link status  X X X   X
-   link status event  X X
+   link statusX X   X X X   X
+   link status event  X X X X
Rx interrupt   X X X X
queue start/stop X X X X X   X
MTU update   X
@@ -95,15 +95,15 @@ Most of these differences are summarized below.
scattered Rx X X X X X   X
LRO
TSO  X X X X X
-   promiscuous mode X X X X X   X
+   promiscuous mode   X X   X X X X X   X
allmulticast modeX X X X X   X
-   unicast MAC filter X X X X
-   multicast MAC filter   X X X X
+   unicast MAC filter X X X X X X
+   multicast MAC filter   X X X X X X
RSS hash X X X X X
RSS key update X X X X
RSS reta updateX X X X
VMDq   X X
-   SR-IOV X X
+   SR-IOV   X X X
DCBX X
VLAN filterX X X X
ethertype filter   X X
@@ -125,14 +125,14 @@ Most of these differences are summarized below.
inner L4 checksum  X   X
packet type parsing  X X   X
timesync   X X
-   basic stats  X X X X X   X
+   basic statsX X   X X X X X   X
extended stats X X X X
stats per queue  X   X
EEPROM dump
registers dump
multiprocess aware X X X X
BSD nic_uio  X X X X X
-   Linux UIOX X X X X
+   Linux UIO  X X   X X X X X
Linux VFIO   X X X X X
other kdrv   X
ARMv7
@@ -140,8 +140,8 @@ Most of these differences are summarized below.
Power8
TILE-Gx
x86-32   X X X X X
-   x86-64   X X X X X   X
-   usage docX   X
+   x86-64 X X   X X X X X   X
+   usage doc  X X   X   X
design doc
perf doc
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-- 
1.7.10.3



[dpdk-dev] [PATCH] snow3g: Bit-wise handling for Wireless Algorithm

2016-03-10 Thread Deepak Kumar JAIN
Wireless algorithms like Snow3G needs input in bits.
In this patch, changes have been made to incorporate this requirement
in both QAT and SW PMD.

Signed-off-by: Deepak Kumar JAIN 
---
This patch depends on "pmd/snow3g: add new SNOW 3G SW PMD" patch
(http://dpdk.org/ml/archives/dev/2016-March/035466.html)

 app/test/test_cryptodev.c  | 118 -
 app/test/test_cryptodev_snow3g_hash_test_vectors.h |  34 +-
 app/test/test_cryptodev_snow3g_test_vectors.h  |  92 +---
 doc/guides/cryptodevs/qat.rst  |   2 +
 doc/guides/cryptodevs/snow3g.rst   |   2 +
 drivers/crypto/qat/qat_crypto.c|  26 -
 drivers/crypto/snow3g/rte_snow3g_pmd.c |  33 --
 lib/librte_cryptodev/rte_crypto_sym.h  |  16 +++
 8 files changed, 247 insertions(+), 76 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 595b9f9..c432c05 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1828,7 +1828,8 @@ create_snow3g_cipher_session(uint8_t dev_id,

 static int
 create_snow3g_cipher_operation(const uint8_t *iv, const unsigned iv_len,
-   const unsigned data_len)
+   const unsigned cipher_len,
+   const unsigned cipher_offset)
 {
struct crypto_testsuite_params *ts_params = _params;
struct crypto_unittest_params *ut_params = _params;
@@ -1860,8 +1861,8 @@ create_snow3g_cipher_operation(const uint8_t *iv, const 
unsigned iv_len,
sym_op->cipher.iv.length = iv_pad_len;

rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
-   sym_op->cipher.data.length = data_len;
-   sym_op->cipher.data.offset = iv_pad_len;
+   sym_op->cipher.data.length = cipher_len;
+   sym_op->cipher.data.offset = cipher_offset;
return 0;
 }

@@ -1958,8 +1959,9 @@ static int
 create_snow3g_hash_operation(const uint8_t *auth_tag,
const unsigned auth_tag_len,
const uint8_t *aad, const unsigned aad_len,
-   const unsigned data_len, unsigned data_pad_len,
-   enum rte_crypto_auth_operation op)
+   unsigned data_pad_len,
+   enum rte_crypto_auth_operation op,
+   const unsigned auth_len, const unsigned auth_offset)
 {
struct crypto_testsuite_params *ts_params = _params;

@@ -2027,8 +2029,8 @@ create_snow3g_hash_operation(const uint8_t *auth_tag,
sym_op->auth.digest.length);
 #endif

-   sym_op->auth.data.length = data_len;
-   sym_op->auth.data.offset = aad_buffer_len;
+   sym_op->auth.data.length = auth_len;
+   sym_op->auth.data.offset = auth_offset;

return 0;
 }
@@ -2037,9 +2039,11 @@ static int
 create_snow3g_cipher_hash_operation(const uint8_t *auth_tag,
const unsigned auth_tag_len,
const uint8_t *aad, const unsigned aad_len,
-   const unsigned data_len, unsigned data_pad_len,
+   unsigned data_pad_len,
enum rte_crypto_auth_operation op,
-   const uint8_t *iv, const unsigned iv_len)
+   const uint8_t *iv, const unsigned iv_len,
+   const unsigned cipher_len, const unsigned cipher_offset,
+   const unsigned auth_len, const unsigned auth_offset)
 {
struct crypto_testsuite_params *ts_params = _params;
struct crypto_unittest_params *ut_params = _params;
@@ -2074,8 +2078,8 @@ create_snow3g_cipher_hash_operation(const uint8_t 
*auth_tag,

rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);

-   sym_op->cipher.data.length = data_len;
-   sym_op->cipher.data.offset = iv_pad_len;
+   sym_op->cipher.data.length = cipher_len;
+   sym_op->cipher.data.offset = cipher_offset;

/* aad */
/*
@@ -2124,8 +2128,8 @@ create_snow3g_cipher_hash_operation(const uint8_t 
*auth_tag,
sym_op->auth.digest.length);
#endif

-   sym_op->auth.data.length = data_len;
-   sym_op->auth.data.offset = aad_buffer_len;
+   sym_op->auth.data.length = auth_len;
+   sym_op->auth.data.offset = auth_offset;

return 0;
 }
@@ -2134,7 +2138,9 @@ static int
 create_snow3g_auth_cipher_operation(const unsigned auth_tag_len,
const uint8_t *iv, const unsigned iv_len,
const uint8_t *aad, const unsigned aad_len,
-   const unsigned data_len, unsigned data_pad_len)
+   unsigned data_pad_len,
+   const unsigned cipher_len, const unsigned cipher_offset,
+   const unsigned auth_len, const unsigned auth_offset)
 {
struct crypto_testsuite_params *ts_params = _params;
struct crypto_unittest_params *ut_params = _params;
@@ -2213,11 +2219,11 @@ create_snow3g_auth_cipher_operation(const unsigned 
auth_tag_len,
sym_op->auth.aad.data, aad_len);
 #endif

-   

[dpdk-dev] [PATCH 0/3] AES GCM, AES CMAC fixes and addition of GCM tests for QAT.

2016-03-10 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John Griffin
> Sent: Tuesday, March 08, 2016 4:22 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 0/3] AES GCM, AES CMAC fixes and addition of
> GCM tests for QAT.
> 
> This patchset solves an issue in QAT driver, that was giving
> invalid AES GCM results, due to incorrect IV setting.
> 
> It adds unit tests to validate AES GCM in QAT.
> 
> It also fixes the premature addition of AES CMAC support which was added
> to
> the code in error.  AES CMAC will be added in a subsequent release
> when testing completes.
> AES CMAC was not advertised in the qat documentation.
> 
> This patchset depends on patches:
> - aesni_gcm: PMD to support AES_GCM crypto operations
>   (http://dpdk.org/dev/patchwork/patch/11201/)
> 
> John Griffin (3):
>   qat: fix AES GCM decryption
>   app/test: add AES GCM tests for QAT
>   qat: fixes premature addition of AES_CMAC in session
> 
>  app/test/test_cryptodev.c  | 34
> +-
>  doc/guides/cryptodevs/qat.rst  |  1 +
>  doc/guides/rel_notes/release_16_04.rst |  5 +
>  drivers/crypto/qat/qat_crypto.c| 24 
>  4 files changed, 59 insertions(+), 5 deletions(-)
> 
> --
> 2.1.0

Series-acked-by: Pablo de Lara 

Just a small comment: there is a type in the title of last patch,
It should be "premature addition of AES_GMAC in session"



[dpdk-dev] [PATCH v3 1/2] ethdev: add buffered tx api

2016-03-10 Thread Thomas Monjalon
2016-03-10 11:57, Tomasz Kulasek:
> +struct rte_eth_dev_tx_buffer {
> + buffer_tx_error_fn callback;
> + void *userdata;

What about renaming this fields as
- error_callback
- error_userdata ?

> + uint16_t size;   /**< Size of buffer for buffered tx */
> + uint16_t length;

Maybe a comment "Number of packets in the array" to be sure?

> + struct rte_mbuf *pkts[];

A comment? "Pending packets to be sent on explicit flush or when full" ?

[...]
> +DPDK_16.04 {
> + global:
> +
> + rte_eth_tx_buffer_drop_callback;
> + rte_eth_tx_buffer_count_callback;
> + rte_eth_tx_buffer_init;
> + rte_eth_tx_buffer_set_err_callback;

Please keep alphabetical order.




[dpdk-dev] [PATCH 0/6] DPDK PMD for new QLogic FastLinQ QL4xxxx 25G/40G CNAs

2016-03-10 Thread Harish Patil
>>
>>
>>
>>On Sat, Feb 20, 2016 at 07:40:25AM -0800, Harish Patil wrote:
>>> This patch set introduces DPDK poll mode driver for new QLogic FastLinQ
>>>QL4
>>> 25G/40G capable family of CNAs as well as their SR-IOV Virtual
>>>Functions (VF).
>>> 
>>> The overall PMD driver design includes a common module called ecore
>>>that deals
>>> with the low level HW and a upper layer portion that provides the glue
>>>logic.
>>> 
>>> Specifically, the ecore module contains all of the common logic,
>>> e.g. initialization, cleanup, infrastructure for interrupt handling,
>>>link
>>> management, slowpath etc. as well as protocol agnostic features and
>>>supplying
>>> an abstraction layer for other modules.
>>> 
>>> The higher layer implements DPDK exported APIs/driver entry points by
>>> interfacing with the common module for configuration/status and also
>>>the
>>> fastpath routines.
>>> 
>>> Included in the patch set is the supporting documentation and
>>>maintainers.
>>> 
>>> Please apply.
>>> 
>>> Thanks,
>>> 
>>> Harish Patil (6):
>>>   qede: add maintainers
>>>   qede: add documentation
>>>   qede: add QLogic PCI ids
>>>   qede: add driver common module
>>>   qede: add driver
>>>   qede: enable PMD build
>>Hi Harish,
>>
>>there are quite a few comments to be addressed on this patchset. Are
>>there plans
>>for a V2 in time for the code freeze deadline later this week?
>>
>>  /Bruce
>>
>>
>
>Hi Bruce,
>Yes we are working on V2 series with the comments addressed. Will send out
>the patches soon.
>Thanks,
>Harish
>
>

Hi Bruce
FYI - We have submitted v2 patch series after incorporating all review
comments.

Thanks,
Harish



[dpdk-dev] [PATCH v2 02/10] qede: add documentation

2016-03-10 Thread Harish Patil
>
>2016-03-10 05:45, Rasesh Mody:
>>  doc/guides/nics/index.rst |1 +
>>  doc/guides/nics/qede.rst  |  340
>>+
>>  2 files changed, 341 insertions(+)
>
>It would be nice to see a new column in the matrix of overview.rst.
>

Hi Thomas,
Yes, we had updated overview.rst with two new columns, but missed this
file while submitting patches.
Will send a follow-on patch.

Thanks,
Harish



[dpdk-dev] [PATCH v3 1/2] ethdev: add buffered tx api

2016-03-10 Thread Kulasek, TomaszX

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Thursday, March 10, 2016 17:24
> To: Kulasek, TomaszX 
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/2] ethdev: add buffered tx api
> 
> 2016-03-10 11:57, Tomasz Kulasek:
> > +struct rte_eth_dev_tx_buffer {
> > +   buffer_tx_error_fn callback;
> > +   void *userdata;
> 
> What about renaming this fields as
> - error_callback
> - error_userdata ?
> 
> > +   uint16_t size;   /**< Size of buffer for buffered tx */
> > +   uint16_t length;
> 
> Maybe a comment "Number of packets in the array" to be sure?
> 
> > +   struct rte_mbuf *pkts[];
> 
> A comment? "Pending packets to be sent on explicit flush or when full" ?
> 
> [...]
> > +DPDK_16.04 {
> > +   global:
> > +
> > +   rte_eth_tx_buffer_drop_callback;
> > +   rte_eth_tx_buffer_count_callback;
> > +   rte_eth_tx_buffer_init;
> > +   rte_eth_tx_buffer_set_err_callback;
> 
> Please keep alphabetical order.
> 

Ok, I'll send v4


[dpdk-dev] [PATCH] aesni_mb: remove params from config file

2016-03-10 Thread Pablo de Lara
Parse the device parameters from rte_eal_vdev_init,
instead of the config file, so user can change the parameters
at runtime.

Signed-off-by: Pablo de Lara 
---
This patch depends on "cryptodev: add capabilities discovery mechanism"
(http://dpdk.org/dev/patchwork/patch/11430/)

 config/common_base |  2 --
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 30 ++
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/config/common_base b/config/common_base
index 73ca7bb..c7634e5 100644
--- a/config/common_base
+++ b/config/common_base
@@ -334,8 +334,6 @@ CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
 #
 CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
 CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n
-CONFIG_RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS=8
-CONFIG_RTE_AESNI_MB_PMD_MAX_NB_SESSIONS=2048

 #
 # Compile PMD for AESNI GCM  device
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index bd273ec..bc44f67 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -593,7 +593,8 @@ aesni_mb_pmd_dequeue_burst(void *queue_pair, struct 
rte_crypto_op **ops,
 static int cryptodev_aesni_mb_uninit(const char *name);

 static int
-cryptodev_aesni_mb_create(const char *name, unsigned socket_id)
+cryptodev_aesni_mb_create(const char *name,
+   struct rte_crypto_vdev_init_params *init_params)
 {
struct rte_cryptodev *dev;
char crypto_dev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
@@ -627,7 +628,7 @@ cryptodev_aesni_mb_create(const char *name, unsigned 
socket_id)


dev = rte_cryptodev_pmd_virtual_dev_init(crypto_dev_name,
-   sizeof(struct aesni_mb_private), socket_id);
+   sizeof(struct aesni_mb_private), 
init_params->socket_id);
if (dev == NULL) {
MB_LOG_ERR("failed to create cryptodev vdev");
goto init_error;
@@ -662,8 +663,8 @@ cryptodev_aesni_mb_create(const char *name, unsigned 
socket_id)
internals = dev->data->dev_private;

internals->vector_mode = vector_mode;
-   internals->max_nb_queue_pairs = RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS;
-   internals->max_nb_sessions = RTE_AESNI_MB_PMD_MAX_NB_SESSIONS;
+   internals->max_nb_queue_pairs = init_params->max_nb_queue_pairs;
+   internals->max_nb_sessions = init_params->max_nb_sessions;

return 0;
 init_error:
@@ -676,11 +677,24 @@ init_error:

 static int
 cryptodev_aesni_mb_init(const char *name,
-   const char *params __rte_unused)
+   const char *input_args)
 {
-   RTE_LOG(INFO, PMD, "Initialising %s\n", name);
-
-   return cryptodev_aesni_mb_create(name, rte_socket_id());
+   struct rte_crypto_vdev_init_params init_params = {
+   RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
+   RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
+   rte_socket_id()
+   };
+
+   rte_cryptodev_parse_vdev_init_params(_params, input_args);
+
+   RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
+   init_params.socket_id);
+   RTE_LOG(INFO, PMD, "  Max number of queue pairs = %d\n",
+   init_params.max_nb_queue_pairs);
+   RTE_LOG(INFO, PMD, "  Max number of sessions = %d\n",
+   init_params.max_nb_sessions);
+
+   return cryptodev_aesni_mb_create(name, _params);
 }

 static int
-- 
2.5.0



[dpdk-dev] [PATCH v9 0/5] cryptodev API changes

2016-03-10 Thread Thomas Monjalon
> Declan Doherty (2):
>   cryptodev: change burst API to be crypto op oriented
>   mbuf_offload: remove library
> 
> Fiona Trahe (3):
>   cryptodev: code cleanup
>   cryptodev: refactor to partition common from symmetric-specific code
>   cryptodev: remove unused phys_addr field from key

Applied, thanks for the big work


[dpdk-dev] [PATCH v4 3/3] app/test: add Snow3G tests

2016-03-10 Thread Deepak Kumar JAIN
Signed-off-by: Deepak Kumar JAIN 
---
 app/test/test_cryptodev.c  | 1037 +++-
 app/test/test_cryptodev.h  |3 +-
 app/test/test_cryptodev_snow3g_hash_test_vectors.h |  415 
 app/test/test_cryptodev_snow3g_test_vectors.h  |  379 +++
 4 files changed, 1831 insertions(+), 3 deletions(-)
 create mode 100644 app/test/test_cryptodev_snow3g_hash_test_vectors.h
 create mode 100644 app/test/test_cryptodev_snow3g_test_vectors.h

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 3240ecd..0fe47b9 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -42,7 +42,8 @@

 #include "test.h"
 #include "test_cryptodev.h"
-
+#include "test_cryptodev_snow3g_test_vectors.h"
+#include "test_cryptodev_snow3g_hash_test_vectors.h"
 static enum rte_cryptodev_type gbl_cryptodev_type;

 struct crypto_testsuite_params {
@@ -68,6 +69,9 @@ struct crypto_unittest_params {
uint8_t *digest;
 };

+#define ALIGN_POW2_ROUNDUP(num, align) \
+   (((num) + (align) - 1) & ~((align) - 1))
+
 /*
  * Forward declarations.
  */
@@ -1747,6 +1751,997 @@ test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify(void)
return TEST_SUCCESS;
 }

+/* * Snow3G Tests * */
+static int
+create_snow3g_hash_session(uint8_t dev_id,
+   const uint8_t *key, const uint8_t key_len,
+   const uint8_t aad_len, const uint8_t auth_len,
+   enum rte_crypto_auth_operation op)
+{
+   uint8_t hash_key[key_len];
+
+   struct crypto_unittest_params *ut_params = _params;
+
+   memcpy(hash_key, key, key_len);
+#ifdef RTE_APP_TEST_DEBUG
+   rte_hexdump(stdout, "key:", key, key_len);
+#endif
+   /* Setup Authentication Parameters */
+   ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+   ut_params->auth_xform.next = NULL;
+
+   ut_params->auth_xform.auth.op = op;
+   ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+   ut_params->auth_xform.auth.key.length = key_len;
+   ut_params->auth_xform.auth.key.data = hash_key;
+   ut_params->auth_xform.auth.digest_length = auth_len;
+   ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+   ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+   _params->auth_xform);
+   TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+   return 0;
+}
+static int
+create_snow3g_cipher_session(uint8_t dev_id,
+   enum rte_crypto_cipher_operation op,
+   const uint8_t *key, const uint8_t key_len)
+{
+   uint8_t cipher_key[key_len];
+
+   struct crypto_unittest_params *ut_params = _params;
+
+   memcpy(cipher_key, key, key_len);
+
+   /* Setup Cipher Parameters */
+   ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+   ut_params->cipher_xform.next = NULL;
+
+   ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+   ut_params->cipher_xform.cipher.op = op;
+   ut_params->cipher_xform.cipher.key.data = cipher_key;
+   ut_params->cipher_xform.cipher.key.length = key_len;
+
+#ifdef RTE_APP_TEST_DEBUG
+   rte_hexdump(stdout, "key:", key, key_len);
+#endif
+   /* Create Crypto session */
+   ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+   _params->
+   cipher_xform);
+   TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+   return 0;
+}
+
+static int
+create_snow3g_cipher_operation(const uint8_t *iv, const unsigned iv_len,
+   const unsigned data_len)
+{
+   struct crypto_testsuite_params *ts_params = _params;
+   struct crypto_unittest_params *ut_params = _params;
+   unsigned iv_pad_len = 0;
+
+   /* Generate Crypto op data structure */
+   ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+   TEST_ASSERT_NOT_NULL(ut_params->op,
+   "Failed to allocate pktmbuf offload");
+
+   /* Set crypto operation data parameters */
+   rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
+
+   struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
+
+   /* set crypto operation source mbuf */
+   sym_op->m_src = ut_params->ibuf;
+
+   /* iv */
+   iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
+   sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf
+   , iv_pad_len);
+
+   TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+
+   memset(sym_op->cipher.iv.data, 0, iv_pad_len);
+   sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
+   sym_op->cipher.iv.length = iv_pad_len;
+
+   rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
+   sym_op->cipher.data.length = 

[dpdk-dev] [PATCH v4 2/3] qat: add support for Snow3G

2016-03-10 Thread Deepak Kumar JAIN
Signed-off-by: Deepak Kumar JAIN 
---
 doc/guides/cryptodevs/qat.rst|  8 ++-
 doc/guides/rel_notes/release_16_04.rst   |  6 ++
 drivers/crypto/qat/qat_adf/qat_algs.h|  1 +
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 86 ++--
 drivers/crypto/qat/qat_crypto.c  | 12 +++-
 5 files changed, 104 insertions(+), 9 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 23402b4..af52047 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2015 Intel Corporation. All rights reserved.
+Copyright(c) 2015-2016 Intel Corporation. All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
@@ -47,6 +47,7 @@ Cipher algorithms:
 * ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC``
+* ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2``

 Hash algorithms:

@@ -54,14 +55,15 @@ Hash algorithms:
 * ``RTE_CRYPTO_AUTH_SHA256_HMAC``
 * ``RTE_CRYPTO_AUTH_SHA512_HMAC``
 * ``RTE_CRYPTO_AUTH_AES_XCBC_MAC``
+* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``


 Limitations
 ---

 * Chained mbufs are not supported.
-* Hash only is not supported.
-* Cipher only is not supported.
+* Hash only is not supported except Snow3G UIA2.
+* Cipher only is not supported except Snow3G UEA2.
 * Only in-place is currently supported (destination address is the same as 
source address).
 * Only supports the session-oriented API implementation (session-less APIs are 
not supported).
 * Not performance tuned.
diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index aa9eabc..4f41e63 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -35,6 +35,12 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

+* **Added support of Snow3G (UEA2 and UIA2) for Intel Quick Assist Devices.**
+
+  Enabled support for Snow3g Wireless algorithm for Intel Quick Assist devices.
+  Support for cipher only, Hash only is also provided
+  along with alg-chaining operations.
+
 * **Added function to check primary process state.**

   A new function ``rte_eal_primary_proc_alive()`` has been added
diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index b73a5d0..b47dbc2 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -125,5 +125,6 @@ void qat_alg_ablkcipher_init_dec(struct 
qat_alg_ablkcipher_cd *cd,
unsigned int keylen);

 int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);

 #endif
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index 534eda0..bcccdf4 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -82,6 +82,9 @@ static int qat_hash_get_state1_size(enum icp_qat_hw_auth_algo 
qat_hash_alg)
case ICP_QAT_HW_AUTH_ALGO_GALOIS_64:
return QAT_HW_ROUND_UP(ICP_QAT_HW_GALOIS_128_STATE1_SZ,
QAT_HW_DEFAULT_ALIGNMENT);
+   case ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2:
+   return QAT_HW_ROUND_UP(ICP_QAT_HW_SNOW_3G_UIA2_STATE1_SZ,
+   QAT_HW_DEFAULT_ALIGNMENT);
case ICP_QAT_HW_AUTH_ALGO_DELIMITER:
/* return maximum state1 size in this case */
return QAT_HW_ROUND_UP(ICP_QAT_HW_SHA512_STATE1_SZ,
@@ -376,7 +379,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,

PMD_INIT_FUNC_TRACE();

-   if (cdesc->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER) {
+   if (cdesc->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER &&
+   cdesc->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2) {
cipher =
(struct icp_qat_hw_cipher_algo_blk *)((char *)>cd +
sizeof(struct icp_qat_hw_auth_algo_blk));
@@ -409,13 +413,20 @@ int 
qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
else
key_convert = ICP_QAT_HW_CIPHER_KEY_CONVERT;

+   if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2)
+   key_convert = ICP_QAT_HW_CIPHER_KEY_CONVERT;
+
/* For Snow3G, set key convert and other bits */
if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2) {
key_convert = ICP_QAT_HW_CIPHER_KEY_CONVERT;

[dpdk-dev] [PATCH v4 1/3] crypto: add cipher/auth only support

2016-03-10 Thread Deepak Kumar JAIN
Refactored the existing functionality into
modular form to support the cipher/auth only
functionalities.

Signed-off-by: Deepak Kumar JAIN 
---
 drivers/crypto/qat/qat_adf/qat_algs.h|  18 +-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 208 ---
 drivers/crypto/qat/qat_crypto.c  | 137 +++
 drivers/crypto/qat/qat_crypto.h  |  10 ++
 4 files changed, 306 insertions(+), 67 deletions(-)

diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index 76c08c0..b73a5d0 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -3,7 +3,7 @@
  *  redistributing this file, you may do so under either license.
  *
  *  GPL LICENSE SUMMARY
- *  Copyright(c) 2015 Intel Corporation.
+ *  Copyright(c) 2015-2016 Intel Corporation.
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of version 2 of the GNU General Public License as
  *  published by the Free Software Foundation.
@@ -17,7 +17,7 @@
  *  qat-linux at intel.com
  *
  *  BSD LICENSE
- *  Copyright(c) 2015 Intel Corporation.
+ *  Copyright(c) 2015-2016 Intel Corporation.
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
@@ -104,11 +104,15 @@ struct qat_alg_ablkcipher_cd {

 int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg);

-int qat_alg_aead_session_create_content_desc(struct qat_session *cd,
-   uint8_t *enckey, uint32_t enckeylen,
-   uint8_t *authkey, uint32_t authkeylen,
-   uint32_t add_auth_data_length,
-   uint32_t digestsize);
+int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cd,
+   uint8_t *enckey,
+   uint32_t enckeylen);
+
+int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
+   uint8_t *authkey,
+   uint32_t authkeylen,
+   uint32_t add_auth_data_length,
+   uint32_t digestsize);

 void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header);

diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index ceaffb7..534eda0 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -3,7 +3,7 @@
  *  redistributing this file, you may do so under either license.
  *
  *  GPL LICENSE SUMMARY
- *  Copyright(c) 2015 Intel Corporation.
+ *  Copyright(c) 2015-2016 Intel Corporation.
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of version 2 of the GNU General Public License as
  *  published by the Free Software Foundation.
@@ -17,7 +17,7 @@
  *  qat-linux at intel.com
  *
  *  BSD LICENSE
- *  Copyright(c) 2015 Intel Corporation.
+ *  Copyright(c) 2015-2016 Intel Corporation.
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
@@ -359,15 +359,139 @@ void qat_alg_init_common_hdr(struct 
icp_qat_fw_comn_req_hdr *header)
   ICP_QAT_FW_LA_NO_UPDATE_STATE);
 }

-int qat_alg_aead_session_create_content_desc(struct qat_session *cdesc,
-   uint8_t *cipherkey, uint32_t cipherkeylen,
-   uint8_t *authkey, uint32_t authkeylen,
-   uint32_t add_auth_data_length,
-   uint32_t digestsize)
+int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
+   uint8_t *cipherkey,
+   uint32_t cipherkeylen)
 {
-   struct qat_alg_cd *content_desc = >cd;
-   struct icp_qat_hw_cipher_algo_blk *cipher = _desc->cipher;
-   struct icp_qat_hw_auth_algo_blk *hash = _desc->hash;
+   struct icp_qat_hw_cipher_algo_blk *cipher;
+   struct icp_qat_fw_la_bulk_req *req_tmpl = >fw_req;
+   struct icp_qat_fw_comn_req_hdr_cd_pars *cd_pars = _tmpl->cd_pars;
+   struct icp_qat_fw_comn_req_hdr *header = _tmpl->comn_hdr;
+   void *ptr = _tmpl->cd_ctrl;
+   struct icp_qat_fw_cipher_cd_ctrl_hdr *cipher_cd_ctrl = ptr;
+   struct icp_qat_fw_auth_cd_ctrl_hdr *hash_cd_ctrl = ptr;
+   enum icp_qat_hw_cipher_convert key_convert;
+   uint16_t proto = ICP_QAT_FW_LA_NO_PROTO;/* no CCM/GCM/Snow3G */
+   uint16_t cipher_offset = 0;
+
+   PMD_INIT_FUNC_TRACE();
+
+   if 

[dpdk-dev] [PATCH v4 0/3] Snow3G support for Intel Quick Assist Devices

2016-03-10 Thread Deepak Kumar JAIN
 This patchset contains fixes and refactoring for Snow3G(UEA2 and
 UIA2) wireless algorithm for Intel Quick Assist devices.

 QAT PMD previously supported only cipher/hash alg-chaining for AES/SHA.
 The code has been refactored to also support cipher-only and hash  only  (for 
Snow3G only) functionality along with alg-chaining.

 Changes from V3:
 1) Rebase based on below mentioned patchset.
 2) Fixes test failure which happens only after 
applying patch 1 only.

 Changes from v2:

 1) Rebasing based on below mentioned patchset.

This patchset depends on
cryptodev API changes
http://dpdk.org/ml/archives/dev/2016-March/035451.html

Deepak Kumar JAIN (3):
  crypto: add cipher/auth only support
  qat: add support for Snow3G
  app/test: add Snow3G tests

 app/test/test_cryptodev.c  | 1037 +++-
 app/test/test_cryptodev.h  |3 +-
 app/test/test_cryptodev_snow3g_hash_test_vectors.h |  415 
 app/test/test_cryptodev_snow3g_test_vectors.h  |  379 +++
 doc/guides/cryptodevs/qat.rst  |8 +-
 doc/guides/rel_notes/release_16_04.rst |6 +
 drivers/crypto/qat/qat_adf/qat_algs.h  |   19 +-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   |  284 +-
 drivers/crypto/qat/qat_crypto.c|  149 ++-
 drivers/crypto/qat/qat_crypto.h|   10 +
 10 files changed, 2236 insertions(+), 74 deletions(-)
 create mode 100644 app/test/test_cryptodev_snow3g_hash_test_vectors.h
 create mode 100644 app/test/test_cryptodev_snow3g_test_vectors.h

-- 
2.1.0



[dpdk-dev] [PATCH v2] cryptodev: add capabilities discovery mechanism

2016-03-10 Thread Pablo de Lara
From: Declan Doherty 

This patch add a mechanism for discovery of crypto device features and supported
crypto operations and algorithms. It also provides a method for a crypto PMD to
publish any data range limitations it may have for the operations and algorithms
it supports.

The parameter feature_flags added to rte_cryptodev struct is used to capture
features such as operations supported (symmetric crypto, operation chaining etc)
as well parameter such as whether the device is hardware accelerated or uses
SIMD instructions.

The capabilities parameter allows a PMD to define an array of supported 
operations
with any limitation which that implementation may have.

Finally the rte_cryptodev_info struct has been extended to allow retrieval of
these parameter using the existing rte_cryptodev_info_get() API.

Signed-off-by: Declan Doherty 
Signed-off-by: Pablo de Lara 

---

This patch depends on "null_crypto_pmd: PMD to support null crypto operations" 
patch
(http://dpdk.org/dev/patchwork/patch/11428/)
and "snow3g: Bit-wise handling for Wireless Algorithm" patch
(http://dpdk.org/dev/patchwork/patch/11429/)

Changes in v2:

- Fixed incorrect values for sizes
- Renamed some fields in capabilities structure
- Added capabilities for new PMDs

 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   |  18 +++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c   |  49 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  18 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 175 +
 drivers/crypto/null/null_crypto_pmd.c  |   3 +
 drivers/crypto/null/null_crypto_pmd_ops.c  |  47 ++
 drivers/crypto/qat/qat_crypto.c| 201 -
 drivers/crypto/qat/rte_qat_cryptodev.c |   3 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c |   3 +
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c |  51 +++
 lib/librte_cryptodev/rte_cryptodev.c   |  28 
 lib/librte_cryptodev/rte_cryptodev.h   | 137 +
 lib/librte_cryptodev/rte_cryptodev_version.map |   1 +
 13 files changed, 733 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 83aa272..c94bb7d 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -445,6 +445,24 @@ aesni_gcm_create(const char *name,
dev->dequeue_burst = aesni_gcm_pmd_dequeue_burst;
dev->enqueue_burst = aesni_gcm_pmd_enqueue_burst;

+   dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
+   RTE_CRYPTODEV_FF_OPERATION_CHAINING |
+   RTE_CRYPTODEV_FF_CPU_AESNI;
+
+   switch (vector_mode) {
+   case RTE_AESNI_GCM_SSE:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
+   break;
+   case RTE_AESNI_GCM_AVX:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX;
+   break;
+   case RTE_AESNI_GCM_AVX2:
+   dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX2;
+   break;
+   default:
+   break;
+   }
+
/* Set vector instructions mode supported */
internals = dev->data->dev_private;

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index f865e0d..af7907b 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -38,6 +38,55 @@

 #include "aesni_gcm_pmd_private.h"

+static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
+   {   /* AES GCM (AUTH) */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   .sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+   .auth = {
+   .algo = RTE_CRYPTO_AUTH_AES_GCM,
+   .block_size = 16,
+   .key_size = {
+   .min = 16,
+   .max = 32,
+   .increment = 8
+   },
+   .digest_size = {
+   .min = 8,
+   .max = 16,
+   .increment = 4
+   },
+   .aad_size = {
+   .min = 8,
+   .max = 12,
+   .increment = 4
+   }
+   }
+   }
+   },
+   {   /* AES GCM (CIPHER) */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   .sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+   .cipher = {
+   .algo = 

[dpdk-dev] [PATCH] l3fwd: Fix compilation & enable exact match mode on ARM.

2016-03-10 Thread maciej.cze...@caviumnetworks.com
From: Maciej Czekaj 

Enable NEON support in exact match mode.
l3fwd example did not compile on ARM due to SSE2 instrincics used
in generic part.
Some instrinsins were used to initialize data structures and those were
replaced by ordinary structure initalization.
All SSE2 intrinsics used in forwarding, i.e. masking the IP/TCP header
are moved to single inline function and made arch-specific.

Signed-off-by: Maciej Czekaj 
---
 examples/l3fwd/l3fwd.h|  4 ++-
 examples/l3fwd/l3fwd_em.c | 72 +--
 examples/l3fwd/main.c |  2 +-
 3 files changed, 48 insertions(+), 30 deletions(-)

diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index da6d369..7dcc7e5 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -34,6 +34,8 @@
 #ifndef __L3_FWD_H__
 #define __L3_FWD_H__

+#include 
+
 #define DO_RFC_1812_CHECKS

 #define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
@@ -103,7 +105,7 @@ extern uint32_t enabled_port_mask;
 extern int ipv6; /**< ipv6 is false by default. */
 extern uint32_t hash_entry_number;

-extern __m128i val_eth[RTE_MAX_ETHPORTS];
+extern xmm_t val_eth[RTE_MAX_ETHPORTS];

 extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index f6a65d8..0adf8f4 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -85,7 +85,7 @@ union ipv4_5tuple_host {
uint16_t port_src;
uint16_t port_dst;
};
-   __m128i xmm;
+   xmm_t xmm;
 };

 #define XMM_NUM_IN_IPV6_5TUPLE 3
@@ -109,9 +109,11 @@ union ipv6_5tuple_host {
uint16_t port_dst;
uint64_t reserve;
};
-   __m128i xmm[XMM_NUM_IN_IPV6_5TUPLE];
+   xmm_t xmm[XMM_NUM_IN_IPV6_5TUPLE];
 };

+
+
 struct ipv4_l3fwd_em_route {
struct ipv4_5tuple key;
uint8_t if_out;
@@ -236,9 +238,27 @@ ipv6_hash_crc(const void *data, __rte_unused uint32_t 
data_len,
 static uint8_t ipv4_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;
 static uint8_t ipv6_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;

-static __m128i mask0;
-static __m128i mask1;
-static __m128i mask2;
+static rte_xmm_t mask0;
+static rte_xmm_t mask1;
+static rte_xmm_t mask2;
+
+#if defined(__SSE2__)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   __m128i data = _mm_loadu_si128((__m128i *)(key));
+
+   return _mm_and_si128(data, mask);
+}
+#elif defined(__ARM_NEON)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   int32x4_t data = vld1q_s32((int32_t *)key);
+
+   return vandq_s32(data, mask);
+}
+#endif

 static inline uint8_t
 em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void *lookup_struct)
@@ -249,13 +269,12 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void 
*lookup_struct)
(struct rte_hash *)lookup_struct;

ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, 
time_to_live);
-   __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr));

/*
 * Get 5 tuple: dst port, src port, dst IP address,
 * src IP address and protocol.
 */
-   key.xmm = _mm_and_si128(data, mask0);
+   key.xmm = em_mask_key(ipv4_hdr, mask0.x);

/* Find destination port */
ret = rte_hash_lookup(ipv4_l3fwd_lookup_struct, (const void *));
@@ -271,35 +290,31 @@ em_get_ipv6_dst_port(void *ipv6_hdr,  uint8_t portid, 
void *lookup_struct)
(struct rte_hash *)lookup_struct;

ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len);
-   __m128i data0 =
-   _mm_loadu_si128((__m128i *)(ipv6_hdr));
-   __m128i data1 =
-   _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr)+
-   sizeof(__m128i)));
-   __m128i data2 =
-   _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr)+
-   sizeof(__m128i)+sizeof(__m128i)));
+   void *data0 = ipv6_hdr;
+   void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t);
+   void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t);

/* Get part of 5 tuple: src IP address lower 96 bits and protocol */
-   key.xmm[0] = _mm_and_si128(data0, mask1);
+   key.xmm[0] = em_mask_key(data0, mask1.x);

/*
 * Get part of 5 tuple: dst IP address lower 96 bits
 * and src IP address higher 32 bits.
 */
-   key.xmm[1] = data1;
+   key.xmm[1] = *(xmm_t *)data1;

/*
 * Get part of 5 tuple: dst port and src port
 * and dst IP address higher 32 bits.
 */
-   key.xmm[2] = _mm_and_si128(data2, mask2);
+   key.xmm[2] = em_mask_key(data2, mask2.x);

/* Find destination port */
ret = rte_hash_lookup(ipv6_l3fwd_lookup_struct, (const void *));
return (uint8_t)((ret < 0) ? portid : ipv6_l3fwd_out_if[ret]);
 }

+
 /*
  * 

[dpdk-dev] [PATCH] l3fwd: Fix compilation & enable exact match mode on ARM

2016-03-10 Thread maciej.cze...@caviumnetworks.com
From: Maciej Czekaj 

This patch depends on following pending patches:
lpm: add support for NEON
http://dpdk.org/dev/patchwork/patch/10479/
lpm: make rte_lpm_lookupx4 API definition architecture agnostic
http://dpdk.org/dev/patchwork/patch/10478/

Maciej Czekaj (1):
  l3fwd: Fix compilation & enable exact match mode on ARM.

 examples/l3fwd/l3fwd.h|  4 ++-
 examples/l3fwd/l3fwd_em.c | 72 +--
 examples/l3fwd/main.c |  2 +-
 3 files changed, 48 insertions(+), 30 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH v9 4/5] cryptodev: change burst API to be crypto op oriented

2016-03-10 Thread Thomas Monjalon
2016-03-10 15:41, Fiona Trahe:
> lib/librte_cryptodev/rte_crypto_sym.h  | 374 ++--

Sorry there is another issue:

rte_crypto_sym.h:622: warning: argument 'op' of command @param is not found in 
the argument list of __rte_crypto_sym_op_attach_sym_session(struct 
rte_crypto_sym_op *sym_op, struct rte_cryptodev_sym_session *sess)
rte_crypto_sym.h:628: warning: The following parameters of 
__rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, struct 
rte_cryptodev_sym_session *sess) are not documented:
  parameter 'sym_op'
rte_crypto_sym.h:592: warning: unable to resolve reference to 
`rte_cryptodev_session_create' for \ref command

I've fixed it with the following changes:

 * The length of the data pointed to by this field is
 * set up for the session in the @ref
 * rte_crypto_auth_xform structure as part of the @ref
-* rte_cryptodev_session_create function call.  This
-* length must not exceed 240 bytes.
+* rte_cryptodev_sym_session_create function call.
+* This length must not exceed 240 bytes.

 /**
  * Attach a session to a symmetric crypto operation
  *
- * @param  op  crypto operation
+ * @param  sym_op  crypto operation
  * @param  sesscryptodev session
  */



[dpdk-dev] [PATCH 8/8] drivers/net/ixgbe: Fix uninitialized warning

2016-03-10 Thread Panu Matilainen
On 03/10/2016 04:45 PM, Remy Horton wrote:
>
> On 10/03/2016 13:42, Panu Matilainen wrote:
>> On 02/25/2016 08:48 PM, Aaron Conole wrote:
>>> Silence a compiler warning that this variable may be used uninitialized.
>>>
>>> Signed-off-by: Aaron Conole 
> [..]
>>
>> The patch looks ok as such, but then again warning looks like a false
>> positive to me: assignment and dereferencing depend on the same value of
>> eop, which cannot change between the two.
>
> In two minds about this. It is a logical impossibility, but these days
> optimising compilers are getting very aggressive. For instance GCC has a
> delightfully-named -fdelete-null-pointer-checks option, which caused
> security holes..

Indeed, that's why silencing a false positive (assuming it actually is 
one) by throwing some more NULL-checks for the allegedly impossible 
makes me a bit nervous. Besides compiler optimizations going crazy, I've 
seen such extra NULL-checks turn into actual bugs when surroundings 
subtly change.

- Panu -



[dpdk-dev] [PATCH v1] I217 and I218 changes

2016-03-10 Thread Bruce Richardson
On Wed, Mar 02, 2016 at 05:55:18AM -0800, Ravi Kerur wrote:
> v1:   Make necessary changes to support I217 and I218 NICs.
>   Use v2' incorporating internal review comments as a base.
>   Internal review done by Wenzhou Lu (Intel) and internal
>   review versions and testing shown below
>   
>   v2':
>   Incorporate Wenzhou's comments, remove superfluous
>   assignment to fc.requested_mode in em_hardware_init
>   function.
>   Compiled and tested (via testpmd) on Ubuntu 14.04 on target
>   x86_64-native-linuxapp-gcc
>   Compiled for target x86_64-native-linuxapp-clang
> 
>   v1':
>   Modified driver and eal code to support I217 and I218
>   Intel NICs.
>   Compiled and tested (via testpmd) on Ubuntu 14.04 for target
>   x86_64-native-linuxapp-gcc
>   Compiled for target x86_64-native-linuxapp-clang
>   M. Jay(Intel) had used the patch for DPDK demo.
> 
> Signed-off-by: Ravi Kerur 
> Acked-by: Wenzhuo Lu 

Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [RFC 35/35] mempool: update copyright

2016-03-10 Thread Panu Matilainen
On 03/09/2016 08:52 PM, Stephen Hemminger wrote:
> I understand that 6Wind has made major contributions to DPDK in many places.
>
> I would prefer that each file not get copyright additions from each
> contributor,
> otherwise this starts a bad precedent where the source gets cluttered with
> every contributor.

That, and they also add rather useless noise to patches and commit 
history just because people feel compelled to update the copyright years.

Many projects have a separate credits file where contributors get noted, 
but I guess those tend to be under copyleft licenses, the BSD license 
expects somebody to claim copyright.

Anyway, I'd much rather see one toplevel license where all such updates 
go. It'd make life easier for packagers whose distros require including 
a license file in packages, and it'd also help fix the first impression 
of dpdk being under [L]GPL (which easily happens if you just glimpse at 
the toplevel source directory)

This is of course getting a bit side-tracked for this patch...

- Panu -



[dpdk-dev] [PATCH v4] pmd/snow3g: add new SNOW 3G SW PMD

2016-03-10 Thread Jain, Deepak K


-Original Message-
From: De Lara Guarch, Pablo 
Sent: Thursday, March 10, 2016 4:33 PM
To: dev at dpdk.org
Cc: Doherty, Declan ; Jain, Deepak K 
; De Lara Guarch, Pablo 
Subject: [PATCH v4] pmd/snow3g: add new SNOW 3G SW PMD

Added new SW PMD which makes use of the libsso SW library, which provides 
wireless algorithms SNOW 3G UEA2 and UIA2 in software.

This PMD supports cipher-only, hash-only and chained operations ("cipher then 
hash" and "hash then cipher") of the following
algorithms:
- RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2
- RTE_CRYPTO_SYM_AUTH_SNOW3G_UIA2

The SNOW 3G hash and cipher algorithms, which are enabled by this crypto PMD 
are implemented by Intel's libsso software library. For library download and 
build instructions, see the documentation included 
(doc/guides/cryptodevs/snow3g.rst)

The patch also contains the related unit tests function to test the PMD 
supported operations.

Signed-off-by: Pablo de Lara 
---

This patch depends on "Snow3G support for Intel Quick Assist Devices" patchset 
(http://dpdk.org/ml/archives/dev/2016-March/03548.html).

Changes in v4:

- Added missing fix casting that was breaking C++ compilation.
- Fixed documentation
- Rebased against latest DPDK code

Changes in v3:

- Corrected patch dependency

Changes in v2:

- Rebased against crypto API changes
- Removed static config options and allow user to provide them
  as virtual device parameters.
- Added unit tests
- Changed DPDK version references from 2.3 to 16.04
- Fixed crypto operation status handling
- Fixed copyright dates
- Fixed enqueue error stats

-- 
2.5.0

Acked-by: Deepak Kumar JAIN 


[dpdk-dev] [PATCH v4] af_packet: make the device detachable

2016-03-10 Thread Bruce Richardson
On Thu, Mar 03, 2016 at 01:54:50PM +, Iremonger, Bernard wrote:
> > -Original Message-
> > From: Wojciech Zmuda [mailto:woz at semihalf.com]
> > Sent: Wednesday, March 2, 2016 11:56 AM
> > To: dev at dpdk.org
> > Cc: Iremonger, Bernard ;
> > linville at tuxdriver.com; Richardson, Bruce  > intel.com>;
> > pmatilai at redhat.com
> > Subject: [PATCH v4] af_packet: make the device detachable
> > 
> > Allow dynamic deallocation of af_packet device through proper API
> > functions. To achieve this:
> > * set device flag to RTE_ETH_DEV_DETACHABLE
> > * implement rte_pmd_af_packet_devuninit() and expose it
> >   through rte_driver.uninit()
> > * copy device name to ethdev->data to make discoverable with
> >   rte_eth_dev_allocated()
> > Moreover, make af_packet init function static, as there is no reason to keep
> > it public.
> > 
> > Signed-off-by: Wojciech Zmuda 
> 
> Acked-by: Bernard Iremonger 
>
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH v2] null_crypto_pmd: PMD to support null crypto operations

2016-03-10 Thread Jain, Deepak K


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Pablo de Lara
Sent: Thursday, March 10, 2016 4:47 PM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH v2] null_crypto_pmd: PMD to support null crypto 
operations

From: Declan Doherty 

This patch provides the implementation of a NULL crypto PMD, which supports 
NULL cipher and NULL authentication operations, which can be chained together 
as follows:

- Authentication Only
- Cipher Only
- Authentication then Cipher
- Cipher then Authentication

As this is a NULL operation device the crypto operations which are submitted 
for processing are not actually modified and are stored in a queue pairs 
processed packets ring ready for collection when rte_cryptodev_burst_dequeue() 
is called.

The patch also contains the related unit tests function to test the PMDs 
supported operations.

Signed-off-by: Declan Doherty 
---

This patch depends on "AES GCM, AES CMAC fixes and addition of GCM tests for 
QAT" patchset
(http://dpdk.org/ml/archives/dev/2016-March/034974.html)

Changes in v2:
- Rebased to include Cryptodev API changes
--
2.5.0

Acked-by: Deepak Kumar JAIN


[dpdk-dev] [PATCH v2] null_crypto_pmd: PMD to support null crypto operations

2016-03-10 Thread Pablo de Lara
From: Declan Doherty 

This patch provides the implementation of a NULL crypto PMD, which supports
NULL cipher and NULL authentication operations, which can be chained together
as follows:

- Authentication Only
- Cipher Only
- Authentication then Cipher
- Cipher then Authentication

As this is a NULL operation device the crypto operations which are submitted for
processing are not actually modified and are stored in a queue pairs processed
packets ring ready for collection when rte_cryptodev_burst_dequeue() is called.

The patch also contains the related unit tests function to test the PMDs
supported operations.

Signed-off-by: Declan Doherty 
---

This patch depends on "AES GCM, AES CMAC fixes and addition of GCM tests for 
QAT" patchset
(http://dpdk.org/ml/archives/dev/2016-March/034974.html)

Changes in v2:
- Rebased to include Cryptodev API changes

 MAINTAINERS|   4 +
 app/test/test_cryptodev.c  | 402 -
 config/common_base |   5 +
 doc/api/doxy-api.conf  |   1 -
 doc/guides/cryptodevs/index.rst|   3 +-
 doc/guides/cryptodevs/null.rst |  72 
 doc/guides/rel_notes/release_16_04.rst |   4 +
 drivers/crypto/Makefile|   1 +
 drivers/crypto/null/Makefile   |  59 +++
 drivers/crypto/null/null_crypto_pmd.c  | 275 ++
 drivers/crypto/null/null_crypto_pmd_ops.c  | 308 
 drivers/crypto/null/null_crypto_pmd_private.h  |  93 +
 .../crypto/null/rte_pmd_null_crypto_version.map|   3 +
 mk/rte.app.mk  |   1 +
 14 files changed, 1228 insertions(+), 3 deletions(-)
 create mode 100644 doc/guides/cryptodevs/null.rst
 create mode 100644 drivers/crypto/null/Makefile
 create mode 100644 drivers/crypto/null/null_crypto_pmd.c
 create mode 100644 drivers/crypto/null/null_crypto_pmd_ops.c
 create mode 100644 drivers/crypto/null/null_crypto_pmd_private.h
 create mode 100644 drivers/crypto/null/rte_pmd_null_crypto_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index d4b2d98..0bf8a77 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -364,6 +364,10 @@ SNOW 3G PMD
 M: Pablo de Lara 
 F: drivers/crypto/snow3g

+Null Crypto PMD
+M: Declan Doherty 
+F: drivers/crypto/null/
+

 Packet processing
 -
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index b862f72..28d9d54 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -226,6 +226,23 @@ testsuite_setup(void)
}
}

+   /* Create 2 NULL devices if required */
+   if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) {
+   nb_devs = rte_cryptodev_count_devtype(
+   RTE_CRYPTODEV_NULL_PMD);
+   if (nb_devs < 2) {
+   for (i = nb_devs; i < 2; i++) {
+   int dev_id = rte_eal_vdev_init(
+   CRYPTODEV_NAME_NULL_PMD, NULL);
+
+   TEST_ASSERT(dev_id >= 0,
+   "Failed to create instance %u of"
+   " pmd : %s",
+   i, CRYPTODEV_NAME_NULL_PMD);
+   }
+   }
+   }
+
nb_devs = rte_cryptodev_count();
if (nb_devs < 1) {
RTE_LOG(ERR, USER1, "No crypto devices found?");
@@ -3364,15 +3381,362 @@ test_not_in_place_crypto(void)
QUOTE_512_BYTES,
"Plaintext data not as expected");

+   return TEST_SUCCESS;
+}
+
+static int
+test_null_cipher_only_operation(void)
+{
+   struct crypto_testsuite_params *ts_params = _params;
+   struct crypto_unittest_params *ut_params = _params;
+
+   /* Generate test mbuf data and space for digest */
+   ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
+   catch_22_quote, QUOTE_512_BYTES, 0);
+
+   /* Setup Cipher Parameters */
+   ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+   ut_params->cipher_xform.next = NULL;
+
+   ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
+   ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+
+   /* Create Crypto session*/
+   ut_params->sess = rte_cryptodev_sym_session_create(
+   ts_params->valid_devs[0], _params->cipher_xform);
+   TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+
+   /* Generate Crypto op data structure */
+   ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+   TEST_ASSERT_NOT_NULL(ut_params->op,
+   "Failed to allocate symmetric crypto operation 

[dpdk-dev] [PATCH] mempool: allow for user-owned mempool caches

2016-03-10 Thread Lazaros Koromilas
The mempool cache is only available to EAL threads as a per-lcore
resource. Change this so that the user can create and provide their own
cache on mempool get and put operations. This works with non-EAL threads
too. This commit introduces new API calls with the 'with_cache' suffix,
while the current ones default to the per-lcore local cache.

Signed-off-by: Lazaros Koromilas 
---
 lib/librte_mempool/rte_mempool.c |  65 +-
 lib/librte_mempool/rte_mempool.h | 442 ---
 2 files changed, 467 insertions(+), 40 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index f8781e1..cebc2b7 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -375,6 +375,43 @@ rte_mempool_xmem_usage(void *vaddr, uint32_t elt_num, 
size_t elt_sz,
return usz;
 }

+#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
+static void
+mempool_cache_init(struct rte_mempool_cache *cache, uint32_t size)
+{
+   cache->size = size;
+   cache->flushthresh = CALC_CACHE_FLUSHTHRESH(size);
+   cache->len = 0;
+}
+
+/*
+ * Creates and initializes a cache for objects that are retrieved from and
+ * returned to an underlying mempool. This structure is identical to the
+ * structure included inside struct rte_mempool.
+ */
+struct rte_mempool_cache *
+rte_mempool_cache_create(uint32_t size)
+{
+   struct rte_mempool_cache *cache;
+
+   if (size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
+   rte_errno = EINVAL;
+   return NULL;
+   }
+
+   cache = rte_zmalloc("MEMPOOL_CACHE", sizeof(*cache), 
RTE_CACHE_LINE_SIZE);
+   if (cache == NULL) {
+   RTE_LOG(ERR, MEMPOOL, "Cannot allocate mempool cache!\n");
+   rte_errno = ENOMEM;
+   return NULL;
+   }
+
+   mempool_cache_init(cache, size);
+
+   return cache;
+}
+#endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */
+
 #ifndef RTE_LIBRTE_XEN_DOM0
 /* stub if DOM0 support not configured */
 struct rte_mempool *
@@ -587,10 +624,18 @@ rte_mempool_xmem_create(const char *name, unsigned n, 
unsigned elt_size,
mp->elt_size = objsz.elt_size;
mp->header_size = objsz.header_size;
mp->trailer_size = objsz.trailer_size;
-   mp->cache_size = cache_size;
-   mp->cache_flushthresh = CALC_CACHE_FLUSHTHRESH(cache_size);
+   mp->cache_size = cache_size; /* Keep this for backwards compat. */
mp->private_data_size = private_data_size;

+#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
+   {
+   unsigned lcore_id;
+   for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
+   mempool_cache_init(>local_cache[lcore_id],
+  cache_size);
+   }
+#endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */
+
/* calculate address of the first element for continuous mempool. */
obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, pg_num) +
private_data_size;
@@ -648,8 +693,8 @@ rte_mempool_count(const struct rte_mempool *mp)

 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
{
-   unsigned lcore_id;
-   if (mp->cache_size == 0)
+   unsigned lcore_id = rte_lcore_id();
+   if (mp->local_cache[lcore_id].size == 0)
return count;

for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
@@ -673,13 +718,17 @@ rte_mempool_dump_cache(FILE *f, const struct rte_mempool 
*mp)
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
unsigned lcore_id;
unsigned count = 0;
+   unsigned cache_size;
unsigned cache_count;

fprintf(f, "  cache infos:\n");
-   fprintf(f, "cache_size=%"PRIu32"\n", mp->cache_size);
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+   cache_size = mp->local_cache[lcore_id].size;
+   fprintf(f, "cache_size[%u]=%"PRIu32"\n",
+   lcore_id, cache_size);
cache_count = mp->local_cache[lcore_id].len;
-   fprintf(f, "cache_count[%u]=%u\n", lcore_id, cache_count);
+   fprintf(f, "cache_count[%u]=%"PRIu32"\n",
+   lcore_id, cache_count);
count += cache_count;
}
fprintf(f, "total_cache_count=%u\n", count);
@@ -761,7 +810,9 @@ mempool_audit_cache(const struct rte_mempool *mp)
/* check cache size consistency */
unsigned lcore_id;
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
-   if (mp->local_cache[lcore_id].len > mp->cache_flushthresh) {
+   const struct rte_mempool_cache *cache;
+   cache = >local_cache[lcore_id];
+   if (cache->len > cache->flushthresh) {
RTE_LOG(CRIT, MEMPOOL, "badness on cache[%u]\n",
lcore_id);
rte_panic("MEMPOOL: invalid cache len\n");
diff --git 

[dpdk-dev] [PATCH v4] aesni_gcm: PMD to support AES_GCM crypto operations

2016-03-10 Thread Pablo de Lara
From: Declan Doherty 

This patch provides the implementation of an AES-NI accelerated crypto PMD
which is dependent on Intel's multi-buffer library, see the white paper
"Fast Multi-buffer IPsec Implementations on Intel?  Architecture  Processors"

This PMD supports AES_GCM authenticated encryption and authenticated decryption 
using
128-bit AES keys

The patch also contains the related unit tests functions for the implemented 
functionality

Signed-off-by: Declan Doherty 
Signed-off-by: Pablo de Lara 
--

This patch depends on "pmd/snow3g: add new SNOW 3G SW PMD" patch
(http://dpdk.org/dev/patchwork/patch/11424/).

Changes in v4:

- Fixed compilation error when debug flag is enabled
- Rebased to latest DPDK code
- Added missing document

Changes in v3:
- Fixed incorrect error messages

Changes in v2:

- Rebased against crypto API changes
- Removed static config options and allow user to provide them
  as virtual device parameters
- Changed DPDK version references from 2.3 to 16.04 
- Added missing library dependency


 MAINTAINERS|   4 +
 app/test/test_cryptodev.c  | 466 +++
 app/test/test_cryptodev_gcm_test_vectors.h | 423 +
 config/common_base |   6 +
 config/defconfig_i686-native-linuxapp-gcc  |  10 +
 config/defconfig_i686-native-linuxapp-icc  |  10 +
 doc/guides/cryptodevs/aesni_gcm.rst|  66 +++
 doc/guides/cryptodevs/index.rst|   1 +
 doc/guides/rel_notes/release_16_04.rst |   5 +
 drivers/crypto/Makefile|   1 +
 drivers/crypto/aesni_gcm/Makefile  |  67 +++
 drivers/crypto/aesni_gcm/aesni_gcm_ops.h   | 127 ++
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   | 505 +
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c   | 292 
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h   | 120 +
 .../crypto/aesni_gcm/rte_pmd_aesni_gcm_version.map |   3 +
 lib/librte_cryptodev/rte_cryptodev.h   |   3 +
 mk/rte.app.mk  |  19 +-
 18 files changed, 2124 insertions(+), 4 deletions(-)
 create mode 100644 app/test/test_cryptodev_gcm_test_vectors.h
 create mode 100644 doc/guides/cryptodevs/aesni_gcm.rst
 create mode 100644 drivers/crypto/aesni_gcm/Makefile
 create mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_ops.h
 create mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
 create mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
 create mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
 create mode 100644 drivers/crypto/aesni_gcm/rte_pmd_aesni_gcm_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 52198b7..d4b2d98 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -349,6 +349,10 @@ Null PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/

+Intel AES-NI GCM PMD
+M: Declan Doherty 
+F: drivers/crypto/aesni_gcm/
+
 Intel AES-NI Multi-Buffer
 M: Declan Doherty 
 F: drivers/crypto/aesni_mb/
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 595b9f9..dfb7a8c 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -44,6 +44,8 @@
 #include "test_cryptodev.h"
 #include "test_cryptodev_snow3g_test_vectors.h"
 #include "test_cryptodev_snow3g_hash_test_vectors.h"
+#include "test_cryptodev_gcm_test_vectors.h"
+
 static enum rte_cryptodev_type gbl_cryptodev_type;

 struct crypto_testsuite_params {
@@ -195,6 +197,21 @@ testsuite_setup(void)
}
}

+   /* Create 2 AESNI GCM devices if required */
+   if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) {
+   nb_devs = rte_cryptodev_count_devtype(
+   RTE_CRYPTODEV_AESNI_GCM_PMD);
+   if (nb_devs < 2) {
+   for (i = nb_devs; i < 2; i++) {
+   TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
+   CRYPTODEV_NAME_AESNI_GCM_PMD, NULL),
+   "Failed to create instance %u of"
+   " pmd : %s",
+   i, CRYPTODEV_NAME_AESNI_GCM_PMD);
+   }
+   }
+   }
+
/* Create 2 Snow3G devices if required */
if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) {
nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
@@ -2760,6 +2777,400 @@ test_snow3g_encrypted_authentication_test_case_1(void)
 /* * AES-GCM Tests * */

 static int
+create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
+   const uint8_t *key, const uint8_t key_len,
+   const uint8_t aad_len, const uint8_t auth_len)
+{
+   uint8_t cipher_key[key_len];
+
+   struct crypto_unittest_params *ut_params = _params;
+
+
+   

[dpdk-dev] [PATCH v5 0/2] fm10k: enable FTAG based forwarding

2016-03-10 Thread Bruce Richardson
On Wed, Mar 02, 2016 at 07:19:12PM +0800, Wang Xiao W wrote:
> v5:
> * Used kvargs api to parse the devargs parameter.
> * Put release note into the driver patch.
> 
> v4:
> * Removed the build time config option, used devargs to config FTAG.
> * Rebased on head of dpdk-next-net/rel_16_04 branch.
> 
> v3:
> * Removed "\n" in PMD_INIT_LOG.
> * Returned "-ENOTSUP" instead of -1 in VF FTAG use case.
> 
> v2:
> * Gave an error message for VF FTAG use case.
> * Added a notice in the doc to emphasize that application should ensure
>   an appropriate FTAG for every frame in FTAG based forwarding mode.
> 
> Wang Xiao W (2):
>   fm10k: enable FTAG based forwarding
>   doc: add introduction for fm10k FTAG based forwarding
>
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH v4] pmd/snow3g: add new SNOW 3G SW PMD

2016-03-10 Thread Pablo de Lara
Added new SW PMD which makes use of the libsso SW library,
which provides wireless algorithms SNOW 3G UEA2 and UIA2
in software.

This PMD supports cipher-only, hash-only and chained operations
("cipher then hash" and "hash then cipher") of the following
algorithms:
- RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2
- RTE_CRYPTO_SYM_AUTH_SNOW3G_UIA2

The SNOW 3G hash and cipher algorithms, which are enabled
by this crypto PMD are implemented by Intel's libsso software
library. For library download and build instructions,
see the documentation included (doc/guides/cryptodevs/snow3g.rst)

The patch also contains the related unit tests function to test the PMD
supported operations.

Signed-off-by: Pablo de Lara 
---

This patch depends on "Snow3G support for Intel Quick Assist Devices" patchset
(http://dpdk.org/ml/archives/dev/2016-March/03548.html).

Changes in v4:

- Added missing fix casting that was breaking C++ compilation.
- Fixed documentation
- Rebased against latest DPDK code

Changes in v3:

- Corrected patch dependency

Changes in v2:

- Rebased against crypto API changes
- Removed static config options and allow user to provide them
  as virtual device parameters.
- Added unit tests
- Changed DPDK version references from 2.3 to 16.04
- Fixed crypto operation status handling
- Fixed copyright dates
- Fixed enqueue error stats


 MAINTAINERS  |   4 +
 app/test/test_cryptodev.c|  78 
 config/common_base   |   6 +
 doc/guides/cryptodevs/index.rst  |   1 +
 doc/guides/cryptodevs/snow3g.rst |  69 +++
 doc/guides/rel_notes/release_16_04.rst   |   4 +
 drivers/crypto/Makefile  |   3 +-
 drivers/crypto/snow3g/Makefile   |  64 +++
 drivers/crypto/snow3g/rte_pmd_snow3g_version.map |   3 +
 drivers/crypto/snow3g/rte_snow3g_pmd.c   | 531 +++
 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c   | 291 +
 drivers/crypto/snow3g/rte_snow3g_pmd_private.h   | 107 +
 lib/librte_cryptodev/Makefile|   3 +-
 lib/librte_cryptodev/rte_cryptodev.h | 120 -
 mk/rte.app.mk|   6 +-
 15 files changed, 1286 insertions(+), 4 deletions(-)
 create mode 100644 doc/guides/cryptodevs/snow3g.rst
 create mode 100644 drivers/crypto/snow3g/Makefile
 create mode 100644 drivers/crypto/snow3g/rte_pmd_snow3g_version.map
 create mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd.c
 create mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
 create mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd_private.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 421c317..52198b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -356,6 +356,10 @@ F: drivers/crypto/aesni_mb/
 Intel QuickAssist
 F: drivers/crypto/qat/

+SNOW 3G PMD
+M: Pablo de Lara 
+F: drivers/crypto/snow3g
+

 Packet processing
 -
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0fe47b9..595b9f9 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -195,6 +195,20 @@ testsuite_setup(void)
}
}

+   /* Create 2 Snow3G devices if required */
+   if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) {
+   nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
+   if (nb_devs < 2) {
+   for (i = nb_devs; i < 2; i++) {
+   TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
+   CRYPTODEV_NAME_SNOW3G_PMD, NULL),
+   "Failed to create instance %u of"
+   " pmd : %s",
+   i, CRYPTODEV_NAME_SNOW3G_PMD);
+   }
+   }
+   }
+
nb_devs = rte_cryptodev_count();
if (nb_devs < 1) {
RTE_LOG(ERR, USER1, "No crypto devices found?");
@@ -3061,6 +3075,56 @@ static struct unit_test_suite 
cryptodev_aesni_mb_testsuite  = {
}
 };

+static struct unit_test_suite cryptodev_sw_snow3g_testsuite  = {
+   .suite_name = "Crypto Device SW Snow3G Unit Test Suite",
+   .setup = testsuite_setup,
+   .teardown = testsuite_teardown,
+   .unit_test_cases = {
+   /** Snow3G encrypt only (UEA2) */
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_snow3g_encryption_test_case_1),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_snow3g_encryption_test_case_2),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_snow3g_encryption_test_case_3),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_snow3g_encryption_test_case_4),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_snow3g_encryption_test_case_5),
+
+
+  

[dpdk-dev] [PATCH v5 1/2] fm10k: enable FTAG based forwarding

2016-03-10 Thread Bruce Richardson
On Wed, Mar 02, 2016 at 07:19:13PM +0800, Wang Xiao W wrote:
> This patch enables reading sglort info into mbuf for RX and inserting
> an FTAG at the beginning of the packet for TX. The vlan_tci_outer field
> selected from rte_mbuf structure for sglort is not used in fm10k now.
> In FTAG based forwarding mode, the switch will forward packets according
> to glort info in FTAG rather than mac and vlan table.
> 
> To activate this feature, user needs to pass a devargs parameter to eal
> for fm10k device like "-w :84:00.0,enable_ftag=1". Currently this
> feature is supported only on PF, because FM10K_PFVTCTL register is
> read-only for VF.
> 
> Signed-off-by: Wang Xiao W 
> Acked-by: Jing Chen 
> Acked-by: John McNamara 

Not sure the acks are correctly recorded here. John has acked the documentation
patch (2/2), not this patch. I'll fix this on apply.
Next time, please try to record the acks more accurately.

Thanks,
/Bruce



[dpdk-dev] [PATCH v4 0/3] Snow3G support for Intel Quick Assist Devices

2016-03-10 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar JAIN
> Sent: Thursday, March 10, 2016 5:13 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 0/3] Snow3G support for Intel Quick Assist
> Devices
> 
>  This patchset contains fixes and refactoring for Snow3G(UEA2 and
>  UIA2) wireless algorithm for Intel Quick Assist devices.
> 
>  QAT PMD previously supported only cipher/hash alg-chaining for AES/SHA.
>  The code has been refactored to also support cipher-only and hash  only
> (for Snow3G only) functionality along with alg-chaining.
> 
>  Changes from V3:
>  1) Rebase based on below mentioned patchset.
>  2) Fixes test failure which happens only after
> applying patch 1 only.
> 
>  Changes from v2:
> 
>  1) Rebasing based on below mentioned patchset.
> 
> This patchset depends on
> cryptodev API changes
> http://dpdk.org/ml/archives/dev/2016-March/035451.html
> 
> Deepak Kumar JAIN (3):
>   crypto: add cipher/auth only support
>   qat: add support for Snow3G
>   app/test: add Snow3G tests
> 
>  app/test/test_cryptodev.c  | 1037 
> +++-
>  app/test/test_cryptodev.h  |3 +-
>  app/test/test_cryptodev_snow3g_hash_test_vectors.h |  415 
>  app/test/test_cryptodev_snow3g_test_vectors.h  |  379 +++
>  doc/guides/cryptodevs/qat.rst  |8 +-
>  doc/guides/rel_notes/release_16_04.rst |6 +
>  drivers/crypto/qat/qat_adf/qat_algs.h  |   19 +-
>  drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   |  284 +-
>  drivers/crypto/qat/qat_crypto.c|  149 ++-
>  drivers/crypto/qat/qat_crypto.h|   10 +
>  10 files changed, 2236 insertions(+), 74 deletions(-)
>  create mode 100644 app/test/test_cryptodev_snow3g_hash_test_vectors.h
>  create mode 100644 app/test/test_cryptodev_snow3g_test_vectors.h
> 
> --
> 2.1.0

Series-acked-by: Pablo de Lara 


[dpdk-dev] [PATCH] doc: add mempool mgr ABI deprication notice

2016-03-10 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of David Hunt
> Sent: Thursday, March 10, 2016 11:56 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] doc: add mempool mgr ABI deprication notice
> 
> Announce the ABI breakage due to addition of external mempool manager
> functionality which requires changes to rte_mempool structure.
> 
> Signed-off-by: David Hunt 

Acked-by: John McNamara 



[dpdk-dev] [PATCH v9 4/5] cryptodev: change burst API to be crypto op oriented

2016-03-10 Thread Trahe, Fiona
HI Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Thursday, March 10, 2016 4:03 PM
> To: Trahe, Fiona
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v9 4/5] cryptodev: change burst API to be 
> crypto
> op oriented
> 
> 2016-03-10 15:41, Fiona Trahe:
> > lib/librte_cryptodev/rte_crypto_sym.h  | 374 ++--
> 
> Sorry there is another issue:
> 
> rte_crypto_sym.h:622: warning: argument 'op' of command @param is not
> found in the argument list of __rte_crypto_sym_op_attach_sym_session(struct
> rte_crypto_sym_op *sym_op, struct rte_cryptodev_sym_session *sess)
> rte_crypto_sym.h:628: warning: The following parameters of
> __rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op,
> struct rte_cryptodev_sym_session *sess) are not documented:
>   parameter 'sym_op'
> rte_crypto_sym.h:592: warning: unable to resolve reference to
> `rte_cryptodev_session_create' for \ref command
> 
> I've fixed it with the following changes:
> 
>  * The length of the data pointed to by this field is
>  * set up for the session in the @ref
>  * rte_crypto_auth_xform structure as part of the @ref
> -* rte_cryptodev_session_create function call.  This
> -* length must not exceed 240 bytes.
> +* rte_cryptodev_sym_session_create function call.
> +* This length must not exceed 240 bytes.
> 
>  /**
>   * Attach a session to a symmetric crypto operation
>   *
> - * @param  op  crypto operation
> + * @param  sym_op  crypto operation
>   * @param  sesscryptodev session
>   */

This is great fun :)
Do you need me to respin a v10 with that fix?
Or have you applied with the fix?


[dpdk-dev] [PATCH] l3fwd: Fix compilation & enable exact match mode on ARM.

2016-03-10 Thread maciej.cze...@caviumnetworks.com
From: Maciej Czekaj 

Enable NEON support in exact match mode.
l3fwd example did not compile on ARM due to SSE2 instrincics used
in generic part.
Some instrinsins were used to initialize data structures and those were
replaced by ordinary structure initalization.
All SSE2 intrinsics used in forwarding, i.e. masking the IP/TCP header
are moved to single inline function and made arch-specific.

Signed-off-by: Maciej Czekaj 
---
 examples/l3fwd/l3fwd.h|  4 ++-
 examples/l3fwd/l3fwd_em.c | 72 +--
 examples/l3fwd/main.c |  2 +-
 3 files changed, 48 insertions(+), 30 deletions(-)

diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index da6d369..7dcc7e5 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -34,6 +34,8 @@
 #ifndef __L3_FWD_H__
 #define __L3_FWD_H__

+#include 
+
 #define DO_RFC_1812_CHECKS

 #define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
@@ -103,7 +105,7 @@ extern uint32_t enabled_port_mask;
 extern int ipv6; /**< ipv6 is false by default. */
 extern uint32_t hash_entry_number;

-extern __m128i val_eth[RTE_MAX_ETHPORTS];
+extern xmm_t val_eth[RTE_MAX_ETHPORTS];

 extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index f6a65d8..0adf8f4 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -85,7 +85,7 @@ union ipv4_5tuple_host {
uint16_t port_src;
uint16_t port_dst;
};
-   __m128i xmm;
+   xmm_t xmm;
 };

 #define XMM_NUM_IN_IPV6_5TUPLE 3
@@ -109,9 +109,11 @@ union ipv6_5tuple_host {
uint16_t port_dst;
uint64_t reserve;
};
-   __m128i xmm[XMM_NUM_IN_IPV6_5TUPLE];
+   xmm_t xmm[XMM_NUM_IN_IPV6_5TUPLE];
 };

+
+
 struct ipv4_l3fwd_em_route {
struct ipv4_5tuple key;
uint8_t if_out;
@@ -236,9 +238,27 @@ ipv6_hash_crc(const void *data, __rte_unused uint32_t 
data_len,
 static uint8_t ipv4_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;
 static uint8_t ipv6_l3fwd_out_if[L3FWD_HASH_ENTRIES] __rte_cache_aligned;

-static __m128i mask0;
-static __m128i mask1;
-static __m128i mask2;
+static rte_xmm_t mask0;
+static rte_xmm_t mask1;
+static rte_xmm_t mask2;
+
+#if defined(__SSE2__)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   __m128i data = _mm_loadu_si128((__m128i *)(key));
+
+   return _mm_and_si128(data, mask);
+}
+#elif defined(__ARM_NEON)
+static inline xmm_t
+em_mask_key(void *key, xmm_t mask)
+{
+   int32x4_t data = vld1q_s32((int32_t *)key);
+
+   return vandq_s32(data, mask);
+}
+#endif

 static inline uint8_t
 em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void *lookup_struct)
@@ -249,13 +269,12 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void 
*lookup_struct)
(struct rte_hash *)lookup_struct;

ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, 
time_to_live);
-   __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr));

/*
 * Get 5 tuple: dst port, src port, dst IP address,
 * src IP address and protocol.
 */
-   key.xmm = _mm_and_si128(data, mask0);
+   key.xmm = em_mask_key(ipv4_hdr, mask0.x);

/* Find destination port */
ret = rte_hash_lookup(ipv4_l3fwd_lookup_struct, (const void *));
@@ -271,35 +290,31 @@ em_get_ipv6_dst_port(void *ipv6_hdr,  uint8_t portid, 
void *lookup_struct)
(struct rte_hash *)lookup_struct;

ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len);
-   __m128i data0 =
-   _mm_loadu_si128((__m128i *)(ipv6_hdr));
-   __m128i data1 =
-   _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr)+
-   sizeof(__m128i)));
-   __m128i data2 =
-   _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr)+
-   sizeof(__m128i)+sizeof(__m128i)));
+   void *data0 = ipv6_hdr;
+   void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t);
+   void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t);

/* Get part of 5 tuple: src IP address lower 96 bits and protocol */
-   key.xmm[0] = _mm_and_si128(data0, mask1);
+   key.xmm[0] = em_mask_key(data0, mask1.x);

/*
 * Get part of 5 tuple: dst IP address lower 96 bits
 * and src IP address higher 32 bits.
 */
-   key.xmm[1] = data1;
+   key.xmm[1] = *(xmm_t *)data1;

/*
 * Get part of 5 tuple: dst port and src port
 * and dst IP address higher 32 bits.
 */
-   key.xmm[2] = _mm_and_si128(data2, mask2);
+   key.xmm[2] = em_mask_key(data2, mask2.x);

/* Find destination port */
ret = rte_hash_lookup(ipv6_l3fwd_lookup_struct, (const void *));
return (uint8_t)((ret < 0) ? portid : ipv6_l3fwd_out_if[ret]);
 }

+
 /*
  * 

[dpdk-dev] [PATCH] l3fwd: Fix compilation & enable exact match mode on ARM

2016-03-10 Thread maciej.cze...@caviumnetworks.com
From: Maciej Czekaj 

This patch depends on following pending patches:
lpm: add support for NEON
http://dpdk.org/dev/patchwork/patch/10479/
lpm: make rte_lpm_lookupx4 API definition architecture agnostic
http://dpdk.org/dev/patchwork/patch/10478/

Maciej Czekaj (1):
  l3fwd: Fix compilation & enable exact match mode on ARM.

 examples/l3fwd/l3fwd.h|  4 ++-
 examples/l3fwd/l3fwd_em.c | 72 +--
 examples/l3fwd/main.c |  2 +-
 3 files changed, 48 insertions(+), 30 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH v2] vhost: Fix default value of kickfd and callfd

2016-03-10 Thread Tetsuya Mukawa
Currently, default values of kickfd and callfd are -1.
If the values are -1, current code guesses kickfd and callfd haven't
been initialized yet. And vhost library will guess the virtqueue isn't
ready for processing.
But callfd and kickfd will be set as -1 when "--enable-kvm"
isn't specified in QEMU command line. It means we cannot treat -1 as
uninitialized state. The patch changes default values to -2. And the
patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_vhost/rte_virtio_net.h |  1 +
 lib/librte_vhost/vhost_user/virtio-net-user.c | 10 +-
 lib/librte_vhost/virtio-net.c |  4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/librte_vhost/rte_virtio_net.h 
b/lib/librte_vhost/rte_virtio_net.h
index 7d1fde2..d745707 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -89,6 +89,7 @@ struct vhost_virtqueue {
uint16_tvhost_hlen; /**< Vhost header 
length (varies depending on RX merge buffers. */
volatile uint16_t   last_used_idx;  /**< Last index used on 
the available ring */
volatile uint16_t   last_used_idx_res;  /**< Used for multiple 
devices reserving buffers. */
+#define VIRTIO_UNINITIALIZED_EVENTFD   (-2)
int callfd; /**< Used to notify the 
guest (trigger interrupt). */
int kickfd; /**< Currently unused 
as polling mode is enabled. */
int enabled;
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c 
b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 65b5652..4c156a6 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -225,8 +225,8 @@ static int
 vq_is_ready(struct vhost_virtqueue *vq)
 {
return vq && vq->desc   &&
-  vq->kickfd != -1 &&
-  vq->callfd != -1;
+  vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD &&
+  vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD;
 }

 static int
@@ -316,10 +316,10 @@ user_get_vring_base(struct vhost_device_ctx ctx,
 * sent and only sent in vhost_vring_stop.
 * TODO: cleanup the vring, it isn't usable since here.
 */
-   if (dev->virtqueue[state->index]->kickfd >= 0) {
+   if (dev->virtqueue[state->index]->kickfd >= 0)
close(dev->virtqueue[state->index]->kickfd);
-   dev->virtqueue[state->index]->kickfd = -1;
-   }
+
+   dev->virtqueue[state->index]->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;

return 0;
 }
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index fe1a77e..3498e9d 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int qp_idx)
 {
memset(vq, 0, sizeof(struct vhost_virtqueue));

-   vq->kickfd = -1;
-   vq->callfd = -1;
+   vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
+   vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD;

/* Backends are set to -1 indicating an inactive device. */
vq->backend = -1;
-- 
2.1.4



[dpdk-dev] [PATCH] ethdev: don't count missed packets in erroneous packets counter

2016-03-10 Thread Igor Ryzhov
Comment for "ierrors" counter says that it counts erroneous received packets. 
But for some reason "imissed" counter is added to "ierrors" counter in most 
drivers. It is a mistake, because missed packets are obviously not received. 
This patch fixes it.

Signed-off-by: Igor Ryzhov 
---
 app/test-pmd/testpmd.c   | 4 ++--
 drivers/net/cxgbe/cxgbe_ethdev.c | 2 +-
 drivers/net/e1000/em_ethdev.c| 1 -
 drivers/net/e1000/igb_ethdev.c   | 1 -
 drivers/net/i40e/i40e_ethdev.c   | 3 +--
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 -
 6 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 269ef81..d3d733b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -753,7 +753,7 @@ fwd_port_stats_display(portid_t port_id, struct 
rte_eth_stats *stats)
if (cur_fwd_eng == _fwd_engine)
printf("  Bad-ipcsum: %-14"PRIu64" Bad-l4csum: 
%-14"PRIu64" \n",
   port->rx_bad_ip_csum, port->rx_bad_l4_csum);
-   if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) 
{
+   if ((stats->ierrors + stats->rx_nombuf) > 0) {
printf("  RX-error: %-"PRIu64"\n",  stats->ierrors);
printf("  RX-nombufs: %-14"PRIu64"\n", 
stats->rx_nombuf);
}
@@ -772,7 +772,7 @@ fwd_port_stats_display(portid_t port_id, struct 
rte_eth_stats *stats)
if (cur_fwd_eng == _fwd_engine)
printf("  Bad-ipcsum:%14"PRIu64"
Bad-l4csum:%14"PRIu64"\n",
   port->rx_bad_ip_csum, port->rx_bad_l4_csum);
-   if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) 
{
+   if ((stats->ierrors + stats->rx_nombuf) > 0) {
printf("  RX-error:%"PRIu64"\n", stats->ierrors);
printf("  RX-nombufs: %14"PRIu64"\n",
   stats->rx_nombuf);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 97ef152..0070e2a 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -662,7 +662,7 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
  ps.rx_trunc2 + ps.rx_trunc3;
eth_stats->ierrors  = ps.rx_symbol_err + ps.rx_fcs_err +
  ps.rx_jabber + ps.rx_too_long + ps.rx_runt +
- ps.rx_len_err + eth_stats->imissed;
+ ps.rx_len_err;

/* TX Stats */
eth_stats->opackets = ps.tx_frames;
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 4a843fe..27ace6d 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -914,7 +914,6 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *rte_stats)
rte_stats->imissed = stats->mpc;
rte_stats->ierrors = stats->crcerrs +
 stats->rlec + stats->ruc + stats->roc +
-rte_stats->imissed +
 stats->rxerrc + stats->algnerrc + stats->cexterr;

/* Tx Errors */
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 4ed5e95..6e93214 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1640,7 +1640,6 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *rte_stats)
rte_stats->imissed = stats->mpc;
rte_stats->ierrors = stats->crcerrs +
 stats->rlec + stats->ruc + stats->roc +
-rte_stats->imissed +
 stats->rxerrc + stats->algnerrc + stats->cexterr;

/* Tx Errors */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7e68c61..7d68d4d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2062,8 +2062,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
pf->main_vsi->eth_stats.rx_discards;
stats->ierrors  = ns->crc_errors +
ns->rx_length_errors + ns->rx_undersize +
-   ns->rx_oversize + ns->rx_fragments + ns->rx_jabber +
-   stats->imissed;
+   ns->rx_oversize + ns->rx_fragments + ns->rx_jabber;

PMD_DRV_LOG(DEBUG, "* PF stats start 
***");
PMD_DRV_LOG(DEBUG, "rx_bytes:%"PRIu64"", ns->eth.rx_bytes);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3e6fe86..ba84544 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2552,7 +2552,6 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
  hw_stats->rlec +
  

[dpdk-dev] [PATCH v3 0/2] add support for buffered tx to ethdev

2016-03-10 Thread Jastrzebski, MichalX K
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ananyev,
> Konstantin
> Sent: Thursday, March 10, 2016 12:32 PM
> To: Kulasek, TomaszX ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/2] add support for buffered tx to
> ethdev
> 
> > Many sample apps include internal buffering for single-packet-at-a-time
> > operation. Since this is such a common paradigm, this functionality is
> > better suited to being implemented in the ethdev API.
> >
> > The new APIs in the ethdev library are:
> > * rte_eth_tx_buffer_init - initialize buffer
> > * rte_eth_tx_buffer - buffer up a single packet for future transmission
> > * rte_eth_tx_buffer_flush - flush any unsent buffered packets
> > * rte_eth_tx_buffer_set_err_callback - set up a callback to be called in
> >   case transmitting a buffered burst fails. By default, we just free the
> >   unsent packets.
> >
> > As well as these, an additional reference callbacks are provided, which
> > frees the packets:
> >
> > * rte_eth_tx_buffer_drop_callback - silently drop packets (default
> >   behavior)
> > * rte_eth_tx_buffer_count_callback - drop and update user-provided
> counter
> >   to track the number of dropped packets
> >
> > Due to the feedback from mailing list, that buffer management facilities
> > in the user application are more preferable than API simplicity, we
> decided
> > to move internal buffer table, as well as callback functions and user data,
> > from rte_eth_dev/rte_eth_dev_data to the application space.
> > It prevents ABI breakage and gives some more flexibility in the buffer's
> > management such as allocation, dynamical size change, reuse buffers on
> many
> > ports or after fail, and so on.
> >
> >
> > The following steps illustrate how tx buffers can be used in application:
> >
> > 1) Initialization
> >
> > a) Allocate memory for a buffer
> >
> >struct rte_eth_dev_tx_buffer *buffer = rte_zmalloc_socket("tx_buffer",
> >RTE_ETH_TX_BUFFER_SIZE(MAX_PKT_BURST), 0, socket_id);
> >
> >RTE_ETH_TX_BUFFER_SIZE(size) macro computes memory required to
> store
> >"size" packets in buffer.
> >
> > b) Initialize allocated memory and set up default values. Threshold level
> >must be lower than or equal to the MAX_PKT_BURST from 1a)
> >
> >rte_eth_tx_buffer_init(buffer, threshold);
> >
> >
> > c) Set error callback (optional)
> >
> >rte_eth_tx_buffer_set_err_callback(buffer, callback_fn, userdata);
> >
> >
> > 2) Store packet "pkt" in buffer and send them all to the queue_id on
> >port_id when number of packets reaches threshold level set up in 1b)
> >
> >rte_eth_tx_buffer(port_id, queue_id, buffer, pkt);
> >
> >
> > 3) Send all stored packets to the queue_id on port_id
> >
> >rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
> >
> >
> > 4) Flush buffer and free memory
> >
> >rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
> >...
> >rte_free(buffer);
> >
> > v3 changes:
> >  - error counter removed from tx buffer structure, now default behavior is
> >silent drop of unsent packets
> >  - some names was changed in tx buffer structure to be more descriptive
> >  - two default calbacks are provided: rte_eth_tx_buffer_drop_callback and
> >rte_eth_tx_buffer_count_callback
> >
> > v2 changes:
> >  - reworked to use new buffer model
> >  - buffer data and callbacks are removed from
> rte_eth_dev/rte_eth_dev_data,
> >so this patch doesn't brake an ABI anymore
> >  - introduced RTE_ETH_TX_BUFFER macro and rte_eth_tx_buffer_init
> >  - buffers are not attached to the port-queue
> >  - buffers can be allocated dynamically during application work
> >  - size of buffer can be changed without port restart
> >
> > Tomasz Kulasek (2):
> >   ethdev: add buffered tx api
> >   examples: rework to use buffered tx
> >
> >  examples/l2fwd-jobstats/main.c |  104 --
> >  examples/l2fwd-keepalive/main.c|  100 --
> >  examples/l2fwd/main.c  |  104 --
> >  examples/l3fwd-acl/main.c  |   92 -
> >  examples/l3fwd-power/main.c|   89 -
> >  examples/link_status_interrupt/main.c  |  107 --
> >  .../client_server_mp/mp_client/client.c|  101 ++
> >  examples/multi_process/l2fwd_fork/main.c   |   97 -
> >  examples/packet_ordering/main.c|  122 
> >  examples/qos_meter/main.c  |   61 ++
> >  lib/librte_ether/rte_ethdev.c  |   46 +
> >  lib/librte_ether/rte_ethdev.h  |  205 
> > +++-
> >  lib/librte_ether/rte_ether_version.map |   10 +
> >  13 files changed, 696 insertions(+), 542 deletions(-)
> >
> > --
> 
> Acked-by: Konstantin Ananyev 
> 
> > 1.7.9.5

Hi Thomas,
Could You write please does this patch meet Your requirements and 
does it 

[dpdk-dev] [PATCH] doc: add mempool mgr ABI deprication notice

2016-03-10 Thread Thomas Monjalon
2016-03-10 13:56, Wiles, Keith:
> >On Thu, Mar 10, 2016 at 01:37:27PM +0100, Olivier MATZ wrote:
> >> Hi David,
> >> 
> >> On 03/10/2016 12:55 PM, David Hunt wrote:
> >> > Announce the ABI breakage due to addition of external mempool
> >> > manager functionality which requires changes to rte_mempool
> >> > structure.
> >> > 
> >> > Signed-off-by: David Hunt 
> >> 
> >> Acked-by: Olivier Matz 
> >> 
> >Acked-by: Bruce Richardson 
> 
> Asked-by: Keith Wiles 

Is it on purpose, Keith, or a typo? Do you have asked this notice?



[dpdk-dev] [PATCH] virtio: fix wrong features returned for legacy virtio

2016-03-10 Thread Yuanhan Liu
On Thu, Mar 10, 2016 at 08:43:37AM +0100, David Marchand wrote:
> On Thu, Mar 10, 2016 at 8:01 AM, Yuanhan Liu
>  wrote:
> > Declare dst as type uint32_t instead of uint64_t, otherwise, we will get
> > a random upper 32 bit feature bits, as the following io port read reads
> > lower 32 bit only. It could lead a feature bits that include 
> > VIRTIO_F_VERSION_1
> > (the 32th bit) for legacy virtio, which is obviously wrong.
> >
> > Fixes: b8f04520ad71 ("virtio: use PCI ioport API")
> >
> > Cc: David Marchand 
> > Signed-off-by: Yuanhan Liu 
> 
> Argh, good catch.
> Relooked at my patch, this should be the only bug (of this kind ;-)).

Yes, I also have a check while making this patch.

--yliu
> 
> Reviewed-by: David Marchand 
> 
> 
> -- 
> David Marchand


[dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations

2016-03-10 Thread Panu Matilainen
Tell the compiler to use unsigned constants for left shift ops,
otherwise building with gcc >= 6.0 fails due to multiple warnings like:
warning: left shift of negative value [-Wshift-negative-value]

Signed-off-by: Panu Matilainen 
---
 examples/ip_pipeline/pipeline/pipeline_common_fe.c | 4 ++--
 examples/ip_pipeline/pipeline/pipeline_firewall.c  | 4 ++--
 examples/ip_pipeline/pipeline/pipeline_routing.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c 
b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
index bffc9a4..a691d42 100644
--- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c
+++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c
@@ -337,7 +337,7 @@ app_link_config(struct app_params *app,
return -1;
}

-   netmask = (~0) << (32 - depth);
+   netmask = (~0U) << (32 - depth);
host = ip & netmask;
bcast = host | (~netmask);

@@ -889,7 +889,7 @@ print_link_info(struct app_link_params *p)
 {
struct rte_eth_stats stats;
struct ether_addr *mac_addr;
-   uint32_t netmask = (~0) << (32 - p->depth);
+   uint32_t netmask = (~0U) << (32 - p->depth);
uint32_t host = p->ip & netmask;
uint32_t bcast = host | (~netmask);

diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c 
b/examples/ip_pipeline/pipeline/pipeline_firewall.c
index 3d7ea7a..320b25d 100644
--- a/examples/ip_pipeline/pipeline/pipeline_firewall.c
+++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c
@@ -256,10 +256,10 @@ app_pipeline_firewall_key_check_and_normalize(struct 
pipeline_firewall_key *key)
return -1;

if (src_ip_depth)
-   src_ip_netmask = (~0) << (32 - src_ip_depth);
+   src_ip_netmask = (~0U) << (32 - src_ip_depth);

if (dst_ip_depth)
-   dst_ip_netmask = ((~0) << (32 - dst_ip_depth));
+   dst_ip_netmask = ((~0U) << (32 - dst_ip_depth));

key->key.ipv4_5tuple.src_ip &= src_ip_netmask;
key->key.ipv4_5tuple.dst_ip &= dst_ip_netmask;
diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c 
b/examples/ip_pipeline/pipeline/pipeline_routing.c
index 6354730..62a5eec 100644
--- a/examples/ip_pipeline/pipeline/pipeline_routing.c
+++ b/examples/ip_pipeline/pipeline/pipeline_routing.c
@@ -319,7 +319,7 @@ app_pipeline_routing_add_route(struct app_params *app,
if ((depth == 0) || (depth > 32))
return -1;

-   netmask = (~0) << (32 - depth);
+   netmask = (~U0) << (32 - depth);
key->key.ipv4.ip &= netmask;

/* data */
@@ -421,7 +421,7 @@ app_pipeline_routing_delete_route(struct app_params *app,
if ((depth == 0) || (depth > 32))
return -1;

-   netmask = (~0) << (32 - depth);
+   netmask = (~0U) << (32 - depth);
key->key.ipv4.ip &= netmask;
}
break;
-- 
2.5.0



[dpdk-dev] [PATCH 8/8] drivers/net/ixgbe: Fix uninitialized warning

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> Silence a compiler warning that this variable may be used uninitialized.
>
> Signed-off-by: Aaron Conole 
> ---
>   drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index e95e6b7..775edc7 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -1563,7 +1563,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf 
> **rx_pkts, uint16_t nb_pkts,
>   struct ixgbe_rx_entry *rxe;
>   struct ixgbe_scattered_rx_entry *sc_entry;
>   struct ixgbe_scattered_rx_entry *next_sc_entry;
> - struct ixgbe_rx_entry *next_rxe;
> + struct ixgbe_rx_entry *next_rxe = NULL;
>   struct rte_mbuf *first_seg;
>   struct rte_mbuf *rxm;
>   struct rte_mbuf *nmb;
> @@ -1740,7 +1740,7 @@ next_desc:
>* the pointer to the first mbuf at the NEXTP entry in the
>* sw_sc_ring and continue to parse the RX ring.
>*/
> - if (!eop) {
> + if (!eop && next_rxe) {
>   rxm->next = next_rxe->mbuf;
>   next_sc_entry->fbuf = first_seg;
>   goto next_desc;
>

The patch looks ok as such, but then again warning looks like a false 
positive to me: assignment and dereferencing depend on the same value of 
eop, which cannot change between the two.

CC'ing the maintainers for attention...

- Panu -


[dpdk-dev] [PATCH] vhost: Fix default value of kickfd and callfd

2016-03-10 Thread Tetsuya Mukawa
On 2016/03/10 15:39, Tan, Jianfeng wrote:
>
> On 3/10/2016 2:34 PM, Tetsuya Mukawa wrote:
>> On 2016/03/10 15:25, Tan, Jianfeng wrote:
>>>
>>> On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote:
 Currently, default value of kickfd and callfd is -1.
 If the value is -1, current code guess kickfd and callfd hasn't been
 initialized yet. And vhost library will guess the virtqueue isn't
 ready
 for processing.
 But callfd and kickfd will be set as -1 when "--enable-kvm"
 isn't specified in QEMU command line. It means we cannot treat -1 as
 uninitialized state. The patch changes default value to -2. And the
 patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD.

 Signed-off-by: Tetsuya Mukawa 
 ---
lib/librte_vhost/rte_virtio_net.h | 1 +
lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ---
lib/librte_vhost/virtio-net.c | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)

 diff --git a/lib/librte_vhost/rte_virtio_net.h
 b/lib/librte_vhost/rte_virtio_net.h
 index 7d1fde2..d745707 100644
 --- a/lib/librte_vhost/rte_virtio_net.h
 +++ b/lib/librte_vhost/rte_virtio_net.h
 @@ -89,6 +89,7 @@ struct vhost_virtqueue {
uint16_tvhost_hlen;/**< Vhost header length
 (varies depending on RX merge buffers. */
volatile uint16_tlast_used_idx;/**< Last index used
 on the available ring */
volatile uint16_tlast_used_idx_res;/**< Used for
 multiple devices reserving buffers. */
 +#define VIRTIO_UNINITIALIZED_EVENTFD(-2)
intcallfd;/**< Used to notify the guest
 (trigger interrupt). */
intkickfd;/**< Currently unused as
 polling mode is enabled. */
intenabled;
 diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c
 b/lib/librte_vhost/vhost_user/virtio-net-user.c
 index 65b5652..591f9bf 100644
 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c
 +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
 @@ -225,8 +225,8 @@ static int
vq_is_ready(struct vhost_virtqueue *vq)
{
return vq && vq->desc   &&
 -   vq->kickfd != -1 &&
 -   vq->callfd != -1;
 +   vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD &&
 +   vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD;
}
  static int
 @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx,
 */
if (dev->virtqueue[state->index]->kickfd >= 0) {
close(dev->virtqueue[state->index]->kickfd);
>>> Then -1 will be a valid value, need to check if it's not -1 to
>>> close()? Nevertheless, close(-1) brings no big problem.
>>>
>> We did it in above 'if' condition checking, then close(-1) will not be
>> called.
>
> Sorry, missed that. So when kickfd == -1, need to be set to
> VIRTIO_UNINITIALIZED_EVENTFD?
>

Aha, I've got it. Will change it.

Thanks,
Tetsuya

> Thanks,
> Jianfeng
>
>>
>> Thanks,
>> Tetsuya
>>
>>> Thanks,
>>> Jianfeng
>>>
 -dev->virtqueue[state->index]->kickfd = -1;
 +dev->virtqueue[state->index]->kickfd =
 +VIRTIO_UNINITIALIZED_EVENTFD;
}
  return 0;
 diff --git a/lib/librte_vhost/virtio-net.c
 b/lib/librte_vhost/virtio-net.c
 index fe1a77e..3498e9d 100644
 --- a/lib/librte_vhost/virtio-net.c
 +++ b/lib/librte_vhost/virtio-net.c
 @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int
 qp_idx)
{
memset(vq, 0, sizeof(struct vhost_virtqueue));
-vq->kickfd = -1;
 -vq->callfd = -1;
 +vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
 +vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD;
  /* Backends are set to -1 indicating an inactive device. */
vq->backend = -1;
>



[dpdk-dev] [PATCH V3 0/4] bonding: fixes and enhancements

2016-03-10 Thread Bruce Richardson
On Tue, Mar 01, 2016 at 09:31:58AM -0800, Eric Kinzie wrote:
> These are bug fixes and some small enhancements to allow bonding
> to work with external control (teamd). Please consider integrating
> these into DPDK 2.2
> 
> Changes in v2:
> - remove "bond: handle slaves with fewer queues than bonding device"
> - remove "bond: per-slave intermediate rx ring"
> 
> Changes in v3:
> This version has only fixes.  Patches with new functionality have been
> removed and will be submitted separately.
> - remove "bond mode 4: allow external state machine"
> - remove "bond: use existing enslaved device queues"
> 
> Eric Kinzie (4):
>   bond mode 4: copy entire config structure
>   bond mode 4: do not ignore multicast
>   bond: active slaves with no primary
>   bond: do not activate slave twice
> 
>  app/test/test_link_bonding_mode4.c|  7 +--
>  drivers/net/bonding/rte_eth_bond_8023ad.c |  1 +
>  drivers/net/bonding/rte_eth_bond_api.c| 13 +++--
>  drivers/net/bonding/rte_eth_bond_pmd.c|  1 +
>  4 files changed, 18 insertions(+), 4 deletions(-)
> 
> -- 
> 2.1.4
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH v9 5/5] mbuf_offload: remove library

2016-03-10 Thread Fiona Trahe
From: Declan Doherty 

As cryptodev library does not depend on mbuf_offload library
any longer, this patch removes it.

Signed-off-by: Declan Doherty 
---
 MAINTAINERS|   4 -
 app/test/test_cryptodev.c  |   1 -
 app/test/test_cryptodev_perf.c |   1 -
 config/common_base |   7 -
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |   1 -
 drivers/crypto/qat/qat_crypto.c|   1 -
 examples/l2fwd-crypto/main.c   |   1 -
 lib/Makefile   |   1 -
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 -
 .../rte_mbuf_offload_version.map   |   7 -
 14 files changed, 493 deletions(-)
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index e253bf7..421c317 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -223,10 +223,6 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c

-Packet buffer offload - EXPERIMENTAL
-M: Declan Doherty 
-F: lib/librte_mbuf_offload/
-
 Ethernet API
 M: Thomas Monjalon 
 F: lib/librte_ether/
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 55367df..3240ecd 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 

 #include 
 #include 
diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
index b43f9aa..b3f4fd9 100644
--- a/app/test/test_cryptodev_perf.c
+++ b/app/test/test_cryptodev_perf.c
@@ -32,7 +32,6 @@

 #include 
 #include 
-#include 
 #include 
 #include 

diff --git a/config/common_base b/config/common_base
index c73f71a..0a02924 100644
--- a/config/common_base
+++ b/config/common_base
@@ -361,13 +361,6 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128

 #
-# Compile librte_mbuf_offload
-# EXPERIMENTAL: API may change without prior notice
-#
-CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
-CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
-
-#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 7a91001..f626386 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -104,7 +104,6 @@ There are many libraries, so their headers may be grouped 
by topics:

 - **containers**:
   [mbuf]   (@ref rte_mbuf.h),
-  [mbuf_offload]   (@ref rte_mbuf_offload.h),
   [ring]   (@ref rte_ring.h),
   [distributor](@ref rte_distributor.h),
   [reorder](@ref rte_reorder.h),
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index f28b29f..9599cc4 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 

 #include "rte_aesni_mb_pmd_private.h"

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 11f7fb2..3533f37 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -59,7 +59,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 

 #include "qat_logs.h"
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 6aaa7c0..65e90b5 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -62,7 +62,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/lib/Makefile b/lib/Makefile
index 6840f87..f254dba 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -36,7 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
-DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index e39ad28..52f96c3 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -728,9 +728,6 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B 
alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
* with a single assignment */

-/** Opaque rte_mbuf_offload  

[dpdk-dev] [PATCH v9 4/5] cryptodev: change burst API to be crypto op oriented

2016-03-10 Thread Fiona Trahe
From: Declan Doherty 

This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts
rte_crypto_op's rather than the current implementation which operates on
rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the
use of crypto operations in general, including new functions for managing
rte_crypto_op pools.

These changes continues the separation of the symmetric operation parameters
from the more general operation parameters, which will simplify the integration
of asymmetric crypto operations in the future.

PMDs, unit tests and sample applications are also modified to work with the
modified and new API.

Signed-off-by: Declan Doherty 
---
 app/test/test_cryptodev.c  | 640 +++--
 app/test/test_cryptodev_perf.c | 221 ---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 133 +++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  12 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   4 +-
 drivers/crypto/qat/qat_crypto.c| 132 +++--
 drivers/crypto/qat/qat_crypto.h|  12 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   4 +-
 examples/l2fwd-crypto/main.c   | 164 +++---
 lib/librte_cryptodev/rte_crypto.h  | 352 +++-
 lib/librte_cryptodev/rte_crypto_sym.h  | 374 ++--
 lib/librte_cryptodev/rte_cryptodev.c   |  76 +++
 lib/librte_cryptodev/rte_cryptodev.h   | 108 ++--
 lib/librte_cryptodev/rte_cryptodev_version.map |   3 +-
 14 files changed, 1397 insertions(+), 838 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 5ced183..55367df 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -48,7 +48,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type;

 struct crypto_testsuite_params {
struct rte_mempool *mbuf_pool;
-   struct rte_mempool *mbuf_ol_pool;
+   struct rte_mempool *op_mpool;
struct rte_cryptodev_config conf;
struct rte_cryptodev_qp_conf qp_conf;

@@ -62,8 +62,7 @@ struct crypto_unittest_params {

struct rte_cryptodev_sym_session *sess;

-   struct rte_mbuf_offload *ol;
-   struct rte_crypto_sym_op *op;
+   struct rte_crypto_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -112,19 +111,21 @@ hexdump_mbuf_data(FILE *f, const char *title, struct 
rte_mbuf *m)
 }
 #endif

-static struct rte_mbuf *
-process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf)
+static struct rte_crypto_op *
+process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 {
-   struct rte_mbuf *obuf = NULL;
 #if HEX_DUMP
hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf);
 #endif

-   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
+   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
printf("Error sending packet for encryption");
return NULL;
}
-   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
+
+   op = NULL;
+
+   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
rte_pause();

 #if HEX_DUMP
@@ -132,7 +133,7 @@ process_crypto_request(uint8_t dev_id, struct rte_mbuf 
*ibuf)
hexdump_mbuf_data(stdout, "Dequeued Packet", obuf);
 #endif

-   return obuf;
+   return op;
 }

 static struct crypto_testsuite_params testsuite_params = { NULL };
@@ -162,13 +163,14 @@ testsuite_setup(void)
}
}

-   ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create(
-   "MBUF_OFFLOAD_POOL",
+   ts_params->op_mpool = rte_crypto_op_pool_create(
+   "MBUF_CRYPTO_SYM_OP_POOL",
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC,
NUM_MBUFS, MBUF_CACHE_SIZE,
DEFAULT_NUM_XFORMS *
sizeof(struct rte_crypto_sym_xform),
rte_socket_id());
-   if (ts_params->mbuf_ol_pool == NULL) {
+   if (ts_params->op_mpool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
return TEST_FAILED;
}
@@ -253,10 +255,9 @@ testsuite_teardown(void)
rte_mempool_count(ts_params->mbuf_pool));
}

-
-   if (ts_params->mbuf_ol_pool != NULL) {
+   if (ts_params->op_mpool != NULL) {
RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
-   rte_mempool_count(ts_params->mbuf_ol_pool));
+   rte_mempool_count(ts_params->op_mpool));
}

 }
@@ -326,8 +327,8 @@ ut_teardown(void)
}

/* free crypto operation structure */
-   if (ut_params->ol)
-   rte_pktmbuf_offload_free(ut_params->ol);
+   if (ut_params->op)
+   rte_crypto_op_free(ut_params->op);

/*
 * free mbuf - both obuf and ibuf are usually 

[dpdk-dev] [PATCH v9 3/5] cryptodev: remove unused phys_addr field from key

2016-03-10 Thread Fiona Trahe
Remove unused phys_addr field from key in crypto_xform, simplifiy struct
and fix knock-on impacts in l2fwd-crypto app

Signed-off-by: Fiona Trahe 
---
 examples/l2fwd-crypto/main.c  | 42 ++-
 lib/librte_cryptodev/rte_crypto_sym.h | 16 ++---
 2 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index ee519e7..9b6b7ef 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -112,6 +112,12 @@ enum l2fwd_crypto_xform_chain {
L2FWD_CRYPTO_HASH_CIPHER
 };

+struct l2fwd_key {
+   uint8_t *data;
+   uint32_t length;
+   phys_addr_t phys_addr;
+};
+
 /** l2fwd crypto application command line options */
 struct l2fwd_crypto_options {
unsigned portmask;
@@ -127,7 +133,7 @@ struct l2fwd_crypto_options {
struct rte_crypto_sym_xform cipher_xform;
uint8_t ckey_data[32];

-   struct rte_crypto_key iv_key;
+   struct l2fwd_key iv_key;
uint8_t ivkey_data[16];

struct rte_crypto_sym_xform auth_xform;
@@ -141,7 +147,7 @@ struct l2fwd_crypto_params {

unsigned digest_length;
unsigned block_size;
-   struct rte_crypto_key iv_key;
+   struct l2fwd_key iv_key;
struct rte_cryptodev_sym_session *session;
 };

@@ -744,7 +750,7 @@ parse_cipher_op(enum rte_crypto_cipher_operation *op, char 
*optarg)

 /** Parse crypto key command line argument */
 static int
-parse_key(struct rte_crypto_key *key __rte_unused,
+parse_key(struct l2fwd_key *key __rte_unused,
unsigned length __rte_unused, char *arg __rte_unused)
 {
printf("Currently an unsupported argument!\n");
@@ -820,11 +826,18 @@ l2fwd_crypto_parse_args_long_options(struct 
l2fwd_crypto_options *options,
return parse_cipher_op(>cipher_xform.cipher.op,
optarg);

-   else if (strcmp(lgopts[option_index].name, "cipher_key") == 0)
-   return parse_key(>cipher_xform.cipher.key,
-   sizeof(options->ckey_data), optarg);
+   else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) {
+   struct l2fwd_key key = { 0 };
+   int retval = 0;
+
+   retval = parse_key(, sizeof(options->ckey_data), optarg);
+
+   options->cipher_xform.cipher.key.data = key.data;
+   options->cipher_xform.cipher.key.length = key.length;

-   else if (strcmp(lgopts[option_index].name, "iv") == 0)
+   return retval;
+
+   } else if (strcmp(lgopts[option_index].name, "iv") == 0)
return parse_key(>iv_key, sizeof(options->ivkey_data),
optarg);

@@ -837,11 +850,18 @@ l2fwd_crypto_parse_args_long_options(struct 
l2fwd_crypto_options *options,
return parse_auth_op(>auth_xform.auth.op,
optarg);

-   else if (strcmp(lgopts[option_index].name, "auth_key") == 0)
-   return parse_key(>auth_xform.auth.key,
-   sizeof(options->akey_data), optarg);
+   else if (strcmp(lgopts[option_index].name, "auth_key") == 0) {
+   struct l2fwd_key key = { 0 };
+   int retval = 0;
+
+   retval = parse_key(, sizeof(options->akey_data), optarg);
+
+   options->auth_xform.auth.key.data = key.data;
+   options->auth_xform.auth.key.length = key.length;
+
+   return retval;

-   else if (strcmp(lgopts[option_index].name, "sessionless") == 0) {
+   } else if (strcmp(lgopts[option_index].name, "sessionless") == 0) {
options->sessionless = 1;
return 0;
}
diff --git a/lib/librte_cryptodev/rte_crypto_sym.h 
b/lib/librte_cryptodev/rte_crypto_sym.h
index de6c701..270510e 100644
--- a/lib/librte_cryptodev/rte_crypto_sym.h
+++ b/lib/librte_cryptodev/rte_crypto_sym.h
@@ -111,12 +111,6 @@ enum rte_crypto_cipher_operation {
/**< Decrypt cipher operation */
 };

-/** Crypto key structure */
-struct rte_crypto_key {
-   uint8_t *data;  /**< pointer to key data */
-   phys_addr_t phys_addr;
-   size_t length;  /**< key length in bytes */
-};

 /**
  * Symmetric Cipher Setup Data.
@@ -133,7 +127,10 @@ struct rte_crypto_cipher_xform {
enum rte_crypto_cipher_algorithm algo;
/**< Cipher algorithm */

-   struct rte_crypto_key key;
+   struct {
+   uint8_t *data;  /**< pointer to key data */
+   size_t length;  /**< key length in bytes */
+   } key;
/**< Cipher key
 *
 * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will
@@ -257,7 +254,10 @@ struct rte_crypto_auth_xform {
enum rte_crypto_auth_algorithm algo;
/**< Authentication algorithm selection */

-   struct rte_crypto_key key;
+   struct {
+   uint8_t *data;  /**< pointer 

[dpdk-dev] [PATCH v9 2/5] cryptodev: refactor to partition common from symmetric-specific code

2016-03-10 Thread Fiona Trahe
This patch splits symmetric specific definitions and
functions away from the common crypto APIs to facilitate the future extension
and expansion of the cryptodev framework, in order to allow asymmetric
crypto operations to be introduced at a later date, as well as to clean the
logical structure of the public includes. The patch also introduces the _sym
prefix to symmetric specific structure and functions to improve clarity in
the API.

Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c  | 161 +++---
 app/test/test_cryptodev_perf.c |  42 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  44 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |   6 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   4 +-
 drivers/crypto/qat/qat_crypto.c|  51 +-
 drivers/crypto/qat/qat_crypto.h|  10 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   |  31 +-
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 547 +--
 lib/librte_cryptodev/rte_crypto_sym.h  | 598 +
 lib/librte_cryptodev/rte_cryptodev.c   |  39 +-
 lib/librte_cryptodev/rte_cryptodev.h   |  46 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  22 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   6 +-
 lib/librte_mbuf_offload/rte_mbuf_offload.h |  22 +-
 17 files changed, 867 insertions(+), 771 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 1a0f204..5ced183 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -57,13 +57,13 @@ struct crypto_testsuite_params {
 };

 struct crypto_unittest_params {
-   struct rte_crypto_xform cipher_xform;
-   struct rte_crypto_xform auth_xform;
+   struct rte_crypto_sym_xform cipher_xform;
+   struct rte_crypto_sym_xform auth_xform;

-   struct rte_cryptodev_session *sess;
+   struct rte_cryptodev_sym_session *sess;

struct rte_mbuf_offload *ol;
-   struct rte_crypto_op *op;
+   struct rte_crypto_sym_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
struct crypto_unittest_params *ut_params);

 static int
-test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess,
+test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session 
*sess,
struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_param);

@@ -166,7 +166,7 @@ testsuite_setup(void)
"MBUF_OFFLOAD_POOL",
NUM_MBUFS, MBUF_CACHE_SIZE,
DEFAULT_NUM_XFORMS *
-   sizeof(struct rte_crypto_xform),
+   sizeof(struct rte_crypto_sym_xform),
rte_socket_id());
if (ts_params->mbuf_ol_pool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -221,7 +221,7 @@ testsuite_setup(void)

ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
-   ts_params->conf.session_mp.nb_objs = info.max_nb_sessions;
+   ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;

TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
_params->conf),
@@ -276,7 +276,7 @@ ut_setup(void)
ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
ts_params->conf.socket_id = SOCKET_ID_ANY;
ts_params->conf.session_mp.nb_objs =
-   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ?
+   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ?
DEFAULT_NUM_OPS_INFLIGHT :
DEFAULT_NUM_OPS_INFLIGHT;

@@ -320,7 +320,7 @@ ut_teardown(void)

/* free crypto session structure */
if (ut_params->sess) {
-   rte_cryptodev_session_free(ts_params->valid_devs[0],
+   rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
ut_params->sess = NULL;
}
@@ -465,7 +465,7 @@ test_queue_pair_descriptor_setup(void)

rte_cryptodev_info_get(ts_params->valid_devs[0], _info);

-   

[dpdk-dev] [PATCH v9 1/5] cryptodev: code cleanup

2016-03-10 Thread Fiona Trahe
- Fixed >80char lines in test file
- Removed unused elements from stats struct
- Removed unused objects in rte_cryptodev_pmd.h
- Renamed variables
- Replaced leading spaces with tabs
- Improved performance results display in test

Signed-off-by: Fiona Trahe 
Signed-off-by: Declan Doherty 
---
 app/test/test_cryptodev.c  | 151 ++---
 app/test/test_cryptodev.h  |   5 +-
 app/test/test_cryptodev_perf.c |  54 +---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  28 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  12 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +-
 lib/librte_cryptodev/rte_cryptodev.h   |  35 +
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  10 +-
 8 files changed, 139 insertions(+), 158 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 62f8fb0..1a0f204 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -165,7 +165,8 @@ testsuite_setup(void)
ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create(
"MBUF_OFFLOAD_POOL",
NUM_MBUFS, MBUF_CACHE_SIZE,
-   DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform),
+   DEFAULT_NUM_XFORMS *
+   sizeof(struct rte_crypto_xform),
rte_socket_id());
if (ts_params->mbuf_ol_pool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -679,76 +680,77 @@ static uint8_t aes_cbc_iv[] = {
 /* * AES-CBC / HMAC-SHA1 Hash Tests * */

 static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = {
-   0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31,
-   0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76,
-   0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E,
-   0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A,
-   0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E,
-   0X42, 0X3C, 0XFB, 0XE9, 0X1A, 0X24, 0XD6, 0X08,
-   0XDD, 0XFD, 0X16, 0XFB, 0XE9, 0X55, 0XEF, 0XF0,
-   0XA0, 0X8D, 0X13, 0XAB, 0X81, 0XC6, 0X90, 0X01,
-   0XB5, 0X18, 0X84, 0XB3, 0XF6, 0XE6, 0X11, 0X57,
-   0XD6, 0X71, 0XC6, 0X3C, 0X3F, 0X2F, 0X33, 0XEE,
-   0X24, 0X42, 0X6E, 0XAC, 0X0B, 0XCA, 0XEC, 0XF9,
-   0X84, 0XF8, 0X22, 0XAA, 0X60, 0XF0, 0X32, 0XA9,
-   0X75, 0X75, 0X3B, 0XCB, 0X70, 0X21, 0X0A, 0X8D,
-   0X0F, 0XE0, 0XC4, 0X78, 0X2B, 0XF8, 0X97, 0XE3,
-   0XE4, 0X26, 0X4B, 0X29, 0XDA, 0X88, 0XCD, 0X46,
-   0XEC, 0XAA, 0XF9, 0X7F, 0XF1, 0X15, 0XEA, 0XC3,
-   0X87, 0XE6, 0X31, 0XF2, 0XCF, 0XDE, 0X4D, 0X80,
-   0X70, 0X91, 0X7E, 0X0C, 0XF7, 0X26, 0X3A, 0X92,
-   0X4F, 0X18, 0X83, 0XC0, 0X8F, 0X59, 0X01, 0XA5,
-   0X88, 0XD1, 0XDB, 0X26, 0X71, 0X27, 0X16, 0XF5,
-   0XEE, 0X10, 0X82, 0XAC, 0X68, 0X26, 0X9B, 0XE2,
-   0X6D, 0XD8, 0X9A, 0X80, 0XDF, 0X04, 0X31, 0XD5,
-   0XF1, 0X35, 0X5C, 0X3B, 0XDD, 0X9A, 0X65, 0XBA,
-   0X58, 0X34, 0X85, 0X61, 0X1C, 0X42, 0X10, 0X76,
-   0X73, 0X02, 0X42, 0XC9, 0X23, 0X18, 0X8E, 0XB4,
-   0X6F, 0XB4, 0XA3, 0X54, 0X6E, 0X88, 0X3B, 0X62,
-   0X7C, 0X02, 0X8D, 0X4C, 0X9F, 0XC8, 0X45, 0XF4,
-   0XC9, 0XDE, 0X4F, 0XEB, 0X22, 0X83, 0X1B, 0XE4,
-   0X49, 0X37, 0XE4, 0XAD, 0XE7, 0XCD, 0X21, 0X54,
-   0XBC, 0X1C, 0XC2, 0X04, 0X97, 0XB4, 0X10, 0X61,
-   0XF0, 0XE4, 0XEF, 0X27, 0X63, 0X3A, 0XDA, 0X91,
-   0X41, 0X25, 0X62, 0X1C, 0X5C, 0XB6, 0X38, 0X4A,
-   0X88, 0X71, 0X59, 0X5A, 0X8D, 0XA0, 0X09, 0XAF,
-   0X72, 0X94, 0XD7, 0X79, 0X5C, 0X60, 0X7C, 0X8F,
-   0X4C, 0XF5, 0XD9, 0XA1, 0X39, 0X6D, 0X81, 0X28,
-   0XEF, 0X13, 0X28, 0XDF, 0XF5, 0X3E, 0XF7, 0X8E,
-   0X09, 0X9C, 0X78, 0X18, 0X79, 0XB8, 0X68, 0XD7,
-   0XA8, 0X29, 0X62, 0XAD, 0XDE, 0XE1, 0X61, 0X76,
-   0X1B, 0X05, 0X16, 0XCD, 0XBF, 0X02, 0X8E, 0XA6,
-   0X43, 0X6E, 0X92, 0X55, 0X4F, 0X60, 0X9C, 0X03,
-   0XB8, 0X4F, 0XA3, 0X02, 0XAC, 0XA8, 0XA7, 0X0C,
-   0X1E, 0XB5, 0X6B, 0XF8, 0XC8, 0X4D, 0XDE, 0XD2,
-   0XB0, 0X29, 0X6E, 0X40, 0XE6, 0XD6, 0XC9, 0XE6,
-   0XB9, 0X0F, 0XB6, 0X63, 0XF5, 0XAA, 0X2B, 0X96,
-   0XA7, 0X16, 0XAC, 0X4E, 0X0A, 0X33, 0X1C, 0XA6,
-   0XE6, 0XBD, 0X8A, 0XCF, 0X40, 0XA9, 0XB2, 0XFA,
-   0X63, 0X27, 0XFD, 0X9B, 0XD9, 0XFC, 0XD5, 0X87,
-   0X8D, 0X4C, 0XB6, 0XA4, 0XCB, 0XE7, 0X74, 0X55,
-   0XF4, 0XFB, 0X41, 0X25, 0XB5, 0X4B, 0X0A, 0X1B,
-   0XB1, 0XD6, 0XB7, 0XD9, 0X47, 0X2A, 0XC3, 0X98,
-   0X6A, 0XC4, 0X03, 0X73, 0X1F, 0X93, 0X6E, 0X53,
-   0X19, 0X25, 0X64, 0X15, 0X83, 0XF9, 0X73, 0X2A,
-   0X74, 0XB4, 0X93, 0X69, 0XC4, 0X72, 0XFC, 0X26,
-   0XA2, 0X9F, 0X43, 0X45, 0XDD, 0XB9, 0XEF, 0X36,
-   0XC8, 0X3A, 0XCD, 0X99, 0X9B, 0X54, 0X1A, 0X36,
-   0XC1, 0X59, 0XF8, 0X98, 0XA8, 0XCC, 0X28, 0X0D,
-   0X73, 0X4C, 0XEE, 0X98, 0XCB, 0X7C, 0X58, 0X7E,
-   0X20, 0X75, 0X1E, 0XB7, 0XC9, 0XF8, 0XF2, 

[dpdk-dev] [PATCH v9 0/5] cryptodev API changes

2016-03-10 Thread Fiona Trahe
From: Pablo de Lara 

This patch set separates the symmetric crypto operations from generic operations
and then modifies the cryptodev burst API to accept bursts of rte_crypto_op 
rather
than rte_mbufs.

v9:
- include missing casting that was making C++ complain

v8:
- split patchset for easier review
- fix broken /examples/l2fwd-crypto build in intermediate patch
- split removal of rte_mbuf_offload into separate commit

v7:
- remove trailing spaces introduced in v6
- rebase against recent config file changes

v6:
- restore EXPERIMENTAL label to cryptodev. Will handle removal in separate 
thread.
(email subject was incorrect in v5, so v5 hasn't arrived in patchwork, 
therefore v6 is in-reply-to v4 message id)

V5: 
- updates .map file
- removes EXPERIMENTAL label from rte_cryptodev.h

V4:
- Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset.
- Typo fix in cached attribute on rte_crypto_op structure.

V3:
 - Addresses V2 comments
 - Rebased for head

Declan Doherty (2):
  cryptodev: change burst API to be crypto op oriented
  mbuf_offload: remove library

Fiona Trahe (3):
  cryptodev: code cleanup
  cryptodev: refactor to partition common from symmetric-specific code
  cryptodev: remove unused phys_addr field from key

 MAINTAINERS|   4 -
 app/test/test_cryptodev.c  | 883 +++--
 app/test/test_cryptodev.h  |   5 +-
 app/test/test_cryptodev_perf.c | 270 ---
 config/common_base |   7 -
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 190 +++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  30 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  10 +-
 drivers/crypto/qat/qat_crypto.c| 160 ++--
 drivers/crypto/qat/qat_crypto.h|  14 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   | 234 +++---
 lib/Makefile   |   1 -
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 819 ---
 lib/librte_cryptodev/rte_crypto_sym.h  | 642 +++
 lib/librte_cryptodev/rte_cryptodev.c   | 115 ++-
 lib/librte_cryptodev/rte_cryptodev.h   | 189 ++---
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   9 +-
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 --
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 
 .../rte_mbuf_offload_version.map   |   7 -
 26 files changed, 2131 insertions(+), 1968 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

-- 
2.5.0



[dpdk-dev] [PATCH] vhost: Fix default value of kickfd and callfd

2016-03-10 Thread Tetsuya Mukawa
On 2016/03/10 15:25, Tan, Jianfeng wrote:
>
>
> On 3/10/2016 2:14 PM, Tetsuya Mukawa wrote:
>> Currently, default value of kickfd and callfd is -1.
>> If the value is -1, current code guess kickfd and callfd hasn't been
>> initialized yet. And vhost library will guess the virtqueue isn't ready
>> for processing.
>> But callfd and kickfd will be set as -1 when "--enable-kvm"
>> isn't specified in QEMU command line. It means we cannot treat -1 as
>> uninitialized state. The patch changes default value to -2. And the
>> patch defines -2 as VIRTIO_UNINITIALIZED_EVENTFD.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>   lib/librte_vhost/rte_virtio_net.h | 1 +
>>   lib/librte_vhost/vhost_user/virtio-net-user.c | 7 ---
>>   lib/librte_vhost/virtio-net.c | 4 ++--
>>   3 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/librte_vhost/rte_virtio_net.h
>> b/lib/librte_vhost/rte_virtio_net.h
>> index 7d1fde2..d745707 100644
>> --- a/lib/librte_vhost/rte_virtio_net.h
>> +++ b/lib/librte_vhost/rte_virtio_net.h
>> @@ -89,6 +89,7 @@ struct vhost_virtqueue {
>>   uint16_tvhost_hlen;/**< Vhost header length
>> (varies depending on RX merge buffers. */
>>   volatile uint16_tlast_used_idx;/**< Last index used
>> on the available ring */
>>   volatile uint16_tlast_used_idx_res;/**< Used for
>> multiple devices reserving buffers. */
>> +#define VIRTIO_UNINITIALIZED_EVENTFD(-2)
>>   intcallfd;/**< Used to notify the guest
>> (trigger interrupt). */
>>   intkickfd;/**< Currently unused as
>> polling mode is enabled. */
>>   intenabled;
>> diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c
>> b/lib/librte_vhost/vhost_user/virtio-net-user.c
>> index 65b5652..591f9bf 100644
>> --- a/lib/librte_vhost/vhost_user/virtio-net-user.c
>> +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
>> @@ -225,8 +225,8 @@ static int
>>   vq_is_ready(struct vhost_virtqueue *vq)
>>   {
>>   return vq && vq->desc   &&
>> -   vq->kickfd != -1 &&
>> -   vq->callfd != -1;
>> +   vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD &&
>> +   vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD;
>>   }
>> static int
>> @@ -318,7 +318,8 @@ user_get_vring_base(struct vhost_device_ctx ctx,
>>*/
>>   if (dev->virtqueue[state->index]->kickfd >= 0) {
>>   close(dev->virtqueue[state->index]->kickfd);
>
> Then -1 will be a valid value, need to check if it's not -1 to
> close()? Nevertheless, close(-1) brings no big problem.
>

We did it in above 'if' condition checking, then close(-1) will not be
called.

Thanks,
Tetsuya

> Thanks,
> Jianfeng
>
>> -dev->virtqueue[state->index]->kickfd = -1;
>> +dev->virtqueue[state->index]->kickfd =
>> +VIRTIO_UNINITIALIZED_EVENTFD;
>>   }
>> return 0;
>> diff --git a/lib/librte_vhost/virtio-net.c
>> b/lib/librte_vhost/virtio-net.c
>> index fe1a77e..3498e9d 100644
>> --- a/lib/librte_vhost/virtio-net.c
>> +++ b/lib/librte_vhost/virtio-net.c
>> @@ -263,8 +263,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int
>> qp_idx)
>>   {
>>   memset(vq, 0, sizeof(struct vhost_virtqueue));
>>   -vq->kickfd = -1;
>> -vq->callfd = -1;
>> +vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
>> +vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD;
>> /* Backends are set to -1 indicating an inactive device. */
>>   vq->backend = -1;
>



[dpdk-dev] [PATCH v3] ixgbe: fix ixgbevf RX/TX function assignment

2016-03-10 Thread Bruce Richardson
On Thu, Mar 10, 2016 at 03:29:13PM +, Zhang, Helin wrote:
> 
> 
> > -Original Message-
> > From: Richardson, Bruce
> > Sent: Thursday, March 10, 2016 11:26 PM
> > To: dev at dpdk.org; Tao, Zhe 
> > Cc: Zhang, Helin ; Richardson, Bruce
> > 
> > Subject: [PATCH v3] ixgbe: fix ixgbevf RX/TX function assignment
> > 
> > From: Zhe Tao 
> Acked-by: Helin Zhang 
> 
Applied to dpdk-next-net/rel_16_04

/Bruce


[dpdk-dev] [PATCH 7/8] drivers/net/ixgbe: Signed left shift operator

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> Tell the compiler to use an unsigned constant for the config shifts.
>
> Signed-off-by: Aaron Conole 
> ---
>   drivers/net/ixgbe/ixgbe_pf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index 2ffbd1f..8b5119f 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -236,9 +236,9 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
>   vfre_slot = (vf_num >> VFRE_SHIFT) > 0 ? 1 : 0;
>
>   /* Enable pools reserved to PF only */
> - IXGBE_WRITE_REG(hw, IXGBE_VFRE(vfre_slot), (~0) << vfre_offset);
> + IXGBE_WRITE_REG(hw, IXGBE_VFRE(vfre_slot), (~0U) << vfre_offset);
>   IXGBE_WRITE_REG(hw, IXGBE_VFRE(vfre_slot ^ 1), vfre_slot - 1);
> - IXGBE_WRITE_REG(hw, IXGBE_VFTE(vfre_slot), (~0) << vfre_offset);
> + IXGBE_WRITE_REG(hw, IXGBE_VFTE(vfre_slot), (~0U) << vfre_offset);
>   IXGBE_WRITE_REG(hw, IXGBE_VFTE(vfre_slot ^ 1), vfre_slot - 1);
>
>   /* PFDMA Tx General Switch Control Enables VMDQ loopback */
>
Acked-by: Panu Matilainen 

CC'd the ixgbe maintainers...

- Panu -


[dpdk-dev] [PATCH 6/8] drivers/net/e1000/igb: Signed left shift operator

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> Tell the compiler to use an unsigned constant for the config shifts.
>
> Signed-off-by: Aaron Conole 
> ---
>   drivers/net/e1000/igb_pf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
> index 1d00dda..afe80f5 100644
> --- a/drivers/net/e1000/igb_pf.c
> +++ b/drivers/net/e1000/igb_pf.c
> @@ -172,8 +172,8 @@ int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
>   E1000_WRITE_REG(hw, E1000_VT_CTL, vtctl);
>
>   /* Enable pools reserved to PF only */
> - E1000_WRITE_REG(hw, E1000_VFRE, (~0) << vf_num);
> - E1000_WRITE_REG(hw, E1000_VFTE, (~0) << vf_num);
> + E1000_WRITE_REG(hw, E1000_VFRE, (~0U) << vf_num);
> + E1000_WRITE_REG(hw, E1000_VFTE, (~0U) << vf_num);
>
>   /* PFDMA Tx General Switch Control Enables VMDQ loopback */
>   if (hw->mac.type == e1000_i350)
>
Acked-by: Panu Matilainen 

CC'd the e1000 maintainer too.

- Panu -


[dpdk-dev] [PATCH v3] ixgbe: fix ixgbevf RX/TX function assignment

2016-03-10 Thread Zhang, Helin


> -Original Message-
> From: Richardson, Bruce
> Sent: Thursday, March 10, 2016 11:26 PM
> To: dev at dpdk.org; Tao, Zhe 
> Cc: Zhang, Helin ; Richardson, Bruce
> 
> Subject: [PATCH v3] ixgbe: fix ixgbevf RX/TX function assignment
> 
> From: Zhe Tao 
Acked-by: Helin Zhang 



[dpdk-dev] [PATCH v3] ip_pipeline: add load balancing function to pass-through pipeline

2016-03-10 Thread Jasvinder Singh
The pass-through pipeline implementation is extended with load balancing
function. This function allows uniform distribution of the packets among
its output ports. For packets distribution, any application level logic
can be applied. For instance, in this implementation, hash value
computed over specific header fields of the incoming packets has been
used to spread traffic uniformly among the output ports.

The following pass-through configuration can be used for implementing
load balancing function over ipv4 traffic;

[PIPELINE0]
type = PASS-THROUGH
core = 0
pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0
pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
dma_src_offset = 278; mbuf (128) + headroom (128) + 1st ethertype offset (14) + 
ttl offset within ip header = 278 (ipv4)
dma_dst_offset = 128; mbuf (128)
dma_size = 16
dma_src_mask = 00FF
dma_hash_offset = 144; (dma_dst_offset+dma_size)
lb = hash

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
v3
* rebased on master

v2
* modify the action handler implementation

 .../ip_pipeline/pipeline/pipeline_actions_common.h |  22 ++
 .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 275 -
 .../ip_pipeline/pipeline/pipeline_passthrough_be.h |   1 +
 3 files changed, 236 insertions(+), 62 deletions(-)

diff --git a/examples/ip_pipeline/pipeline/pipeline_actions_common.h 
b/examples/ip_pipeline/pipeline/pipeline_actions_common.h
index 9958758..ab08612 100644
--- a/examples/ip_pipeline/pipeline/pipeline_actions_common.h
+++ b/examples/ip_pipeline/pipeline/pipeline_actions_common.h
@@ -59,6 +59,28 @@ f_ah(
\
return 0;   \
 }

+#define PIPELINE_PORT_IN_AH_HIJACK_ALL(f_ah, f_pkt_work, f_pkt4_work) \
+static int \
+f_ah(  \
+   struct rte_pipeline *p, \
+   struct rte_mbuf **pkts, \
+   uint32_t n_pkts,\
+   void *arg)  \
+{  \
+   uint64_t pkt_mask = RTE_LEN2MASK(n_pkts, uint64_t); \
+   uint32_t i; \
+   \
+   rte_pipeline_ah_packet_hijack(p, pkt_mask); \
+   \
+   for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)   \
+   f_pkt4_work([i], arg); \
+   \
+   for ( ; i < n_pkts; i++)\
+   f_pkt_work(pkts[i], arg);   \
+   \
+   return 0;   \
+}
+
 #define PIPELINE_TABLE_AH_HIT(f_ah, f_pkt_work, f_pkt4_work)   \
 static int \
 f_ah(  \
diff --git a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c 
b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
index 3e3fdd0..a0d11ae 100644
--- a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
+++ b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
@@ -73,7 +73,9 @@ pkt_work(
struct rte_mbuf *pkt,
void *arg,
uint32_t dma_size,
-   uint32_t hash_enabled)
+   uint32_t hash_enabled,
+   uint32_t lb_hash,
+   uint32_t port_out_pow2)
 {
struct pipeline_passthrough *p = arg;

@@ -91,8 +93,24 @@ pkt_work(
dma_dst[i] = dma_src[i] & dma_mask[i];

/* Read (dma_dst), compute (hash), write (hash) */
-   if (hash_enabled)
-   *dma_hash = p->f_hash(dma_dst, dma_size, 0);
+   if (hash_enabled) {
+   uint32_t hash = p->f_hash(dma_dst, dma_size, 0);
+   *dma_hash = hash;
+
+   if (lb_hash) {
+   uint32_t port_out;
+
+   if (port_out_pow2)
+   port_out
+   = hash & (p->p.n_ports_out - 1);
+   else
+   port_out
+   = hash % p->p.n_ports_out;
+
+   rte_pipeline_port_out_packet_insert(p->p.p,
+   port_out, pkt);
+   }
+   }
 }

 static inline __attribute__((always_inline)) void
@@ -100,7 +118,9 @@ pkt4_work(
struct rte_mbuf **pkts,
void *arg,
uint32_t dma_size,
-   uint32_t 

[dpdk-dev] [PATCH 5/8] drivers/net/ixgbe: Fix vlan filter missing brackets

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> The ixgbe vlan filter code has an if check with an incorrect whitespace.
>
> Signed-off-by: Aaron Conole 
> ---
>   drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c 
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 3e6fe86..2e1c3ad 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4258,10 +4258,11 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
> uint16_t vlan,
>   if (ixgbe_vmdq_mode_check(hw) < 0)
>   return -ENOTSUP;
>   for (pool_idx = 0; pool_idx < ETH_64_POOLS; pool_idx++) {
> - if (pool_mask & ((uint64_t)(1ULL << pool_idx)))
> + if (pool_mask & ((uint64_t)(1ULL << pool_idx))) {
>   ret = hw->mac.ops.set_vfta(hw,vlan,pool_idx,vlan_on);
>   if (ret < 0)
>   return ret;
> + }
>   }
>
>   return ret;
>

Acked-by: Panu Matilainen 

Seems really obvious but cc'd the ixgbe maintainers too.

- Panu -


[dpdk-dev] [PATCH 4/8] drivers/net/e1000: Fix missing lsc interrupt check brackets

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> The device lsc interupt check has a misleading whitespace around it which
> can be improved by adding appropriate braces to the check. Since the ret
> variable was checked after previous assignment, this introduces no functional
> change.
>
> Signed-off-by: Aaron Conole 
> ---
>   drivers/net/e1000/em_ethdev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 4a843fe..1d86091 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -637,13 +637,14 @@ eth_em_start(struct rte_eth_dev *dev)
>
>   if (rte_intr_allow_others(intr_handle)) {
>   /* check if lsc interrupt is enabled */
> - if (dev->data->dev_conf.intr_conf.lsc != 0)
> + if (dev->data->dev_conf.intr_conf.lsc != 0) {
>   ret = eth_em_interrupt_setup(dev);
>   if (ret) {
>   PMD_INIT_LOG(ERR, "Unable to setup interrupts");
>   em_dev_clear_queues(dev);
>   return ret;
>   }
> + }
>   } else {
>   rte_intr_callback_unregister(intr_handle,
>   eth_em_interrupt_handler,
>

Acked-by: Panu Matilainen 

Seems really obvious but cc'd the e1000 maintainer too.

- Panu -


[dpdk-dev] [PATCH v3] ixgbe: fix ixgbevf RX/TX function assignment

2016-03-10 Thread Bruce Richardson
From: Zhe Tao 

For the secondary process of DPDK to initialize ixgbevf, it will always
use the simple RX function or LRO RX function, and this behavior is not
the same RX/TX function selection logic as it is for the primary process.
Use the ixgbe_set_tx_function and ixgbe_set_rx_function to select the
RX/TX function when secondary process calls the init function for eth dev.

Fixes: 9d8a92628f21 ("ixgbe: remove simple scalar scattered Rx method") 

Signed-off-by: Zhe Tao 
Signed-off-by: Bruce Richardson 

---
V3: fixed spacing and string splitting issues flagged by checkpatch.pl
adjusted the fixes line to show original commit to introduce the bug
V2: add fixes line
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 891be50..a9a1583 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1291,8 +1291,21 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 * has already done this work. Only check we don't need a different
 * RX function */
if (rte_eal_process_type() != RTE_PROC_PRIMARY){
-   if (eth_dev->data->scattered_rx)
-   eth_dev->rx_pkt_burst = 
ixgbe_recv_pkts_lro_single_alloc;
+   struct ixgbe_tx_queue *txq;
+   /* TX queue function in primary, set by last queue initialized
+* Tx queue may not initialized by primary process
+*/
+   if (eth_dev->data->tx_queues) {
+   txq = 
eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues - 1];
+   ixgbe_set_tx_function(eth_dev, txq);
+   } else {
+   /* Use default TX function if we get here */
+   PMD_INIT_LOG(NOTICE,
+   "No TX queues configured yet. Using default TX 
function.");
+   }
+
+   ixgbe_set_rx_function(eth_dev);
+
return 0;
}

-- 
2.5.0



[dpdk-dev] [PATCH 2/8] app/test/test: Fix missing brackets

2016-03-10 Thread Panu Matilainen
On 02/25/2016 08:48 PM, Aaron Conole wrote:
> The test application calls printf(...) with the suite->suite_name argument.
> The intent (based on whitespace) in the printf is to check suite->suite_name
> first and then apply the printf. This doesn't happen due to missing brackets.
>
> Signed-off-by: Aaron Conole 
> ---
>   app/test/test.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test.c b/app/test/test.c
> index f35b304..ccad0e3 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -162,9 +162,10 @@ unit_test_suite_runner(struct unit_test_suite *suite)
>   int test_success;
>   unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 
> 0;
>
> - if (suite->suite_name)
> + if (suite->suite_name) {
>   printf(" + 
> --- +\n");
>   printf(" + Test Suite : %s\n", suite->suite_name);
> + }
>
>   if (suite->setup)
>   if (suite->setup() != 0)
>

Acked-by: Panu Matilainen 

This is just about as obvious as they get...

- Panu -


[dpdk-dev] [PATCH v5 4/4] ena: DPDK polling-mode driver for Amazon Elastic Network Adapters (ENA)

2016-03-10 Thread Hunt, David
Hi Jan,

On 3/7/2016 8:05 PM, Jan Medala wrote:

--snip--

> diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
> new file mode 100644
> index 000..7f069b9
> --- /dev/null
> +++ b/drivers/net/ena/ena_ethdev.h
> @@ -0,0 +1,154 @@
> +/*-
> +* BSD LICENSE
> +*
> +* Copyright (c) 2015-2016 Amazon.com, Inc. or its affiliates.
> +* All rights reserved.
> +*
> +* Redistribution and use in source and binary forms, with or without
> +* modification, are permitted provided that the following conditions
> +* are met:
> +*
> +* * Redistributions of source code must retain the above copyright
> +* notice, this list of conditions and the following disclaimer.
> +* * Redistributions in binary form must reproduce the above copyright
> +* notice, this list of conditions and the following disclaimer in
> +* the documentation and/or other materials provided with the
> +* distribution.
> +* * Neither the name of copyright holder nor the names of its
> +* contributors may be used to endorse or promote products derived
> +* from this software without specific prior written permission.
> +*
> +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +*/
> +
> +#ifndef _ENA_ETHDEV_H_
> +#define _ENA_ETHDEV_H_
> +
> +#include 
> +
> +#pragma GCC diagnostic ignored "-Wcast-qual"

Is this #pragma really needed here? My setup compiles fine without 
warnings, and I reckon it's better not have this line if it's not needed 
just in case we inadvertently introduce additional warnings in the future.

---snip--

The only other thing I'd note with the rest of the patch-set is the 
output from checkpatch, which Bruce has already mentioned.

Regards,
David.



[dpdk-dev] [PATCH v2] ixgbe: fix ixgbevf RX/TX function assignment

2016-03-10 Thread Bruce Richardson
On Tue, Mar 08, 2016 at 04:49:41PM +0800, Zhe Tao wrote:
> For the secondary process of DPDK to initialize ixgbevf, it will always
> use the simple RX function or LRO RX function, and this behavior is not
> the same RX/TX function selection logic as it is for the primary process,
> so use the ixgbe_set_tx_function and ixgbe_set_rx_function to select the
> RX/TX function when secondary process call the init function for eth dev.  
> 
> Fixes: abf7275bbaa2918 (ixgbe: move to drivers/net/)

That doesn't look to be the commit that actually introduced the bug.

> 
> V2:add fixes line
> 
> Signed-off-by: Zhe Tao 
> 

Checkpatch flags two minor issues with this:
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#33: FILE: drivers/net/ixgbe/ixgbe_ethdev.c:1299:
+   txq = 
eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];

  ^

WARNING:SPLIT_STRING: quoted string split across lines
#38: FILE: drivers/net/ixgbe/ixgbe_ethdev.c:1304:
+   PMD_INIT_LOG(NOTICE, "No TX queues configured yet. "
+"Using default TX function.");

total: 0 errors, 1 warnings, 1 checks, 23 lines checked

/Bruce



[dpdk-dev] [PATCH] virtio: fix wrong features returned for legacy virtio

2016-03-10 Thread Tan, Jianfeng


On 3/10/2016 3:01 PM, Yuanhan Liu wrote:
> Declare dst as type uint32_t instead of uint64_t, otherwise, we will get
> a random upper 32 bit feature bits, as the following io port read reads
> lower 32 bit only. It could lead a feature bits that include 
> VIRTIO_F_VERSION_1
> (the 32th bit) for legacy virtio, which is obviously wrong.
>
> Fixes: b8f04520ad71 ("virtio: use PCI ioport API")
>
> Cc: David Marchand 
> Signed-off-by: Yuanhan Liu 
> ---
>   drivers/net/virtio/virtio_pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index 98fc370..c007959 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,
>   static uint64_t
>   legacy_get_features(struct virtio_hw *hw)
>   {
> - uint64_t dst;
> + uint32_t dst;
>   
>   rte_eal_pci_ioport_read(>io, , 4, VIRTIO_PCI_HOST_FEATURES);
>   return dst;

Acked-by: Jianfeng Tan 


[dpdk-dev] [PATCH v3 3/3] mk: add DT_NEEDED entries for librte_eal external dependencies

2016-03-10 Thread Panu Matilainen
Details between the platforms differ somewhat, and for static
builds they need to be handled from mk/exec-env still.

Signed-off-by: Panu Matilainen 
---
 lib/librte_eal/bsdapp/eal/Makefile   | 4 
 lib/librte_eal/linuxapp/eal/Makefile | 4 
 2 files changed, 8 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index 9ecf429..349b0d0 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -44,6 +44,10 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ring
 CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
 CFLAGS += $(WERROR_FLAGS) -O3

+LDLIBS += -lexecinfo
+LDLIBS += -lpthread
+LDLIBS += -lgcc_s
+
 EXPORT_MAP := rte_eal_version.map

 LIBABIVER := 2
diff --git a/lib/librte_eal/linuxapp/eal/Makefile 
b/lib/librte_eal/linuxapp/eal/Makefile
index d72f035..25b3a8e 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -49,6 +49,10 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
 CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem
 CFLAGS += $(WERROR_FLAGS) -O3

+LDLIBS += -ldl
+LDLIBS += -lpthread
+LDLIBS += -lgcc_s
+
 # specific to linuxapp exec-env
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) := eal.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_hugepage_info.c
-- 
2.5.0



[dpdk-dev] [PATCH v3 2/3] mk: add DT_NEEDED entries for librte_vhost external dependencies

2016-03-10 Thread Panu Matilainen
Add DT_NEEDED entries for external library dependencies which
are the most critical ones for sane operation.
Clean up vhost_cuse CFLAGS/LDFLAGS confusion while at it.

Signed-off-by: Panu Matilainen 
---
 lib/librte_vhost/Makefile |  7 ---
 mk/rte.app.mk | 14 ++
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index ef9bbae..e33ff53 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -41,13 +41,14 @@ LIBABIVER := 2
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
 CFLAGS += -I vhost_user
+LDLIBS += -lpthread
 else
-CFLAGS += -I vhost_cuse -lfuse
-LDFLAGS += -lfuse
+CFLAGS += -I vhost_cuse
+LDLIBS += -lfuse
 endif

 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-LDFLAGS += -lnuma
+LDLIBS += -lnuma
 endif

 # all source are stored in SRCS-y
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index cadc7ab..e1cdddf 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -80,14 +80,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter
 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lnuma
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
-endif
-
 # The static libraries do not know their dependencies.
 # So linking with static library requires explicit dependencies.
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
@@ -102,6 +94,12 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)  += -lgxio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)+= -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lnuma
+endif
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lfuse
+endif
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS

 _LDLIBS-y += --start-group
-- 
2.5.0



[dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion

2016-03-10 Thread Panu Matilainen
There are two places that need -lm (test app and librte_sched) and
exactly one that needs -lrt (librte_sched). Add the relevant
DT_NEEDED entries to both, and eliminate the bogus discrepancy
between Linux and BSD EXECENV_LDLIBS wrt these libs.

Signed-off-by: Panu Matilainen 
---
 app/test/Makefile| 2 ++
 lib/librte_sched/Makefile| 3 +++
 mk/exec-env/linuxapp/rte.vars.mk | 2 +-
 mk/rte.app.mk| 6 ++
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/app/test/Makefile b/app/test/Makefile
index ec33e1a..00e4df2 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -160,6 +160,8 @@ CFLAGS += $(WERROR_FLAGS)

 CFLAGS += -D_GNU_SOURCE

+LDLIBS += -lm
+
 # Disable VTA for memcpy test
 ifeq ($(CC), gcc)
 ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index b1cb285..4d631f6 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)

 CFLAGS_rte_red.o := -D_GNU_SOURCE

+LDLIBS += -lm
+LDLIBS += -lrt
+
 EXPORT_MAP := rte_sched_version.map

 LIBABIVER := 1
diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
index 5fd7d85..d51bd17 100644
--- a/mk/exec-env/linuxapp/rte.vars.mk
+++ b/mk/exec-env/linuxapp/rte.vars.mk
@@ -48,7 +48,7 @@ endif
 # Workaround lack of DT_NEEDED entry
 EXECENV_LDFLAGS = --no-as-needed

-EXECENV_LDLIBS  = -lrt -lm
+EXECENV_LDLIBS  =
 EXECENV_ASFLAGS =

 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index daac09f..cadc7ab 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -77,11 +77,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)+= -lrte_lpm
 _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)  += -lrte_power
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)+= -lrte_acl
 _LDLIBS-$(CONFIG_RTE_LIBRTE_METER)  += -lrte_meter
-
 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrte_sched
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt
-
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)  += -lrte_vhost

 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
@@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)+= -lxenstore
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)  += -lgxio
 # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC 
precomputes
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)+= -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)  += -lrt
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS

 _LDLIBS-y += --start-group
-- 
2.5.0



[dpdk-dev] [PATCH v3 0/3] mk: add DT_NEEDED entries for external library deps

2016-03-10 Thread Panu Matilainen
Add hopefully all the remaining missing DT_NEEDED entries for external
library dependencies on the libraries side: librte_vhost, librte_sched
and librte_eal.

Panu Matilainen (3):
  mk: clear up libm and librt linkage confusion
  mk: add DT_NEEDED entries for librte_vhost external dependencies
  mk: add DT_NEEDED entries for librte_eal external dependencies

 app/test/Makefile|  2 ++
 lib/librte_eal/bsdapp/eal/Makefile   |  4 
 lib/librte_eal/linuxapp/eal/Makefile |  4 
 lib/librte_sched/Makefile|  3 +++
 lib/librte_vhost/Makefile|  7 ---
 mk/exec-env/linuxapp/rte.vars.mk |  2 +-
 mk/rte.app.mk| 20 
 7 files changed, 26 insertions(+), 16 deletions(-)

-- 

v3:
- split up to separate patches
- clear up up libm and librt linkage confusion and unnecessary
  Linux vs BSD differences

v2: 
- clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion while at it

2.5.0



[dpdk-dev] [PATCH v8 4/5] cryptodev: change burst API to be crypto op oriented

2016-03-10 Thread Thomas Monjalon
2016-03-10 13:43, Fiona Trahe:
>  lib/librte_cryptodev/rte_crypto.h  | 352 +++-

One of the problems with inline functions in a header, is that it must
compile with C and C++. Unfortunately there is a small error here when
included in a C++ app:

rte_crypto.h:172:24: error:
invalid conversion from ?void*? to ?rte_crypto_op_pool_private*?
rte_crypto.h:220:29: error:
invalid conversion from ?void*? to ?rte_crypto_op_pool_private*?



[dpdk-dev] [PATCH] i40e: Fix a typo.

2016-03-10 Thread Bruce Richardson
On Sun, Feb 28, 2016 at 07:29:28AM +, Zhang, Helin wrote:
> 
> 
> > -Original Message-
> > From: Rosen, Rami
> > Sent: Saturday, February 27, 2016 2:34 AM
> > To: Zhang, Helin 
> > Cc: dev at dpdk.org; Rosen, Rami 
> > Subject: [PATCH] i40e: Fix a typo.
> > 
> > This patch fixes a typo in a comment in the definition of the i40e_pf 
> > struct.
> > 
> > Signed-off-by: Rami Rosen 
> Acked-by: Helin Zhang 
> 
Applied to dpdk-next-net/rel_16_04

Thanks,
/Bruce


[dpdk-dev] [PATCH] virtio: fix wrong features returned for legacy virtio

2016-03-10 Thread Yuanhan Liu
Declare dst as type uint32_t instead of uint64_t, otherwise, we will get
a random upper 32 bit feature bits, as the following io port read reads
lower 32 bit only. It could lead a feature bits that include VIRTIO_F_VERSION_1
(the 32th bit) for legacy virtio, which is obviously wrong.

Fixes: b8f04520ad71 ("virtio: use PCI ioport API")

Cc: David Marchand 
Signed-off-by: Yuanhan Liu 
---
 drivers/net/virtio/virtio_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 98fc370..c007959 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,
 static uint64_t
 legacy_get_features(struct virtio_hw *hw)
 {
-   uint64_t dst;
+   uint32_t dst;

rte_eal_pci_ioport_read(>io, , 4, VIRTIO_PCI_HOST_FEATURES);
return dst;
-- 
1.9.0



[dpdk-dev] [PATCH v7 00/11] Add API to get packet type info

2016-03-10 Thread Bruce Richardson
On Thu, Mar 10, 2016 at 03:31:24AM +0800, Jianfeng Tan wrote:
> To achieve this, a new function pointer, dev_ptype_info_get, is added
> into struct eth_dev_ops. For those devices who do not implement it, it
> means it does not provide any ptype info.
> 

FYI: If doing a V8, please remove the "pmd/" from the prefixes of the titles.
It will save me removing them manually on apply. :-)

/Bruce



[dpdk-dev] [PATCH v7 04/11] pmd/enic: add dev_ptype_info_get implementation

2016-03-10 Thread Bruce Richardson
On Thu, Mar 10, 2016 at 02:50:04PM +, Bruce Richardson wrote:
> On Thu, Mar 10, 2016 at 03:31:28AM +0800, Jianfeng Tan wrote:
> > Signed-off-by: Jianfeng Tan 
> > Acked-by: Konstantin Ananyev 
> > Acked-by: Adrien Mazarguil 
> > ---
> >  drivers/net/enic/enic_ethdev.c | 17 +
> >  1 file changed, 17 insertions(+)
> > 
> I get compile errors when I apply this patch:
> 
> == Build drivers/net/enic
>   CC enic_ethdev.o
> /home/bruce/next-net/dpdk-next-net/drivers/net/enic/enic_ethdev.c:57:17: 
> error: ?enicpmd_recv_pkts? used but never defined [-Werror]
>  static uint16_t enicpmd_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
> ^
>  compilation terminated due to -Wfatal-errors.
> 

Sorry, forgot other details to reproduce. This error I see with gcc 5.3 on 
Fedora 23.

/Bruce


[dpdk-dev] [PATCH v7 04/11] pmd/enic: add dev_ptype_info_get implementation

2016-03-10 Thread Bruce Richardson
On Thu, Mar 10, 2016 at 03:31:28AM +0800, Jianfeng Tan wrote:
> Signed-off-by: Jianfeng Tan 
> Acked-by: Konstantin Ananyev 
> Acked-by: Adrien Mazarguil 
> ---
>  drivers/net/enic/enic_ethdev.c | 17 +
>  1 file changed, 17 insertions(+)
> 
I get compile errors when I apply this patch:

== Build drivers/net/enic
  CC enic_ethdev.o
/home/bruce/next-net/dpdk-next-net/drivers/net/enic/enic_ethdev.c:57:17: error: 
?enicpmd_recv_pkts? used but never defined [-Werror]
 static uint16_t enicpmd_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
^
 compilation terminated due to -Wfatal-errors.

/Bruce


[dpdk-dev] [PATCH] doc: fill in cxgbe driver features matrix

2016-03-10 Thread Thomas Monjalon
2016-03-10 19:08, Rahul Lakkireddy:
> Fill in the supported features matrix for CXGBE PMD.
> 
> Signed-off-by: Rahul Lakkireddy 
> Signed-off-by: Kumar Sanghvi 

Applied, thanks


[dpdk-dev] [PATCH v2 02/10] qede: add documentation

2016-03-10 Thread Thomas Monjalon
2016-03-10 05:45, Rasesh Mody:
>  doc/guides/nics/index.rst |1 +
>  doc/guides/nics/qede.rst  |  340 
> +
>  2 files changed, 341 insertions(+)

It would be nice to see a new column in the matrix of overview.rst.


[dpdk-dev] [PATCH v5 1/4] ena: Amazon ENA documentation

2016-03-10 Thread Hunt, David

On 3/7/2016 8:05 PM, Jan Medala wrote:
> Signed-off-by: Evgeny Schemeilin 
> Signed-off-by: Alexander Matushevsky 
> Signed-off-by: Jan Medala 
> Signed-off-by: Jakub Palider 
> ---
>   MAINTAINERS   |   8 ++
>   doc/guides/nics/ena.rst   | 252 
> ++
>   doc/guides/nics/index.rst |   1 +
>   3 files changed, 261 insertions(+)
>   create mode 100644 doc/guides/nics/ena.rst

--snip--

Small nit while doing 'git am':

Applying: ena: Amazon ENA documentation
/root/dpdk/.git/rebase-apply/patch:197: trailing whitespace.
Any Linux distribution fulfilling the conditions described in ``System 
Requirements``
/root/dpdk/.git/rebase-apply/patch:284: new blank line at EOF.
+
warning: 2 lines add whitespace errors.

Regards,
David.


[dpdk-dev] [PATCH 8/8] drivers/net/ixgbe: Fix uninitialized warning

2016-03-10 Thread Remy Horton

On 10/03/2016 13:42, Panu Matilainen wrote:
> On 02/25/2016 08:48 PM, Aaron Conole wrote:
>> Silence a compiler warning that this variable may be used uninitialized.
>>
>> Signed-off-by: Aaron Conole 
[..]
>
> The patch looks ok as such, but then again warning looks like a false
> positive to me: assignment and dereferencing depend on the same value of
> eop, which cannot change between the two.

In two minds about this. It is a logical impossibility, but these days 
optimising compilers are getting very aggressive. For instance GCC has a 
delightfully-named -fdelete-null-pointer-checks option, which caused 
security holes..

..Remy


[dpdk-dev] [PATCH 3/3] scripts: ignore self-generated directories in validate-abi startup check

2016-03-10 Thread Panu Matilainen
On 03/10/2016 02:34 PM, Ferruh Yigit wrote:
> On 3/10/2016 12:29 PM, Panu Matilainen wrote:
>> On 03/10/2016 02:22 PM, Ferruh Yigit wrote:
>>> On 3/10/2016 10:53 AM, Panu Matilainen wrote:
 When doing multiple runs of validate-abi.sh, the git status check
 will more often than not unnecessarily fail with "Working directory not
 clean" error because of the compat_result and compile target directories
 from the previous run. Filter out the self-generated directories
 when checking.

 Signed-off-by: Panu Matilainen 
 ---
scripts/validate-abi.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/scripts/validate-abi.sh b/scripts/validate-abi.sh
 index ea60639..a21f883 100755
 --- a/scripts/validate-abi.sh
 +++ b/scripts/validate-abi.sh
 @@ -163,8 +163,7 @@ log "INFO" "against DPDK DSOs built from version 
 $TAG2."
log "INFO" ""

# Check to make sure we have a clean tree
 -git status | grep -q clean
 -if [ $? -ne 0 ]
 +if [ $(git status --porcelain | grep -vE "($TARGET|compat_reports)" | wc 
 -l)  -ne 0 ]
then
log "WARN" "Working directory not clean, aborting"
cleanup_and_exit 1

>>> Hi Panu,
>>>
>>> This check catches untracked files too, does it makes sense to limit
>>> error only to modified files (local or staged)?
>>
>> I did ponder about that, untracked files seem mostly harmless in this
>> picture but erred on the side of caution.
>>
> This is something prevents me running script from working tree, and
> forces to create a new clone.

Hmm, what untracked files you typically have in your working tree then?

>>>
>>> This also prevents specific "compat_reports" folder check.
>>>
>>> And of course mentioned change requires "git clean -fd" removed, or
>>> replaced with "make clean"
>>
>> Sorry, I dont understand you mean by these two comments.
>>
> If untracked files accepted by script, "compat_reports" exclusion is no
> more required, and "git clean -fd" needs to removed from script.

Ah, sure. Thanks for clarifying.

- Panu -

>
> Regards,
> ferruh
>



  1   2   3   >