[dpdk-dev] [PATCH] test: fix hash multiwriter test

2016-10-06 Thread Pablo de Lara
Hash multiwriter test consists of two subtests.
If the any of the subtests fails, the overall test should fail,
but the overall test only passed if the second subtest passed,
because the return of the first subtest was being overwritten.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")

Signed-off-by: Pablo de Lara 
---
 app/test/test_hash_multiwriter.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/app/test/test_hash_multiwriter.c b/app/test/test_hash_multiwriter.c
index 40af95d..4dcbd9d 100644
--- a/app/test/test_hash_multiwriter.c
+++ b/app/test/test_hash_multiwriter.c
@@ -247,8 +247,6 @@ err1:
 static int
 test_hash_multiwriter_main(void)
 {
-   int r = -1;
-
if (rte_lcore_count() == 1) {
printf("More than one lcore is required to do multiwriter 
test\n");
return 0;
@@ -268,14 +266,16 @@ test_hash_multiwriter_main(void)
printf("Test multi-writer with Hardware transactional 
memory\n");

use_htm = 1;
-   r = test_hash_multiwriter();
+   if (test_hash_multiwriter() < 0)
+   return -1;
}

printf("Test multi-writer without Hardware transactional memory\n");
use_htm = 0;
-   r = test_hash_multiwriter();
+   if (test_hash_multiwriter() < 0)
+   return -1;

-   return r;
+   return 0;
 }

 REGISTER_TEST_COMMAND(hash_multiwriter_autotest, test_hash_multiwriter_main);
-- 
2.7.4



[dpdk-dev] [PATCH] Revert "bonding: use existing enslaved device queues"

2016-10-06 Thread Eric Kinzie
On Wed Sep 07 15:28:10 +0300 2016, Ilya Maximets wrote:
> This reverts commit 5b7bb2bda5519b7800f814df64d4e015282140e5.
> 
> It is necessary to reconfigure all queues every time because configuration
> can be changed.
> 
> For example, if we're reconfiguring bonding device with new memory pool,
> already configured queues will still use the old one. And if the old
> mempool be freed, application likely will panic in attempt to use
> freed mempool.
> 
> This happens when we use the bonding device with OVS 2.6 while MTU
> reconfiguration:
> 
> PANIC in rte_mempool_get_ops():
> assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" failed
> 
> Cc: 
> Signed-off-by: Ilya Maximets 
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
> b/drivers/net/bonding/rte_eth_bond_pmd.c
> index b20a272..eb5b6d1 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1305,8 +1305,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   struct bond_rx_queue *bd_rx_q;
>   struct bond_tx_queue *bd_tx_q;
>  
> - uint16_t old_nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
> - uint16_t old_nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
>   int errval;
>   uint16_t q_id;
>  
> @@ -1347,9 +1345,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   }
>  
>   /* Setup Rx Queues */
> - /* Use existing queues, if any */
> - for (q_id = old_nb_rx_queues;
> -  q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
> + for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>   bd_rx_q = (struct bond_rx_queue 
> *)bonded_eth_dev->data->rx_queues[q_id];
>  
>   errval = rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
> @@ -1365,9 +1361,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   }
>  
>   /* Setup Tx Queues */
> - /* Use existing queues, if any */
> - for (q_id = old_nb_tx_queues;
> -  q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
> + for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>   bd_tx_q = (struct bond_tx_queue 
> *)bonded_eth_dev->data->tx_queues[q_id];
>  
>   errval = rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
> -- 
> 2.7.4
> 

NAK

There are still some users of this code.  Let's give them a chance to
comment before removing it.


Thanks,

Eric


[dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation

2016-10-06 Thread Pablo de Lara
Fixes: 1d0c90e6cf0b ("doc: update build instructions for libsso_snow3g")

Signed-off-by: Pablo de Lara 
---
 doc/guides/cryptodevs/snow3g.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/cryptodevs/snow3g.rst b/doc/guides/cryptodevs/snow3g.rst
index f6eb538..75a08aa 100644
--- a/doc/guides/cryptodevs/snow3g.rst
+++ b/doc/guides/cryptodevs/snow3g.rst
@@ -58,7 +58,7 @@ Limitations
 Installation
 

-To build DPDK with the KASUMI_PMD the user is required to download
+To build DPDK with the SNOW3G_PMD the user is required to download
 the export controlled ``libsso_snow3g`` library, by requesting it from
 ``_.
 Once approval has been granted, the user needs to log in
-- 
2.7.4



[dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation

2016-10-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Mcnamara, John
> Sent: Thursday, October 06, 2016 2:00 PM
> To: De Lara Guarch, Pablo; dev at dpdk.org
> Cc: De Lara Guarch, Pablo
> Subject: RE: [dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
> > Sent: Thursday, October 6, 2016 9:55 PM
> > To: dev at dpdk.org
> > Cc: De Lara Guarch, Pablo 
> > Subject: [dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation
> >
> > Fixes: 1d0c90e6cf0b ("doc: update build instructions for libsso_snow3g")
> >
> > Signed-off-by: Pablo de Lara 
> 
> Acked-by: John McNamara 
> 
Applied to dpdk-next-crypto.

Pablo


[dpdk-dev] [PATCH 1/1] doc: fix errors in pdump doc

2016-10-06 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mark Kavanagh
> Sent: Thursday, October 6, 2016 11:37 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 1/1] doc: fix errors in pdump doc
> 
> - Fix copy/paste error in description of how to capture both rx
>   & tx traffic in a single pcap file
> - Replace duplicate word with what original author presumably
>   intended, such that description now makes sense
> 
> Signed-off-by: Mark Kavanagh 

Acked-by: John McNamara 



[dpdk-dev] [PATCH v2] cryptodev: fix compilation error in SUSE 11 SP2

2016-10-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Adrien Mazarguil
> Sent: Wednesday, October 05, 2016 1:52 AM
> To: De Lara Guarch, Pablo
> Cc: dev at dpdk.org; Doherty, Declan
> Subject: Re: [dpdk-dev] [PATCH v2] cryptodev: fix compilation error in SUSE 11
> SP2
> 
> On Wed, Oct 05, 2016 at 03:45:51AM +0100, Pablo de Lara wrote:
> > This commit fixes following build error, which happens in SUSE 11 SP2,
> > with gcc 4.5.1:
> >
> > In file included from lib/librte_cryptodev/rte_cryptodev.c:70:0:
> > lib/librte_cryptodev/rte_cryptodev.h:772:7:
> > error: flexible array member in otherwise empty struct
> >
> > Fixes: 347a1e037fd3 ("lib: use C99 syntax for zero-size arrays")
> >
> > Signed-off-by: Pablo de Lara 
> > ---
> >
> > Changes in v2:
> > - Fixed commit message
> >
> >  lib/librte_cryptodev/rte_cryptodev.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev.h
> b/lib/librte_cryptodev/rte_cryptodev.h
> > index d565f39..6ad5e91 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev.h
> > @@ -773,7 +773,7 @@ struct rte_cryptodev_sym_session {
> > } __rte_aligned(8);
> > /**< Public symmetric session details */
> >
> > -   char _private[];
> > +   __extension__ char _private[0];
> > /**< Private session material */
> >  };
> >
> > --
> > 2.7.4
> 
> Acked-by: Adrien Mazarguil 

Applied to dpdk-next-crypto.

Pablo


[dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation

2016-10-06 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
> Sent: Thursday, October 6, 2016 9:55 PM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo 
> Subject: [dpdk-dev] [PATCH] doc: fix typo in SNOW3G documentation
> 
> Fixes: 1d0c90e6cf0b ("doc: update build instructions for libsso_snow3g")
> 
> Signed-off-by: Pablo de Lara 

Acked-by: John McNamara 




[dpdk-dev] [PATCH] eal/vdev: rename vdev driver init/uninit to probe/remove

2016-10-06 Thread Shreyansh Jain
Inline with PCI probe and remove, VDEV probe and remove hooks provide
a uniform naming.
PCI probe represents scan and driver initialization. For VDEV, it will
represent argument parsing and initialization.

Signed-off-by: Shreyansh Jain 
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c   | 12 ++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 12 ++--
 drivers/crypto/kasumi/rte_kasumi_pmd.c | 12 ++--
 drivers/crypto/null/null_crypto_pmd.c  | 12 ++--
 drivers/crypto/snow3g/rte_snow3g_pmd.c | 12 ++--
 drivers/net/af_packet/rte_eth_af_packet.c  |  8 
 drivers/net/bonding/rte_eth_bond_pmd.c |  8 
 drivers/net/mpipe/mpipe_tilegx.c   |  6 +++---
 drivers/net/null/rte_eth_null.c|  8 
 drivers/net/pcap/rte_eth_pcap.c|  8 
 drivers/net/ring/rte_eth_ring.c|  8 
 drivers/net/vhost/rte_eth_vhost.c  |  8 
 drivers/net/virtio/virtio_user_ethdev.c|  8 
 drivers/net/xenvirt/rte_eth_xenvirt.c  |  8 
 lib/librte_eal/common/eal_common_vdev.c|  4 ++--
 lib/librte_eal/common/include/rte_vdev.h   | 14 +++---
 16 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index fc939fa..317c556 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -395,7 +395,7 @@ aesni_gcm_pmd_dequeue_burst(void *queue_pair,
return nb_dequeued;
 }

-static int aesni_gcm_uninit(const char *name);
+static int aesni_gcm_remove(const char *name);

 static int
 aesni_gcm_create(const char *name,
@@ -477,12 +477,12 @@ aesni_gcm_create(const char *name,
 init_error:
GCM_LOG_ERR("driver %s: create failed", name);

-   aesni_gcm_uninit(crypto_dev_name);
+   aesni_gcm_remove(crypto_dev_name);
return -EFAULT;
 }

 static int
-aesni_gcm_init(const char *name, const char *input_args)
+aesni_gcm_probe(const char *name, const char *input_args)
 {
struct rte_crypto_vdev_init_params init_params = {
RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
@@ -503,7 +503,7 @@ aesni_gcm_init(const char *name, const char *input_args)
 }

 static int
-aesni_gcm_uninit(const char *name)
+aesni_gcm_remove(const char *name)
 {
if (name == NULL)
return -EINVAL;
@@ -515,8 +515,8 @@ aesni_gcm_uninit(const char *name)
 }

 static struct rte_vdev_driver aesni_gcm_pmd_drv = {
-   .init = aesni_gcm_init,
-   .uninit = aesni_gcm_uninit
+   .probe = aesni_gcm_probe,
+   .remove = aesni_gcm_remove
 };

 DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 2047269..ff2fc25 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -595,7 +595,7 @@ 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_remove(const char *name);

 static int
 cryptodev_aesni_mb_create(const char *name,
@@ -675,13 +675,13 @@ cryptodev_aesni_mb_create(const char *name,
 init_error:
MB_LOG_ERR("driver %s: cryptodev_aesni_create failed", name);

-   cryptodev_aesni_mb_uninit(crypto_dev_name);
+   cryptodev_aesni_mb_remove(crypto_dev_name);
return -EFAULT;
 }


 static int
-cryptodev_aesni_mb_init(const char *name,
+cryptodev_aesni_mb_probe(const char *name,
const char *input_args)
 {
struct rte_crypto_vdev_init_params init_params = {
@@ -703,7 +703,7 @@ cryptodev_aesni_mb_init(const char *name,
 }

 static int
-cryptodev_aesni_mb_uninit(const char *name)
+cryptodev_aesni_mb_remove(const char *name)
 {
if (name == NULL)
return -EINVAL;
@@ -715,8 +715,8 @@ cryptodev_aesni_mb_uninit(const char *name)
 }

 static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
-   .init = cryptodev_aesni_mb_init,
-   .uninit = cryptodev_aesni_mb_uninit
+   .probe = cryptodev_aesni_mb_probe,
+   .remove = cryptodev_aesni_mb_remove
 };

 DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c 
b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index d1b0b99..8774fc2 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -556,7 +556,7 @@ kasumi_pmd_dequeue_burst(void *queue_pair,
return nb_dequeued;
 }

-static int cryptodev_kasumi_uninit(const char *name);
+static int cryptodev_kasumi_remove(const char *name);

 static int
 cryptodev_kasumi_create(const char *name,
@@ -611,12 +611,12 @@ cryptodev_kasumi_create(const char *name,
 init_error:
KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed", name);

-   cryptode

[dpdk-dev] [PATCH] vhost: Only access header if offloading is supported in dequeue path

2016-10-06 Thread Maxime Coquelin


On 10/06/2016 07:00 PM, Maxime Coquelin wrote:
> If offloading features are not negotiated, parsing the virtio header
> is not needed.
>
> Micro-benchmark with testpmd shows that the gain is +4% with indirect
> descriptors, +1% when using direct descriptors.
>
> Signed-off-by: Maxime Coquelin 
> ---
>  lib/librte_vhost/virtio_net.c | 47 
> ---
>  1 file changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index a59c39b..5d51693 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -548,6 +548,18 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
>   return virtio_dev_rx(dev, queue_id, pkts, count);
>  }
>
> +static inline bool
> +virtio_net_with_host_offload(struct virtio_net *dev)
> +{
> + if (dev->features &
> + (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_ECN |
> +  VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 |
> +  VIRTIO_NET_F_HOST_UFO))
> + return true;
> +
> + return false;
> +}
> +
>  static void
>  parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr)
>  {
> @@ -600,6 +612,9 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct 
> rte_mbuf *m)
>   void *l4_hdr = NULL;
>   struct tcp_hdr *tcp_hdr = NULL;
>
> + if (hdr->flags == 0 || hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE)
> + return;
> +

Oops, just noticed I forgot to amend a fix I did.
Of course, the above test should be:
if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE)

It will be fixed in the v2.

Regards,
Maxime


[dpdk-dev] [PATCH] vhost: Only access header if offloading is supported in dequeue path

2016-10-06 Thread Maxime Coquelin
If offloading features are not negotiated, parsing the virtio header
is not needed.

Micro-benchmark with testpmd shows that the gain is +4% with indirect
descriptors, +1% when using direct descriptors.

Signed-off-by: Maxime Coquelin 
---
 lib/librte_vhost/virtio_net.c | 47 ---
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index a59c39b..5d51693 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -548,6 +548,18 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
return virtio_dev_rx(dev, queue_id, pkts, count);
 }

+static inline bool
+virtio_net_with_host_offload(struct virtio_net *dev)
+{
+   if (dev->features &
+   (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_ECN |
+VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 |
+VIRTIO_NET_F_HOST_UFO))
+   return true;
+
+   return false;
+}
+
 static void
 parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr)
 {
@@ -600,6 +612,9 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct 
rte_mbuf *m)
void *l4_hdr = NULL;
struct tcp_hdr *tcp_hdr = NULL;

+   if (hdr->flags == 0 || hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE)
+   return;
+
parse_ethernet(m, &l4_proto, &l4_hdr);
if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) {
if (hdr->csum_start == (m->l2_len + m->l3_len)) {
@@ -684,12 +699,12 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct 
vring_desc *descs,
  struct rte_mempool *mbuf_pool)
 {
struct vring_desc *desc;
-   uint64_t desc_addr;
+   uint64_t desc_addr = 0;
uint32_t desc_avail, desc_offset;
uint32_t mbuf_avail, mbuf_offset;
uint32_t cpy_len;
struct rte_mbuf *cur = m, *prev = m;
-   struct virtio_net_hdr *hdr;
+   struct virtio_net_hdr *hdr = NULL;
/* A counter to avoid desc dead loop chain */
uint32_t nr_desc = 1;

@@ -698,12 +713,14 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct 
vring_desc *descs,
(desc->flags & VRING_DESC_F_INDIRECT))
return -1;

-   desc_addr = gpa_to_vva(dev, desc->addr);
-   if (unlikely(!desc_addr))
-   return -1;
+   if (virtio_net_with_host_offload(dev)) {
+   desc_addr = gpa_to_vva(dev, desc->addr);
+   if (unlikely(!desc_addr))
+   return -1;

-   hdr = (struct virtio_net_hdr *)((uintptr_t)desc_addr);
-   rte_prefetch0(hdr);
+   hdr = (struct virtio_net_hdr *)((uintptr_t)desc_addr);
+   rte_prefetch0(hdr);
+   }

/*
 * A virtio driver normally uses at least 2 desc buffers
@@ -720,18 +737,24 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct 
vring_desc *descs,
if (unlikely(!desc_addr))
return -1;

-   rte_prefetch0((void *)(uintptr_t)desc_addr);
-
desc_offset = 0;
desc_avail  = desc->len;
nr_desc+= 1;
-
-   PRINT_PACKET(dev, (uintptr_t)desc_addr, desc->len, 0);
} else {
+   if (!desc_addr) {
+   desc_addr = gpa_to_vva(dev, desc->addr);
+   if (unlikely(!desc_addr))
+   return -1;
+   }
+
desc_avail  = desc->len - dev->vhost_hlen;
desc_offset = dev->vhost_hlen;
}

+   rte_prefetch0((void *)(uintptr_t)(desc_addr + desc_offset));
+
+   PRINT_PACKET(dev, (uintptr_t)(desc_addr + desc_offset), desc_avail, 0);
+
mbuf_offset = 0;
mbuf_avail  = m->buf_len - RTE_PKTMBUF_HEADROOM;
while (1) {
@@ -795,7 +818,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vring_desc 
*descs,
prev->data_len = mbuf_offset;
m->pkt_len+= mbuf_offset;

-   if (hdr->flags != 0 || hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE)
+   if (virtio_net_with_host_offload(dev))
vhost_dequeue_offload(hdr, m);

return 0;
-- 
2.7.4



[dpdk-dev] [PATCH v3 4/4] app/test: remove hard-coding of crypto num qps

2016-10-06 Thread Fiona Trahe
ts_params->conf.nb_queue_pairs should not be hard coded with device
specific number. It should be retrieved from the device info.
Any test which changes it should restore it to orig value.

Signed-off-by: Akhil Goyal 
Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c  | 5 -
 app/test/test_cryptodev_perf.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index e0b0252..83036a1 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -414,7 +414,6 @@ ut_setup(void)
memset(ut_params, 0, sizeof(*ut_params));

/* Reconfigure device to default parameters */
-   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 = DEFAULT_NUM_OPS_INFLIGHT;

@@ -526,6 +525,7 @@ static int
 test_device_configure_invalid_queue_pair_ids(void)
 {
struct crypto_testsuite_params *ts_params = &testsuite_params;
+   uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;

/* Stop the device in case it's started so it can be configured */
rte_cryptodev_stop(ts_params->valid_devs[0]);
@@ -580,6 +580,9 @@ test_device_configure_invalid_queue_pair_ids(void)
ts_params->valid_devs[0],
ts_params->conf.nb_queue_pairs);

+   /* revert to original testsuite value */
+   ts_params->conf.nb_queue_pairs = orig_nb_qps;
+
return TEST_SUCCESS;
 }

diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
index 27d8cf8..4aee9af 100644
--- a/app/test/test_cryptodev_perf.c
+++ b/app/test/test_cryptodev_perf.c
@@ -431,7 +431,7 @@ testsuite_setup(void)

rte_cryptodev_info_get(ts_params->dev_id, &info);

-   ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
+   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.sym.max_nb_sessions;

-- 
2.5.0



[dpdk-dev] [PATCH v3 3/4] app/test: cleanup unnecessary ring size setup

2016-10-06 Thread Fiona Trahe
Removed obsolete comments re inability to free and re-allocate
queue memory and obsolete workaround for it
which used to create maximum size queues first, then later
create smaller queues.

Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c  | 15 +--
 app/test/test_cryptodev_perf.c | 17 +
 2 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index db2f23c..e0b0252 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -362,13 +362,6 @@ testsuite_setup(void)

rte_cryptodev_info_get(dev_id, &info);

-   /*
-* Since we can't free and re-allocate queue memory always set
-* the queues on this device up to max size first so enough
-* memory is allocated for any later re-configures needed by
-* other tests
-*/
-
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.sym.max_nb_sessions;
@@ -378,7 +371,7 @@ testsuite_setup(void)
"Failed to configure cryptodev %u with %u qps",
dev_id, ts_params->conf.nb_queue_pairs);

-   ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
+   ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;

for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
@@ -430,12 +423,6 @@ ut_setup(void)
"Failed to configure cryptodev %u",
ts_params->valid_devs[0]);

-   /*
-* Now reconfigure queues to size we actually want to use in this
-* test suite.
-*/
-   ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
-
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
ts_params->valid_devs[0], qp_id,
diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
index e8fc097..27d8cf8 100644
--- a/app/test/test_cryptodev_perf.c
+++ b/app/test/test_cryptodev_perf.c
@@ -426,9 +426,7 @@ testsuite_setup(void)

/*
 * Using Crypto Device Id 0 by default.
-* Since we can't free and re-allocate queue memory always set the 
queues
-* on this device up to max size first so enough memory is allocated for
-* any later re-configures needed by other tests
+* Set up all the qps on this device
 */

rte_cryptodev_info_get(ts_params->dev_id, &info);
@@ -442,19 +440,6 @@ testsuite_setup(void)
"Failed to configure cryptodev %u",
ts_params->dev_id);

-
-   ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
-
-   for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
-   TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
-   ts_params->dev_id, qp_id,
-   &ts_params->qp_conf,
-   rte_cryptodev_socket_id(ts_params->dev_id)),
-   "Failed to setup queue pair %u on cryptodev %u",
-   qp_id, ts_params->dev_id);
-   }
-
-   /*Now reconfigure queues to size we actually want to use in this 
testsuite.*/
ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT;
for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {

-- 
2.5.0



[dpdk-dev] [PATCH v3 2/4] app/test: remove pointless for loop

2016-10-06 Thread Fiona Trahe
Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c | 49 +++
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 8f40dea..db2f23c 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -357,37 +357,35 @@ testsuite_setup(void)
return TEST_FAILED;

/* Set up all the qps on the first of the valid devices found */
-   for (i = 0; i < 1; i++) {
-   dev_id = ts_params->valid_devs[i];

-   rte_cryptodev_info_get(dev_id, &info);
+   dev_id = ts_params->valid_devs[0];

-   /*
-* Since we can't free and re-allocate queue memory always set
-* the queues on this device up to max size first so enough
-* memory is allocated for any later re-configures needed by
-* other tests
-*/
+   rte_cryptodev_info_get(dev_id, &info);

-   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.sym.max_nb_sessions;
+   /*
+* Since we can't free and re-allocate queue memory always set
+* the queues on this device up to max size first so enough
+* memory is allocated for any later re-configures needed by
+* other tests
+*/

-   TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
-   &ts_params->conf),
-   "Failed to configure cryptodev %u with %u qps",
-   dev_id, ts_params->conf.nb_queue_pairs);
+   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.sym.max_nb_sessions;

-   ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
+   TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
+   &ts_params->conf),
+   "Failed to configure cryptodev %u with %u qps",
+   dev_id, ts_params->conf.nb_queue_pairs);

-   for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
-   TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
-   dev_id, qp_id, &ts_params->qp_conf,
-   rte_cryptodev_socket_id(dev_id)),
-   "Failed to setup queue pair %u on "
-   "cryptodev %u",
-   qp_id, dev_id);
-   }
+   ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
+
+   for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
+   TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
+   dev_id, qp_id, &ts_params->qp_conf,
+   rte_cryptodev_socket_id(dev_id)),
+   "Failed to setup queue pair %u on cryptodev %u",
+   qp_id, dev_id);
}

return TEST_SUCCESS;
-- 
2.5.0



[dpdk-dev] [PATCH v3 1/4] crypto/aesni_mb: free ring memory on qp release in PMD

2016-10-06 Thread Fiona Trahe
Free ring memory on queue_pair release, else
releasing and setting up queue-pair of a different size fails.

Signed-off-by: Fiona Trahe 
---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index d3c46ac..3d49e2a 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -311,8 +311,14 @@ aesni_mb_pmd_info_get(struct rte_cryptodev *dev,
 static int
 aesni_mb_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
-   if (dev->data->queue_pairs[qp_id] != NULL) {
-   rte_free(dev->data->queue_pairs[qp_id]);
+   struct aesni_mb_qp *qp = dev->data->queue_pairs[qp_id];
+   struct rte_ring *r = NULL;
+
+   if (qp != NULL) {
+   r = rte_ring_lookup(qp->name);
+   if (r)
+   rte_ring_free(r);
+   rte_free(qp);
dev->data->queue_pairs[qp_id] = NULL;
}
return 0;
-- 
2.5.0



[dpdk-dev] [PATCH v3 0/4] remove hard-coding of crypto num qps and cleanup

2016-10-06 Thread Fiona Trahe

ts_params->conf.nb_queue_pairs should not be hard coded with device
specific number. It should be retrieved from the device info.
Any test which changes it should restore it to orig value.

Also related cleanup of test code setting number and size of
queue-pairs on a device, e.g.
* Removed irrelevant ???for??? loop ??? was hardcoded to only loop once.
* Removed obsolete comment re inability to free and re-allocate queu memory
  and obsolete workaround for it which used to create maximum size queues.

And added freeing of ring memory on queue-pair release in aesni_mb PMD, 
else releasing and setting up queue-pair of a different size fails.

v3:
  separate out into 4 patches

v2:
  Fix for broken QAT PMD unit tests exposed by v1
  i.e. In test_device_configure_invalid_queue_pair_ids() after running tests
  for invalid values restore original nb_queue_pairs.
  Also cleanup of test code setting number and size of queue-pairs on a device
  Also fix for aesni_mb PMD not freeing ring memory on qp release


Fiona Trahe (4):
  crypto/aesni_mb: free ring memory on qp release in PMD
  app/test: remove pointless for loop
  app/test: cleanup unnecessary ring size setup
  app/test: remove hard-coding of crypto num qps
Akhil Goyal (1):
  app/test: remove hard-coding of crypto num qps

 app/test/test_cryptodev.c  | 53 ++
 app/test/test_cryptodev_perf.c | 19 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 10 -
 3 files changed, 31 insertions(+), 51 deletions(-)

-- 
2.5.0



[dpdk-dev] [PATCH v6 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 Thread Bernard Iremonger
call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 
 3 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 55a82d3..91db2c3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
ixgbe_dev_link_update(dev, 0);
intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
ixgbe_dev_link_status_print(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == IXGBE_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..2a177b8 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_vf_info *vfinfo =
*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, 
&cb_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf

[dpdk-dev] [PATCH v6 1/2] librte_ether: modify internal callback function

2016-10-06 Thread Bernard Iremonger
add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function
in the following PMD's:

net/bonding
net/e1000
net/i40e
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio
net/enic

app/test: add parameter to callback process function
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
Signed-off-by: Alex Zelezniak 
---
 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 +++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 -
 lib/librte_ether/rte_ethdev.h  | 12 +++-
 15 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4831113..65b44c6 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 int
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index fb4050c..8d510e3 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
return;

_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);

} else {
if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}
}
 }
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f767e1c..e13e858 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,

eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5a1a83e..d9ab2df 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_TCTL, tctl);
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
E1000_WRITE_FLUSH(hw);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

return 0;
@@ -2743,7 +2743,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == E1000_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 15a05b4..fb72491 100644
---

[dpdk-dev] [PATCH v6 0/2] modify callback for VF management

2016-10-06 Thread Bernard Iremonger
This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process
function. All references to this function have been updated.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function.
Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function
Removed two new callback functions which were added previously.
Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.




















Bernard Iremonger (2):
  librte_ether: modify internal callback function
  net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c   | 42 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 17 ++
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 ++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 +++-
 lib/librte_ether/rte_ethdev.h  | 12 +-
 18 files changed, 91 insertions(+), 31 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Thomas Monjalon
2016-10-06 15:32, Iremonger, Bernard:
> > > > 2016-10-06 12:26, Bernard Iremonger:
> > > > >  void
> > > > >  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> > > > > - enum rte_eth_event_type event)
> > > > > + enum rte_eth_event_type event, void *param)
> > > >
> > > > You need to squash the patches updating the calls to this function.
> > > > Otherwise, this patch does not compile.
> > >
> > > I will have to squash everything into one patch, separate patches will not
> > compile.
> > 
> > No you can keep a separate patch for the VF event in ixgbe.
> 
> I have 4 patches at present
> 
> librte_ether
> net/ixgbe
> drivers/net
> app/test
> 
> Would this be acceptable or do you just want  everything squashed into 
> librte_ether except for net/ixgbe?

You can test the compilation of each patch with this command:
git rebase -i origin/master -x scripts/test-build.sh
or just:
git rebase -i origin/master -x make

I think you need to squash drivers/net (adding just NULL param) and
app/test in ethdev patch.


[dpdk-dev] [PATCH v1 0/4] Generalize PCI specific EAL function/structures

2016-10-06 Thread Shreyansh Jain
Hi Thomas,

On Monday 03 October 2016 07:06 PM, Thomas Monjalon wrote:
> 2016-10-03 11:07, Shreyansh Jain:
>> Hi David,
>>
>> On Friday 30 September 2016 09:01 PM, David Marchand wrote:
>>> On Tue, Sep 27, 2016 at 4:12 PM, Shreyansh Jain  
>>> wrote:
 (I rebased these over HEAD 7b3c4f3)

 These patches were initially part of Jan's original series on SoC
 Framework ([1],[2]). An update to that series, without these patches,
 was posted here [3].

 Main motivation for these is aim of introducing a non-PCI centric
 subsystem in EAL. As of now the first usecase is SoC, but not limited to
 it.

 4 patches in this series are independent of each other, as well as SoC
 framework. All these focus on generalizing some structure or functions
 present with the PCI specific code to EAL Common area (or splitting a
 function to be more userful).
>>>
>>> Those patches move linux specifics (binding pci devices using sysfs)
>>> to common infrastucture.
>>> We have no proper hotplug support on bsd, but if we had some common
>>> code we should at least try to make the apis generic.
>>>
>>
>> I am not sure if I understood your point well. Just to confirm - you are
>> stating that the movement done in the patches might not suit BSD.
>> Probably you are talking about (Patch 3/4 and 4/4).
>> Is my understanding correct?
>>
>> So, movement to just Linux area is not enough?
>> I am not well versed with BSD way of doing something similar so if
>> someone can point it out, I can integrate that. (I will investigate it
>> at my end as well).
>>
>> This patchset makes the PCI->EAL movement *only* for Linux for sysfs
>> bind/unbind. (I should add this to cover letter, at the least).
>
> The concern is about function declarations in
>   lib/librte_eal/common/eal_private.h
> We cannot be sure it can be applicable to something else than Linux.
> As it is implemented in Linux only, it should not be in a common header.
>

Ok. But, digging a little I found at least one more similar case.
'rte_eal_check_module()' which is present in the linuxapp/eal.c and has 
existence in common, but no parallel implementation for BSD exists. This 
function is accessing /sys/modules - which might be Linux specific.

It seems to be a pretty old entry though (dating back to 2014).

-
Shreyansh


[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Thomas Monjalon
2016-10-06 14:33, Iremonger, Bernard:
> Hi Thomas,
> 
> > Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal
> > callback function
> > 
> > 2016-10-06 12:26, Bernard Iremonger:
> > >  void
> > >  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> > > - enum rte_eth_event_type event)
> > > + enum rte_eth_event_type event, void *param)
> > 
> > You need to squash the patches updating the calls to this function.
> > Otherwise, this patch does not compile.
> 
> I will have to squash everything into one patch, separate patches will not 
> compile.

No you can keep a separate patch for the VF event in ixgbe.

> > [...]
> > > + if (param != NULL)
> > > + dev_cb.cb_arg = (void *) param;
> > 
> > You are overriding the user parameter.
> 
> Yes, we want to update the user parameter for the RTE_ETH_EVENT_VF_MBOX
> 
> > As it is only for a new event, it can be described in the register API that 
> > the
> > user param won't be returned for this event.
> 
> I will add a description in the rte_eth_dev_callback_register  function.
> 
> > But a better design would be to add a new parameter to the callback.
> > However it will be an API breakage.
> 
> I do not want to break the ABI at this point.

Yes, but it can be considered for a later change.

> > > + RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
> > 
> > Sorry I do not parse well this line.
> > The event name is VF_MBOX and the comment is about the callback
> > processing this event on PF side?
> > I would suggest this kind of comment: "message from VF received by PF"
> 
> Ok.
> 
> > 
> > [...]
> > >   *  Pointer to struct rte_eth_dev.
> > >   * @param event
> > >   *  Eth device interrupt event type.
> > > + * @param param
> > > + *  Parameter to pass back to user application.
> > > + *  Allows the user application to decide if a particular function
> > > + *  is permitted.
> > 
> > In a more generic case, the parameter gives some details about the event.

Please consider a rewording here, thanks.




[dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data

2016-10-06 Thread Thomas Monjalon
2016-09-30 16:00, Marcin Kerlin:
> Added protection against overwrite device data in array rte_eth_dev_data[]
> for the next secondary applications. Secondary process appends in the
> first free place rather than at the beginning. This behavior prevents
> overwriting devices data of primary process by secondary process.

It would be good to state what is a secondary process.
You are trying to extend its capabilities to be able to initialize devices.
So primary and secondary processes are almost equivalent?
What happens if we do not create any device in the primary?
Answer from code review: "Cannot allocate memzone for ethernet port data\n"

The secondary process is a hack to me.
But it is fine to have such hack for debug or monitoring purpose.
I would like to understand what are the other use cases?

By the way, the code managing the shared data of a device should
be at the EAL level in order to be used by other interfaces like crypto.

> @@ -631,6 +692,8 @@ int
>  rte_eth_dev_detach(uint8_t port_id, char *name)
>  {
>   struct rte_pci_addr addr;
> + struct rte_eth_dev_data *eth_dev_data = NULL;
> + char device[RTE_ETH_NAME_MAX_LEN];
>   int ret = -1;
>  
>   if (name == NULL) {
> @@ -642,6 +705,15 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
>   if (rte_eth_dev_is_detachable(port_id))
>   goto err;
>  
> + /* get device name by port id */
> + if (rte_eth_dev_get_name_by_port(port_id, device))
> + goto err;
> +
> + /* look for an entry in the shared device data */
> + eth_dev_data = rte_eth_dev_get_dev_data_by_name(device);
> + if (eth_dev_data == NULL)
> + goto err;

Why not getting eth_dev_data from rte_eth_devices[port_id].data ?

> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
>  /**
>   * @internal
> + * Release device data kept in shared memory for all processes.
> + *
> + * @paramport_id
> + *   The port identifier of the device to release device data.
> + * @return
> + *   - 0 on success, negative on error
> + */
> +int rte_eth_dev_release_dev_data(uint8_t port_id);

Why this function? It is not used.
You already have done the job in the detach function.


[dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data

2016-10-06 Thread Thomas Monjalon
2016-10-06 13:57, Kerlin, MarcinX:
> Hi Thomas,
> 
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > 
> > Hi Marcin,
> > 
> > 2016-09-30 16:00, Marcin Kerlin:
> > > Added protection against overwrite device data in array
> > > rte_eth_dev_data[] for the next secondary applications. Secondary
> > > process appends in the first free place rather than at the beginning.
> > > This behavior prevents overwriting devices data of primary process by
> > secondary process.
> > 
> > I've just realized that you are trying to fix an useless code.
> > Why not just remove the array rte_eth_dev_data[] at first?
> 
> because pointer to rte_eth_dev_data in rte_eth_devices[] is 
> just to array rte_eth_dev_data[].
> 
> rte_ethdev.c:214 
> eth_dev->data = &rte_eth_dev_data[port_id];

This line indicates that the pointer data is to the struct rte_eth_dev_data
of the port_id, not the array of every devices.

> > We already have the array rte_eth_devices[] and there is a pointer to
> > rte_eth_dev_data in rte_eth_dev.
> 
> As you write above there is a pointer, but after run secondary testpmd this 
> pointer
> will indicate data which hold from now data for secondary testpmd.
[...]
I think I've understood the bug.
I'm just saying you are fixing a weird design (rte_eth_dev_data[]).

> > Is it just a workaround to be able to lookup the rte_eth_dev_data memzone in
> > the secondary process?
> 
> No it is not workaround, it is protection against overwrite device data.
> I think that my cover letter good explain what is wrong. I did there
> short debug log.

I'm talking about the initial introduction of rte_eth_dev_data[]
which seems to be a workaround for multi-process without touching
rte_eth_devices[] allocated as a global variable (not a memzone).

> > So wouldn't it be saner to have rte_eth_devices[] in a memzone?
> 
> So you mean that move rte_eth_devices[] to memzone + remove 
> rte_eth_dev_data[].

Yes

> What will indicate pointer inside rte_eth_dev  rte_eth_devices[]:
> (struct rte_eth_dev_data *data;  /**< Pointer to device data */)

After thinking more about it, I realize that rte_eth_devices cannot be
in a shared memzone because of its local pointers.

Sorry for the noise, I'll reconsider your patch.


[dpdk-dev] [PATCH] eal/vdev: rename vdev driver init/uninit to probe/remove

2016-10-06 Thread Thomas Monjalon
2016-10-06 19:24, Shreyansh Jain:
> Inline with PCI probe and remove, VDEV probe and remove hooks provide
> a uniform naming.
> PCI probe represents scan and driver initialization. For VDEV, it will
> represent argument parsing and initialization.
> 
> Signed-off-by: Shreyansh Jain 

Applied, thanks


[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Iremonger, Bernard
Hi Thomas,

> Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal
> callback function
> 
> 2016-10-06 15:32, Iremonger, Bernard:
> > > > > 2016-10-06 12:26, Bernard Iremonger:
> > > > > >  void
> > > > > >  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> > > > > > -   enum rte_eth_event_type event)
> > > > > > +   enum rte_eth_event_type event, void *param)
> > > > >
> > > > > You need to squash the patches updating the calls to this function.
> > > > > Otherwise, this patch does not compile.
> > > >
> > > > I will have to squash everything into one patch, separate patches
> > > > will not
> > > compile.
> > >
> > > No you can keep a separate patch for the VF event in ixgbe.
> >
> > I have 4 patches at present
> >
> > librte_ether
> > net/ixgbe
> > drivers/net
> > app/test
> >
> > Would this be acceptable or do you just want  everything squashed into
> librte_ether except for net/ixgbe?
> 
> You can test the compilation of each patch with this command:
>   git rebase -i origin/master -x scripts/test-build.sh or just:
>   git rebase -i origin/master -x make
> 
> I think you need to squash drivers/net (adding just NULL param) and
> app/test in ethdev patch.

They do not compile if applied one by one.
Ok, I will squash drivers/net and app/test into the librte_ether patch.

Regards,

Bernard.



[dpdk-dev] [PATCH] Revert "bonding: use existing enslaved device queues"

2016-10-06 Thread Declan Doherty
On 07/09/16 13:28, Ilya Maximets wrote:
> This reverts commit 5b7bb2bda5519b7800f814df64d4e015282140e5.
>
> It is necessary to reconfigure all queues every time because configuration
> can be changed.
>

Hey Ilya, this makes sense. I guess this was my original intention but I 
missed this case in my review of the change.

> For example, if we're reconfiguring bonding device with new memory pool,
> already configured queues will still use the old one. And if the old
> mempool be freed, application likely will panic in attempt to use
> freed mempool.
>
> This happens when we use the bonding device with OVS 2.6 while MTU
> reconfiguration:
>
> PANIC in rte_mempool_get_ops():
> assert "(ops_index >= 0) && (ops_index < RTE_MEMPOOL_MAX_OPS_IDX)" failed
>
> Cc: 
> Signed-off-by: Ilya Maximets 
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
> b/drivers/net/bonding/rte_eth_bond_pmd.c
> index b20a272..eb5b6d1 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1305,8 +1305,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   struct bond_rx_queue *bd_rx_q;
>   struct bond_tx_queue *bd_tx_q;
>
> - uint16_t old_nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
> - uint16_t old_nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
>   int errval;
>   uint16_t q_id;
>
> @@ -1347,9 +1345,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   }
>
>   /* Setup Rx Queues */
> - /* Use existing queues, if any */
> - for (q_id = old_nb_rx_queues;
> -  q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
> + for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
>   bd_rx_q = (struct bond_rx_queue 
> *)bonded_eth_dev->data->rx_queues[q_id];
>
>   errval = rte_eth_rx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
> @@ -1365,9 +1361,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>   }
>
>   /* Setup Tx Queues */
> - /* Use existing queues, if any */
> - for (q_id = old_nb_tx_queues;
> -  q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
> + for (q_id = 0; q_id < bonded_eth_dev->data->nb_tx_queues; q_id++) {
>   bd_tx_q = (struct bond_tx_queue 
> *)bonded_eth_dev->data->tx_queues[q_id];
>
>   errval = rte_eth_tx_queue_setup(slave_eth_dev->data->port_id, 
> q_id,
>

Acked-by: Declan Doherty 


[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Iremonger, Bernard
Hi Thomas,



> > > Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify
> > > internal callback function
> > >
> > > 2016-10-06 12:26, Bernard Iremonger:
> > > >  void
> > > >  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> > > > -   enum rte_eth_event_type event)
> > > > +   enum rte_eth_event_type event, void *param)
> > >
> > > You need to squash the patches updating the calls to this function.
> > > Otherwise, this patch does not compile.
> >
> > I will have to squash everything into one patch, separate patches will not
> compile.
> 
> No you can keep a separate patch for the VF event in ixgbe.

I have 4 patches at present

librte_ether
net/ixgbe
drivers/net
app/test

Would this be acceptable or do you just want  everything squashed into 
librte_ether except for net/ixgbe?


> > > [...]
> > > > +   if (param != NULL)
> > > > +   dev_cb.cb_arg = (void *) param;
> > >
> > > You are overriding the user parameter.
> >
> > Yes, we want to update the user parameter for the
> > RTE_ETH_EVENT_VF_MBOX

I have renamed param to cb_arg to make it clearer what is happening.


> > > As it is only for a new event, it can be described in the register
> > > API that the user param won't be returned for this event.
> >
> > I will add a description in the rte_eth_dev_callback_register  function.
> >
> > > But a better design would be to add a new parameter to the callback.
> > > However it will be an API breakage.
> >
> > I do not want to break the ABI at this point.
> 
> Yes, but it can be considered for a later change.

Yes, ok

> > > > +   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
> > >
> > > Sorry I do not parse well this line.
> > > The event name is VF_MBOX and the comment is about the callback
> > > processing this event on PF side?
> > > I would suggest this kind of comment: "message from VF received by PF"
> >
> > Ok.
> >
> > >
> > > [...]
> > > >   *  Pointer to struct rte_eth_dev.
> > > >   * @param event
> > > >   *  Eth device interrupt event type.
> > > > + * @param param
> > > > + *  Parameter to pass back to user application.
> > > > + *  Allows the user application to decide if a particular
> > > > + function
> > > > + *  is permitted.
> > >
> > > In a more generic case, the parameter gives some details about the
> event.
> 
> Please consider a rewording here, thanks.

I have reworded here, I hope it is clearer.

Regards,

Bernard.



[dpdk-dev] [PATCH v4 2/2] i40e: Enable bad checksum flags in i40e vPMD

2016-10-06 Thread Chen, Jing D

> -Original Message-
> From: Shaw, Jeffrey B
> Sent: Wednesday, October 5, 2016 11:38 PM
> To: dev at dpdk.org
> Cc: Zhang, Helin ; Wu, Jingjing
> ; damarion at cisco.com; Zhang, Qi Z
> ; Chen, Jing D 
> Subject: [PATCH v4 2/2] i40e: Enable bad checksum flags in i40e vPMD
> 
> From: Damjan Marion 
> 
> Decode the checksum flags from the rx descriptor, setting the appropriate bit
> in the mbuf ol_flags field when the flag indicates a bad checksum.
> 
> Signed-off-by: Damjan Marion 
> Signed-off-by: Jeff Shaw 
Acked-by: Jing Chen 


[dpdk-dev] [PATCH v4 1/2] i40e: Add packet_type metadata in the i40e vPMD

2016-10-06 Thread Chen, Jing D

> -Original Message-
> From: Shaw, Jeffrey B
> Sent: Wednesday, October 5, 2016 11:38 PM
> To: dev at dpdk.org
> Cc: Zhang, Helin ; Wu, Jingjing
> ; damarion at cisco.com; Zhang, Qi Z
> ; Chen, Jing D 
> Subject: [PATCH v4 1/2] i40e: Add packet_type metadata in the i40e vPMD
> 
> From: Damjan Marion 
> 
> The ptype is decoded from the rx descriptor and stored in the packet type
> field in the mbuf using the same function as the non-vector driver.
> 
> Signed-off-by: Damjan Marion 
> Signed-off-by: Jeff Shaw 
> Acked-by: Qi Zhang 
> ---
> 
> Changes in v2:
>  - Add missing reference to i40e_recv_scattered_pkts_vec() when
>querying supported packet types.
> 
> Changes in v3:
>  - None. (Please ignore this version).
> 
> Changes in v4:
>  - Fix rss/fdir status mask and shift to get accurate Flow Director Filter
>Match (FLM) indication.
> 
>  drivers/net/i40e/i40e_rxtx.c | 567 
> +--
>  drivers/net/i40e/i40e_rxtx.h | 563
> ++
>  drivers/net/i40e/i40e_rxtx_vec.c |  16 ++
>  3 files changed, 582 insertions(+), 564 deletions(-)
Acked-by : Jing Chen 



[dpdk-dev] [PATCH] eal: fix compilation when optimization level is O1

2016-10-06 Thread Thomas Monjalon
2016-09-19 14:26, Olivier Matz:
> When compiled with EXTRA_CFLAGS="-O1", the compiler is not
> able to detect that size is always initialized when used, and
> issues a wrong warning:
> 
>   eal_memory.c: In function ?rte_eal_hugepage_attach?:
>   eal_memory.c:1684:3: error: ?size? may be used uninitialized in this
>function [-Werror=maybe-uninitialized]
>  munmap(hp, size);
>  ^
> 
> Workaround this issue by initializing size to 0.
> Seen on gcc (Debian 5.4.1-1) 5.4.1 20160803.
> 
> Signed-off-by: Olivier Matz 

Applied, thanks


[dpdk-dev] [PATCH v1 0/4] Generalize PCI specific EAL function/structures

2016-10-06 Thread Thomas Monjalon
2016-10-06 17:13, Shreyansh Jain:
> Hi Thomas,
> 
> On Monday 03 October 2016 07:06 PM, Thomas Monjalon wrote:
> > 2016-10-03 11:07, Shreyansh Jain:
> >> Hi David,
> >>
> >> On Friday 30 September 2016 09:01 PM, David Marchand wrote:
> >>> Those patches move linux specifics (binding pci devices using sysfs)
> >>> to common infrastucture.
> >>> We have no proper hotplug support on bsd, but if we had some common
> >>> code we should at least try to make the apis generic.
> >>>
> >>
> >> I am not sure if I understood your point well. Just to confirm - you are
> >> stating that the movement done in the patches might not suit BSD.
> >> Probably you are talking about (Patch 3/4 and 4/4).
> >> Is my understanding correct?
> >>
> >> So, movement to just Linux area is not enough?
> >> I am not well versed with BSD way of doing something similar so if
> >> someone can point it out, I can integrate that. (I will investigate it
> >> at my end as well).
> >>
> >> This patchset makes the PCI->EAL movement *only* for Linux for sysfs
> >> bind/unbind. (I should add this to cover letter, at the least).
> >
> > The concern is about function declarations in
> > lib/librte_eal/common/eal_private.h
> > We cannot be sure it can be applicable to something else than Linux.
> > As it is implemented in Linux only, it should not be in a common header.
> >
> 
> Ok. But, digging a little I found at least one more similar case.
> 'rte_eal_check_module()' which is present in the linuxapp/eal.c and has 
> existence in common, but no parallel implementation for BSD exists. This 
> function is accessing /sys/modules - which might be Linux specific.

Yes the BSD implementation is missing.
But the common function prototype makes sense as it can be called by an
application and could be implemented for BSD.


[dpdk-dev] ixgbe: support checksum flags in sse vector Rx function

2016-10-06 Thread Remy Horton

On 07/07/2016 13:19, Olivier Matz wrote:
[..]
> Signed-off-by: Maxime Leroy 
> Signed-off-by: Olivier Matz 
> ---
>  drivers/net/ixgbe/ixgbe_rxtx_vec_common.h |  8 ++---
>  drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c   |  6 
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c| 50 
> +--
>  3 files changed, 42 insertions(+), 22 deletions(-)

Acked-by: Remy Horton 


[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Thomas Monjalon
2016-10-06 12:26, Bernard Iremonger:
>  void
>  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> - enum rte_eth_event_type event)
> + enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function.
Otherwise, this patch does not compile.

[...]
> + if (param != NULL)
> + dev_cb.cb_arg = (void *) param;

You are overriding the user parameter.
As it is only for a new event, it can be described in the register API
that the user param won't be returned for this event.
But a better design would be to add a new parameter to the callback.
However it will be an API breakage.

> + RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */

Sorry I do not parse well this line.
The event name is VF_MBOX and the comment is about the callback
processing this event on PF side?
I would suggest this kind of comment: "message from VF received by PF"

[...]
>   *  Pointer to struct rte_eth_dev.
>   * @param event
>   *  Eth device interrupt event type.
> + * @param param
> + *  Parameter to pass back to user application.
> + *  Allows the user application to decide if a particular function
> + *  is permitted.

In a more generic case, the parameter gives some details about the event.



[dpdk-dev] [PATCH v2] app/test: remove hard-coding of crypto num qps

2016-10-06 Thread Trahe, Fiona


> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Wednesday, October 5, 2016 1:50 AM
> To: Trahe, Fiona ; dev at dpdk.org
> Cc: Trahe, Fiona ; Akhil Goyal  nxp.com>
> Subject: RE: [dpdk-dev] [PATCH v2] app/test: remove hard-coding of crypto
> num qps
> 
> Hi,
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Fiona Trahe
> > Sent: Thursday, September 29, 2016 10:18 AM
> > To: dev at dpdk.org
> > Cc: De Lara Guarch, Pablo; Trahe, Fiona; Akhil Goyal
> > Subject: [dpdk-dev] [PATCH v2] app/test: remove hard-coding of crypto
> > num qps
> >
> > ts_params->conf.nb_queue_pairs should not be hard coded with device
> > specific number. It should be retrieved from the device info.
> > Any test which changes it should restore it to orig value.
> >
> > Also related cleanup of test code setting number and size of
> > queue-pairs on a device, e.g.
> > * Removed irrelevant ?for? loop ? was hardcoded to only loop once.
> > * Removed obsolete comment re inability to free and re-allocate queu
> > memory
> >   and obsolete workaround for it which used to create maximum size queues.
> >
> > And added freeing of ring memory on queue-pair release in aesni_mb
> > PMD, else releasing and setting up queue-pair of a different size fails.
> >
> > Signed-off-by: Akhil Goyal 
> > Signed-off-by: Fiona Trahe 
> > ---
> >
> > v2:
> >   Fix for broken QAT PMD unit tests exposed by v1
> >   i.e. In test_device_configure_invalid_queue_pair_ids() after running tests
> >   for invalid values restore original nb_queue_pairs.
> >   Also cleanup of test code setting number and size of queue-pairs on a
> device
> >   Also fix for aesni_mb PMD not freeing ring memory on qp release
> 
> Sorry, I missed this patch. Could you split this patch into different patches?
> It looks like you are making (three?) changes in different places.
> 
> Thanks,
> Pablo

Ok, will do,
Fiona



[dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

2016-10-06 Thread Xu, Qian Q
See the bottom. 

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Yuanhan Liu
Sent: Friday, September 23, 2016 5:13 AM
To: dev at dpdk.org
Cc: Maxime Coquelin ; Yuanhan Liu 
Subject: [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy

The basic idea of dequeue zero copy is, instead of copying data from the desc 
buf, here we let the mbuf reference the desc buf addr directly.

Doing so, however, has one major issue: we can't update the used ring at the 
end of rte_vhost_dequeue_burst. Because we don't do the copy here, an update of 
the used ring would let the driver to reclaim the desc buf. As a result, DPDK 
might reference a stale memory region.

To update the used ring properly, this patch does several tricks:

- when mbuf references a desc buf, refcnt is added by 1.

  This is to pin lock the mbuf, so that a mbuf free from the DPDK
  won't actually free it, instead, refcnt is subtracted by 1.

- We chain all those mbuf together (by tailq)

  And we check it every time on the rte_vhost_dequeue_burst entrance,
  to see if the mbuf is freed (when refcnt equals to 1). If that
  happens, it means we are the last user of this mbuf and we are
  safe to update the used ring.

- "struct zcopy_mbuf" is introduced, to associate an mbuf with the
  right desc idx.

Dequeue zero copy is introduced for performance reason, and some rough tests 
show about 50% perfomance boost for packet size 1500B. For small packets, (e.g. 
64B), it actually slows a bit down (well, it could up to 15%). That is expected 
because this patch introduces some extra works, and it outweighs the benefit 
from saving few bytes copy.

Signed-off-by: Yuanhan Liu 
---

v2: - use unlikely/likely for dequeue_zero_copy check, as it's not enabled
  by default, as well as it has some limitations in vm2nic case.

- handle the case that a desc buf might across 2 host phys pages

- reset nr_zmbuf to 0 at set_vring_num

- set the zmbuf_size to vq->size, but not the double of it.
---
 lib/librte_vhost/vhost.c  |   2 +
 lib/librte_vhost/vhost.h  |  22 +-
 lib/librte_vhost/vhost_user.c |  42 +-  lib/librte_vhost/virtio_net.c 
| 173 +-
 4 files changed, 219 insertions(+), 20 deletions(-)

diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 
46095c3..ab25649 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -141,6 +141,8 @@ init_vring_queue(struct vhost_virtqueue *vq, int qp_idx)
/* always set the default vq pair to enabled */
if (qp_idx == 0)
vq->enabled = 1;
+
+   TAILQ_INIT(&vq->zmbuf_list);
 }

 static void
diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 
8565fa1..be8a398 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -61,6 +62,19 @@ struct buf_vector {
uint32_t desc_idx;
 };

+/*
+ * A structure to hold some fields needed in zero copy code path,
+ * mainly for associating an mbuf with the right desc_idx.
+ */
+struct zcopy_mbuf {
+   struct rte_mbuf *mbuf;
+   uint32_t desc_idx;
+   uint16_t in_use;
+
+   TAILQ_ENTRY(zcopy_mbuf) next;
+};
+TAILQ_HEAD(zcopy_mbuf_list, zcopy_mbuf);
+
 /**
  * Structure contains variables relevant to RX/TX virtqueues.
  */
@@ -85,6 +99,12 @@ struct vhost_virtqueue {

/* Physical address of used ring, for logging */
uint64_tlog_guest_addr;
+
+   uint16_tnr_zmbuf;
+   uint16_tzmbuf_size;
+   uint16_tlast_zmbuf_idx;
+   struct zcopy_mbuf   *zmbufs;
+   struct zcopy_mbuf_list  zmbuf_list;
 } __rte_cache_aligned;

 /* Old kernels have no such macro defined */ @@ -135,6 +155,7 @@ struct 
virtio_net {
/* to tell if we need broadcast rarp packet */
rte_atomic16_t  broadcast_rarp;
uint32_tvirt_qp_nb;
+   int dequeue_zero_copy;
struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
charifname[IF_NAME_SZ];
@@ -146,7 +167,6 @@ struct virtio_net {
uint32_tnr_guest_pages;
uint32_tmax_guest_pages;
struct guest_page   *guest_pages;
-
 } __rte_cache_aligned;

 /**
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c 
index a92377a..ac40408 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -180,7 +180,23 @@ static int
 vhost_user_set_vring_num(struct virtio_net *dev,
 struct vhost_vring_state *state)
 {
-   dev->virtqueue[state->index]->size = state->num;
+   struct vhost_virtqueue *vq = dev->virtqueue[state->index];
+
+   vq->size = state->num;
+
+   if (dev->dequeue_zero_

[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Iremonger, Bernard
Hi Thomas,

> Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal
> callback function
> 
> 2016-10-06 12:26, Bernard Iremonger:
> >  void
> >  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
> > -   enum rte_eth_event_type event)
> > +   enum rte_eth_event_type event, void *param)
> 
> You need to squash the patches updating the calls to this function.
> Otherwise, this patch does not compile.

I will have to squash everything into one patch, separate patches will not 
compile.

> [...]
> > +   if (param != NULL)
> > +   dev_cb.cb_arg = (void *) param;
> 
> You are overriding the user parameter.


Yes, we want to update the user parameter for the RTE_ETH_EVENT_VF_MBOX

> As it is only for a new event, it can be described in the register API that 
> the
> user param won't be returned for this event.

I will add a description in the rte_eth_dev_callback_register  function.

> But a better design would be to add a new parameter to the callback.
> However it will be an API breakage.

I do not want to break the ABI at this point.

> 
> > +   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
> 
> Sorry I do not parse well this line.
> The event name is VF_MBOX and the comment is about the callback
> processing this event on PF side?
> I would suggest this kind of comment: "message from VF received by PF"

Ok.

> 
> [...]
> >   *  Pointer to struct rte_eth_dev.
> >   * @param event
> >   *  Eth device interrupt event type.
> > + * @param param
> > + *  Parameter to pass back to user application.
> > + *  Allows the user application to decide if a particular function
> > + *  is permitted.
> 
> In a more generic case, the parameter gives some details about the event.



[dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio

2016-10-06 Thread Kavanagh, Mark B
>
>Hi Stephen/Liu,
>   Any other comments or suggestions for this. If the below patch looks 
> fine then please
>do suggest the next steps .


Hi Souvik,

Just to let you know that Yuanhan is out of office on account of public 
holidays in PRC.

AFAIA he should be back online from next week.

Thanks,
Mark

>
>--
>Regards,
>Souvik
>
>-Original Message-
>From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Dey, Souvik
>Sent: Wednesday, October 5, 2016 10:05 AM
>To: Kavanagh, Mark B ; yuanhan.liu at 
>linux.intel.com;
>stephen at networkplumber.org
>Cc: dev at dpdk.org
>Subject: Re: [dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio
>
>Yes Mark, I have modified the patch with the below comments.
>
>drivers/net/virtio/virtio_ethdev.c | 17 +
> 1 file changed, 17 insertions(+)
>
>diff --git a/drivers/net/virtio/virtio_ethdev.c 
>b/drivers/net/virtio/virtio_ethdev.c
>index 423c597..1dbfea6 100644
>--- a/drivers/net/virtio/virtio_ethdev.c
>+++ b/drivers/net/virtio/virtio_ethdev.c
>@@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
>PMD_INIT_LOG(ERR, "Failed to disable allmulticast");  }
>
>+#define VLAN_TAG_LEN   4/* 802.3ac tag (not DMA'd) */
>+
>+static int  virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
>+  struct virtio_hw *hw = dev->data->dev_private;
>+  uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
>+  hw->vtnet_hdr_size;
>+  uint32_t frame_size = mtu + ether_hdr_len;
>+
>+  if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) {
>+  PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n",
>+  ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len));
>+  return -EINVAL;
>+  }
>+  return 0;
>+}
>
>Let mem know if this looks good or we have few more comments.
>
>--
>Regards,
>Souvik
>
>-Original Message-
>From: Kavanagh, Mark B [mailto:mark.b.kavanagh at intel.com]
>Sent: Wednesday, October 5, 2016 4:16 AM
>To: Dey, Souvik ; yuanhan.liu at linux.intel.com; 
>stephen at networkplumber.org
>Cc: dev at dpdk.org
>Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio
>
>>Hi All,
>>  Is there any further comments or modifications required for this
>>patch, or what next steps do you guys suggest here ?
>
>Hi Souvik,
>
>Some minor comments inline.
>
>Thanks,
>Mark
>
>>
>>--
>>Regards,
>>Souvik
>>
>>-Original Message-
>>From: Dey, Souvik
>>Sent: Saturday, October 1, 2016 10:09 AM
>>To: mark.b.kavanagh at intel.com; yuanhan.liu at linux.intel.com;
>>stephen at networkplumber.org; dev at dpdk.org
>>Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio
>>
>>Hi Liu/Stephen/Mark,
>>
>>  I have submitted Version 7 of this patch. Do let me know if this looks 
>> proper.
>>
>>--
>>Regards,
>>Souvik
>>
>>-Original Message-
>>From: Dey, Souvik
>>Sent: Thursday, September 29, 2016 4:32 PM
>>To: mark.b.kavanagh at intel.com; yuanhan.liu at linux.intel.com;
>>stephen at networkplumber.org; dev at dpdk.org
>>Cc: Dey, Souvik 
>>Subject: [PATCH v7] net/virtio: add set_mtu in virtio
>>
>>
>>Virtio interfaces do not currently allow the user to specify a
>>particular Maximum Transmission Unit (MTU).Consequently, the MTU of
>>Virtio interfaces is typically set to the Ethernet default value of 1500.
>>This is problematic in the case of cloud deployments, in which a
>>specific (and potentially non-standard) MTU needs to be set by a DHCP
>>server, which needs to be honored by all interfaces across the traffic
>>path.To achieve this Virtio interfaces should support setting of MTU.
>>In case when GRE/VXLAN tunneling is used for internal communication,
>>there will be an overhead added by the infrastructure in the packet
>>over and above the ETHER MTU of 1518. So to take care of this overhead
>>in these cases the DHCP server corrects the L3 MTU to 1454. But since
>>virtio interfaces was not having the MTU set functionality that MTU
>>sent by the DHCP server was ignored and the instance will still send
>>packets with 1500 MTU which after encapsulation will become more than
>>1518 and eventually gets dropped in the infrastructure.
>>By adding an additional 'set_mtu' function to the Virtio driver, we can
>>honor the MTU sent by the DHCP server. The dhcp server/controller can
>>then leverage this 'set_mtu' functionality to resolve the above
>>mentioned issue of packets getting dropped due to incorrect size.
>>
>>
>>Signed-off-by: Souvik Dey 
>>
>>---
>>Changes in v7:
>>- Replaced the CRC_LEN with the merge rx buf header length.
>>- Changed the frame_len max validation to VIRTIO_MAX_RX_PKTLEN.
>>Changes in v6:
>>- Description of change corrected
>>- Corrected the identations
>>- Corrected the subject line too
>>- The From line was also not correct
>>- Re-submitting as the below patch was not proper Changes in v5:
>>- Fix log message for out-of-bounds MTU parameter in virtio_mtu_set
>>- Calculate frame size, based on '

[dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data

2016-10-06 Thread Kerlin, MarcinX
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Thursday, October 06, 2016 11:41 AM
> To: Kerlin, MarcinX 
> Cc: dev at dpdk.org; De Lara Guarch, Pablo  intel.com>;
> Gonzalez Monroy, Sergio 
> Subject: Re: [PATCH v5 1/2] librte_ether: add protection against overwrite
> device data
> 
> Hi Marcin,
> 
> 2016-09-30 16:00, Marcin Kerlin:
> > Added protection against overwrite device data in array
> > rte_eth_dev_data[] for the next secondary applications. Secondary
> > process appends in the first free place rather than at the beginning.
> > This behavior prevents overwriting devices data of primary process by
> secondary process.
> 
> I've just realized that you are trying to fix an useless code.
> Why not just remove the array rte_eth_dev_data[] at first?

because pointer to rte_eth_dev_data in rte_eth_devices[] is 
just to array rte_eth_dev_data[].

rte_ethdev.c:214 
eth_dev->data = &rte_eth_dev_data[port_id];

> We already have the array rte_eth_devices[] and there is a pointer to
> rte_eth_dev_data in rte_eth_dev.

As you write above there is a pointer, but after run secondary testpmd this 
pointer
will indicate data which hold from now data for secondary testpmd.

1) run testpmd [primary]

rte_eth_devices[0].data.name = 3:0.1

2) run testpmd [secondary]
This testpmd overwrite first index in rte_eth_dev_data[]
3:0.1 -> eth_pcap0

3) back to testpmd [primary]
rte_eth_devices[0].data.name = eth_pcap0

from now in primary testpmd our device name is eth_pcap0 but should be 3:0.1

> 
> Is it just a workaround to be able to lookup the rte_eth_dev_data memzone in
> the secondary process?

No it is not workaround, it is protection against overwrite device data.
I think that my cover letter good explain what is wrong. I did there
short debug log. 

> So wouldn't it be saner to have rte_eth_devices[] in a memzone?

So you mean that move rte_eth_devices[] to memzone + remove rte_eth_dev_data[].
What will indicate pointer inside rte_eth_dev  rte_eth_devices[]:
(struct rte_eth_dev_data *data;  /**< Pointer to device data */)

If I did not understand you please clarify more.

Regards,
Marcin
> 
> Sergio, as the multi-process maintainer, I guess you have an idea :)



[dpdk-dev] [PATCH v6 3/4] app/test: added tests for libcrypto PMD

2016-10-06 Thread Azarewicz, PiotrX T
Hi Fiona,

> This patch breaks autotests for all PMDs, due to increasing the MBUF size to
> UNIT16_MAX.
> USER1: Can't create CRYPTO_MBUFPOOL
> 
> It needs more than 500MBs in the MBUFPOOL to run this test.
> Setting this back to MBUF_SIZE fixes the issue, but breaks 2 tests in
> libcrypto_autotest
> 
> TestCase create_gmac_operation() line 5060 failed: no room to append aad
>  + TestCase [27] : test_AES_GMAC_authentication_test_case_4 failed
> TestCase create_gmac_operation() line 5060 failed: no room to append aad
>  + TestCase [28] : test_AES_GMAC_authentication_verify_test_case_4 failed
> 
> Can you investigate if it's possible to run these 2 tests using a different
> smaller MBUFPOOL -  maybe with only a few large mbufs?

Yes, I think that it is possible to run these 2 tests using a different mempoll.
I will make a fix for the issue.

Piotr



[dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio

2016-10-06 Thread Dey, Souvik
Hi Stephen/Liu,
   Any other comments or suggestions for this. If the below patch looks 
fine then please do suggest the next steps .

--
Regards,
Souvik

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dey, Souvik
Sent: Wednesday, October 5, 2016 10:05 AM
To: Kavanagh, Mark B ; yuanhan.liu at 
linux.intel.com; stephen at networkplumber.org
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio

Yes Mark, I have modified the patch with the below comments.

drivers/net/virtio/virtio_ethdev.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 423c597..1dbfea6 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
PMD_INIT_LOG(ERR, "Failed to disable allmulticast");  } 

+#define VLAN_TAG_LEN   4/* 802.3ac tag (not DMA'd) */
+
+static int  virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
+   struct virtio_hw *hw = dev->data->dev_private;
+   uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN +
+   hw->vtnet_hdr_size;
+   uint32_t frame_size = mtu + ether_hdr_len;
+
+   if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) {
+   PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n",
+   ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len));
+   return -EINVAL;
+   }
+   return 0;
+}

Let mem know if this looks good or we have few more comments. 

--
Regards,
Souvik

-Original Message-
From: Kavanagh, Mark B [mailto:mark.b.kavan...@intel.com]
Sent: Wednesday, October 5, 2016 4:16 AM
To: Dey, Souvik ; yuanhan.liu at linux.intel.com; 
stephen at networkplumber.org
Cc: dev at dpdk.org
Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio

>Hi All,
>   Is there any further comments or modifications required for this 
>patch, or what next steps do you guys suggest here ?

Hi Souvik,

Some minor comments inline.

Thanks,
Mark

>
>--
>Regards,
>Souvik
>
>-Original Message-
>From: Dey, Souvik
>Sent: Saturday, October 1, 2016 10:09 AM
>To: mark.b.kavanagh at intel.com; yuanhan.liu at linux.intel.com; 
>stephen at networkplumber.org; dev at dpdk.org
>Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio
>
>Hi Liu/Stephen/Mark,
>
>   I have submitted Version 7 of this patch. Do let me know if this looks 
> proper.
>
>--
>Regards,
>Souvik
>
>-Original Message-
>From: Dey, Souvik
>Sent: Thursday, September 29, 2016 4:32 PM
>To: mark.b.kavanagh at intel.com; yuanhan.liu at linux.intel.com; 
>stephen at networkplumber.org; dev at dpdk.org
>Cc: Dey, Souvik 
>Subject: [PATCH v7] net/virtio: add set_mtu in virtio
>
>
>Virtio interfaces do not currently allow the user to specify a 
>particular Maximum Transmission Unit (MTU).Consequently, the MTU of 
>Virtio interfaces is typically set to the Ethernet default value of 1500.
>This is problematic in the case of cloud deployments, in which a 
>specific (and potentially non-standard) MTU needs to be set by a DHCP 
>server, which needs to be honored by all interfaces across the traffic 
>path.To achieve this Virtio interfaces should support setting of MTU.
>In case when GRE/VXLAN tunneling is used for internal communication, 
>there will be an overhead added by the infrastructure in the packet 
>over and above the ETHER MTU of 1518. So to take care of this overhead 
>in these cases the DHCP server corrects the L3 MTU to 1454. But since 
>virtio interfaces was not having the MTU set functionality that MTU 
>sent by the DHCP server was ignored and the instance will still send 
>packets with 1500 MTU which after encapsulation will become more than
>1518 and eventually gets dropped in the infrastructure.
>By adding an additional 'set_mtu' function to the Virtio driver, we can 
>honor the MTU sent by the DHCP server. The dhcp server/controller can 
>then leverage this 'set_mtu' functionality to resolve the above 
>mentioned issue of packets getting dropped due to incorrect size.
>
>
>Signed-off-by: Souvik Dey 
>
>---
>Changes in v7:
>- Replaced the CRC_LEN with the merge rx buf header length.
>- Changed the frame_len max validation to VIRTIO_MAX_RX_PKTLEN.
>Changes in v6:
>- Description of change corrected
>- Corrected the identations
>- Corrected the subject line too
>- The From line was also not correct
>- Re-submitting as the below patch was not proper Changes in v5:
>- Fix log message for out-of-bounds MTU parameter in virtio_mtu_set
>- Calculate frame size, based on 'mtu' parameter
>- Corrected the upper bound and lower bound checks in virtio_mtu_set 
>Changes in v4: Incorporated review comments.
>Changes in v3: Corrected few style errors as reported by sys-stv.
>Changes in v2: Incorporated review comments.
>
> drivers/net/virtio/virtio_ethdev.

[dpdk-dev] [PATCH v6 3/4] app/test: added tests for libcrypto PMD

2016-10-06 Thread Trahe, Fiona
Hi Slawomir,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Slawomir Mrozowicz
> Sent: Tuesday, October 4, 2016 4:11 PM
> To: dev at dpdk.org
> Cc: Mrozowicz, SlawomirX ; Azarewicz,
> PiotrX T ; Kerlin, MarcinX
> ; Mrzyglod, DanielX T
> 
> Subject: [dpdk-dev] [PATCH v6 3/4] app/test: added tests for libcrypto PMD
> 
> This patch contains unit tests for libcrypto PMD. User can
> use app/test application to check how to use this pmd and to
> verify crypto processing.
> 
> Test name is cryptodev_libcrypto_autotest.
> For performance test cryptodev_libcrypto_perftest can be used.
> 
> Signed-off-by: Piotr Azarewicz 
> Signed-off-by: Marcin Kerlin 
> Signed-off-by: Daniel Mrzyglod 
> ---
> v2:
> - rename AES-named functions to blockcipher
> - replace different test cases with blockcipher functions pattern
> - add 3DES tests into QuickAssist PMD testsuite
> 
> v3:
> - add nagative verification tests
> - add big data test
> 
> v4:
> - move aes test rework to another patch
> - move big data test to another patch
> - checking if libcrypto pmd is available
> 
> v5:
> - add reduced big data test
> 
> v6:
> - fix checkpatch warnings

This patch breaks autotests for all PMDs, due to increasing the MBUF size to 
UNIT16_MAX.
USER1: Can't create CRYPTO_MBUFPOOL

It needs more than 500MBs in the MBUFPOOL to run this test.
Setting this back to MBUF_SIZE fixes the issue, but breaks 2 tests in 
libcrypto_autotest

TestCase create_gmac_operation() line 5060 failed: no room to append aad
 
 + TestCase [27] : test_AES_GMAC_authentication_test_case_4 failed  
 
TestCase create_gmac_operation() line 5060 failed: no room to append aad
 
 + TestCase [28] : test_AES_GMAC_authentication_verify_test_case_4 failed

Can you investigate if it's possible to run these 2 tests using a different 
smaller MBUFPOOL -  maybe with only a few large mbufs?



[dpdk-dev] [PATCH 2/2] app/testpmd: use consistent vdev names

2016-10-06 Thread Thomas Monjalon
The vdev eth_bond has been renamed to net_bond.
testpmd is creating a bonding device with the old prefix.
It is changed for consistency.

The script test-null.sh was failing because using the old name
for the null vdev.

Fixes also the bonding and testpmd doc.

Fixes: 2f45703c17ac ("drivers: make driver names consistent")

Signed-off-by: Thomas Monjalon 
---
 app/test-pmd/cmdline.c   |  2 +-
 doc/guides/contributing/documentation.rst|  4 ++--
 doc/guides/howto/lm_bond_virtio_sriov.rst|  2 +-
 doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst | 14 +++---
 doc/guides/testpmd_app_ug/run_app.rst|  2 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst  | 14 +++---
 scripts/test-null.sh |  2 +-
 7 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 17d238f..b3772ce 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -4391,7 +4391,7 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,
return;
}

-   snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "eth_bond_testpmd_%d",
+   snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "net_bond_testpmd_%d",
bond_dev_num++);

/* Create a new bonded device. */
diff --git a/doc/guides/contributing/documentation.rst 
b/doc/guides/contributing/documentation.rst
index 6d4c277..2cfb1a2 100644
--- a/doc/guides/contributing/documentation.rst
+++ b/doc/guides/contributing/documentation.rst
@@ -458,8 +458,8 @@ Code and Literal block sections
   For long literal lines that exceed that limit try to wrap the text at 
sensible locations.
   For example a long command line could be documented like this and still work 
if copied directly from the docs::

- build/app/testpmd -c7 -n3 --vdev=eth_pcap0,iface=eth0 \
-   --vdev=eth_pcap1,iface=eth1 \
+ build/app/testpmd -c7 -n3 --vdev=net_pcap0,iface=eth0 \
+   --vdev=net_pcap1,iface=eth1 \
-- -i --nb-cores=2 --nb-ports=2 \
   --total-num-mbufs=2048

diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
index 9bc3450..fe9803e 100644
--- a/doc/guides/howto/lm_bond_virtio_sriov.rst
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -142,7 +142,7 @@ Bonding is port 2 (P2).
 .. code-block:: console

testpmd> create bonded device 1 0
-   Created new bonded device eth_bond_testpmd_0 on (port 2).
+   Created new bonded device net_bond_testpmd_0 on (port 2).
testpmd> add bonding slave 0 2
testpmd> add bonding slave 1 2
testpmd> show bonding config 2
diff --git a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst 
b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
index 01ddcb9..65813c9 100644
--- a/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
+++ b/doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
@@ -356,7 +356,7 @@ Using Link Bonding Devices from the EAL Command Line

 Link bonding devices can be created at application startup time using the
 ``--vdev`` EAL command line option. The device name must start with the
-eth_bond prefix followed by numbers or letters. The name must be unique for
+net_bond prefix followed by numbers or letters. The name must be unique for
 each device. Each device can have multiple options arranged in a comma
 separated list. Multiple devices definitions can be arranged by calling the
 ``--vdev`` option multiple times.
@@ -365,7 +365,7 @@ Device names and bonding options must be separated by 
commas as shown below:

 .. code-block:: console

-$RTE_TARGET/app/testpmd -c f -n 4 --vdev 'eth_bond0,bond_opt0=..,bond 
opt1=..'--vdev 'eth_bond1,bond _opt0=..,bond_opt1=..'
+$RTE_TARGET/app/testpmd -c f -n 4 --vdev 'net_bond0,bond_opt0=..,bond 
opt1=..'--vdev 'net_bond1,bond _opt0=..,bond_opt1=..'

 Link Bonding EAL Options
 
@@ -373,7 +373,7 @@ Link Bonding EAL Options
 There are multiple ways of definitions that can be assessed and combined as
 long as the following two rules are respected:

-*   A unique device name, in the format of eth_bondX is provided,
+*   A unique device name, in the format of net_bondX is provided,
 where X can be any combination of numbers and/or letters,
 and the name is no greater than 32 characters long.

@@ -465,22 +465,22 @@ Create a bonded device in round robin mode with two 
slaves specified by their PC

 .. code-block:: console

-$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 'eth_bond0,mode=0, 
slave=:00a:00.01,slave=:004:00.00' -- --port-topology=chained
+$RTE_TARGET/app/testpmd -c '0xf' -n 4 --vdev 'net_bond0,mode=0, 
slave=:00a:00.01,slave=:004:00.00' -- --port-topology=chained

 Create a bonded device in r

[dpdk-dev] [PATCH 1/2] app/test: fix vdev names

2016-10-06 Thread Thomas Monjalon
The vdev eth_ring has been renamed to net_ring.
Some unit tests are using the old name and fail.

Fixes also the vdev comments in EAL and ethdev.

Fixes: 2f45703c17ac ("drivers: make driver names consistent")

Signed-off-by: Thomas Monjalon 
---
 app/test/test_devargs.c  |  8 
 app/test/test_eal_flags.c|  6 +++---
 app/test/test_pmd_ring.c | 14 +++---
 doc/guides/contributing/documentation.rst|  4 ++--
 doc/guides/prog_guide/port_hotplug_framework.rst |  2 +-
 lib/librte_eal/common/eal_common_options.c   |  2 +-
 lib/librte_eal/common/eal_common_vdev.c  |  4 ++--
 lib/librte_eal/common/include/rte_devargs.h  |  8 
 lib/librte_ether/rte_ethdev.h|  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 151ac2a..63242f1 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -78,19 +78,19 @@ test_devargs(void)
goto fail;
if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 0)
goto fail;
-   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring0") < 0)
+   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "net_ring0") < 0)
goto fail;
-   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, 
"eth_ring1,key=val,k2=val2") < 0)
+   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, 
"net_ring1,key=val,k2=val2") < 0)
goto fail;
if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2)
goto fail;
free_devargs_list();

/* check virtual device with argument parsing */
-   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, 
"eth_ring1,k1=val,k2=val2") < 0)
+   if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, 
"net_ring1,k1=val,k2=val2") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
-   if (strncmp(devargs->virt.drv_name, "eth_ring1",
+   if (strncmp(devargs->virt.drv_name, "net_ring1",
sizeof(devargs->virt.drv_name)) != 0)
goto fail;
if (!devargs->args || strcmp(devargs->args, "k1=val,k2=val2") != 0)
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 6202f05..91b4066 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -414,13 +414,13 @@ test_invalid_vdev_flag(void)

/* Test with valid vdev option */
const char *vdevval1[] = {prgname, prefix, "-n", "1",
-   "-c", "1", vdev, "eth_ring0"};
+   "-c", "1", vdev, "net_ring0"};

const char *vdevval2[] = {prgname, prefix, "-n", "1",
-   "-c", "1", vdev, "eth_ring0,args=test"};
+   "-c", "1", vdev, "net_ring0,args=test"};

const char *vdevval3[] = {prgname, prefix, "-n", "1",
-   "-c", "1", vdev, "eth_ring0,nodeaction=r1:0:CREATE"};
+   "-c", "1", vdev, "net_ring0,nodeaction=r1:0:CREATE"};

if (launch_proc(vdevinval) == 0) {
printf("Error - process did run ok with invalid "
diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index 47374db..2cdf60d 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -434,7 +434,7 @@ test_pmd_ring(void)
/*  create the rings and eth_rings in the test code.
 *  This does not test the rte_pmd_ring_devinit function.
 *
-*  Test with the command line option --vdev=eth_ring0 to test 
rte_pmd_ring_devinit.
+*  Test with the command line option --vdev=net_ring0 to test 
rte_pmd_ring_devinit.
 */
rxtx[0] = rte_ring_create("R0", RING_SIZE, SOCKET0, 
RING_F_SP_ENQ|RING_F_SC_DEQ);
if (rxtx[0] == NULL) {
@@ -448,11 +448,11 @@ test_pmd_ring(void)
return -1;
}

-   tx_porta = rte_eth_from_rings("eth_ringa", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
-   rx_portb = rte_eth_from_rings("eth_ringb", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
-   rxtx_portc = rte_eth_from_rings("eth_ringc", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
-   rxtx_portd = rte_eth_from_rings("eth_ringd", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
-   rxtx_porte = rte_eth_from_rings("eth_ringe", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
+   tx_porta = rte_eth_from_rings("net_ringa", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
+   rx_portb = rte_eth_from_rings("net_ringb", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
+   rxtx_portc = rte_eth_from_rings("net_ringc", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
+   rxtx_portd = rte_eth_from_rings("net_ringd", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);
+   rxtx_porte = rte_eth_from_rings("net_ringe", rxtx, NUM_RINGS, rxtx, 
NUM_RINGS, SOCKET0);

printf("tx_porta=%d rx_portb=%d rxtx_portc=%d rxtx_portd=%d 
rxtx_porte=%d\n",
tx_porta, rx_portb, rxtx_portc, rxtx_portd, rxtx_porte);
@@ -501,7 +501,7 @@ tes

[dpdk-dev] [PATCH v5 13/13] net/enic: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 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 15a05b4..fb72491 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle 
*handle,
vnic_intr_return_all_credits(&enic->intr);

enic_link_update(enic);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
enic_log_q_error(enic);
 }

-- 
2.9.0



[dpdk-dev] [PATCH v5 12/13] net/virtio: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index b4dfc0a..2f0065a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,
if (isr & VIRTIO_PCI_ISR_CONFIG) {
if (virtio_dev_link_update(dev, 0) == 0)
_rte_eth_dev_callback_process(dev,
- RTE_ETH_EVENT_INTR_LSC);
+ RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 11/13] net/vhost: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 409e090..421cdba 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -559,7 +559,7 @@ new_device(int vid)

RTE_LOG(INFO, PMD, "New connection established\n");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);

return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)

RTE_LOG(INFO, PMD, "Connection closed\n");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
@@ -655,7 +655,7 @@ vring_state_changed(int vid, uint16_t vring, int enable)
RTE_LOG(INFO, PMD, "vring%u is %s\n",
vring, enable ? "enabled" : "disabled");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);

return 0;
 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 10/13] net/thunderx: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/thunderx/nicvf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c 
b/drivers/net/thunderx/nicvf_ethdev.c
index b758c9f..c61e171 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
nicvf_set_eth_link_status(nic,
&nic->eth_dev->data->dev_link);
_rte_eth_dev_callback_process(nic->eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}

rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
-- 
2.9.0



[dpdk-dev] [PATCH v5 09/13] net/nfp: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index d526f34..a2b9056 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1219,7 +1219,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;

nfp_net_link_update(dev, 0);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);

nfp_net_dev_link_status_print(dev);

-- 
2.9.0



[dpdk-dev] [PATCH v5 08/13] net/mlx5: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index bf4232a..c76e754 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle 
*intr_handle, void *cb_arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
-- 
2.9.0



[dpdk-dev] [PATCH v5 07/13] net/mlx4: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/mlx4/mlx4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 1553b2e..3e57cca 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle 
*intr_handle, void *cb_arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
-- 
2.9.0



[dpdk-dev] [PATCH v5 06/13] net/i40e: update call to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/i40e/i40e_ethdev.c| 4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 697800e..d947760 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5510,7 +5510,7 @@ i40e_dev_interrupt_delayed_handler(void *param)

/* handle the link up interrupt in an alarm callback */
i40e_dev_link_update(dev, 0);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);

i40e_pf_enable_irq0(hw);
rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5594,7 +5594,7 @@ i40e_dev_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,
return;
else
_rte_eth_dev_callback_process(dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}

 done:
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
b/drivers/net/i40e/i40e_ethdev_vf.c
index 34eb274..bd89cd9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev 
*dev,
switch (pf_msg->event) {
case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
break;
case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
-- 
2.9.0



[dpdk-dev] [PATCH v5 05/13] net/e1000: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/e1000/em_ethdev.c  | 2 +-
 drivers/net/e1000/igb_ethdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f767e1c..e13e858 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,

eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5a1a83e..d9ab2df 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_TCTL, tctl);
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
E1000_WRITE_FLUSH(hw);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

return 0;
@@ -2743,7 +2743,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == E1000_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
-- 
2.9.0



[dpdk-dev] [PATCH v5 04/13] net/bonding: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 292086a..0913020 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
return;

_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);

} else {
if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}
}
 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 03/13] app/test: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 app/test/virtual_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4831113..65b44c6 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 int
-- 
2.9.0



[dpdk-dev] [PATCH v5 02/13] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 Thread Bernard Iremonger
call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 
 3 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 55a82d3..91db2c3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
ixgbe_dev_link_update(dev, 0);
intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
ixgbe_dev_link_status_print(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == IXGBE_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..2a177b8 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ixgbe_vf_info *vfinfo =
*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, 
&cb_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf

[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Bernard Iremonger
add parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c | 5 -
 lib/librte_ether/rte_ethdev.h | 7 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index c517e88..416ca77 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,

 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-   enum rte_eth_event_type event)
+   enum rte_eth_event_type event, void *param)
 {
struct rte_eth_dev_callback *cb_lst;
struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
continue;
dev_cb = *cb_lst;
cb_lst->active = 1;
+   if (param != NULL)
+   dev_cb.cb_arg = (void *) param;
+
rte_spinlock_unlock(&rte_eth_dev_cb_lock);
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
dev_cb.cb_arg);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7218b6f..9fb34ca 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
/**< queue state event (enabled/disabled) */
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
+   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

@@ -3085,12 +3086,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param param
+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-   enum rte_eth_event_type event);
+   enum rte_eth_event_type event, void *param);

 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
-- 
2.9.0



[dpdk-dev] [PATCH v5 00/13] modify callback for VF management

2016-10-06 Thread Bernard Iremonger
This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process
function. All references to this function have been updated.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function
Removed two new callback functions which were added previously.
Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.




















Bernard Iremonger (13):
  librte_ether: modify internal callback function
  net/ixgbe: add callback to user app on VF to PF mbox msg
  app/test: add parameter to callback process function
  net/bonding: add parameter to callback process function
  net/e1000: add parameter to callback process function
  net/i40e: update call to callback process function
  net/mlx4: add parameter to callback process function
  net/mlx5: add parameter to callback process function
  net/nfp: add parameter to callback process function
  net/thunderx: add parameter to callback process function
  net/vhost: add parameter to callback process function
  net/virtio: add parameter to callback process function
  net/enic: add parameter to callback process function

 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c   | 42 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 17 ++
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 ++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 +++-
 lib/librte_ether/rte_ethdev.h  |  7 +-
 18 files changed, 86 insertions(+), 31 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v5 1/2] librte_ether: add protection against overwrite device data

2016-10-06 Thread Thomas Monjalon
Hi Marcin,

2016-09-30 16:00, Marcin Kerlin:
> Added protection against overwrite device data in array rte_eth_dev_data[]
> for the next secondary applications. Secondary process appends in the
> first free place rather than at the beginning. This behavior prevents
> overwriting devices data of primary process by secondary process.

I've just realized that you are trying to fix an useless code.
Why not just remove the array rte_eth_dev_data[] at first?
We already have the array rte_eth_devices[] and there is a pointer to
rte_eth_dev_data in rte_eth_dev.

Is it just a workaround to be able to lookup the rte_eth_dev_data memzone
in the secondary process?
So wouldn't it be saner to have rte_eth_devices[] in a memzone?

Sergio, as the multi-process maintainer, I guess you have an idea :)


[dpdk-dev] [PATCH 1/1] doc: fix errors in pdump doc

2016-10-06 Thread Mark Kavanagh
- Fix copy/paste error in description of how to capture both rx
  & tx traffic in a single pcap file
- Replace duplicate word with what original author presumably
  intended, such that description now makes sense

Signed-off-by: Mark Kavanagh 
---
 doc/guides/sample_app_ug/pdump.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/sample_app_ug/pdump.rst 
b/doc/guides/sample_app_ug/pdump.rst
index ac0e7c9..320c914 100644
--- a/doc/guides/sample_app_ug/pdump.rst
+++ b/doc/guides/sample_app_ug/pdump.rst
@@ -119,8 +119,8 @@ Can be either a pcap file name or any Linux iface.
   * To receive ingress and egress packets separately ``rx-dev`` and 
``tx-dev``
 should both be passed with the different file names or the Linux iface 
names.

-  * To receive ingress and egress packets separately ``rx-dev`` and 
``tx-dev``
-should both be passed with the same file names or the the Linux iface 
names.
+  * To receive ingress and egress packets together, ``rx-dev`` and 
``tx-dev``
+should both be passed with the same file name or the same Linux iface 
name.

 ``ring-size``:
 Size of the ring. This value is used internally for ring creation. The ring 
will be used to enqueue the packets from
-- 
1.9.3



[dpdk-dev] [PATCH v4] app/testpmd: add option to enable lro

2016-10-06 Thread Olivier Matz
Introduce a new argument '--enable-lro' to ask testpmd to enable the LRO
feature on enabled ports, like it's done for '--enable-rx-cksum' for
instance.

Signed-off-by: Olivier Matz 
---

v3 -> v4:
- fix typo in documentation

 app/test-pmd/parameters.c | 4 
 doc/guides/testpmd_app_ug/run_app.rst | 4 
 2 files changed, 8 insertions(+)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 6a6a07e..c45f78a 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -149,6 +149,7 @@ usage(char* progname)
   "If the drop-queue doesn't exist, the packet is dropped. "
   "By default drop-queue=127.\n");
printf("  --crc-strip: enable CRC stripping by hardware.\n");
+   printf("  --enable-lro: enable large receive offload.\n");
printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf("  --disable-hw-vlan: disable hardware vlan.\n");
printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
@@ -524,6 +525,7 @@ launch_args_parse(int argc, char** argv)
{ "pkt-filter-size",1, 0, 0 },
{ "pkt-filter-drop-queue",  1, 0, 0 },
{ "crc-strip",  0, 0, 0 },
+   { "enable-lro", 0, 0, 0 },
{ "enable-rx-cksum",0, 0, 0 },
{ "enable-scatter", 0, 0, 0 },
{ "disable-hw-vlan",0, 0, 0 },
@@ -764,6 +766,8 @@ launch_args_parse(int argc, char** argv)
}
if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
rx_mode.hw_strip_crc = 1;
+   if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
+   rx_mode.enable_lro = 1;
if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
rx_mode.enable_scatter = 1;
if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 7712bd2..55c7ac0 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -285,6 +285,10 @@ The commandline options are:

 Enable hardware CRC stripping.

+*   ``--enable-lro``
+
+Enable large receive offload.
+
 *   ``--enable-rx-cksum``

 Enable hardware RX checksum offload.
-- 
2.8.1



[dpdk-dev] [PATCH v3] app/testpmd: add option to enable lro

2016-10-06 Thread Olivier Matz
Introduce a new argument '--enable-lro' to ask testpmd to enable the LRO
feature on enabled ports, like it's done for '--enable-rx-cksum' for
instance.

Signed-off-by: Olivier Matz 
---

v2 -> v3:
- add documentation for this new option

 app/test-pmd/parameters.c | 4 
 doc/guides/testpmd_app_ug/run_app.rst | 4 
 2 files changed, 8 insertions(+)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 6a6a07e..c45f78a 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -149,6 +149,7 @@ usage(char* progname)
   "If the drop-queue doesn't exist, the packet is dropped. "
   "By default drop-queue=127.\n");
printf("  --crc-strip: enable CRC stripping by hardware.\n");
+   printf("  --enable-lro: enable large receive offload.\n");
printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf("  --disable-hw-vlan: disable hardware vlan.\n");
printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
@@ -524,6 +525,7 @@ launch_args_parse(int argc, char** argv)
{ "pkt-filter-size",1, 0, 0 },
{ "pkt-filter-drop-queue",  1, 0, 0 },
{ "crc-strip",  0, 0, 0 },
+   { "enable-lro", 0, 0, 0 },
{ "enable-rx-cksum",0, 0, 0 },
{ "enable-scatter", 0, 0, 0 },
{ "disable-hw-vlan",0, 0, 0 },
@@ -764,6 +766,8 @@ launch_args_parse(int argc, char** argv)
}
if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
rx_mode.hw_strip_crc = 1;
+   if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
+   rx_mode.enable_lro = 1;
if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
rx_mode.enable_scatter = 1;
if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 7712bd2..4060036 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -285,6 +285,10 @@ The commandline options are:

 Enable hardware CRC stripping.

+*   ``enable-lro``
+
+Enable large receive offload.
+
 *   ``--enable-rx-cksum``

 Enable hardware RX checksum offload.
-- 
2.8.1



[dpdk-dev] [PATCH v3] mbuf: add function to dump ol flag list

2016-10-06 Thread Olivier Matz
The functions rte_get_rx_ol_flag_name() and rte_get_tx_ol_flag_name()
can dump one flag, or set of flag that are part of the same mask (ex:
PKT_TX_UDP_CKSUM, part of PKT_TX_L4_MASK). But they are not designed to
dump the list of flags contained in mbuf->ol_flags.

This commit introduce new functions to do that. Similarly to the packet
type dump functions, the goal is to factorize the code that could be
used in several applications and reduce the risk of desynchronization
between the flags and the dump functions.

Signed-off-by: Olivier Matz 
---

v2 -> v3:
- Move return type on a separate line in function definitions

 doc/guides/rel_notes/release_16_11.rst |  5 ++
 lib/librte_mbuf/rte_mbuf.c | 93 ++
 lib/librte_mbuf/rte_mbuf.h | 28 ++
 lib/librte_mbuf/rte_mbuf_version.map   |  2 +
 4 files changed, 128 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_11.rst 
b/doc/guides/rel_notes/release_16_11.rst
index 40c09ca..3d3c417 100644
--- a/doc/guides/rel_notes/release_16_11.rst
+++ b/doc/guides/rel_notes/release_16_11.rst
@@ -50,6 +50,11 @@ New Features

   Added new functions ``rte_get_ptype_*()`` to dump a packet type as a string.

+* **Added functions to dump the offload flags as a string.**
+
+  Added two new functions ``rte_get_rx_ol_flag_list()`` and
+  ``rte_get_tx_ol_flag_list()`` to dump offload flags as a string.
+
 Resolved Issues
 ---

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 37fd72b..37691ca 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -317,6 +317,54 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
}
 }

+struct flag_mask {
+   uint64_t flag;
+   uint64_t mask;
+   const char *default_name;
+};
+
+/* write the list of rx ol flags in buffer buf */
+int
+rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
+{
+   const struct flag_mask rx_flags[] = {
+   { PKT_RX_VLAN_PKT, PKT_RX_VLAN_PKT, NULL },
+   { PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, NULL },
+   { PKT_RX_FDIR, PKT_RX_FDIR, NULL },
+   { PKT_RX_L4_CKSUM_BAD, PKT_RX_L4_CKSUM_BAD, NULL },
+   { PKT_RX_IP_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD, NULL },
+   { PKT_RX_EIP_CKSUM_BAD, PKT_RX_EIP_CKSUM_BAD, NULL },
+   { PKT_RX_VLAN_STRIPPED, PKT_RX_VLAN_STRIPPED, NULL },
+   { PKT_RX_IEEE1588_PTP, PKT_RX_IEEE1588_PTP, NULL },
+   { PKT_RX_IEEE1588_TMST, PKT_RX_IEEE1588_TMST, NULL },
+   { PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL },
+   };
+   const char *name;
+   unsigned int i;
+   int ret;
+
+   if (buflen == 0)
+   return -1;
+
+   buf[0] = '\0';
+   for (i = 0; i < RTE_DIM(rx_flags); i++) {
+   if ((mask & rx_flags[i].mask) != rx_flags[i].flag)
+   continue;
+   name = rte_get_rx_ol_flag_name(rx_flags[i].flag);
+   if (name == NULL)
+   name = rx_flags[i].default_name;
+   ret = snprintf(buf, buflen, "%s ", name);
+   if (ret < 0)
+   return -1;
+   if ((size_t)ret >= buflen)
+   return -1;
+   buf += ret;
+   buflen -= ret;
+   }
+
+   return 0;
+}
+
 /*
  * Get the name of a TX offload flag. Must be kept synchronized with flag
  * definitions in rte_mbuf.h.
@@ -339,3 +387,48 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask)
default: return NULL;
}
 }
+
+/* write the list of tx ol flags in buffer buf */
+int
+rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
+{
+   const struct flag_mask tx_flags[] = {
+   { PKT_TX_VLAN_PKT, PKT_TX_VLAN_PKT, NULL },
+   { PKT_TX_IP_CKSUM, PKT_TX_IP_CKSUM, NULL },
+   { PKT_TX_TCP_CKSUM, PKT_TX_L4_MASK, NULL },
+   { PKT_TX_SCTP_CKSUM, PKT_TX_L4_MASK, NULL },
+   { PKT_TX_UDP_CKSUM, PKT_TX_L4_MASK, NULL },
+   { PKT_TX_L4_NO_CKSUM, PKT_TX_L4_MASK, "PKT_TX_L4_NO_CKSUM" },
+   { PKT_TX_IEEE1588_TMST, PKT_TX_IEEE1588_TMST, NULL },
+   { PKT_TX_TCP_SEG, PKT_TX_TCP_SEG, NULL },
+   { PKT_TX_IPV4, PKT_TX_IPV4, NULL },
+   { PKT_TX_IPV6, PKT_TX_IPV6, NULL },
+   { PKT_TX_OUTER_IP_CKSUM, PKT_TX_OUTER_IP_CKSUM, NULL },
+   { PKT_TX_OUTER_IPV4, PKT_TX_OUTER_IPV4, NULL },
+   { PKT_TX_OUTER_IPV6, PKT_TX_OUTER_IPV6, NULL },
+   };
+   const char *name;
+   unsigned int i;
+   int ret;
+
+   if (buflen == 0)
+   return -1;
+
+   buf[0] = '\0';
+   for (i = 0; i < RTE_DIM(tx_flags); i++) {
+   if ((mask & tx_flags[i].mask) != tx_flags[i].flag)
+   continue;
+   name = rte_get_tx_ol_flag_name(tx_flags[i].flag);
+   if (n

[dpdk-dev] [PATCH v2 2/2] i40e: Enable bad checksum flags in i40e vPMD

2016-10-06 Thread Damjan Marion (damarion)

On 6 Oct 2016, at 04:19, Jeff Shaw mailto:jeffrey.b.shaw at intel.com>> wrote:

On Wed, Oct 05, 2016 at 04:57:28PM -0700, Chen, Jing D wrote:
Hi,

-Original Message-
From: Shaw, Jeffrey B
Sent: Wednesday, October 5, 2016 5:13 PM
To: dev at dpdk.org
Cc: Zhang, Helin mailto:helin.zhang at intel.com>>; 
Wu, Jingjing
mailto:jingjing.wu at intel.com>>; damarion at 
cisco.com; Zhang, Qi Z
mailto:qi.z.zhang at intel.com>>; Chen, Jing D 
mailto:jing.d.chen at intel.com>>
Subject: [PATCH v2 2/2] i40e: Enable bad checksum flags in i40e vPMD

From: Damjan Marion mailto:damar...@cisco.com>>

Decode the checksum flags from the rx descriptor, setting the appropriate bit
in the mbuf ol_flags field when the flag indicates a bad checksum.

Signed-off-by: Damjan Marion mailto:damarion at 
cisco.com>>
Signed-off-by: Jeff Shaw mailto:jeffrey.b.shaw at 
intel.com>>
---
drivers/net/i40e/i40e_rxtx_vec.c | 48 +++---
--
1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec.c
b/drivers/net/i40e/i40e_rxtx_vec.c
index 6c63141..d2267ad 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -138,19 +138,14 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)  static
inline void  desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)  {
- __m128i vlan0, vlan1, rss;
- union {
- uint16_t e[4];
- uint64_t dword;
- } vol;
+ __m128i vlan0, vlan1, rss, l3_l4e;

/* mask everything except RSS, flow director and VLAN flags
 * bit2 is for VLAN tag, bit11 for flow director indication
 * bit13:12 for RSS indication.
 */
- const __m128i rss_vlan_msk = _mm_set_epi16(
- 0x, 0x, 0x, 0x,
- 0x3804, 0x3804, 0x3804, 0x3804);
+ const __m128i rss_vlan_msk = _mm_set_epi32(
+ 0x1c03004, 0x1c03004, 0x1c03004, 0x1c03004);

Mask is wrong here. Should be 0x1c03804, ..., etc.


/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0, @@ -163,23
+158,36 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
PKT_RX_RSS_HASH | PKT_RX_FDIR,
PKT_RX_RSS_HASH, 0, 0,
0, 0, PKT_RX_FDIR, 0);

- vlan0 = _mm_unpackhi_epi16(descs[0], descs[1]);
- vlan1 = _mm_unpackhi_epi16(descs[2], descs[3]);
- vlan0 = _mm_unpacklo_epi32(vlan0, vlan1);
+ const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
+ PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
| PKT_RX_IP_CKSUM_BAD,
+ PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
+ PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+ PKT_RX_EIP_CKSUM_BAD,
+ PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+ PKT_RX_L4_CKSUM_BAD,
+ PKT_RX_IP_CKSUM_BAD,
+ 0);
+
+ vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
+ vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
+ vlan0 = _mm_unpacklo_epi64(vlan0, vlan1);

vlan1 = _mm_and_si128(vlan0, rss_vlan_msk);
vlan0 = _mm_shuffle_epi8(vlan_flags, vlan1);

- rss = _mm_srli_epi16(vlan1, 11);
+ rss = _mm_srli_epi32(vlan1, 12);
rss = _mm_shuffle_epi8(rss_flags, rss);

My bad. Original code will use bit[13:11] to identify RSS and FDIR flag. Now
It masked bit 11 out when creating " rss_vlan_msk" and doing shift above,
while it still try to use  original "rss_flags"?

Good catch.  I have no idea how you spotted that, and you're right, we should
be shifting by 11, not 12. Also the mask needs to be updated (as you
mentioned to me offline) which I noted above.

Damjan, unless you object I'll send a v3 with an updated rss_vlan_msk and
the 11 bit shift so we also get the Flow Director Filter Match (FLM)
indication.

Absolutely no objection, and thanks for taking care for that!

Damjan




[dpdk-dev] [PATCH v4 2/2] i40e: Enable bad checksum flags in i40e vPMD

2016-10-06 Thread Jeff Shaw
From: Damjan Marion 

Decode the checksum flags from the rx descriptor, setting
the appropriate bit in the mbuf ol_flags field when the flag
indicates a bad checksum.

Signed-off-by: Damjan Marion 
Signed-off-by: Jeff Shaw 
---
 drivers/net/i40e/i40e_rxtx_vec.c | 48 +++-
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index 6c63141..ccd4956 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -138,19 +138,14 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
 static inline void
 desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
-   __m128i vlan0, vlan1, rss;
-   union {
-   uint16_t e[4];
-   uint64_t dword;
-   } vol;
+   __m128i vlan0, vlan1, rss, l3_l4e;

/* mask everything except RSS, flow director and VLAN flags
 * bit2 is for VLAN tag, bit11 for flow director indication
 * bit13:12 for RSS indication.
 */
-   const __m128i rss_vlan_msk = _mm_set_epi16(
-   0x, 0x, 0x, 0x,
-   0x3804, 0x3804, 0x3804, 0x3804);
+   const __m128i rss_vlan_msk = _mm_set_epi32(
+   0x1c03804, 0x1c03804, 0x1c03804, 0x1c03804);

/* map rss and vlan type to rss hash and vlan flag */
const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
@@ -163,23 +158,36 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf 
**rx_pkts)
PKT_RX_RSS_HASH | PKT_RX_FDIR, PKT_RX_RSS_HASH, 0, 0,
0, 0, PKT_RX_FDIR, 0);

-   vlan0 = _mm_unpackhi_epi16(descs[0], descs[1]);
-   vlan1 = _mm_unpackhi_epi16(descs[2], descs[3]);
-   vlan0 = _mm_unpacklo_epi32(vlan0, vlan1);
+   const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
+   PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | 
PKT_RX_IP_CKSUM_BAD,
+   PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
+   PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+   PKT_RX_EIP_CKSUM_BAD,
+   PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+   PKT_RX_L4_CKSUM_BAD,
+   PKT_RX_IP_CKSUM_BAD,
+   0);
+
+   vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
+   vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
+   vlan0 = _mm_unpacklo_epi64(vlan0, vlan1);

vlan1 = _mm_and_si128(vlan0, rss_vlan_msk);
vlan0 = _mm_shuffle_epi8(vlan_flags, vlan1);

-   rss = _mm_srli_epi16(vlan1, 11);
+   rss = _mm_srli_epi32(vlan1, 11);
rss = _mm_shuffle_epi8(rss_flags, rss);

+   l3_l4e = _mm_srli_epi32(vlan1, 22);
+   l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
+
vlan0 = _mm_or_si128(vlan0, rss);
-   vol.dword = _mm_cvtsi128_si64(vlan0);
+   vlan0 = _mm_or_si128(vlan0, l3_l4e);

-   rx_pkts[0]->ol_flags = vol.e[0];
-   rx_pkts[1]->ol_flags = vol.e[1];
-   rx_pkts[2]->ol_flags = vol.e[2];
-   rx_pkts[3]->ol_flags = vol.e[3];
+   rx_pkts[0]->ol_flags = _mm_extract_epi16(vlan0, 0);
+   rx_pkts[1]->ol_flags = _mm_extract_epi16(vlan0, 2);
+   rx_pkts[2]->ol_flags = _mm_extract_epi16(vlan0, 4);
+   rx_pkts[3]->ol_flags = _mm_extract_epi16(vlan0, 6);
 }
 #else
 #define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
@@ -754,7 +762,8 @@ i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev 
*dev)
 #ifndef RTE_LIBRTE_I40E_RX_OLFLAGS_ENABLE
/* whithout rx ol_flags, no VP flag report */
if (rxmode->hw_vlan_strip != 0 ||
-   rxmode->hw_vlan_extend != 0)
+   rxmode->hw_vlan_extend != 0 ||
+   rxmode->hw_ip_checksum != 0)
return -1;
 #endif

@@ -765,8 +774,7 @@ i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev 
*dev)
 /* - no csum error report support
 * - no header split support
 */
-   if (rxmode->hw_ip_checksum == 1 ||
-   rxmode->header_split == 1)
+   if (rxmode->header_split == 1)
return -1;

return 0;
-- 
2.1.0



[dpdk-dev] [PATCH v4 1/2] i40e: Add packet_type metadata in the i40e vPMD

2016-10-06 Thread Jeff Shaw
From: Damjan Marion 

The ptype is decoded from the rx descriptor and stored
in the packet type field in the mbuf using the same function
as the non-vector driver.

Signed-off-by: Damjan Marion 
Signed-off-by: Jeff Shaw 
Acked-by: Qi Zhang 
---

Changes in v2:
 - Add missing reference to i40e_recv_scattered_pkts_vec() when
   querying supported packet types.

Changes in v3:
 - None. (Please ignore this version).

Changes in v4:
 - Fix rss/fdir status mask and shift to get accurate Flow Director Filter
   Match (FLM) indication.

 drivers/net/i40e/i40e_rxtx.c | 567 +--
 drivers/net/i40e/i40e_rxtx.h | 563 ++
 drivers/net/i40e/i40e_rxtx_vec.c |  16 ++
 3 files changed, 582 insertions(+), 564 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 554d167..7433480 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -174,569 +174,6 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t 
qword)
 }
 #endif

-/* For each value it means, datasheet of hardware can tell more details
- *
- * @note: fix i40e_dev_supported_ptypes_get() if any change here.
- */
-static inline uint32_t
-i40e_rxd_pkt_type_mapping(uint8_t ptype)
-{
-   static const uint32_t type_table[UINT8_MAX + 1] __rte_cache_aligned = {
-   /* L2 types */
-   /* [0] reserved */
-   [1] = RTE_PTYPE_L2_ETHER,
-   [2] = RTE_PTYPE_L2_ETHER_TIMESYNC,
-   /* [3] - [5] reserved */
-   [6] = RTE_PTYPE_L2_ETHER_LLDP,
-   /* [7] - [10] reserved */
-   [11] = RTE_PTYPE_L2_ETHER_ARP,
-   /* [12] - [21] reserved */
-
-   /* Non tunneled IPv4 */
-   [22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_FRAG,
-   [23] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_NONFRAG,
-   [24] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_UDP,
-   /* [25] reserved */
-   [26] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_TCP,
-   [27] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_SCTP,
-   [28] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_ICMP,
-
-   /* IPv4 --> IPv4 */
-   [29] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_FRAG,
-   [30] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_NONFRAG,
-   [31] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_UDP,
-   /* [32] reserved */
-   [33] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_TCP,
-   [34] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_SCTP,
-   [35] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_ICMP,
-
-   /* IPv4 --> IPv6 */
-   [36] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_FRAG,
-   [37] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_NONFRAG,
-   [38] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_UDP,
-   /* [39] reserved */
-   [40] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_IN

[dpdk-dev] [PATCH v3 1/2] i40e: Add packet_type metadata in the i40e vPMD

2016-10-06 Thread Jeff Shaw
From: Damjan Marion 

The ptype is decoded from the rx descriptor and stored
in the packet type field in the mbuf using the same function
as the non-vector driver.

Signed-off-by: Damjan Marion 
Signed-off-by: Jeff Shaw 
Acked-by: Qi Zhang 
---

Changes in v2:
 - Add missing reference to i40e_recv_scattered_pkts_vec() when
   querying supported packet types.

Changes in v3:
 - None.

 drivers/net/i40e/i40e_rxtx.c | 567 +--
 drivers/net/i40e/i40e_rxtx.h | 563 ++
 drivers/net/i40e/i40e_rxtx_vec.c |  16 ++
 3 files changed, 582 insertions(+), 564 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 554d167..7433480 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -174,569 +174,6 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t 
qword)
 }
 #endif

-/* For each value it means, datasheet of hardware can tell more details
- *
- * @note: fix i40e_dev_supported_ptypes_get() if any change here.
- */
-static inline uint32_t
-i40e_rxd_pkt_type_mapping(uint8_t ptype)
-{
-   static const uint32_t type_table[UINT8_MAX + 1] __rte_cache_aligned = {
-   /* L2 types */
-   /* [0] reserved */
-   [1] = RTE_PTYPE_L2_ETHER,
-   [2] = RTE_PTYPE_L2_ETHER_TIMESYNC,
-   /* [3] - [5] reserved */
-   [6] = RTE_PTYPE_L2_ETHER_LLDP,
-   /* [7] - [10] reserved */
-   [11] = RTE_PTYPE_L2_ETHER_ARP,
-   /* [12] - [21] reserved */
-
-   /* Non tunneled IPv4 */
-   [22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_FRAG,
-   [23] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_NONFRAG,
-   [24] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_UDP,
-   /* [25] reserved */
-   [26] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_TCP,
-   [27] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_SCTP,
-   [28] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_L4_ICMP,
-
-   /* IPv4 --> IPv4 */
-   [29] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_FRAG,
-   [30] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_NONFRAG,
-   [31] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_UDP,
-   /* [32] reserved */
-   [33] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_TCP,
-   [34] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_SCTP,
-   [35] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_ICMP,
-
-   /* IPv4 --> IPv6 */
-   [36] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_FRAG,
-   [37] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_NONFRAG,
-   [38] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_UDP,
-   /* [39] reserved */
-   [40] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-   RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
-   RTE_PTYPE_INNER_L4_TCP,
-   [41] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-   RTE_PTYPE_TUNNEL_IP |
-