[dpdk-dev] [PATCH] eal: add missing include to debug header

2016-05-05 Thread Thomas Monjalon
2016-05-05 17:07, Ferruh Yigit:
> On 5/5/2016 1:59 PM, Bruce Richardson wrote:
> > On Wed, May 04, 2016 at 05:37:56PM +0100, Bruce Richardson wrote:
> >> The header file rte_debug.h makes use of the "unlikely" macro which
> >> means it should include the rte_branch_prediction.h header file.
> >>
> >> Fixes: 50705e8e3cdd ("eal: add assert macro for debug")
> >>
> >> Signed-off-by: Bruce Richardson 
> > 
> > Ping on this patch - any comments or concerns?
> > It's a fairly trivial fix that prevents issues with testing some other 
> > patches
> > on the mainline.
> > 
> 
> Tested on top of David Marchand's 12123-12139 patchset.
> 
> Acked-by: Ferruh Yigit 

Applied, thanks
Sorry for the delay, I was gardening today :)


[dpdk-dev] [PATCH 2/2] test: add autotest for external mempool stack handler

2016-05-05 Thread David Hunt
Signed-off-by: David Hunt 
---
 app/test/test_mempool.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 09951cc..8190f20 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -570,6 +570,7 @@ test_mempool(void)
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_ext = NULL;
+   struct rte_mempool *mp_stack = NULL;

rte_atomic32_init();

@@ -619,6 +620,27 @@ test_mempool(void)
}
rte_mempool_obj_iter(mp_ext, my_obj_init, NULL);

+   /* create a mempool with an external handler */
+   mp_stack = rte_mempool_create_empty("test_stack",
+   MEMPOOL_SIZE,
+   MEMPOOL_ELT_SIZE,
+   RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+   SOCKET_ID_ANY, 0);
+
+   if (mp_stack == NULL) {
+   printf("cannot allocate mp_stack mempool\n");
+   goto err;
+   }
+   if (rte_mempool_set_handler(mp_stack, "stack") < 0) {
+   printf("cannot set stack handler\n");
+   goto err;
+   }
+   if (rte_mempool_populate_default(mp_stack) < 0) {
+   printf("cannot populate mp_stack mempool\n");
+   goto err;
+   }
+   rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+
/* retrieve the mempool from its name */
if (rte_mempool_lookup("test_nocache") != mp_nocache) {
printf("Cannot lookup mempool from its name\n");
@@ -652,6 +674,10 @@ test_mempool(void)
if (test_mempool_xmem_misc() < 0)
goto err;

+   /* test the stack handler */
+   if (test_mempool_basic(mp_stack) < 0)
+   goto err;
+
rte_mempool_list_dump(stdout);

return 0;
-- 
2.5.5



[dpdk-dev] [PATCH 1/2] mempool: add stack (fifo) mempool handler

2016-05-05 Thread David Hunt
This is a mempool handler that is useful for pipelining apps, where
the mempool cache doesn't really work - example, where we have one
core doing rx (and alloc), and another core doing Tx (and return). In
such a case, the mempool ring simply cycles through all the mbufs,
resulting in a LLC miss on every mbuf allocated when the number of
mbufs is large. A stack recycles buffers more effectively in this
case.

Signed-off-by: David Hunt 
---
 lib/librte_mempool/Makefile|   1 +
 lib/librte_mempool/rte_mempool_stack.c | 154 +
 2 files changed, 155 insertions(+)
 create mode 100644 lib/librte_mempool/rte_mempool_stack.c

diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index f19366e..5aa9ef8 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -44,6 +44,7 @@ LIBABIVER := 2
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_handler.c
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_default.c
+SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_stack.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h

diff --git a/lib/librte_mempool/rte_mempool_stack.c 
b/lib/librte_mempool/rte_mempool_stack.c
new file mode 100644
index 000..1874781
--- /dev/null
+++ b/lib/librte_mempool/rte_mempool_stack.c
@@ -0,0 +1,154 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+struct rte_mempool_common_stack
+{
+   /* Spinlock to protect access */
+   rte_spinlock_t sl;
+
+   uint32_t size;
+   uint32_t len;
+   void *objs[];
+
+#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
+#endif
+};
+
+static void *
+common_stack_alloc(struct rte_mempool *mp)
+{
+   struct rte_mempool_common_stack *s;
+   char stack_name[RTE_RING_NAMESIZE];
+   unsigned n = mp->size;
+   int size = sizeof(*s) + (n+16)*sizeof(void*);
+
+   /* Allocate our local memory structure */
+   snprintf(stack_name, sizeof(stack_name), "%s-common-stack", mp->name);
+   s = rte_zmalloc_socket(stack_name,
+   size,
+   RTE_CACHE_LINE_SIZE,
+   mp->socket_id);
+   if (s == NULL) {
+   RTE_LOG(ERR, MEMPOOL, "Cannot allocate stack!\n");
+   return NULL;
+   }
+
+   /* And the spinlock we use to protect access */
+   rte_spinlock_init(>sl);
+
+   s->size = n;
+   mp->pool = (void *) s;
+   rte_mempool_set_handler(mp, "stack");
+
+   return (void *) s;
+}
+
+static int common_stack_put(void *p, void * const *obj_table,
+   unsigned n)
+{
+   struct rte_mempool_common_stack * s = (struct rte_mempool_common_stack 
*)p;
+   void **cache_objs;
+   unsigned index;
+
+   /* Acquire lock */
+   rte_spinlock_lock(>sl);
+   cache_objs = >objs[s->len];
+
+   /* Is there sufficient space in the stack ? */
+   if((s->len + n) > s->size) {
+   rte_spinlock_unlock(>sl);
+   return -ENOENT;
+   }
+
+   /* Add elements back into the cache */
+   for (index = 0; index < n; ++index, obj_table++)
+   cache_objs[index] = *obj_table;
+
+   s->len += n;
+
+   rte_spinlock_unlock(>sl);
+

[dpdk-dev] [PATCH 0/2] mempool: add stack (fifo) mempool handler

2016-05-05 Thread David Hunt
This patch set adds a fifo stack handler to the external mempool 
manager. 

This patch set depends on the 3 part external mempool handler 
patch set (v4 of the series):
http://dpdk.org/dev/patchwork/patch/12077/
which depends on the 36 part patch set for mempool rework
http://dpdk.org/dev/patchwork/patch/12038/

David Hunt (2):
  mempool: add stack (fifo) mempool handler
  test: add autotest for external mempool stack handler

 app/test/test_mempool.c|  26 ++
 lib/librte_mempool/Makefile|   1 +
 lib/librte_mempool/rte_mempool_stack.c | 154 +
 3 files changed, 181 insertions(+)
 create mode 100644 lib/librte_mempool/rte_mempool_stack.c

-- 
2.5.5



[dpdk-dev] [PATCH] vhost: add support for dynamic vhost PMD creation

2016-05-05 Thread Ferruh Yigit
Add rte_eth_from_vhost() API to create vhost PMD dynamically from
applications.

Signed-off-by: Ferruh Yigit 
---
 drivers/net/vhost/rte_eth_vhost.c   | 117 
 drivers/net/vhost/rte_eth_vhost.h   |  19 +
 drivers/net/vhost/rte_pmd_vhost_version.map |   7 ++
 3 files changed, 143 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 310cbef..c860ab8 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -796,6 +796,123 @@ error:
return -1;
 }

+static int
+rte_eth_from_vhost_create(const char *name, char *iface_name,
+   const unsigned int numa_node, struct rte_mempool *mb_pool)
+{
+   struct rte_eth_dev_data *data = NULL;
+   struct rte_eth_dev *eth_dev = NULL;
+   struct pmd_internal *internal = NULL;
+   struct internal_list *list;
+   int nb_queues = 1;
+   uint16_t nb_rx_queues = nb_queues;
+   uint16_t nb_tx_queues = nb_queues;
+   struct vhost_queue *vq;
+   int i;
+
+   int port_id = eth_dev_vhost_create(name, iface_name, nb_queues,
+   numa_node);
+
+   if (port_id < 0)
+   return -1;
+
+   eth_dev = _eth_devices[port_id];
+   data = eth_dev->data;
+   internal = data->dev_private;
+   list = find_internal_resource(internal->iface_name);
+
+   data->rx_queues = rte_zmalloc_socket(name,
+   sizeof(void *) * nb_rx_queues, 0, numa_node);
+   if (data->rx_queues == NULL)
+   goto error;
+
+   data->tx_queues = rte_zmalloc_socket(name,
+   sizeof(void *) * nb_tx_queues, 0, numa_node);
+   if (data->tx_queues == NULL)
+   goto error;
+
+   for (i = 0; i < nb_rx_queues; i++) {
+   vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
+   RTE_CACHE_LINE_SIZE, numa_node);
+   if (vq == NULL) {
+   RTE_LOG(ERR, PMD,
+   "Failed to allocate memory for rx queue\n");
+   goto error;
+   }
+   vq->mb_pool = mb_pool;
+   vq->virtqueue_id = i * VIRTIO_QNUM + VIRTIO_TXQ;
+   data->rx_queues[i] = vq;
+   }
+
+   for (i = 0; i < nb_tx_queues; i++) {
+   vq = rte_zmalloc_socket(NULL, sizeof(struct vhost_queue),
+   RTE_CACHE_LINE_SIZE, numa_node);
+   if (vq == NULL) {
+   RTE_LOG(ERR, PMD,
+   "Failed to allocate memory for tx queue\n");
+   goto error;
+   }
+   vq->mb_pool = mb_pool;
+   vq->virtqueue_id = i * VIRTIO_QNUM + VIRTIO_RXQ;
+   data->tx_queues[i] = vq;
+   }
+
+   return port_id;
+
+error:
+   pthread_mutex_lock(_list_lock);
+   TAILQ_REMOVE(_list, list, next);
+   pthread_mutex_unlock(_list_lock);
+
+   if (internal)
+   free(internal->dev_name);
+   free(vring_states[port_id]);
+   free(data->mac_addrs);
+   rte_eth_dev_release_port(eth_dev);
+   if (data->rx_queues) {
+   for (i = 0; i < nb_rx_queues; i++) {
+   vq = data->rx_queues[i];
+   free(vq);
+   }
+   rte_free(data->rx_queues);
+   }
+   if (data->tx_queues) {
+   for (i = 0; i < nb_tx_queues; i++) {
+   vq = data->tx_queues[i];
+   free(vq);
+   }
+   rte_free(data->tx_queues);
+   }
+   rte_free(internal);
+   rte_free(list);
+   rte_free(data);
+
+   return -1;
+}
+
+int
+rte_eth_from_vhost(const char *name, char *iface_name,
+   const unsigned int numa_node, struct rte_mempool *mb_pool)
+{
+   int port_id;
+   int ret;
+
+   port_id = rte_eth_from_vhost_create(name, iface_name, numa_node,
+   mb_pool);
+   if (port_id < 0)
+   return port_id;
+
+   ret = rte_vhost_driver_register(iface_name);
+   if (ret < 0)
+   return ret;
+
+   ret = vhost_driver_session_start();
+   if (ret < 0)
+   return ret;
+
+   return port_id;
+}
+
 static inline int
 open_iface(const char *key __rte_unused, const char *value, void *extra_args)
 {
diff --git a/drivers/net/vhost/rte_eth_vhost.h 
b/drivers/net/vhost/rte_eth_vhost.h
index ff5d877..624978c 100644
--- a/drivers/net/vhost/rte_eth_vhost.h
+++ b/drivers/net/vhost/rte_eth_vhost.h
@@ -102,6 +102,25 @@ struct rte_eth_vhost_queue_event {
 int rte_eth_vhost_get_queue_event(uint8_t port_id,
struct rte_eth_vhost_queue_event *event);

+/**
+ * API to create vhost PMD
+ *
+ * @param name
+ *  Vhost device name
+ * @param iface_name
+ *  Vhost interface name
+ * @param numa_node
+ *  Socket id
+ * 

[dpdk-dev] [RFC 4/4] app/test: support resources archived by tar

2016-05-05 Thread Jan Viktorin
On Thu, 5 May 2016 14:33:01 +0100
Bruce Richardson  wrote:

> On Fri, Apr 29, 2016 at 03:11:36PM +0200, Jan Viktorin wrote:
> > When needing a more complex resource (a file hierarchy), packing every 
> > single
> > file as a single resource would be very ineffective. For that purpose, it is
> > possible to pack the files into a tar archive, extract it before test from 
> > the
> > resource and finally clean up all the created files.
> > 
> > This patch introduces functions resource_untar and resource_rm_by_tar to
> > perform those tasks. An example of using those functions is included as a 
> > test.
> > 
> > Signed-off-by: Jan Viktorin   
> We might want to make this configurable on/off at build time, since it adds a 
> new
> dependency for building dpdk - libarchive-devel.

This is true. Unfortunately...

Is it a problem to introduce such dependency into the test app?
Would it be help to use another similar (more spread) library (zlib)?

Jan

> 
> /Bruce



-- 
   Jan Viktorin  E-mail: Viktorin at RehiveTech.com
   System Architect  Web:www.RehiveTech.com
   RehiveTech
   Brno, Czech Republic


[dpdk-dev] [RFC 0/4] Include resources in tests

2016-05-05 Thread Jan Viktorin
On Thu, 5 May 2016 14:29:30 +0100
Bruce Richardson  wrote:

> On Fri, Apr 29, 2016 at 03:11:32PM +0200, Jan Viktorin wrote:
> > Hello,
> > 
> > this patch set introduces a mechanism to include a resource (in general a 
> > blob)
> > into the test binary. This allows to make tests less dependent on the target
> > testing environment. The first use case is testing of PCI bus scan by 
> > changing
> > the hard-coded path (/sys/bus/pci/devices) to something different and 
> > provide
> > a fake tree of devices with the test. It can help with testing of 
> > device-tree
> > parsing as I've proposed in [1] where such mechanism was missing at that 
> > time.
> > I'd like to use such framework for the SoC infra testing as well.
> > 
> > The patch set introduces a struct resource into the app/test. The resource 
> > is
> > generic to include any kind of binary data. The binary data can be created 
> > in
> > C or linked as an object file (created by objcopy). I am not sure where to
> > place the objcopy logic and how to perform guessing of the objcopy arguments
> > as they are pretty non-standard.
> > 
> > To include a complex resource (a file hierarchy), the last patch implements
> > an archive extraction logic. So, it is possible to include a tar archive and
> > unpack it before a test starts. Any ideas how to do this in a better way are
> > welcome.
> > 
> > [1] http://comments.gmane.org/gmane.comp.networking.dpdk.devel/36545
> > 
> > Regards
> > Jan Viktorin
> >   
> BTW: It looks like your patch has a dependency on the 17-patch dev cleanup 
> set from
> David, [and now on the header include bug fix I submitted yesterday too], so
> you should probably note that in any future revs of the patch you do. Save
> some head-scratching from those of us testing it out. :-)

Hello, well, the patch set should be independent on that cleanup, so I take it 
as a
bug report. There should be no dependency, sorry. I'll fix it and repost.

Thanks
Jan

> 
> Thanks,
> /Bruce
> 



-- 
   Jan Viktorin  E-mail: Viktorin at RehiveTech.com
   System Architect  Web:www.RehiveTech.com
   RehiveTech
   Brno, Czech Republic


[dpdk-dev] [PATCH 6/6] testpmd: update documentation

2016-05-05 Thread Zhihong Wang
This patch updates documentation for testpmd.


Signed-off-by: Zhihong Wang 
---
 doc/guides/testpmd_app_ug/run_app.rst   |  1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index f605564..edd3e42 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -328,6 +328,7 @@ The commandline options are:
 Set the forwarding mode where ``mode`` is one of the following::

io (the default)
+   io_retry
mac
mac_retry
mac_swap
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index aed5e47..7703c89 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -98,9 +98,11 @@ Start packet forwarding with current configuration::
 start tx_first
 ~~

-Start packet forwarding with current configuration after sending one burst of 
packets::
+Start packet forwarding with current configuration after sending specified 
number of bursts of packets::

-   testpmd> start tx_first
+   testpmd> start tx_first (""|burst_num)
+
+The default burst number is 1 when ``burst_num`` not presented.

 stop
 
@@ -249,7 +251,7 @@ set fwd

 Set the packet forwarding mode::

-   testpmd> set fwd (io|mac|mac_retry|macswap|flowgen| \
+   testpmd> set fwd (io|io_retry|mac|mac_retry|macswap|flowgen| \
  rxonly|txonly|csum|icmpecho)

 The available information categories are:
@@ -258,6 +260,8 @@ The available information categories are:
   This is the fastest possible forwarding operation as it does not access 
packets data.
   This is the default mode.

+* ``io_retry``: Forwards packets "as-is" in I/O retry mode.
+
 * ``mac``: Changes the source and the destination Ethernet addresses of 
packets before forwarding them.

 * ``mac_retry``: Same as "mac" forwarding mode, but includes retries if the 
destination queue is full.
-- 
2.5.0



[dpdk-dev] [PATCH 5/6] testpmd: show topology at forwarding start

2016-05-05 Thread Zhihong Wang
This patch show topology at forwarding start.

"show config fwd" also does this, but showing it directly can reduce the
possibility of misconfiguration.


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index b9c8db9..ef72a93 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1003,7 +1003,7 @@ start_packet_forwarding(int with_tx_first)
if(!no_flush_rx)
flush_fwd_rx_queues();

-   fwd_config_setup();
+   fwd_config_display();
rxtx_config_display();

for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-- 
2.5.0



[dpdk-dev] [PATCH 4/6] testpmd: handle all rxqs in rss setup

2016-05-05 Thread Zhihong Wang
This patch removes constraints in rxq handling when multiqueue is enabled
to handle all the rxqs.

Current testpmd forces a dedicated core for each rxq, some rxqs may be
ignored when core number is less than rxq number, and that causes confusion
and inconvenience.


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/config.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bb0b542..8ab2963 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1193,19 +1193,13 @@ rss_fwd_config_setup(void)
cur_fwd_config.nb_fwd_ports = nb_fwd_ports;
cur_fwd_config.nb_fwd_streams =
(streamid_t) (nb_q * cur_fwd_config.nb_fwd_ports);
-   if (cur_fwd_config.nb_fwd_streams > cur_fwd_config.nb_fwd_lcores)
-   cur_fwd_config.nb_fwd_streams =
-   (streamid_t)cur_fwd_config.nb_fwd_lcores;
-   else
-   cur_fwd_config.nb_fwd_lcores =
-   (lcoreid_t)cur_fwd_config.nb_fwd_streams;

/* reinitialize forwarding streams */
init_fwd_streams();

setup_fwd_config_of_each_lcore(_fwd_config);
rxp = 0; rxq = 0;
-   for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_lcores; lc_id++) {
+   for (lc_id = 0; lc_id < cur_fwd_config.nb_fwd_streams; lc_id++) {
struct fwd_stream *fs;

fs = fwd_streams[lc_id];
-- 
2.5.0



[dpdk-dev] [PATCH 3/6] testpmd: show throughput in port stats

2016-05-05 Thread Zhihong Wang
This patch adds throughput numbers (in the period since last use of this
command) in port statistics display for "show port stats (port_id|all)".


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/config.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1c552e4..bb0b542 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -92,6 +92,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "testpmd.h"

@@ -150,6 +151,10 @@ print_ethaddr(const char *name, struct ether_addr 
*eth_addr)
 void
 nic_stats_display(portid_t port_id)
 {
+   static uint64_t sum_rx[RTE_MAX_ETHPORTS];
+   static uint64_t sum_tx[RTE_MAX_ETHPORTS];
+   static uint64_t cycles[RTE_MAX_ETHPORTS];
+   uint64_t pkt_rx, pkt_tx, cycle;
struct rte_eth_stats stats;
struct rte_port *port = [port_id];
uint8_t i;
@@ -209,6 +214,21 @@ nic_stats_display(portid_t port_id)
}
}

+   cycle = cycles[port_id];
+   cycles[port_id] = rte_rdtsc();
+   if (cycle > 0)
+   cycle = cycles[port_id] - cycle;
+
+   pkt_rx = stats.ipackets - sum_rx[port_id];
+   pkt_tx = stats.opackets - sum_tx[port_id];
+   sum_rx[port_id] = stats.ipackets;
+   sum_tx[port_id] = stats.opackets;
+   printf("\n  Throughput (since last show)\n");
+   printf("  RX-pps: %12"PRIu64"\n"
+   "  TX-pps: %12"PRIu64"\n",
+   cycle > 0 ? pkt_rx * rte_get_tsc_hz() / cycle : 0,
+   cycle > 0 ? pkt_tx * rte_get_tsc_hz() / cycle : 0);
+
printf("  %s%s\n",
   nic_stats_border, nic_stats_border);
 }
-- 
2.5.0



[dpdk-dev] [PATCH 2/6] testpmd: configurable tx_first burst number

2016-05-05 Thread Zhihong Wang
This patch enables configurable tx_first burst number.

Use "start tx_first (burst_num)" to specify how many bursts of packets to
be sent before forwarding start, or "start tx_first" like before for the
default 1 burst send.


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/cmdline.c | 41 +
 app/test-pmd/testpmd.c |  7 +--
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c5b9479..8f78cc6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5240,6 +5240,46 @@ cmdline_parse_inst_t cmd_start_tx_first = {
},
 };

+/* *** START FORWARDING WITH N TX BURST FIRST *** */
+struct cmd_start_tx_first_n_result {
+   cmdline_fixed_string_t start;
+   cmdline_fixed_string_t tx_first;
+   uint32_t tx_num;
+};
+
+static void
+cmd_start_tx_first_n_parsed(__attribute__((unused)) void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+   struct cmd_start_tx_first_n_result *res = parsed_result;
+
+   start_packet_forwarding(res->tx_num);
+}
+
+cmdline_parse_token_string_t cmd_start_tx_first_n_start =
+   TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result,
+   start, "start");
+cmdline_parse_token_string_t cmd_start_tx_first_n_tx_first =
+   TOKEN_STRING_INITIALIZER(struct cmd_start_tx_first_n_result,
+   tx_first, "tx_first");
+cmdline_parse_token_num_t cmd_start_tx_first_n_tx_num =
+   TOKEN_NUM_INITIALIZER(struct cmd_start_tx_first_n_result,
+   tx_num, UINT32);
+
+cmdline_parse_inst_t cmd_start_tx_first_n = {
+   .f = cmd_start_tx_first_n_parsed,
+   .data = NULL,
+   .help_str = "start packet forwarding, after sending  "
+   "bursts of packets",
+   .tokens = {
+   (void *)_start_tx_first_n_start,
+   (void *)_start_tx_first_n_tx_first,
+   (void *)_start_tx_first_n_tx_num,
+   NULL,
+   },
+};
+
 /* *** SET LINK UP *** */
 struct cmd_set_link_up_result {
cmdline_fixed_string_t set;
@@ -10399,6 +10439,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)_showcfg,
(cmdline_parse_inst_t *)_start,
(cmdline_parse_inst_t *)_start_tx_first,
+   (cmdline_parse_inst_t *)_start_tx_first_n,
(cmdline_parse_inst_t *)_set_link_up,
(cmdline_parse_inst_t *)_set_link_down,
(cmdline_parse_inst_t *)_reset,
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 61abcf8..b9c8db9 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1037,8 +1037,11 @@ start_packet_forwarding(int with_tx_first)
for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
(*port_fwd_begin)(fwd_ports_ids[i]);
}
-   launch_packet_forwarding(run_one_txonly_burst_on_core);
-   rte_eal_mp_wait_lcore();
+   while (with_tx_first--) {
+   launch_packet_forwarding(
+   run_one_txonly_burst_on_core);
+   rte_eal_mp_wait_lcore();
+   }
port_fwd_end = tx_only_engine.port_fwd_end;
if (port_fwd_end != NULL) {
for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
-- 
2.5.0



[dpdk-dev] [PATCH 1/6] testpmd: add io_retry forwarding

2016-05-05 Thread Zhihong Wang
This patch adds an io_retry-fwd in testpmd to prevent most packet
losses. It can be enabled by "set fwd io_retry".

io-fwd is the fastest possible forwarding engine, good for basic
performance test. Adding retry mechanism expands test case coverage
to support scenarios where packet loss affects test results.


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/Makefile  |   1 +
 app/test-pmd/iofwd-retry.c | 139 +
 app/test-pmd/testpmd.c |   1 +
 app/test-pmd/testpmd.h |   1 +
 4 files changed, 142 insertions(+)
 create mode 100644 app/test-pmd/iofwd-retry.c

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 72426f3..a6735cf 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -49,6 +49,7 @@ SRCS-y += parameters.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline.c
 SRCS-y += config.c
 SRCS-y += iofwd.c
+SRCS-y += iofwd-retry.c
 SRCS-y += macfwd.c
 SRCS-y += macfwd-retry.c
 SRCS-y += macswap.c
diff --git a/app/test-pmd/iofwd-retry.c b/app/test-pmd/iofwd-retry.c
new file mode 100644
index 000..14c5660
--- /dev/null
+++ b/app/test-pmd/iofwd-retry.c
@@ -0,0 +1,139 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "testpmd.h"
+
+#define TX_RETRY_TIMES 128
+#define TX_RETRY_WAIT_US 1
+
+/*
+ * I/O retry forwarding mode.
+ * Forward packets "as-is" without access to packet data.
+ */
+static void
+pkt_burst_io_retry_forward(struct fwd_stream *fs)
+{
+   struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
+   uint16_t nb_rx;
+   uint16_t nb_tx;
+   uint32_t retry;
+
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+   uint64_t start_tsc;
+   uint64_t end_tsc;
+   uint64_t core_cycles;
+#endif
+
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+   start_tsc = rte_rdtsc();
+#endif
+
+   nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
+   pkts_burst, nb_pkt_per_burst);
+   if (unlikely(nb_rx == 0))
+   return;
+   fs->rx_packets += nb_rx;
+
+#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
+   fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
+#endif
+
+   retry = 0;
+   nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
+   pkts_burst, nb_rx);
+   while (unlikely(nb_tx < nb_rx) && (retry++ < TX_RETRY_TIMES)) {
+   rte_delay_us(TX_RETRY_WAIT_US);
+   nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
+   _burst[nb_tx], nb_rx - nb_tx);
+   }
+   fs->tx_packets += nb_tx;
+
+#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
+   fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
+#endif
+
+   if (unlikely(nb_tx < nb_rx)) {
+   fs->fwd_dropped += (nb_rx - nb_tx);
+   do {
+   rte_pktmbuf_free(pkts_burst[nb_tx]);
+   } while (++nb_tx < nb_rx);
+   }
+
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+   end_tsc = rte_rdtsc();
+   core_cycles = 

[dpdk-dev] [PATCH 0/6] vhost/virtio performance loopback utility

2016-05-05 Thread Zhihong Wang
This patch enables vhost/virtio pmd performance loopback test in testpmd.
All the features are for general usage.

The loopback test focuses on the maximum full-path packet forwarding
performance between host and guest, it runs vhost/virtio pmd only without
introducing extra overhead.

Therefore, the main requirement is traffic generation, since there's no
other packet generators like IXIA to help.

In current testpmd, io-fwd is the ideal candidate to perform this loopback
test because it's the fastest possible forwarding engine: Start testpmd
io-fwd in host with 1 vhost pmd port, and start testpmd io-fwd in the
connected guest with 1 corresponding virtio pmd port, and these 2 ports
form a forwarding loop, packets received by the host vhost pmd port are
forwarded to the guest virtio pmd port, and packets received by the guest
virtio pmd port are sent to the host vhost pmd port.

As to traffic generation, "start tx_first" injects a burst of packets into
the loop, which is the ideal way to do that.

However 2 issues remain:

   1. If only 1 burst of packets are injected in the loop, there will
  almost definitely be empty rx operations, e.g. When guest virtio pmd
  port send burst to the host, then it starts the rx immediately, it's
  likely the packets are still being forwarded by host vhost pmd port
  and haven't reached the guest yet.

  We need to fill up the ring to keep all pmds busy.

   2. io-fwd doesn't provide retry mechanism, so if packet loss occurs,
  there won't be a full burst in the loop.

To address these issues, this patch:

   1. Add an io_retry-fwd in testpmd to prevent most packet losses.

   2. Add parameter to enable configurable tx_first burst number.

Other related improvements include:

   1. Handle all rxqs when multiqueue is enabled: Current testpmd forces a
  single core for each rxq which causes inconvenience and confusion.

   2. Show topology at forwarding start: "show config fwd" also does this,
  but show it directly can reduce the possibility of mis-configuration.

   3. Add throughput information in port statistics display for "show port
  stats (port_id|all)".

Finally there's documentation update.

Example on how to enable vhost/virtio performance loopback test:

   1. Start testpmd in host with 1 vhost pmd port only.

   2. Start testpmd in guest with only 1 virtio pmd port connected to the
  corresponding vhost pmd port.

   3. "set fwd io_retry" in testpmds in both host and guest.

   4. "start" in testpmd in guest.

   5. "start tx_first 8" in testpmd in host.

Then use "show port stats all" to monitor the performance.


Zhihong Wang (6):
  testpmd: add io_retry forwarding
  testpmd: configurable tx_first burst number
  testpmd: show throughput in port stats
  testpmd: handle all rxqs in rss setup
  testpmd: show topology at forwarding start
  testpmd: update documentation

 app/test-pmd/Makefile   |   1 +
 app/test-pmd/cmdline.c  |  41 
 app/test-pmd/config.c   |  28 --
 app/test-pmd/iofwd-retry.c  | 139 
 app/test-pmd/testpmd.c  |  10 +-
 app/test-pmd/testpmd.h  |   1 +
 doc/guides/testpmd_app_ug/run_app.rst   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  10 +-
 8 files changed, 218 insertions(+), 13 deletions(-)
 create mode 100644 app/test-pmd/iofwd-retry.c

-- 
2.5.0



[dpdk-dev] [PATCH] eal: add missing include to debug header

2016-05-05 Thread Ferruh Yigit
On 5/5/2016 1:59 PM, Bruce Richardson wrote:
> On Wed, May 04, 2016 at 05:37:56PM +0100, Bruce Richardson wrote:
>> The header file rte_debug.h makes use of the "unlikely" macro which
>> means it should include the rte_branch_prediction.h header file.
>>
>> Fixes: 50705e8e3cdd ("eal: add assert macro for debug")
>>
>> Signed-off-by: Bruce Richardson 
>> ---
>>  lib/librte_eal/common/include/rte_debug.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/librte_eal/common/include/rte_debug.h 
>> b/lib/librte_eal/common/include/rte_debug.h
>> index 9260eda..cab6fb4 100644
>> --- a/lib/librte_eal/common/include/rte_debug.h
>> +++ b/lib/librte_eal/common/include/rte_debug.h
>> @@ -44,6 +44,7 @@
>>   */
>>  
>>  #include "rte_log.h"
>> +#include "rte_branch_prediction.h"
>>  
>>  #ifdef __cplusplus
>>  extern "C" {
> 
> Ping on this patch - any comments or concerns?
> It's a fairly trivial fix that prevents issues with testing some other patches
> on the mainline.
> 

Tested on top of David Marchand's 12123-12139 patchset.

Acked-by: Ferruh Yigit 



[dpdk-dev] [PATCH 15/15] i40e/base: add capability of disabling all link

2016-05-05 Thread Helin Zhang
It adds a flag, which can be used to tell the firmware to
disable the link on all ports.

Signed-off-by: Helin Zhang 
---
 doc/guides/rel_notes/release_16_07.rst  | 7 +++
 drivers/net/i40e/Makefile   | 2 +-
 drivers/net/i40e/base/i40e_adminq_cmd.h | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 001888f..235f3cb 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -34,6 +34,13 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

+* **Updated the i40e base driver.**
+
+  The i40e base driver was updated with changes which includes the
+  following:
+
+  * Add new X722 and XXV710 device IDs
+

 Resolved Issues
 ---
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 6dd6eaa..dd941f4 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -85,7 +85,7 @@ VPATH += $(SRCDIR)/base

 #
 # all source are stored in SRCS-y
-# base driver is based on the package of dpdk-i40e.2016.01.07.14.tar.gz.
+# base driver is based on the package of dpdk-i40e.2016.04.18.12.tar.gz.
 #
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_adminq.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_common.c
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 968..2b7a760 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1899,7 +1899,10 @@ struct i40e_aqc_set_phy_debug {
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE  0x00
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD  0x01
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT  0x02
+/* Disable link manageability on a single port */
 #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW  0x10
+/* Disable link manageability on all ports needs both bits 4 and 5 */
+#define I40E_AQ_PHY_DEBUG_DISABLE_ALL_LINK_FW  0x20
u8  reserved[15];
 };

-- 
2.5.0



[dpdk-dev] [PATCH 14/15] i40e/base: add RSS config to virtual channel

2016-05-05 Thread Helin Zhang
It add opcodes and structures to support RSS configuration
by PF driver on behalf of the VF drivers.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_virtchnl.h | 45 ---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_virtchnl.h 
b/drivers/net/i40e/base/i40e_virtchnl.h
index 26208f3..fd51ec3 100644
--- a/drivers/net/i40e/base/i40e_virtchnl.h
+++ b/drivers/net/i40e/base/i40e_virtchnl.h
@@ -87,10 +87,15 @@ enum i40e_virtchnl_ops {
I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
I40E_VIRTCHNL_OP_GET_STATS = 15,
I40E_VIRTCHNL_OP_FCOE = 16,
-   I40E_VIRTCHNL_OP_EVENT = 17,
+   I40E_VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
 #ifdef I40E_SOL_VF_SUPPORT
I40E_VIRTCHNL_OP_GET_ADDNL_SOL_CONFIG = 19,
 #endif
+   I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
+   I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
+   I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
+   I40E_VIRTCHNL_OP_SET_RSS_HENA = 26,
+
 };

 /* Virtual channel message descriptor. This overlays the admin queue
@@ -164,6 +169,7 @@ struct i40e_virtchnl_vsi_resource {
 #define I40E_VIRTCHNL_VF_OFFLOAD_VLAN  0x0001
 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING0x0002
 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x0004
+#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF0X0008

 struct i40e_virtchnl_vf_resource {
u16 num_vsis;
@@ -172,8 +178,8 @@ struct i40e_virtchnl_vf_resource {
u16 max_mtu;

u32 vf_offload_flags;
-   u32 max_fcoe_contexts;
-   u32 max_fcoe_filters;
+   u32 rss_key_size;
+   u32 rss_lut_size;

struct i40e_virtchnl_vsi_resource vsi_res[1];
 };
@@ -349,6 +355,39 @@ struct i40e_virtchnl_promisc_info {
  * PF replies with struct i40e_eth_stats in an external buffer.
  */

+/* I40E_VIRTCHNL_OP_CONFIG_RSS_KEY
+ * I40E_VIRTCHNL_OP_CONFIG_RSS_LUT
+ * VF sends these messages to configure RSS. Only supported if both PF
+ * and VF drivers set the I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
+ * configuration negotiation. If this is the case, then the rss fields in
+ * the vf resource struct are valid.
+ * Both the key and LUT are initialized to 0 by the PF, meaning that
+ * RSS is effectively disabled until set up by the VF.
+ */
+struct i40e_virtchnl_rss_key {
+   u16 vsi_id;
+   u16 key_len;
+   u8 key[1]; /* RSS hash key, packed bytes */
+};
+
+struct i40e_virtchnl_rss_lut {
+   u16 vsi_id;
+   u16 lut_entries;
+   u8 lut[1];/* RSS lookup table*/
+};
+
+/* I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS
+ * I40E_VIRTCHNL_OP_SET_RSS_HENA
+ * VF sends these messages to get and set the hash filter enable bits for RSS.
+ * By default, the PF sets these to all possible traffic types that the
+ * hardware supports. The VF can query this value if it wants to change the
+ * traffic types that are hashed by the hardware.
+ * Traffic types are defined in the i40e_filter_pctype enum in i40e_type.h
+ */
+struct i40e_virtchnl_rss_hena {
+   u64 hena;
+};
+
 /* I40E_VIRTCHNL_OP_EVENT
  * PF sends this message to inform the VF driver of events that may affect it.
  * No direct response is expected from the VF, though it may generate other
-- 
2.5.0



[dpdk-dev] [PATCH 13/15] i40e/base: add input set mask definitions

2016-05-05 Thread Helin Zhang
It adds input set mask definitions for RSS, flow director
and flex bytes.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_type.h | 33 +
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index bc68b47..5349419 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1638,4 +1638,37 @@ struct i40e_lldp_variables {

 /* RSS Hash Table Size */
 #define I40E_PFQF_CTL_0_HASHLUTSIZE_5120x0001
+
+/* INPUT SET MASK for RSS, flow director, and flexible payload */
+#define I40E_L3_SRC_SHIFT  47
+#define I40E_L3_SRC_MASK   (0x3ULL << I40E_L3_SRC_SHIFT)
+#define I40E_L3_V6_SRC_SHIFT   43
+#define I40E_L3_V6_SRC_MASK(0xFFULL << I40E_L3_V6_SRC_SHIFT)
+#define I40E_L3_DST_SHIFT  35
+#define I40E_L3_DST_MASK   (0x3ULL << I40E_L3_DST_SHIFT)
+#define I40E_L3_V6_DST_SHIFT   35
+#define I40E_L3_V6_DST_MASK(0xFFULL << I40E_L3_V6_DST_SHIFT)
+#define I40E_L4_SRC_SHIFT  34
+#define I40E_L4_SRC_MASK   (0x1ULL << I40E_L4_SRC_SHIFT)
+#define I40E_L4_DST_SHIFT  33
+#define I40E_L4_DST_MASK   (0x1ULL << I40E_L4_DST_SHIFT)
+#define I40E_VERIFY_TAG_SHIFT  31
+#define I40E_VERIFY_TAG_MASK   (0x3ULL << I40E_VERIFY_TAG_SHIFT)
+
+#define I40E_FLEX_50_SHIFT 13
+#define I40E_FLEX_50_MASK  (0x1ULL << I40E_FLEX_50_SHIFT)
+#define I40E_FLEX_51_SHIFT 12
+#define I40E_FLEX_51_MASK  (0x1ULL << I40E_FLEX_51_SHIFT)
+#define I40E_FLEX_52_SHIFT 11
+#define I40E_FLEX_52_MASK  (0x1ULL << I40E_FLEX_52_SHIFT)
+#define I40E_FLEX_53_SHIFT 10
+#define I40E_FLEX_53_MASK  (0x1ULL << I40E_FLEX_53_SHIFT)
+#define I40E_FLEX_54_SHIFT 9
+#define I40E_FLEX_54_MASK  (0x1ULL << I40E_FLEX_54_SHIFT)
+#define I40E_FLEX_55_SHIFT 8
+#define I40E_FLEX_55_MASK  (0x1ULL << I40E_FLEX_55_SHIFT)
+#define I40E_FLEX_56_SHIFT 7
+#define I40E_FLEX_56_MASK  (0x1ULL << I40E_FLEX_56_SHIFT)
+#define I40E_FLEX_57_SHIFT 6
+#define I40E_FLEX_57_MASK  (0x1ULL << I40E_FLEX_57_SHIFT)
 #endif /* _I40E_TYPE_H_ */
-- 
2.5.0



[dpdk-dev] [PATCH 12/15] i40e/base: increase supported AQ API version

2016-05-05 Thread Helin Zhang
It increases the supported AQ API version to 1.5
for X722.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 7ed3048..bc68b47 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -188,7 +188,7 @@ enum i40e_memcpy_type {
 };

 #ifdef X722_SUPPORT
-#define I40E_FW_API_VERSION_MINOR_X722 0x0004
+#define I40E_FW_API_VERSION_MINOR_X722 0x0005
 #endif
 #define I40E_FW_API_VERSION_MINOR_X710 0x0005

-- 
2.5.0



[dpdk-dev] [PATCH 11/15] i40e/base: add more device capabilities

2016-05-05 Thread Helin Zhang
It adds more device capabilities for NVM management.
- if update is available
- if security check is needed

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 drivers/net/i40e/base/i40e_common.c | 6 ++
 drivers/net/i40e/base/i40e_type.h   | 5 +
 3 files changed, 12 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 00c2c0a..968 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -446,6 +446,7 @@ struct i40e_aqc_list_capabilities_element_resp {
 #define I40E_AQ_CAP_ID_SDP 0x0062
 #define I40E_AQ_CAP_ID_MDIO0x0063
 #define I40E_AQ_CAP_ID_WSR_PROT0x0064
+#define I40E_AQ_CAP_ID_NVM_MGMT0x0080
 #define I40E_AQ_CAP_ID_FLEX10  0x00F1
 #define I40E_AQ_CAP_ID_CEM 0x00F2

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 9c0a018..09bf6d5 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -3761,6 +3761,12 @@ STATIC void i40e_parse_discover_capabilities(struct 
i40e_hw *hw, void *buff,
   "HW Capability: wr_csr_prot = 0x%llX\n\n",
   (p->wr_csr_prot & 0x));
break;
+   case I40E_AQ_CAP_ID_NVM_MGMT:
+   if (number & I40E_NVM_MGMT_SEC_REV_DISABLED)
+   p->sec_rev_disabled = true;
+   if (number & I40E_NVM_MGMT_UPDATE_DISABLED)
+   p->update_disabled = true;
+   break;
 #ifdef X722_SUPPORT
case I40E_AQ_CAP_ID_WOL_AND_PROXY:
hw->num_wol_proxy_filters = (u16)number;
diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 73a18e1..7ed3048 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -376,6 +376,11 @@ struct i40e_hw_capabilities {
 #define I40E_FLEX10_STATUS_DCC_ERROR   0x1
 #define I40E_FLEX10_STATUS_VC_MODE 0x2

+   bool sec_rev_disabled;
+   bool update_disabled;
+#define I40E_NVM_MGMT_SEC_REV_DISABLED 0x1
+#define I40E_NVM_MGMT_UPDATE_DISABLED  0x2
+
bool mgmt_cem;
bool ieee_1588;
bool iwarp;
-- 
2.5.0



[dpdk-dev] [PATCH 10/15] i40e/base: fix debug output

2016-05-05 Thread Helin Zhang
It fixes the debug output messages.

Fixes: f388b435bc33 ("i40e/base: clean adminq debug")

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index ebc4ebb..9c0a018 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -375,14 +375,15 @@ void i40e_debug_aq(struct i40e_hw *hw, enum 
i40e_debug_mask mask, void *desc,
/* the most we could have left is 16 bytes, pad with zeros */
if (i < len) {
char d_buf[16];
-   int j;
+   int j, i_sav;

+   i_sav = i;
memset(d_buf, 0, sizeof(d_buf));
for (j = 0; i < len; j++, i++)
d_buf[j] = buf[i];
i40e_debug(hw, mask,
   "\t0x%04X  %02X %02X %02X %02X %02X %02X 
%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
-  i, d_buf[0], d_buf[1], d_buf[2], d_buf[3],
+  i_sav, d_buf[0], d_buf[1], d_buf[2], 
d_buf[3],
   d_buf[4], d_buf[5], d_buf[6], d_buf[7],
   d_buf[8], d_buf[9], d_buf[10], d_buf[11],
   d_buf[12], d_buf[13], d_buf[14], d_buf[15]);
-- 
2.5.0



[dpdk-dev] [PATCH 09/15] i40e/base: fix the number of MSIX vector

2016-05-05 Thread Helin Zhang
It corrects the number of MSIX vector in a debug info.

Fixes: 889bc9f0cd3a ("i40e/base: unify the capability function")

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index b911ef2..ebc4ebb 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -3670,7 +3670,7 @@ STATIC void i40e_parse_discover_capabilities(struct 
i40e_hw *hw, void *buff,
p->num_msix_vectors = number;
i40e_debug(hw, I40E_DEBUG_INIT,
   "HW Capability: MSIX vector count = %d\n",
-  p->num_msix_vectors_vf);
+  p->num_msix_vectors);
break;
case I40E_AQ_CAP_ID_VF_MSIX:
p->num_msix_vectors_vf = number;
-- 
2.5.0



[dpdk-dev] [PATCH 08/15] i40e/base: add new devices

2016-05-05 Thread Helin Zhang
It adds new device IDs of both X722 and XXV710, and
new PHY types.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 4 
 drivers/net/i40e/base/i40e_common.c | 4 
 drivers/net/i40e/base/i40e_devids.h | 4 
 lib/librte_eal/common/include/rte_pci_dev_ids.h | 8 
 4 files changed, 20 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 687eaa5..00c2c0a 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1678,6 +1678,10 @@ enum i40e_aq_phy_type {
I40E_PHY_TYPE_1000BASE_LX   = 0x1C,
I40E_PHY_TYPE_1000BASE_T_OPTICAL= 0x1D,
I40E_PHY_TYPE_20GBASE_KR2   = 0x1E,
+   I40E_PHY_TYPE_25GBASE_KR= 0x1F,
+   I40E_PHY_TYPE_25GBASE_CR= 0x20,
+   I40E_PHY_TYPE_25GBASE_SR= 0x21,
+   I40E_PHY_TYPE_25GBASE_LR= 0x22,
I40E_PHY_TYPE_MAX
 };

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index ef6b270..b911ef2 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -67,6 +67,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw 
*hw)
case I40E_DEV_ID_10G_BASE_T4:
case I40E_DEV_ID_20G_KR2:
case I40E_DEV_ID_20G_KR2_A:
+   case I40E_DEV_ID_25G_B:
+   case I40E_DEV_ID_25G_SFP28:
hw->mac.type = I40E_MAC_XL710;
break;
 #ifdef X722_SUPPORT
@@ -78,6 +80,8 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw 
*hw)
case I40E_DEV_ID_SFP_X722:
case I40E_DEV_ID_1G_BASE_T_X722:
case I40E_DEV_ID_10G_BASE_T_X722:
+   case I40E_DEV_ID_SFP_I_X722:
+   case I40E_DEV_ID_QSFP_I_X722:
hw->mac.type = I40E_MAC_X722;
break;
 #endif
diff --git a/drivers/net/i40e/base/i40e_devids.h 
b/drivers/net/i40e/base/i40e_devids.h
index f844340..ed73e1d 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -49,6 +49,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_DEV_ID_20G_KR20x1587
 #define I40E_DEV_ID_20G_KR2_A  0x1588
 #define I40E_DEV_ID_10G_BASE_T40x1589
+#define I40E_DEV_ID_25G_B  0x158A
+#define I40E_DEV_ID_25G_SFP28  0x158B
 #if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_VF 0x154C
 #define I40E_DEV_ID_VF_HV  0x1571
@@ -65,6 +67,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_DEV_ID_SFP_X722   0x37D0
 #define I40E_DEV_ID_1G_BASE_T_X722 0x37D1
 #define I40E_DEV_ID_10G_BASE_T_X7220x37D2
+#define I40E_DEV_ID_SFP_I_X722 0x37D3
+#define I40E_DEV_ID_QSFP_I_X7220x37D4
 #if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_X722_VF0x37CD
 #define I40E_DEV_ID_X722_VF_HV 0x37D9
diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h 
b/lib/librte_eal/common/include/rte_pci_dev_ids.h
index cf7b548..c812b64 100644
--- a/lib/librte_eal/common/include/rte_pci_dev_ids.h
+++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h
@@ -532,12 +532,16 @@ RTE_PCI_DEV_ID_DECL_IXGBE(PCI_VENDOR_ID_INTEL, 
IXGBE_DEV_ID_82599_BYPASS)
 #define I40E_DEV_ID_20G_KR2 0x1587
 #define I40E_DEV_ID_20G_KR2_A   0x1588
 #define I40E_DEV_ID_10G_BASE_T4 0x1589
+#define I40E_DEV_ID_25G_B   0x158A
+#define I40E_DEV_ID_25G_SFP28   0x158B
 #define I40E_DEV_ID_X722_A0 0x374C
 #define I40E_DEV_ID_KX_X722 0x37CE
 #define I40E_DEV_ID_QSFP_X722   0x37CF
 #define I40E_DEV_ID_SFP_X7220x37D0
 #define I40E_DEV_ID_1G_BASE_T_X722  0x37D1
 #define I40E_DEV_ID_10G_BASE_T_X722 0x37D2
+#define I40E_DEV_ID_SFP_I_X722  0x37D3
+#define I40E_DEV_ID_QSFP_I_X722 0x37D4

 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_SFP_XL710)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_QEMU)
@@ -550,12 +554,16 @@ RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, 
I40E_DEV_ID_10G_BASE_T)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_20G_KR2)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_20G_KR2_A)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_10G_BASE_T4)
+RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_25G_B)
+RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_25G_SFP28)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_X722_A0)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_KX_X722)
 RTE_PCI_DEV_ID_DECL_I40E(PCI_VENDOR_ID_INTEL, I40E_DEV_ID_QSFP_X722)
 

[dpdk-dev] [PATCH 07/15] i40e/base: fix problematic mirror rule ID check

2016-05-05 Thread Helin Zhang
It removes the problematic mirror rule ID check. It
returns an error if the mirror rule ID is 0, which is
a valid value.

Fixes: 0bf2dbbe077c ("i40e/base: support mirroring rules")

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_common.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index ace5b84..ef6b270 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -3042,10 +3042,7 @@ enum i40e_status_code i40e_aq_delete_mirrorrule(struct 
i40e_hw *hw, u16 sw_seid,
u16 *rules_used, u16 *rules_free)
 {
/* Rule ID has to be valid except rule_type: INGRESS VLAN mirroring */
-   if (rule_type != I40E_AQC_MIRROR_RULE_TYPE_VLAN) {
-   if (!rule_id)
-   return I40E_ERR_PARAM;
-   } else {
+   if (rule_type == I40E_AQC_MIRROR_RULE_TYPE_VLAN) {
/* count and mr_list shall be valid for rule_type INGRESS VLAN
 * mirroring. For other rule_type, count and rule_type should
 * not matter.
-- 
2.5.0



[dpdk-dev] [PATCH 06/15] i40e/base: expose mirroring config

2016-05-05 Thread Helin Zhang
It exposes the configuration of mirroring or not egress
traffic to VSIs in promiscuous mode, as latest firmware
supports that from API version 1.5.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_common.c| 9 ++---
 drivers/net/i40e/base/i40e_prototype.h | 4 ++--
 drivers/net/i40e/i40e_ethdev.c | 4 ++--
 drivers/net/i40e/i40e_pf.c | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index e958099..ace5b84 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2214,10 +2214,12 @@ enum i40e_status_code i40e_aq_set_default_vsi(struct 
i40e_hw *hw,
  * @seid: vsi number
  * @set: set unicast promiscuous enable/disable
  * @cmd_details: pointer to command details structure or NULL
+ * @rx_only_promisc: flag to decide if egress traffic gets mirrored in promisc
  **/
 enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
u16 seid, bool set,
-   struct i40e_asq_cmd_details *cmd_details)
+   struct i40e_asq_cmd_details *cmd_details,
+   bool rx_only_promisc)
 {
struct i40e_aq_desc desc;
struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
@@ -2230,8 +2232,9 @@ enum i40e_status_code 
i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,

if (set) {
flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
-   if (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
-(hw->aq.api_maj_ver > 1))
+   if (rx_only_promisc &&
+   (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+(hw->aq.api_maj_ver > 1)))
flags |= I40E_AQC_SET_VSI_PROMISC_TX;
}

diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index 48a08fd..03dda93 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -166,7 +166,8 @@ enum i40e_status_code i40e_aq_set_vsi_broadcast(struct 
i40e_hw *hw,
u16 vsi_id, bool set_filter,
struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
-   u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
+   u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details,
+   bool rx_only_promisc);
 enum i40e_status_code i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw,
u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan(struct i40e_hw *hw,
@@ -404,7 +405,6 @@ enum i40e_status_code i40e_aq_remove_cloud_filters(struct 
i40e_hw *hw,
u16 vsi,
struct i40e_aqc_add_remove_cloud_filters_element_data *filters,
u8 filter_count);
-
 enum i40e_status_code i40e_aq_alternate_read(struct i40e_hw *hw,
u32 reg_addr0, u32 *reg_val0,
u32 reg_addr1, u32 *reg_val1);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bc28d3c..b1765fe 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1661,7 +1661,7 @@ i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
int status;

status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-   true, NULL);
+true, NULL, true);
if (status != I40E_SUCCESS)
PMD_DRV_LOG(ERR, "Failed to enable unicast promiscuous");

@@ -1681,7 +1681,7 @@ i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
int status;

status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-   false, NULL);
+false, NULL, true);
if (status != I40E_SUCCESS)
PMD_DRV_LOG(ERR, "Failed to disable unicast promiscuous");

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 5afd61a..b549caa 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -810,7 +810,7 @@ i40e_pf_host_process_cmd_config_promisc_mode(
if (promisc->flags & I40E_FLAG_VF_UNICAST_PROMISC)
unicast = TRUE;
ret = i40e_aq_set_vsi_unicast_promiscuous(hw,
-   vf->vsi->seid, unicast, NULL);
+   vf->vsi->seid, unicast, NULL, true);
if (ret != I40E_SUCCESS)
goto send_msg;

-- 
2.5.0



[dpdk-dev] [PATCH 05/15] i40e/base: fixup Geneve VNI for HW use

2016-05-05 Thread Helin Zhang
The hardware doesn't layout the Geneve VNI quite the same
as the VxLAN VNI, so it needs to adjust it before sending
through the AQ commands as the workaround.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_common.c | 35 ++-
 drivers/net/i40e/base/i40e_osdep.h  |  7 +++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index f7dff12..e958099 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -5422,6 +5422,35 @@ void 
i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
 }

 /**
+ * i40e_fix_up_geneve_vni - adjust Geneve VNI for HW issue
+ * @filters: list of cloud filters
+ * @filter_count: length of list
+ *
+ * There's an issue in the device where the Geneve VNI layout needs
+ * to be shifted 1 byte over from the VxLAN VNI
+ **/
+STATIC void i40e_fix_up_geneve_vni(
+   struct i40e_aqc_add_remove_cloud_filters_element_data *filters,
+   u8 filter_count)
+{
+   struct i40e_aqc_add_remove_cloud_filters_element_data *f = filters;
+   int i;
+
+   for (i = 0; i < filter_count; i++) {
+   u16 tnl_type;
+   u32 ti;
+
+   tnl_type = (le16_to_cpu(f[i].flags) &
+  I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK) >>
+  I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT;
+   if (tnl_type == I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE) {
+   ti = le32_to_cpu(f[i].tenant_id);
+   f[i].tenant_id = cpu_to_le32(ti << 8);
+   }
+   }
+}
+
+/**
  * i40e_aq_add_cloud_filters
  * @hw: pointer to the hardware structure
  * @seid: VSI seid to add cloud filters from
@@ -5441,8 +5470,8 @@ enum i40e_status_code i40e_aq_add_cloud_filters(struct 
i40e_hw *hw,
struct i40e_aq_desc desc;
struct i40e_aqc_add_remove_cloud_filters *cmd =
(struct i40e_aqc_add_remove_cloud_filters *)
-   u16 buff_len;
enum i40e_status_code status;
+   u16 buff_len;

i40e_fill_default_direct_cmd_desc(,
  i40e_aqc_opc_add_cloud_filters);
@@ -5453,6 +5482,8 @@ enum i40e_status_code i40e_aq_add_cloud_filters(struct 
i40e_hw *hw,
cmd->num_filters = filter_count;
cmd->seid = CPU_TO_LE16(seid);

+   i40e_fix_up_geneve_vni(filters, filter_count);
+
status = i40e_asq_send_command(hw, , filters, buff_len, NULL);

return status;
@@ -5490,6 +5521,8 @@ enum i40e_status_code i40e_aq_remove_cloud_filters(struct 
i40e_hw *hw,
cmd->num_filters = filter_count;
cmd->seid = CPU_TO_LE16(seid);

+   i40e_fix_up_geneve_vni(filters, filter_count);
+
status = i40e_asq_send_command(hw, , filters, buff_len, NULL);

return status;
diff --git a/drivers/net/i40e/base/i40e_osdep.h 
b/drivers/net/i40e/base/i40e_osdep.h
index 8c84ed8..38e7ba5 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -204,6 +204,13 @@ struct i40e_virt_mem {
 #define LE32_TO_CPU(c) rte_le_to_cpu_32(c)
 #define LE64_TO_CPU(k) rte_le_to_cpu_64(k)

+#define cpu_to_le16(o) rte_cpu_to_le_16(o)
+#define cpu_to_le32(s) rte_cpu_to_le_32(s)
+#define cpu_to_le64(h) rte_cpu_to_le_64(h)
+#define le16_to_cpu(a) rte_le_to_cpu_16(a)
+#define le32_to_cpu(c) rte_le_to_cpu_32(c)
+#define le64_to_cpu(k) rte_le_to_cpu_64(k)
+
 /* SW spinlock */
 struct i40e_spinlock {
rte_spinlock_t spinlock;
-- 
2.5.0



[dpdk-dev] [PATCH 04/15] i40e/base: code style fixes

2016-05-05 Thread Helin Zhang
It adds code style fixes.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq.c | 52 +++--
 drivers/net/i40e/base/i40e_adminq.h |  4 +--
 drivers/net/i40e/base/i40e_adminq_cmd.h | 21 +++--
 drivers/net/i40e/base/i40e_common.c |  5 ++--
 drivers/net/i40e/base/i40e_prototype.h  |  3 +-
 5 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index ba7ef42..0d3a83f 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -572,6 +572,26 @@ shutdown_arq_out:
i40e_release_spinlock(>aq.arq_spinlock);
return ret_code;
 }
+#ifdef PF_DRIVER
+
+/**
+ *  i40e_resume_aq - resume AQ processing from 0
+ *  @hw: pointer to the hardware structure
+ **/
+STATIC void i40e_resume_aq(struct i40e_hw *hw)
+{
+   /* Registers are reset after PF reset */
+   hw->aq.asq.next_to_use = 0;
+   hw->aq.asq.next_to_clean = 0;
+
+   i40e_config_asq_regs(hw);
+
+   hw->aq.arq.next_to_use = 0;
+   hw->aq.arq.next_to_clean = 0;
+
+   i40e_config_arq_regs(hw);
+}
+#endif /* PF_DRIVER */

 /**
  *  i40e_init_adminq - main initialization routine for Admin Queue
@@ -586,12 +606,15 @@ shutdown_arq_out:
  **/
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
-   enum i40e_status_code ret_code;
 #ifdef PF_DRIVER
-   u16 eetrack_lo, eetrack_hi;
u16 cfg_ptr, oem_hi, oem_lo;
+   u16 eetrack_lo, eetrack_hi;
+#endif
+   enum i40e_status_code ret_code;
+#ifdef PF_DRIVER
int retry = 0;
 #endif
+
/* verify input for valid configuration */
if ((hw->aq.num_arq_entries == 0) ||
(hw->aq.num_asq_entries == 0) ||
@@ -600,8 +623,6 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
ret_code = I40E_ERR_CONFIG;
goto init_adminq_exit;
}
-
-   /* initialize spin locks */
i40e_init_spinlock(>aq.asq_spinlock);
i40e_init_spinlock(>aq.arq_spinlock);

@@ -704,8 +725,6 @@ enum i40e_status_code i40e_shutdown_adminq(struct i40e_hw 
*hw)

i40e_shutdown_asq(hw);
i40e_shutdown_arq(hw);
-
-   /* destroy the spinlocks */
i40e_destroy_spinlock(>aq.asq_spinlock);
i40e_destroy_spinlock(>aq.arq_spinlock);

@@ -731,7 +750,6 @@ u16 i40e_clean_asq(struct i40e_hw *hw)

desc = I40E_ADMINQ_DESC(*asq, ntc);
details = I40E_ADMINQ_DETAILS(*asq, ntc);
-
while (rd32(hw, hw->aq.asq.head) != ntc) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
@@ -764,7 +782,11 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
  *  Returns true if the firmware has processed all descriptors on the
  *  admin send queue. Returns false if there are still requests pending.
  **/
+#ifdef VF_DRIVER
 bool i40e_asq_done(struct i40e_hw *hw)
+#else
+STATIC bool i40e_asq_done(struct i40e_hw *hw)
+#endif
 {
/* AQ designers suggest use of head for better
 * timing reliability than DD bit
@@ -922,7 +944,6 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw 
*hw,
 */
if (i40e_asq_done(hw))
break;
-   /* ugh! delay while spin_lock */
i40e_msec_delay(1);
total_delay++;
} while (total_delay < hw->aq.asq_cmd_timeout);
@@ -1105,7 +1126,7 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,

 #ifdef PF_DRIVER
i40e_nvmupd_check_wait_event(hw, LE16_TO_CPU(e->desc.opcode));
-#endif
+#endif /* PF_DRIVER */
 clean_arq_element_out:
/* Set pending if needed, unlock and return */
if (pending != NULL)
@@ -1116,16 +1137,3 @@ clean_arq_element_err:
return ret_code;
 }

-void i40e_resume_aq(struct i40e_hw *hw)
-{
-   /* Registers are reset after PF reset */
-   hw->aq.asq.next_to_use = 0;
-   hw->aq.asq.next_to_clean = 0;
-
-   i40e_config_asq_regs(hw);
-
-   hw->aq.arq.next_to_use = 0;
-   hw->aq.arq.next_to_clean = 0;
-
-   i40e_config_arq_regs(hw);
-}
diff --git a/drivers/net/i40e/base/i40e_adminq.h 
b/drivers/net/i40e/base/i40e_adminq.h
index 29c04a3..750973c 100644
--- a/drivers/net/i40e/base/i40e_adminq.h
+++ b/drivers/net/i40e/base/i40e_adminq.h
@@ -157,8 +157,8 @@ STATIC INLINE int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
 }

 /* general information */
-#define I40E_AQ_LARGE_BUF  512
-#define I40E_ASQ_CMD_TIMEOUT   250  /* msecs */
+#define I40E_AQ_LARGE_BUF  512
+#define I40E_ASQ_CMD_TIMEOUT   250  /* msecs */
 #ifdef I40E_ESS_SUPPORT
 #define I40E_ASQ_CMD_TIMEOUT_ESS   5  /* msecs */
 #endif
diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 58ba609..687eaa5 100644
--- 

[dpdk-dev] [PATCH 03/15] i40e/base: refactor NVM update event handling

2016-05-05 Thread Helin Zhang
It refactors the NVM update event handling, with specifying
the AQ event opcode to wait on.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq.c| 33 +--
 drivers/net/i40e/base/i40e_nvm.c   | 77 +++---
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 drivers/net/i40e/base/i40e_type.h  |  1 +
 4 files changed, 75 insertions(+), 37 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index 15d5f5a..ba7ef42 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -37,18 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "i40e_adminq.h"
 #include "i40e_prototype.h"

-#ifdef PF_DRIVER
-/**
- * i40e_is_nvm_update_op - return true if this is an NVM update operation
- * @desc: API request descriptor
- **/
-STATIC INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
-{
-   return (desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_erase) ||
-   desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update));
-}
-
-#endif /* PF_DRIVER */
 /**
  *  i40e_adminq_init_regs - Initialize AdminQ registers
  *  @hw: pointer to the hardware structure
@@ -1116,26 +1104,7 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,
hw->aq.arq.next_to_use = ntu;

 #ifdef PF_DRIVER
-   if (i40e_is_nvm_update_op(>desc)) {
-   if (hw->nvm_release_on_done) {
-   i40e_release_nvm(hw);
-   hw->nvm_release_on_done = false;
-   }
-
-   switch (hw->nvmupd_state) {
-   case I40E_NVMUPD_STATE_INIT_WAIT:
-   hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
-   break;
-
-   case I40E_NVMUPD_STATE_WRITE_WAIT:
-   hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
-   break;
-
-   default:
-   break;
-   }
-   }
-
+   i40e_nvmupd_check_wait_event(hw, LE16_TO_CPU(e->desc.opcode));
 #endif
 clean_arq_element_out:
/* Set pending if needed, unlock and return */
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index 04e422f..dfe0dc6 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -872,10 +872,10 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw 
*hw,
/* early check for status command and debug msgs */
upd_cmd = i40e_nvmupd_validate_command(hw, cmd, perrno);

-   i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d cmd 
0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n",
+   i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d opc 
0x%04x cmd 0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n",
   i40e_nvm_update_state_str[upd_cmd],
   hw->nvmupd_state,
-  hw->nvm_release_on_done,
+  hw->nvm_release_on_done, hw->nvm_wait_opcode,
   cmd->command, cmd->config, cmd->offset, cmd->data_size);

if (upd_cmd == I40E_NVMUPD_INVALID) {
@@ -889,7 +889,18 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw 
*hw,
 * going into the state machine
 */
if (upd_cmd == I40E_NVMUPD_STATUS) {
+   if (!cmd->data_size) {
+   *perrno = -EFAULT;
+   return I40E_ERR_BUF_TOO_SHORT;
+   }
+
bytes[0] = hw->nvmupd_state;
+
+   if (cmd->data_size >= 4) {
+   bytes[1] = 0;
+   *((u16 *)[2]) = hw->nvm_wait_opcode;
+   }
+
return I40E_SUCCESS;
}

@@ -908,6 +919,14 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw 
*hw,

case I40E_NVMUPD_STATE_INIT_WAIT:
case I40E_NVMUPD_STATE_WRITE_WAIT:
+   /* if we need to stop waiting for an event, clear
+* the wait info and return before doing anything else
+*/
+   if (cmd->offset == 0x) {
+   i40e_nvmupd_check_wait_event(hw, hw->nvm_wait_opcode);
+   return I40E_SUCCESS;
+   }
+
status = I40E_ERR_NOT_READY;
*perrno = -EBUSY;
break;
@@ -981,6 +1000,7 @@ STATIC enum i40e_status_code i40e_nvmupd_state_init(struct 
i40e_hw *hw,
i40e_release_nvm(hw);
} else {
hw->nvm_release_on_done = true;
+   hw->nvm_wait_opcode = i40e_aqc_opc_nvm_erase;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
}
@@ -997,6 +1017,7 @@ STATIC enum i40e_status_code i40e_nvmupd_state_init(struct 
i40e_hw *hw,
i40e_release_nvm(hw);
} 

[dpdk-dev] [PATCH 02/15] i40e/base: refactor NVM update status info

2016-05-05 Thread Helin Zhang
It centralizes all NVM update status info in the same
structure, for better management.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq.c |  6 +++---
 drivers/net/i40e/base/i40e_adminq.h |  1 -
 drivers/net/i40e/base/i40e_nvm.c| 12 ++--
 drivers/net/i40e/base/i40e_type.h   |  1 +
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index 0e4198e..15d5f5a 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -680,7 +680,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)

/* pre-emptive resource lock release */
i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL);
-   hw->aq.nvm_release_on_done = false;
+   hw->nvm_release_on_done = false;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;

 #endif /* PF_DRIVER */
@@ -1117,9 +1117,9 @@ enum i40e_status_code i40e_clean_arq_element(struct 
i40e_hw *hw,

 #ifdef PF_DRIVER
if (i40e_is_nvm_update_op(>desc)) {
-   if (hw->aq.nvm_release_on_done) {
+   if (hw->nvm_release_on_done) {
i40e_release_nvm(hw);
-   hw->aq.nvm_release_on_done = false;
+   hw->nvm_release_on_done = false;
}

switch (hw->nvmupd_state) {
diff --git a/drivers/net/i40e/base/i40e_adminq.h 
b/drivers/net/i40e/base/i40e_adminq.h
index 40c86d9..29c04a3 100644
--- a/drivers/net/i40e/base/i40e_adminq.h
+++ b/drivers/net/i40e/base/i40e_adminq.h
@@ -104,7 +104,6 @@ struct i40e_adminq_info {
u32 fw_build;   /* firmware build number */
u16 api_maj_ver;/* api major version */
u16 api_min_ver;/* api minor version */
-   bool nvm_release_on_done;

struct i40e_spinlock asq_spinlock; /* Send queue spinlock */
struct i40e_spinlock arq_spinlock; /* Receive queue spinlock */
diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index f4e4eaa..04e422f 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -875,7 +875,7 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw 
*hw,
i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d cmd 
0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n",
   i40e_nvm_update_state_str[upd_cmd],
   hw->nvmupd_state,
-  hw->aq.nvm_release_on_done,
+  hw->nvm_release_on_done,
   cmd->command, cmd->config, cmd->offset, cmd->data_size);

if (upd_cmd == I40E_NVMUPD_INVALID) {
@@ -980,7 +980,7 @@ STATIC enum i40e_status_code i40e_nvmupd_state_init(struct 
i40e_hw *hw,
if (status) {
i40e_release_nvm(hw);
} else {
-   hw->aq.nvm_release_on_done = true;
+   hw->nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
}
@@ -996,7 +996,7 @@ STATIC enum i40e_status_code i40e_nvmupd_state_init(struct 
i40e_hw *hw,
if (status) {
i40e_release_nvm(hw);
} else {
-   hw->aq.nvm_release_on_done = true;
+   hw->nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
}
@@ -1030,7 +1030,7 @@ STATIC enum i40e_status_code 
i40e_nvmupd_state_init(struct i40e_hw *hw,
   -EIO;
i40e_release_nvm(hw);
} else {
-   hw->aq.nvm_release_on_done = true;
+   hw->nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
}
@@ -1138,7 +1138,7 @@ retry:
   -EIO;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
} else {
-   hw->aq.nvm_release_on_done = true;
+   hw->nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
break;
@@ -1167,7 +1167,7 @@ retry:
   -EIO;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
} else {
-   hw->aq.nvm_release_on_done = true;
+   hw->nvm_release_on_done = true;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
}
break;
diff --git a/drivers/net/i40e/base/i40e_type.h 

[dpdk-dev] [PATCH 01/15] i40e/base: remove HMC AQ APIs

2016-05-05 Thread Helin Zhang
HMC AQ APIs were removed from the latest datasheet, and
hence remove its implementations and relevant.

Signed-off-by: Helin Zhang 
---
 drivers/net/i40e/base/i40e_adminq.c |  4 ---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 25 --
 drivers/net/i40e/base/i40e_common.c | 61 -
 drivers/net/i40e/base/i40e_prototype.h  |  8 -
 4 files changed, 98 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq.c 
b/drivers/net/i40e/base/i40e_adminq.c
index 222add4..0e4198e 100644
--- a/drivers/net/i40e/base/i40e_adminq.c
+++ b/drivers/net/i40e/base/i40e_adminq.c
@@ -683,10 +683,6 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
hw->aq.nvm_release_on_done = false;
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;

-   ret_code = i40e_aq_set_hmc_resource_profile(hw,
-   I40E_HMC_PROFILE_DEFAULT,
-   0,
-   NULL);
 #endif /* PF_DRIVER */
ret_code = I40E_SUCCESS;

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index fe9d5b5..58ba609 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -224,10 +224,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_resume_port_tx = 0x041C,
i40e_aqc_opc_configure_partition_bw = 0x041D,

-   /* hmc */
-   i40e_aqc_opc_query_hmc_resource_profile = 0x0500,
-   i40e_aqc_opc_set_hmc_resource_profile   = 0x0501,
-
/* phy commands*/
i40e_aqc_opc_get_phy_abilities  = 0x0600,
i40e_aqc_opc_set_phy_config = 0x0601,
@@ -1646,27 +1642,6 @@ struct i40e_aqc_configure_partition_bw_data {

 I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);

-/* Get and set the active HMC resource profile and status.
- * (direct 0x0500) and (direct 0x0501)
- */
-struct i40e_aq_get_set_hmc_resource_profile {
-   u8  pm_profile;
-   u8  pe_vf_enabled;
-   u8  reserved[14];
-};
-
-I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
-
-enum i40e_aq_hmc_profile {
-   /* I40E_HMC_PROFILE_NO_CHANGE= 0, reserved */
-   I40E_HMC_PROFILE_DEFAULT= 1,
-   I40E_HMC_PROFILE_FAVOR_VF   = 2,
-   I40E_HMC_PROFILE_EQUAL  = 3,
-};
-
-#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK   0xF
-#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK0x3F
-
 /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */

 /* set in param0 for get phy abilities to report qualified modules */
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index ef3425e..7a5f754 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -3240,67 +3240,6 @@ enum i40e_status_code 
i40e_aq_debug_write_register(struct i40e_hw *hw,
 }

 /**
- * i40e_aq_get_hmc_resource_profile
- * @hw: pointer to the hw struct
- * @profile: type of profile the HMC is to be set as
- * @pe_vf_enabled_count: the number of PE enabled VFs the system has
- * @cmd_details: pointer to command details structure or NULL
- *
- * query the HMC profile of the device.
- **/
-enum i40e_status_code i40e_aq_get_hmc_resource_profile(struct i40e_hw *hw,
-   enum i40e_aq_hmc_profile *profile,
-   u8 *pe_vf_enabled_count,
-   struct i40e_asq_cmd_details *cmd_details)
-{
-   struct i40e_aq_desc desc;
-   struct i40e_aq_get_set_hmc_resource_profile *resp =
-   (struct i40e_aq_get_set_hmc_resource_profile *)
-   enum i40e_status_code status;
-
-   i40e_fill_default_direct_cmd_desc(,
-   i40e_aqc_opc_query_hmc_resource_profile);
-   status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
-
-   *profile = (enum i40e_aq_hmc_profile)(resp->pm_profile &
-  I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK);
-   *pe_vf_enabled_count = resp->pe_vf_enabled &
-  I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK;
-
-   return status;
-}
-
-/**
- * i40e_aq_set_hmc_resource_profile
- * @hw: pointer to the hw struct
- * @profile: type of profile the HMC is to be set as
- * @pe_vf_enabled_count: the number of PE enabled VFs the system has
- * @cmd_details: pointer to command details structure or NULL
- *
- * set the HMC profile of the device.
- **/
-enum i40e_status_code i40e_aq_set_hmc_resource_profile(struct i40e_hw *hw,
-   enum i40e_aq_hmc_profile profile,
-   u8 pe_vf_enabled_count,
-   struct i40e_asq_cmd_details *cmd_details)
-{
-   struct i40e_aq_desc desc;
-   struct i40e_aq_get_set_hmc_resource_profile *cmd =
-  

[dpdk-dev] [PATCH 00/15] i40e base driver update

2016-05-05 Thread Helin Zhang
This is the i40e base driver update, which includes
bug fixes, enhancements, refactoring, and new device
enabling. Below are the details.

Helin Zhang (15):
  i40e/base: remove HMC AQ APIs
  i40e/base: refactor NVM update status info
  i40e/base: refactor NVM update event handling
  i40e/base: code style fixes
  i40e/base: fixup Geneve VNI for HW use
  i40e/base: expose mirroring config
  i40e/base: fix problematic mirror rule ID check
  i40e/base: add new devices
  i40e/base: fix the number of MSIX vector
  i40e/base: fix debug output
  i40e/base: add more device capabilities
  i40e/base: increase supported AQ API version
  i40e/base: add input set mask definitions
  i40e/base: add RSS config to virtual channel
  i40e/base: add capability of disabling all link

 doc/guides/rel_notes/release_16_07.rst  |   7 ++
 drivers/net/i40e/Makefile   |   2 +-
 drivers/net/i40e/base/i40e_adminq.c |  91 ++--
 drivers/net/i40e/base/i40e_adminq.h |   5 +-
 drivers/net/i40e/base/i40e_adminq_cmd.h |  54 --
 drivers/net/i40e/base/i40e_common.c | 132 ++--
 drivers/net/i40e/base/i40e_devids.h |   4 +
 drivers/net/i40e/base/i40e_nvm.c|  87 ++--
 drivers/net/i40e/base/i40e_osdep.h  |   7 ++
 drivers/net/i40e/base/i40e_prototype.h  |  16 +--
 drivers/net/i40e/base/i40e_type.h   |  42 +++-
 drivers/net/i40e/base/i40e_virtchnl.h   |  45 +++-
 drivers/net/i40e/i40e_ethdev.c  |   4 +-
 drivers/net/i40e/i40e_pf.c  |   2 +-
 lib/librte_eal/common/include/rte_pci_dev_ids.h |   8 ++
 15 files changed, 306 insertions(+), 200 deletions(-)

-- 
2.5.0



[dpdk-dev] [PATCH v2 8/8] app/testpmd: check for valid mbuf pool

2016-05-05 Thread Bernard Iremonger
Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device")
Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index f044a91..dad616d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1347,7 +1347,7 @@ start_port(portid_t pid)
if (mp == NULL) {
printf("Failed to setup RX 
queue:"
"No mempool allocation"
-   "on the socket %d\n",
+   " on the socket %d\n",
rxring_numa[pi]);
return -1;
}
@@ -1355,17 +1355,23 @@ start_port(portid_t pid)
diag = rte_eth_rx_queue_setup(pi, qi,
 nb_rxd,rxring_numa[pi],
 &(port->rx_conf),mp);
-   }
-   else
+   } else {
+   struct rte_mempool *mp =
+   mbuf_pool_find(port->socket_id);
+   if (mp == NULL) {
+   printf("Failed to setup RX 
queue:"
+   "No mempool allocation"
+   " on the socket %d\n",
+   port->socket_id);
+   return -1;
+   }
diag = rte_eth_rx_queue_setup(pi, qi,
 nb_rxd,port->socket_id,
-&(port->rx_conf),
-mbuf_pool_find(port->socket_id));
-
+&(port->rx_conf), mp);
+   }
if (diag == 0)
continue;

-
/* Fail to setup rx queue, return */
if (rte_atomic16_cmpset(&(port->port_status),
RTE_PORT_HANDLING,
-- 
2.6.3



[dpdk-dev] [PATCH v2 7/8] app/testpmd: check for valid socket id when attaching port

2016-05-05 Thread Bernard Iremonger
Fixes: edab33b1c01d ("app/testpmd: support port hotplug")
Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e632a5b..f044a91 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1514,6 +1514,7 @@ void
 attach_port(char *identifier)
 {
portid_t pi = 0;
+   unsigned int socket_id;

printf("Attaching a new port...\n");

@@ -1526,7 +1527,11 @@ attach_port(char *identifier)
return;

ports[pi].enabled = 1;
-   reconfig(pi, rte_eth_dev_socket_id(pi));
+   socket_id = (unsigned)rte_eth_dev_socket_id(pi);
+   /* if socket_id is invalid, set to 0 */
+   if (check_socket_id(socket_id) < 0)
+   socket_id = 0;
+   reconfig(pi, socket_id);
rte_eth_promiscuous_enable(pi);

nb_ports = rte_eth_dev_count();
-- 
2.6.3



[dpdk-dev] [PATCH v2 6/8] app/testpmd: move call to init_fwd_streams

2016-05-05 Thread Bernard Iremonger
Move call to init_fwd_streams from start_port function
to start_packet_forwarding function.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e5e50ca..e632a5b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -981,6 +981,12 @@ start_packet_forwarding(int with_tx_first)
printf("Packet forwarding already started\n");
return;
}
+
+   if (init_fwd_streams() < 0) {
+   printf("Fail from init_fwd_streams()\n");
+   return;
+   }
+
if(dcb_test) {
for (i = 0; i < nb_fwd_ports; i++) {
pt_id = fwd_ports_ids[i];
@@ -1271,11 +1277,6 @@ start_port(portid_t pid)
if (port_id_is_invalid(pid, ENABLED_WARN))
return 0;

-   if (init_fwd_streams() < 0) {
-   printf("Fail from init_fwd_streams()\n");
-   return -1;
-   }
-
if(dcb_config)
dcb_test = 1;
FOREACH_PORT(pi, ports) {
-- 
2.6.3



[dpdk-dev] [PATCH v2 5/8] app/testpmd: add function port_is_bonding_slave

2016-05-05 Thread Bernard Iremonger
Use this function in stop_port and close_port functions.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 18 ++
 app/test-pmd/testpmd.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 2c58075..e5e50ca 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1438,6 +1438,11 @@ stop_port(portid_t pid)
continue;
}

+   if (port_is_bonding_slave(pi)) {
+   printf("Please remove port %d from bonded device.\n", 
pi);
+   continue;
+   }
+
port = [pi];
if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED,
RTE_PORT_HANDLING) == 0)
@@ -1476,6 +1481,11 @@ close_port(portid_t pid)
continue;
}

+   if (port_is_bonding_slave(pi)) {
+   printf("Please remove port %d from bonded device.\n", 
pi);
+   continue;
+   }
+
port = [pi];
if (rte_atomic16_cmpset(&(port->port_status),
RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
@@ -1814,6 +1824,14 @@ void clear_port_slave_flag(portid_t slave_pid)
port->slave_flag = 0;
 }

+uint8_t port_is_bonding_slave(portid_t slave_pid)
+{
+   struct rte_port *port;
+
+   port = [slave_pid];
+   return port->slave_flag;
+}
+
 const uint16_t vlan_tags[] = {
0,  1,  2,  3,  4,  5,  6,  7,
8,  9, 10, 11,  12, 13, 14, 15,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index aa4bdac..50f81d7 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -532,6 +532,8 @@ void dev_set_link_down(portid_t pid);
 void init_port_config(void);
 void set_port_slave_flag(portid_t slave_pid);
 void clear_port_slave_flag(portid_t slave_pid);
+uint8_t port_is_bonding_slave(portid_t slave_pid);
+
 int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode,
 enum rte_eth_nb_tcs num_tcs,
 uint8_t pfc_en);
-- 
2.6.3



[dpdk-dev] [PATCH v2 4/8] app/testpmd: reconfigure forwarding after changing portlist

2016-05-05 Thread Bernard Iremonger
Set nb_fwd_ports to zero on quit.
Check portlist has been set before displaying forwarding configuration.

Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
Fixes: af75078fece3 ("first public release")

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/config.c  | 8 ++--
 app/test-pmd/testpmd.c | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f434999..10ac768 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config *cfg)
 void
 fwd_config_display(void)
 {
-   fwd_config_setup();
-   pkt_fwd_config_display(_fwd_config);
+   if (cur_fwd_config.nb_fwd_ports)
+   pkt_fwd_config_display(_fwd_config);
+   else
+   printf("Please set portlist first\n");
 }

 int
@@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, unsigned int 
nb_pt)
   (unsigned int) nb_fwd_ports, nb_pt);
nb_fwd_ports = (portid_t) nb_pt;
}
+
+   fwd_config_setup();
 }

 void
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 11b4cf7..2c58075 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1560,6 +1560,7 @@ pmd_test_exit(void)

if (ports != NULL) {
no_link_check = 1;
+   nb_fwd_ports = 0;
FOREACH_PORT(pt_id, ports) {
printf("\nShutting down port %d...\n", pt_id);
fflush(stdout);
-- 
2.6.3



[dpdk-dev] [PATCH v2 3/8] app/testpmd: check port is not forwarding in stop_port and close_port

2016-05-05 Thread Bernard Iremonger
Add calls to port_is_forwarding function.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc7bba..11b4cf7 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1268,11 +1268,6 @@ start_port(portid_t pid)
struct rte_port *port;
struct ether_addr mac_addr;

-   if (test_done == 0) {
-   printf("Please stop forwarding first\n");
-   return -1;
-   }
-
if (port_id_is_invalid(pid, ENABLED_WARN))
return 0;

@@ -1424,10 +1419,6 @@ stop_port(portid_t pid)
struct rte_port *port;
int need_check_link_status = 0;

-   if (test_done == 0) {
-   printf("Please stop forwarding first\n");
-   return;
-   }
if (dcb_test) {
dcb_test = 0;
dcb_config = 0;
@@ -1442,6 +1433,11 @@ stop_port(portid_t pid)
if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;

+   if (port_is_forwarding(pi) != 0 && test_done == 0) {
+   printf("Please remove port %d from forwarding 
configuration.\n", pi);
+   continue;
+   }
+
port = [pi];
if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED,
RTE_PORT_HANDLING) == 0)
@@ -1466,11 +1462,6 @@ close_port(portid_t pid)
portid_t pi;
struct rte_port *port;

-   if (test_done == 0) {
-   printf("Please stop forwarding first\n");
-   return;
-   }
-
if (port_id_is_invalid(pid, ENABLED_WARN))
return;

@@ -1480,6 +1471,11 @@ close_port(portid_t pid)
if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;

+   if (port_is_forwarding(pi) != 0 && test_done == 0) {
+   printf("Please remove port %d from forwarding 
configuration.\n", pi);
+   continue;
+   }
+
port = [pi];
if (rte_atomic16_cmpset(&(port->port_status),
RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
-- 
2.6.3



[dpdk-dev] [PATCH v2 2/8] app/testpmd: don't update fwding config when attaching/detaching a port

2016-05-05 Thread Bernard Iremonger
Remove checks on test_done variable.
Remove code to update forwarding configuration.

Fixes: edab33b1c01d ("app/testpmd: support port hotplug")

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 28 +---
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 26a174c..5dc7bba 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1506,7 +1506,7 @@ close_port(portid_t pid)
 void
 attach_port(char *identifier)
 {
-   portid_t i, j, pi = 0;
+   portid_t pi = 0;

printf("Attaching a new port...\n");

@@ -1515,11 +1515,6 @@ attach_port(char *identifier)
return;
}

-   if (test_done == 0) {
-   printf("Please stop forwarding first\n");
-   return;
-   }
-
if (rte_eth_dev_attach(identifier, ))
return;

@@ -1529,16 +1524,6 @@ attach_port(char *identifier)

nb_ports = rte_eth_dev_count();

-   /* set_default_fwd_ports_config(); */
-   memset(fwd_ports_ids, 0, sizeof(fwd_ports_ids));
-   i = 0;
-   FOREACH_PORT(j, ports) {
-   fwd_ports_ids[i] = j;
-   i++;
-   }
-   nb_cfg_ports = nb_ports;
-   nb_fwd_ports++;
-
ports[pi].port_status = RTE_PORT_STOPPED;

printf("Port %d is attached. Now total ports is %d\n", pi, nb_ports);
@@ -1548,7 +1533,6 @@ attach_port(char *identifier)
 void
 detach_port(uint8_t port_id)
 {
-   portid_t i, pi = 0;
char name[RTE_ETH_NAME_MAX_LEN];

printf("Detaching a port...\n");
@@ -1564,16 +1548,6 @@ detach_port(uint8_t port_id)
ports[port_id].enabled = 0;
nb_ports = rte_eth_dev_count();

-   /* set_default_fwd_ports_config(); */
-   memset(fwd_ports_ids, 0, sizeof(fwd_ports_ids));
-   i = 0;
-   FOREACH_PORT(pi, ports) {
-   fwd_ports_ids[i] = pi;
-   i++;
-   }
-   nb_cfg_ports = nb_ports;
-   nb_fwd_ports--;
-
printf("Port '%s' is detached. Now total ports is %d\n",
name, nb_ports);
printf("Done\n");
-- 
2.6.3



[dpdk-dev] [PATCH v2 1/8] app/testpmd: add function port_is_forwarding

2016-05-05 Thread Bernard Iremonger
Add function port_is_forwarding to check whether
a port is forwarding or not.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/config.c  | 18 +-
 app/test-pmd/testpmd.h |  3 ++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1c552e4..f434999 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 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
@@ -1565,6 +1565,22 @@ set_fwd_ports_number(uint16_t nb_pt)
   (unsigned int) nb_fwd_ports);
 }

+int
+port_is_forwarding(portid_t port_id)
+{
+   unsigned int i;
+
+   if (port_id_is_invalid(port_id, ENABLED_WARN))
+   return -1;
+
+   for (i = 0; i < nb_fwd_ports; i++) {
+   if (fwd_ports_ids[i] == port_id)
+   return 1;
+   }
+
+   return 0;
+}
+
 void
 set_nb_pkt_per_burst(uint16_t nb)
 {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 0f72ca1..aa4bdac 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -500,6 +500,7 @@ void set_fwd_lcores_number(uint16_t nb_lc);
 void set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt);
 void set_fwd_ports_mask(uint64_t portmask);
 void set_fwd_ports_number(uint16_t nb_pt);
+int port_is_forwarding(portid_t port_id);

 void rx_vlan_strip_set(portid_t port_id, int on);
 void rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on);
-- 
2.6.3



[dpdk-dev] [PATCH v2 0/8] app/testpmd: forwarding

2016-05-05 Thread Bernard Iremonger
Modify testpmd to allow stop, close, detach and attach
of a port without stopping forwarding.

This patchset should not be applied unless the following bonding patchset is 
applied:

0001-bonding-replace-spinlock-with-read-write-lock.patch
0002-bonding-add-read-write-lock-to-rx-tx-burst-functions.patch
0003-bonding-remove-memcopy-of-slaves-from-rx-tx-burst-fu.patch
0004-bonding-add-read-write-lock-to-stop-function.patch
0005-bonding-add-read-write-lock-to-the-link_update-funct.patch

Changes in v2:
Added 4 more patches
  app/testpmd: add function port_is_bonding_slave
  app/testpmd: move call to init_fwd_streams
  app/testpmd: check for valid socket id when attaching port
  app/testpmd: check for valid mbuf pool

Bernard Iremonger (8):
  app/testpmd: add function port_is_forwarding
  app/testpmd: don't update fwding config when attaching/detaching a
port
  app/testpmd: check port is not forwarding in stop_port and close_port
  app/testpmd: reconfigure forwarding after changing portlist
  app/testpmd: add function port_is_bonding_slave
  app/testpmd: move call to init_fwd_streams
  app/testpmd: check for valid socket id when attaching port
  app/testpmd: check for valid mbuf pool

 app/test-pmd/config.c  |  26 ++--
 app/test-pmd/testpmd.c | 109 +
 app/test-pmd/testpmd.h |   5 ++-
 3 files changed, 82 insertions(+), 58 deletions(-)

-- 
2.6.3



[dpdk-dev] [PATCH 5/5] bonding: add read/write lock to the link_update function

2016-05-05 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 6e1cc10..fff6654 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1819,9 +1819,11 @@ bond_ethdev_link_update(struct rte_eth_dev 
*bonded_eth_dev,
 {
struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;

+   rte_rwlock_read_lock(>rwlock);
if (!bonded_eth_dev->data->dev_started ||
internals->active_slave_count == 0) {
bonded_eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
+   rte_rwlock_read_unlock(>rwlock);
return 0;
} else {
struct rte_eth_dev *slave_eth_dev;
@@ -1840,7 +1842,7 @@ bond_ethdev_link_update(struct rte_eth_dev 
*bonded_eth_dev,

bonded_eth_dev->data->dev_link.link_status = link_up;
}
-
+   rte_rwlock_read_unlock(>rwlock);
return 0;
 }

-- 
2.6.3



[dpdk-dev] [PATCH 4/5] bonding: add read/write lock to stop function

2016-05-05 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index c33a860..6e1cc10 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1623,6 +1623,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)

bond_mode_8023ad_stop(eth_dev);

+   rte_rwlock_read_lock(>rwlock);
/* Discard all messages to/from mode 4 state machines */
for (i = 0; i < internals->active_slave_count; i++) {
port = _8023ad_ports[internals->active_slaves[i]];
@@ -1635,15 +1636,20 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
while (rte_ring_dequeue(port->tx_ring, ) != -ENOENT)
rte_pktmbuf_free(pkt);
}
+   rte_rwlock_read_unlock(>rwlock);
}

if (internals->mode == BONDING_MODE_TLB ||
internals->mode == BONDING_MODE_ALB) {
bond_tlb_disable(internals);
+
+   rte_rwlock_read_lock(>rwlock);
for (i = 0; i < internals->active_slave_count; i++)
tlb_last_obytets[internals->active_slaves[i]] = 0;
+   rte_rwlock_read_unlock(>rwlock);
}

+   rte_rwlock_write_lock(>rwlock);
internals->active_slave_count = 0;
internals->link_status_polling_enabled = 0;
for (i = 0; i < internals->slave_count; i++)
@@ -1651,6 +1657,7 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)

eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
eth_dev->data->dev_started = 0;
+   rte_rwlock_write_unlock(>rwlock);
 }

 void
-- 
2.6.3



[dpdk-dev] [PATCH 3/5] bonding: remove memcopy of slaves from rx/tx burst function

2016-05-05 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 41 +-
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index c3e772c..c33a860 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -142,19 +142,11 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,

const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
uint16_t num_rx_total = 0;  /* Total number of received packets */
-   uint8_t slaves[RTE_MAX_ETHPORTS];
-   uint8_t slave_count;
-
uint8_t collecting;  /* current slave collecting status */
const uint8_t promisc = internals->promiscuous_en;
uint8_t i, j, k;

rte_eth_macaddr_get(internals->port_id, _mac);
-   /* Copy slave list to protect against slave up/down changes during tx
-* bursting */
-   slave_count = internals->active_slave_count;
-   memcpy(slaves, internals->active_slaves,
-   sizeof(internals->active_slaves[0]) * slave_count);

rte_rwlock_read_lock(>rwlock);
for (i = 0; i < internals->active_slave_count && num_rx_total < nb_pkts;
@@ -409,10 +401,7 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,

struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts];
uint16_t slave_nb_pkts[RTE_MAX_ETHPORTS] = { 0 };
-
uint8_t num_of_slaves;
-   uint8_t slaves[RTE_MAX_ETHPORTS];
-
uint16_t num_tx_total = 0, num_tx_slave;

static int slave_idx = 0;
@@ -421,12 +410,8 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,
bd_tx_q = (struct bond_tx_queue *)queue;
internals = bd_tx_q->dev_private;

-   /* Copy slave list to protect against slave up/down changes during tx
-* bursting */
rte_rwlock_read_lock(>rwlock);
num_of_slaves = internals->active_slave_count;
-   memcpy(slaves, internals->active_slaves,
-   sizeof(internals->active_slaves[0]) * num_of_slaves);
if (num_of_slaves < 1) {
rte_rwlock_read_unlock(>rwlock);
return num_tx_total;
@@ -722,7 +707,6 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf 
**bufs, uint16_t nb_pkts)
uint16_t num_tx_total = 0;
uint8_t i, j;
uint8_t num_of_slaves;
-   uint8_t slaves[RTE_MAX_ETHPORTS];

struct ether_hdr *ether_hdr;
struct ether_addr primary_slave_addr;
@@ -735,10 +719,6 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf 
**bufs, uint16_t nb_pkts)
return num_tx_total;
}

-   memcpy(slaves, internals->tlb_slaves_order,
-   sizeof(internals->tlb_slaves_order[0]) * 
num_of_slaves);
-
-
ether_addr_copy(primary_port->data->mac_addrs, _slave_addr);

if (nb_pkts > 3) {
@@ -941,8 +921,6 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf 
**bufs,
struct bond_tx_queue *bd_tx_q;

uint8_t num_of_slaves;
-   uint8_t slaves[RTE_MAX_ETHPORTS];
-
uint16_t num_tx_total = 0, num_tx_slave = 0, tx_fail_total = 0;

int i, op_slave_id;
@@ -953,14 +931,8 @@ bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf 
**bufs,
bd_tx_q = (struct bond_tx_queue *)queue;
internals = bd_tx_q->dev_private;

-   /* Copy slave list to protect against slave up/down changes during tx
-* bursting */
rte_rwlock_read_lock(>rwlock);
num_of_slaves = internals->active_slave_count;
-
-   memcpy(slaves, internals->active_slaves,
-   sizeof(internals->active_slaves[0]) * num_of_slaves);
-
if (num_of_slaves < 1) {
rte_rwlock_read_unlock(>rwlock);
return num_tx_total;
@@ -1009,7 +981,7 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
struct bond_tx_queue *bd_tx_q;

uint8_t num_of_slaves;
-   uint8_t slaves[RTE_MAX_ETHPORTS];
+
 /* positions in slaves, not ID */
uint8_t distributing_offsets[RTE_MAX_ETHPORTS];
uint8_t distributing_count;
@@ -1030,8 +1002,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
bd_tx_q = (struct bond_tx_queue *)queue;
internals = bd_tx_q->dev_private;

-   /* Copy slave list to protect against slave up/down changes during tx
-* bursting */
rte_rwlock_read_lock(>rwlock);
num_of_slaves = internals->active_slave_count;
if (num_of_slaves < 1) {
@@ -1039,8 +1009,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
return num_tx_total;
}

-   memcpy(slaves, internals->active_slaves, sizeof(slaves[0]) * 
num_of_slaves);
-
distributing_count = 0;
for (i = 0; i < num_of_slaves; i++) {
  

[dpdk-dev] [PATCH 2/5] bonding: add read/write lock to rx/tx burst functions

2016-05-05 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 112 +
 1 file changed, 85 insertions(+), 27 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index ed6245b..c3e772c 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -92,7 +92,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)

internals = bd_rx_q->dev_private;

-
+   rte_rwlock_read_lock(>rwlock);
for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
/* Offset of pointer to *bufs increases as packets are received
 * from other slaves */
@@ -103,6 +103,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
nb_pkts -= num_rx_slave;
}
}
+   rte_rwlock_read_unlock(>rwlock);

return num_rx_total;
 }
@@ -112,14 +113,20 @@ bond_ethdev_rx_burst_active_backup(void *queue, struct 
rte_mbuf **bufs,
uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
+   uint16_t num_rx_total;

/* Cast to structure, containing bonded device's port id and queue id */
struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;

internals = bd_rx_q->dev_private;
+   rte_rwlock_read_lock(>rwlock);
+
+   num_rx_total = rte_eth_rx_burst(internals->current_primary_port,
+   bd_rx_q->queue_id, bufs, nb_pkts);

-   return rte_eth_rx_burst(internals->current_primary_port,
-   bd_rx_q->queue_id, bufs, nb_pkts);
+   rte_rwlock_read_unlock(>rwlock);
+
+   return num_rx_total;
 }

 static uint16_t
@@ -149,12 +156,17 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
memcpy(slaves, internals->active_slaves,
sizeof(internals->active_slaves[0]) * slave_count);

-   for (i = 0; i < slave_count && num_rx_total < nb_pkts; i++) {
+   rte_rwlock_read_lock(>rwlock);
+   for (i = 0; i < internals->active_slave_count && num_rx_total < nb_pkts;
+i++) {
j = num_rx_total;
-   collecting = ACTOR_STATE(_8023ad_ports[slaves[i]], 
COLLECTING);
+   collecting = ACTOR_STATE(
+   _8023ad_ports[internals->active_slaves[i]],
+   COLLECTING);

/* Read packets from this slave */
-   num_rx_total += rte_eth_rx_burst(slaves[i], bd_rx_q->queue_id,
+   num_rx_total += rte_eth_rx_burst(internals->active_slaves[i],
+   bd_rx_q->queue_id,
[num_rx_total], nb_pkts - num_rx_total);

for (k = j; k < 2 && k < num_rx_total; k++)
@@ -175,7 +187,9 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
!is_same_ether_addr(_mac, 
>d_addr {

if (hdr->ether_type == ether_type_slow_be) {
-   
bond_mode_8023ad_handle_slow_pkt(internals, slaves[i],
+   bond_mode_8023ad_handle_slow_pkt(
+   internals,
+   internals->active_slaves[i],
bufs[j]);
} else
rte_pktmbuf_free(bufs[j]);
@@ -190,6 +204,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf 
**bufs,
j++;
}
}
+   rte_rwlock_read_unlock(>rwlock);

return num_rx_total;
 }
@@ -408,12 +423,14 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,

/* Copy slave list to protect against slave up/down changes during tx
 * bursting */
+   rte_rwlock_read_lock(>rwlock);
num_of_slaves = internals->active_slave_count;
memcpy(slaves, internals->active_slaves,
sizeof(internals->active_slaves[0]) * num_of_slaves);
-
-   if (num_of_slaves < 1)
+   if (num_of_slaves < 1) {
+   rte_rwlock_read_unlock(>rwlock);
return num_tx_total;
+   }

/* Populate slaves mbuf with which packets are to be sent on it  */
for (i = 0; i < nb_pkts; i++) {
@@ -428,8 +445,10 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,
/* Send packet burst on each slave device */
for (i = 0; i < num_of_slaves; i++) {
if (slave_nb_pkts[i] > 0) {
-   num_tx_slave = rte_eth_tx_burst(slaves[i], 
bd_tx_q->queue_id,
-   slave_bufs[i], slave_nb_pkts[i]);
+   num_tx_slave = 

[dpdk-dev] [PATCH 1/5] bonding: replace spinlock with read/write lock

2016-05-05 Thread Bernard Iremonger
Fixes: a45b288ef21a ("bond: support link status polling")
Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_api.c | 10 +++---
 drivers/net/bonding/rte_eth_bond_pmd.c | 57 +++---
 drivers/net/bonding/rte_eth_bond_private.h |  6 ++--
 3 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c 
b/drivers/net/bonding/rte_eth_bond_api.c
index d3bda35..c77626d 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -227,7 +227,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t 
socket_id)
eth_dev->data->drv_name = pmd_bond_driver_name;
eth_dev->data->numa_node =  socket_id;

-   rte_spinlock_init(>lock);
+   rte_rwlock_init(>rwlock);

internals->port_id = eth_dev->data->port_id;
internals->mode = BONDING_MODE_INVALID;
@@ -451,11 +451,11 @@ rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t 
slave_port_id)
bonded_eth_dev = _eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;

-   rte_spinlock_lock(>lock);
+   rte_rwlock_write_lock(>rwlock);

retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id);

-   rte_spinlock_unlock(>lock);
+   rte_rwlock_write_unlock(>rwlock);

return retval;
 }
@@ -553,11 +553,11 @@ rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t 
slave_port_id)
bonded_eth_dev = _eth_devices[bonded_port_id];
internals = bonded_eth_dev->data->dev_private;

-   rte_spinlock_lock(>lock);
+   rte_rwlock_write_lock(>rwlock);

retval = __eth_bond_slave_remove_lock_free(bonded_port_id, 
slave_port_id);

-   rte_spinlock_unlock(>lock);
+   rte_rwlock_write_unlock(>rwlock);

return retval;
 }
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 129f04b..ed6245b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.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
@@ -1750,37 +1750,36 @@ bond_ethdev_slave_link_status_change_monitor(void 
*cb_arg)
!internals->link_status_polling_enabled)
return;

-   /* If device is currently being configured then don't check slaves link
-* status, wait until next period */
-   if (rte_spinlock_trylock(>lock)) {
-   if (internals->slave_count > 0)
-   polling_slave_found = 0;
+   rte_rwlock_read_lock(>rwlock);
+   if (internals->slave_count > 0)
+   polling_slave_found = 0;

-   for (i = 0; i < internals->slave_count; i++) {
-   if (!internals->slaves[i].link_status_poll_enabled)
-   continue;
-
-   slave_ethdev = 
_eth_devices[internals->slaves[i].port_id];
-   polling_slave_found = 1;
-
-   /* Update slave link status */
-   (*slave_ethdev->dev_ops->link_update)(slave_ethdev,
-   
internals->slaves[i].link_status_wait_to_complete);
-
-   /* if link status has changed since last checked then 
call lsc
-* event callback */
-   if (slave_ethdev->data->dev_link.link_status !=
-   internals->slaves[i].last_link_status) {
-   internals->slaves[i].last_link_status =
-   
slave_ethdev->data->dev_link.link_status;
-
-   
bond_ethdev_lsc_event_callback(internals->slaves[i].port_id,
-   RTE_ETH_EVENT_INTR_LSC,
-   _ethdev->data->port_id);
-   }
+   for (i = 0; i < internals->slave_count; i++) {
+   if (!internals->slaves[i].link_status_poll_enabled)
+   continue;
+
+   slave_ethdev = _eth_devices[internals->slaves[i].port_id];
+   polling_slave_found = 1;
+
+   /* Update slave link status */
+   (*slave_ethdev->dev_ops->link_update)(slave_ethdev,
+   internals->slaves[i].link_status_wait_to_complete);
+
+   /* if link status has changed since last checked then call lsc
+* event callback
+*/
+   if (slave_ethdev->data->dev_link.link_status !=
+   internals->slaves[i].last_link_status) {
+   internals->slaves[i].last_link_status =
+   

[dpdk-dev] [PATCH 0/5] bonding: locks

2016-05-05 Thread Bernard Iremonger
Replace spinlock with read/write lock.
Add read/write locks where needed to protect
active_slave_count and active_slaves[].
With read/write locks in place remove memcpy of slaves.

Bernard Iremonger (5):
  bonding: replace spinlock with read/write lock
  bonding: add read/write lock to rx/tx burst functions
  bonding: remove memcopy of slaves from rx/tx burst function
  bonding: add read/write lock to stop function
  bonding: add read/write lock to the link_update function

 drivers/net/bonding/rte_eth_bond_api.c |  10 +-
 drivers/net/bonding/rte_eth_bond_pmd.c | 219 -
 drivers/net/bonding/rte_eth_bond_private.h |   6 +-
 3 files changed, 131 insertions(+), 104 deletions(-)

-- 
2.6.3



[dpdk-dev] [PATCH 2/2] app/test: add aes-ni multi-buffer pmd test cases for AES CTR

2016-05-05 Thread Fan Zhang
Added tests cases for AES-NI MB PMD working in counter mode.

Signed-off-by: Fan Zhang 
---
 app/test/test_cryptodev.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 03d6f02..45e6daa 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -4649,6 +4649,19 @@ static struct unit_test_suite 
cryptodev_aesni_mb_testsuite  = {
test_AES_CBC_HMAC_SHA1_encrypt_digest_sessionless),

TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_encrypt_digest_case_1),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_encrypt_digest_case_2),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_encrypt_digest_case_3),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_digest_verify_decrypt_case_1),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_digest_verify_decrypt_case_2),
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_CTR_digest_verify_decrypt_case_3),
+
+   TEST_CASE_ST(ut_setup, ut_teardown,
test_not_in_place_crypto),

TEST_CASES_END() /**< NULL terminate unit test array */
-- 
2.5.5



[dpdk-dev] [PATCH 1/2] aesni_mb: add counter mode support

2016-05-05 Thread Fan Zhang
This patch provides counter mode support to AES-NI multi-buffer library.

The following cipher algorithm is enabled:
- RTE_CRYPTO_CIPHER_AES_CTR

Signed-off-by: Fan Zhang 
---
 doc/guides/cryptodevs/aesni_mb.rst |  3 +++
 doc/guides/cryptodevs/overview.rst |  6 +++---
 doc/guides/rel_notes/release_16_07.rst |  5 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  3 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 20 
 5 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/doc/guides/cryptodevs/aesni_mb.rst 
b/doc/guides/cryptodevs/aesni_mb.rst
index fd5414d..60a8914 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -48,6 +48,9 @@ Cipher algorithms:
 * RTE_CRYPTO_SYM_CIPHER_AES128_CBC
 * RTE_CRYPTO_SYM_CIPHER_AES192_CBC
 * RTE_CRYPTO_SYM_CIPHER_AES256_CBC
+* RTE_CRYPTO_SYM_CIPHER_AES128_CTR
+* RTE_CRYPTO_SYM_CIPHER_AES192_CTR
+* RTE_CRYPTO_SYM_CIPHER_AES256_CTR

 Hash algorithms:

diff --git a/doc/guides/cryptodevs/overview.rst 
b/doc/guides/cryptodevs/overview.rst
index e1f33e1..4a84146 100644
--- a/doc/guides/cryptodevs/overview.rst
+++ b/doc/guides/cryptodevs/overview.rst
@@ -55,9 +55,9 @@ Supported Cipher Algorithms
"AES_CBC_128",x,,x,,
"AES_CBC_192",x,,x,,
"AES_CBC_256",x,,x,,
-   "AES_CTR_128",x
-   "AES_CTR_192",x
-   "AES_CTR_256",x
+   "AES_CTR_128",x,,x,,
+   "AES_CTR_192",x,,x,,
+   "AES_CTR_256",x,,x,,
"SNOW3G_UEA2",xx

 Supported Authentication Algorithms
diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 84e61c0..4600e81 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -34,6 +34,11 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

+* **Added AES-CTR support to AESNI MB PMD.**
+
+  Now AESNI MB PMD supports 128/192/256-bit counter mode AES encryption and
+  decryption.
+
 * **Added support of AES counter mode for Intel QuickAssist devices.**

   Enabled support for the AES CTR algorithm for IntelQuick Assist devices.
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index 3415ac1..ce763bf 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -222,6 +222,9 @@ aesni_mb_set_session_cipher_parameters(const struct 
aesni_mb_ops *mb_ops,
case RTE_CRYPTO_CIPHER_AES_CBC:
sess->cipher.mode = CBC;
break;
+   case RTE_CRYPTO_CIPHER_AES_CTR:
+   sess->cipher.mode = CNTR;
+   break;
default:
MB_LOG_ERR("Unsupported cipher mode parameter");
return -1;
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 3806a66..d3c46ac 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -207,6 +207,26 @@ static const struct rte_cryptodev_capabilities 
aesni_mb_pmd_capabilities[] = {
}, }
}, }
},
+   {   /* AES CTR */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   {.sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+   {.cipher = {
+   .algo = RTE_CRYPTO_CIPHER_AES_CTR,
+   .block_size = 16,
+   .key_size = {
+   .min = 16,
+   .max = 32,
+   .increment = 8
+   },
+   .iv_size = {
+   .min = 16,
+   .max = 16,
+   .increment = 0
+   }
+   }, }
+   }, }
+   },
RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };

-- 
2.5.5



[dpdk-dev] [PATCH 0/2] Add AES Counter mode support for AES-NI MB PMD

2016-05-05 Thread Fan Zhang
This patchset adds counter mode support to AES-NI multi-buffer library
and appropriate test cases. 

This patchset depends on "doc: fix supported AES-CBC key lengths"
(http://dpdk.org/ml/archives/dev/2016-May/038358.html)
and "Added AES counter mode capability"
(http://dpdk.org/ml/archives/dev/2016-May/038364.html)

Fan Zhang (2):
  aesni_mb: add counter mode support
  app/test: add aes-ni multi-buffer pmd test cases for AES CTR

 app/test/test_cryptodev.c  | 13 +
 doc/guides/cryptodevs/aesni_mb.rst |  3 +++
 doc/guides/cryptodevs/overview.rst |  6 +++---
 doc/guides/rel_notes/release_16_07.rst |  5 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  3 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 20 
 6 files changed, 47 insertions(+), 3 deletions(-)

-- 
2.5.5



[dpdk-dev] [PATCH 2/2] app/test: add test cases for AES CTR

2016-05-05 Thread Arek Kusztal
Added tests cases for AES working in counter mode

Signed-off-by: Arek Kusztal 
---
 app/test/test_cryptodev.c  | 254 
 app/test/test_cryptodev_aes_ctr_test_vectors.h | 257 +
 2 files changed, 511 insertions(+)
 create mode 100644 app/test/test_cryptodev_aes_ctr_test_vectors.h

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 8e8da98..03d6f02 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -42,6 +42,8 @@

 #include "test.h"
 #include "test_cryptodev.h"
+
+#include "test_cryptodev_aes_ctr_test_vectors.h"
 #include "test_cryptodev_snow3g_test_vectors.h"
 #include "test_cryptodev_snow3g_hash_test_vectors.h"
 #include "test_cryptodev_gcm_test_vectors.h"
@@ -1358,6 +1360,245 @@ test_AES_CBC_HMAC_SHA1_decrypt_digest_verify(void)
return TEST_SUCCESS;
 }

+/*  AES counter mode tests  */
+
+static int
+test_AES_CTR_encrypt_digest(const struct aes_ctr_test_data *tdata)
+{
+   struct crypto_testsuite_params *ts_params = _params;
+   struct crypto_unittest_params *ut_params = _params;
+   struct rte_crypto_sym_op *sym_op;
+
+   uint8_t hash_key[tdata->auth_key.len];
+   uint8_t cipher_key[tdata->key.len];
+
+   ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
+   (const char *)tdata->plaintext.data,
+   tdata->plaintext.len, 0);
+
+   /* Setup Cipher Parameters */
+   ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+   ut_params->cipher_xform.next = _params->auth_xform;
+
+   ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CTR;
+   ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+
+   rte_memcpy(cipher_key, tdata->key.data, tdata->key.len);
+   ut_params->cipher_xform.cipher.key.data = cipher_key;
+   ut_params->cipher_xform.cipher.key.length =
+   tdata->key.len;
+
+   /* Setup HMAC Parameters */
+   ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+   ut_params->auth_xform.next = NULL;
+
+   ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+   ut_params->auth_xform.auth.algo = tdata->auth_key.algo;
+   ut_params->auth_xform.auth.key.length =
+   tdata->auth_key.len;
+   rte_memcpy(hash_key, tdata->auth_key.data, tdata->auth_key.len);
+   ut_params->auth_xform.auth.key.data = hash_key;
+   ut_params->auth_xform.auth.digest_length = tdata->digest.len;
+
+   /* Create Crypto session*/
+   ut_params->sess = rte_cryptodev_sym_session_create(
+   ts_params->valid_devs[0],
+   _params->cipher_xform);
+   TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+
+   /* Generate Crypto op data structure */
+   ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+   TEST_ASSERT_NOT_NULL(ut_params->op,
+   "Failed to allocate symmetric crypto operation struct");
+
+   rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
+
+   sym_op = ut_params->op->sym;
+
+   /* set crypto operation source mbuf */
+   sym_op->m_src = ut_params->ibuf;
+
+   /* Set operation cipher parameters */
+   sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
+   sym_op->m_src, tdata->iv.len);
+   sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(sym_op->m_src);
+   sym_op->cipher.iv.length = tdata->iv.len;
+
+   rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data,
+   tdata->iv.len);
+
+   sym_op->cipher.data.offset = tdata->iv.len;
+   sym_op->cipher.data.length = tdata->plaintext.len;
+
+   /* Set operation authentication parameters */
+   sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+   sym_op->m_src, tdata->digest.len);
+   sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+   sym_op->m_src,
+   tdata->iv.len + tdata->ciphertext.len);
+   sym_op->auth.digest.length = tdata->digest.len;
+
+   memset(sym_op->auth.digest.data, 0, tdata->digest.len);
+
+   sym_op->auth.data.offset = tdata->iv.len;
+   sym_op->auth.data.length = tdata->plaintext.len;
+
+   /* Process crypto operation */
+   ut_params->op = process_crypto_request(ts_params->valid_devs[0],
+   ut_params->op);
+
+   TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
+   "crypto op processing failed");
+
+   uint8_t *ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src,
+   uint8_t *, tdata->iv.len);
+
+   TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext,
+   tdata->ciphertext.data,
+   tdata->ciphertext.len,
+  

[dpdk-dev] [PATCH 1/2] qat: add AES counter mode capability

2016-05-05 Thread Arek Kusztal
Added possibility for AES to work in counter mode

Signed-off-by: Arek Kusztal 
---
 doc/guides/cryptodevs/overview.rst |  6 +++---
 doc/guides/cryptodevs/qat.rst  |  3 +++
 doc/guides/rel_notes/release_16_07.rst |  5 +
 drivers/crypto/qat/qat_crypto.c| 29 -
 4 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/doc/guides/cryptodevs/overview.rst 
b/doc/guides/cryptodevs/overview.rst
index 9f9af43..e1f33e1 100644
--- a/doc/guides/cryptodevs/overview.rst
+++ b/doc/guides/cryptodevs/overview.rst
@@ -55,9 +55,9 @@ Supported Cipher Algorithms
"AES_CBC_128",x,,x,,
"AES_CBC_192",x,,x,,
"AES_CBC_256",x,,x,,
-   "AES_CTR_128",
-   "AES_CTR_192",
-   "AES_CTR_256",
+   "AES_CTR_128",x
+   "AES_CTR_192",x
+   "AES_CTR_256",x
"SNOW3G_UEA2",xx

 Supported Authentication Algorithms
diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 4b8f782..cae1958 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -44,6 +44,9 @@ Cipher algorithms:
 * ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC``
+* ``RTE_CRYPTO_SYM_CIPHER_AES128_CTR``
+* ``RTE_CRYPTO_SYM_CIPHER_AES192_CTR``
+* ``RTE_CRYPTO_SYM_CIPHER_AES256_CTR``
 * ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2``
 * ``RTE_CRYPTO_CIPHER_AES_GCM``

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 001888f..1d90a5a 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -34,6 +34,11 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

+* **Added support of AES counter mode for Intel QuickAssist devices.**
+
+  Enabled support for the AES CTR algorithm for Intel QuickAssist devices.
+  Provided support for algorithm-chaining operations.
+

 Resolved Issues
 ---
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 495ea1c..858f632 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -263,6 +263,26 @@ static const struct rte_cryptodev_capabilities 
qat_pmd_capabilities[] = {
}, }
}, }
},
+   {   /* AES CTR */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   {.sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+   {.cipher = {
+   .algo = RTE_CRYPTO_CIPHER_AES_CTR,
+   .block_size = 16,
+   .key_size = {
+   .min = 16,
+   .max = 32,
+   .increment = 8
+   },
+   .iv_size = {
+   .min = 16,
+   .max = 16,
+   .increment = 0
+   }
+   }, }
+   }, }
+   },
RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };

@@ -368,6 +388,14 @@ qat_crypto_sym_configure_session_cipher(struct 
rte_cryptodev *dev,
}
session->qat_mode = ICP_QAT_HW_CIPHER_CTR_MODE;
break;
+   case RTE_CRYPTO_CIPHER_AES_CTR:
+   if (qat_alg_validate_aes_key(cipher_xform->key.length,
+   >qat_cipher_alg) != 0) {
+   PMD_DRV_LOG(ERR, "Invalid AES cipher key size");
+   goto error_out;
+   }
+   session->qat_mode = ICP_QAT_HW_CIPHER_CTR_MODE;
+   break;
case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
if (qat_alg_validate_snow3g_key(cipher_xform->key.length,
>qat_cipher_alg) != 0) {
@@ -380,7 +408,6 @@ qat_crypto_sym_configure_session_cipher(struct 
rte_cryptodev *dev,
case RTE_CRYPTO_CIPHER_3DES_ECB:
case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_ECB:
-   case RTE_CRYPTO_CIPHER_AES_CTR:
case RTE_CRYPTO_CIPHER_AES_CCM:
case RTE_CRYPTO_CIPHER_KASUMI_F8:
PMD_DRV_LOG(ERR, "Crypto: Unsupported Cipher alg %u",
-- 
2.1.0



[dpdk-dev] [PATCH 0/2] Added AES counter mode capability

2016-05-05 Thread Arek Kusztal
This patchset adds AES counter mode capability for Intel QuickAssist Technology 
crypto driver.
It adds six test cases for 16B, 24B, 32B key size.

Arek Kusztal (2):
  qat: add AES counter mode capability
  app/test: add test cases for AES CTR

 app/test/test_cryptodev.c  | 254 
 app/test/test_cryptodev_aes_ctr_test_vectors.h | 257 +
 doc/guides/cryptodevs/overview.rst |   6 +-
 doc/guides/cryptodevs/qat.rst  |   3 +
 doc/guides/rel_notes/release_16_07.rst |   5 +
 drivers/crypto/qat/qat_crypto.c|  29 ++-
 6 files changed, 550 insertions(+), 4 deletions(-)
 create mode 100644 app/test/test_cryptodev_aes_ctr_test_vectors.h

-- 
2.1.0



[dpdk-dev] [RFC 4/4] app/test: support resources archived by tar

2016-05-05 Thread Bruce Richardson
On Fri, Apr 29, 2016 at 03:11:36PM +0200, Jan Viktorin wrote:
> When needing a more complex resource (a file hierarchy), packing every single
> file as a single resource would be very ineffective. For that purpose, it is
> possible to pack the files into a tar archive, extract it before test from the
> resource and finally clean up all the created files.
> 
> This patch introduces functions resource_untar and resource_rm_by_tar to
> perform those tasks. An example of using those functions is included as a 
> test.
> 
> Signed-off-by: Jan Viktorin 
We might want to make this configurable on/off at build time, since it adds a 
new
dependency for building dpdk - libarchive-devel.

/Bruce


[dpdk-dev] [RFC 0/4] Include resources in tests

2016-05-05 Thread Bruce Richardson
On Fri, Apr 29, 2016 at 03:11:32PM +0200, Jan Viktorin wrote:
> Hello,
> 
> this patch set introduces a mechanism to include a resource (in general a 
> blob)
> into the test binary. This allows to make tests less dependent on the target
> testing environment. The first use case is testing of PCI bus scan by changing
> the hard-coded path (/sys/bus/pci/devices) to something different and provide
> a fake tree of devices with the test. It can help with testing of device-tree
> parsing as I've proposed in [1] where such mechanism was missing at that time.
> I'd like to use such framework for the SoC infra testing as well.
> 
> The patch set introduces a struct resource into the app/test. The resource is
> generic to include any kind of binary data. The binary data can be created in
> C or linked as an object file (created by objcopy). I am not sure where to
> place the objcopy logic and how to perform guessing of the objcopy arguments
> as they are pretty non-standard.
> 
> To include a complex resource (a file hierarchy), the last patch implements
> an archive extraction logic. So, it is possible to include a tar archive and
> unpack it before a test starts. Any ideas how to do this in a better way are
> welcome.
> 
> [1] http://comments.gmane.org/gmane.comp.networking.dpdk.devel/36545
> 
> Regards
> Jan Viktorin
> 
BTW: It looks like your patch has a dependency on the 17-patch dev cleanup set 
from
David, [and now on the header include bug fix I submitted yesterday too], so
you should probably note that in any future revs of the patch you do. Save
some head-scratching from those of us testing it out. :-)

Thanks,
/Bruce



[dpdk-dev] [PATCH 1/2] mempool: add stack (fifo) mempool handler

2016-05-05 Thread Stephen Hemminger
Overall, this is ok, but why can't it be the default?
Lots of little things should be cleaned up


> +struct rte_mempool_common_stack
> +{
> + /* Spinlock to protect access */
> + rte_spinlock_t sl;
> +
> + uint32_t size;
> + uint32_t len;
> + void *objs[];
> +
> +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
> +#endif

Useless remove it

> +};
> +
> +static void *
> +common_stack_alloc(struct rte_mempool *mp)
> +{
> + struct rte_mempool_common_stack *s;
> + char stack_name[RTE_RING_NAMESIZE];
> + unsigned n = mp->size;
> + int size = sizeof(*s) + (n+16)*sizeof(void*);
> +
> + /* Allocate our local memory structure */
> + snprintf(stack_name, sizeof(stack_name), "%s-common-stack", mp->name);
> + s = rte_zmalloc_socket(stack_name,
The name for zmalloc is ignored in current code, why bother making it unique.

> + size,
> + RTE_CACHE_LINE_SIZE,
> + mp->socket_id);
> + if (s == NULL) {
> + RTE_LOG(ERR, MEMPOOL, "Cannot allocate stack!\n");
> + return NULL;
> + }
> +
> + /* And the spinlock we use to protect access */
> + rte_spinlock_init(>sl);
> +
> + s->size = n;
> + mp->pool = (void *) s;
Since pool is void *, no need for a cast here

> + rte_mempool_set_handler(mp, "stack");
> +
> + return (void *) s;
> +}
> +
> +static int common_stack_put(void *p, void * const *obj_table,
> + unsigned n)
> +{
> + struct rte_mempool_common_stack * s = (struct rte_mempool_common_stack 
> *)p;
> + void **cache_objs;
> + unsigned index;
> +
> + /* Acquire lock */
Useless obvious comment, about as good a classic /* Add one to i */
>
> +static int common_stack_get(void *p, void **obj_table,
> + unsigned n)
> +{
> + struct rte_mempool_common_stack * s = (struct rte_mempool_common_stack 
> *)p;

Unnecessary cast, in C void * can be assigned to any type.

> + void **cache_objs;
> + unsigned index, len;
> +
> + /* Acquire lock */
Yet another useless comment.

> + rte_spinlock_lock(>sl);
> +
> + if(unlikely(n > s->len)) {
> + rte_spinlock_unlock(>sl);
> + return -ENOENT;
> + }
> +
> + cache_objs = s->objs;
> +
> + for (index = 0, len = s->len - 1; index < n; ++index, len--, 
> obj_table++)
> + *obj_table = cache_objs[len];
> +
> + s->len -= n;
> + rte_spinlock_unlock(>sl);
> + return n;
> +}
> +
> +static unsigned common_stack_get_count(void *p)
> +{
> + struct rte_mempool_common_stack * s = (struct rte_mempool_common_stack 
> *)p;

Another useless cast.

> + return s->len;
> +}
> +
> +static void
> +common_stack_free(void *p)
> +{
> + rte_free((struct rte_mempool_common_stack *)p);
Yet another useless cast

> +}
> +
> +static struct rte_mempool_handler handler_stack = {
For security, any data structure with function pointers should be const.

> + .name = "stack",
> + .alloc = common_stack_alloc,
> + .free = common_stack_free,
> + .put = common_stack_put,
> + .get = common_stack_get,
> + .get_count = common_stack_get_count
> +};
> +
> +MEMPOOL_REGISTER_HANDLER(handler_stack);



[dpdk-dev] [PATCH] i40evf: fix return value if command fails

2016-05-05 Thread Jingjing Wu
Previously, if message is sent successfully, but no response is
received, function "i40evf_execute_vf_cmd" will return without error.
The root cause is value "err" is overwritten. This patch fixes it.

Fixes: ae19955e7c86 ("i40evf: support reporting PF reset")
Signed-off-by: Jingjing Wu 
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
b/drivers/net/i40e/i40e_ethdev_vf.c
index 2bce69b..9380019 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -327,8 +327,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct 
vf_cmd_info *args)
struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct i40evf_arq_msg_info info;
enum i40evf_aq_result ret;
-   int err = -1;
-   int i = 0;
+   int err, i = 0;

if (_atomic_set_cmd(vf, args->ops))
return -1;
@@ -346,6 +345,7 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct 
vf_cmd_info *args)
return err;
}

+   err = -1;
switch (args->ops) {
case I40E_VIRTCHNL_OP_RESET_VF:
/*no need to process in this function */
@@ -358,10 +358,8 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct 
vf_cmd_info *args)
if (ret == I40EVF_MSG_CMD) {
err = 0;
break;
-   } else if (ret == I40EVF_MSG_ERR) {
-   err = -1;
+   } else if (ret == I40EVF_MSG_ERR)
break;
-   }
rte_delay_ms(ASQ_DELAY_MS);
/* If don't read msg or read sys event, continue */
} while (i++ < MAX_TRY_TIMES);
-- 
2.4.0



[dpdk-dev] [PATCH] eal: add missing include to debug header

2016-05-05 Thread Bruce Richardson
On Wed, May 04, 2016 at 05:37:56PM +0100, Bruce Richardson wrote:
> The header file rte_debug.h makes use of the "unlikely" macro which
> means it should include the rte_branch_prediction.h header file.
> 
> Fixes: 50705e8e3cdd ("eal: add assert macro for debug")
> 
> Signed-off-by: Bruce Richardson 
> ---
>  lib/librte_eal/common/include/rte_debug.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/common/include/rte_debug.h 
> b/lib/librte_eal/common/include/rte_debug.h
> index 9260eda..cab6fb4 100644
> --- a/lib/librte_eal/common/include/rte_debug.h
> +++ b/lib/librte_eal/common/include/rte_debug.h
> @@ -44,6 +44,7 @@
>   */
>  
>  #include "rte_log.h"
> +#include "rte_branch_prediction.h"
>  
>  #ifdef __cplusplus
>  extern "C" {

Ping on this patch - any comments or concerns?
It's a fairly trivial fix that prevents issues with testing some other patches
on the mainline.

Regards,
/Bruce


[dpdk-dev] Old oversubscription related checkin

2016-05-05 Thread Dumitrescu, Cristian
Hi Sridhar,

I think this patch is simply the implementation of the oversubscription 
feature, as introduced by DPDK release 1.4.1. Most likely, this patch is the 
way Thomas added this Intel release to dpdk.org.

The oversubscription feature was never implemented for all 4 traffic classes. 
The patch you are pointing to simply introduced this feature for TC3 only. 
Before this patch, there might have been just a placeholder in the code for the 
oversubscription feature that was to be developed later on.

Again, the reason for introducing this feature for TC3 only is that the higher 
priority traffic classes TC0 .. TC2 are typically fully provisioned, as the 
amount of TC0 .. TC2 traffic is much less than TC3 (Best Effort) traffic, which 
is usually hugely overprovisioned. This feature can potentially be extended to 
TC0 .. TC2 as well, as the way this feature basically works is deciding the 
quanta to be applied for all pipes in the subport during the next scheduling 
decision based on the amount of unused credits found at the end of the current 
scheduling period.

Regards,
Cristian

From: Sridhar.V.Iyer [mailto:sridhari...@versa-networks.com]
Sent: Wednesday, May 4, 2016 10:15 PM
To: dev at dpdk.org; Dumitrescu, Cristian 
Cc: Ananda 
Subject: Old oversubscription related checkin

Hi Cristian,

 I stumbled into an old from 2013 
(http://dpdk.org/browse/dpdk/patch/lib/librte_sched/rte_sched.c?id=835c5409a7bac3055b82bebee65d8ada7f20d332)

I couldn?t find any context for the patch from the mail archives. Could you 
please let me know why oversubscription was removed from all the other traffic 
classes and just given to tc3?
Were there huge performance penalties? Would there be any issues if I add this 
patch back again locally (enable/disabled via config).

Regards,

Sridhar V Iyer


















[dpdk-dev] [PATCH] doc: fix supported AES-CBC key lengths

2016-05-05 Thread Pablo de Lara
AES-NI MB PMD supports 128, 192 and 256-bit keys,
not 128, 256 and 512-bit keys.

Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")

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

diff --git a/doc/guides/cryptodevs/aesni_mb.rst 
b/doc/guides/cryptodevs/aesni_mb.rst
index 9e04853..fd5414d 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -46,8 +46,8 @@ AESNI MB PMD has support for:
 Cipher algorithms:

 * RTE_CRYPTO_SYM_CIPHER_AES128_CBC
+* RTE_CRYPTO_SYM_CIPHER_AES192_CBC
 * RTE_CRYPTO_SYM_CIPHER_AES256_CBC
-* RTE_CRYPTO_SYM_CIPHER_AES512_CBC

 Hash algorithms:

-- 
2.5.5



[dpdk-dev] [RFC PATCH 0/4]: Implement module information export

2016-05-05 Thread Bruce Richardson
On Wed, May 04, 2016 at 11:16:42PM +0200, Thomas Monjalon wrote:
> This discussion requires more opinions.
> Please everybody, READ and COMMENT. Thanks
> 
> If it is not enough visible, a new thread could be started later.
> 
> 2016-05-04 07:43, Neil Horman:
> > On Wed, May 04, 2016 at 10:24:18AM +0200, David Marchand wrote:
> > > On Tue, May 3, 2016 at 1:57 PM, Neil Horman  
> > > wrote:
> > > >> This approach has a few pros and cons:
> > > >>
> > > >> pros:
> > > >> 1) Its simple, and doesn't require extra infrastructure to implement.  
> > > >> E.g. we
> > > >> don't need a new tool to extract driver information and emit the C 
> > > >> code to build
> > > >> the binary data for the special section, nor do we need a custom 
> > > >> linker script
> > > >> to link said special section in place
> > > >>
> > > >> 2) Its stable.  Because the marker symbols are explicitly exported, 
> > > >> this
> > > >> approach is resilient against stripping.
> 
> It is a good point. We need something resilient against stripping.
> 
> > > >> cons:
> > > >> 1) It creates an artifact in that PMD_REGISTER_DRIVER has to be used 
> > > >> in one
> > > >> compilation unit per DSO.  As an example em and igb effectively merge 
> > > >> two
> > > >> drivers into one DSO, and the uses of PMD_REGISTER_DRIVER occur in two 
> > > >> separate
> > > >> C files for the same single linked DSO.  Because of the use of the 
> > > >> __COUNTER__
> > > >> macro we get multiple definitions of the same marker symbols.
> > > >>
> > > >> I would make the argument that the downside of the above artifact 
> > > >> isn't that big
> > > >> a deal.  Traditionally in other projects a unit like a module (or DSO 
> > > >> in our
> > > >> case) only ever codifies a single driver (e.g. module_init() in the 
> > > >> linux kernel
> > > >> is only ever used once per built module).  If we have code like igb/em 
> > > >> that
> > > >> shares some core code, we should build the shared code to object files 
> > > >> and link
> > > >> them twice, once to an em.so pmd and again to an igb.so pmd.
> 
> It is also a problem for compilation units having PF and VF drivers.
> 
> > > >> But regardless, I thought I would propose this to see what you all 
> > > >> thought of
> > > >> it.
> 
> Thanks for proposing.
> 
> > > - This implementation does not support binaries, so it is not suitable
> > > for people who don't want dso, this is partially why I used bfd rather
> > > than just dlopen.
> > 
> > If you're statically linking an application, you should know what hardware 
> > you
> > support already.  Its going to be very hard, if not impossible to develop a
> > robust solution that works with static binaries (the prior solutions don't 
> > work
> > consistently with static binaries either).  I really think the static 
> > solution
> > needs to just be built into the application (i.e. the application needs to 
> > add a
> > command line option to dump out the pci id's that are registered).
> 
> No, we need a tool to know what are the supported devices before running
> the application (e.g. for binding).
> This tool should not behave differently depending of how DPDK was compiled
> (static or shared).
> 
> [...]
> > > - How does it behave if we strip the dsos ?
> > 
> > I described this above, its invariant to stripping, because the symbols for 
> > each
> > pmd are explicitly exported, so strip doesn't touch the symbols that pmdinfo
> > keys off of.
> > 
> [...]
> > > - The tool output format is not script friendly from my pov.
> > 
> > Don't think it really needs to be script friendly, it was meant to provide 
> > human
> > readable output, but script friendly output can be added easily enough if 
> > you
> > want.
> 
> Yes it needs to be script friendly.
> 
> It appears that we must agree on a set of requirements first.
> Please let's forget the implementation until we have collected enough
> feedbacks on the needs.
> I suggest these items to start the list:
> 
> - query all drivers in static binary or shared library
> - stripping resiliency
> - human friendly
> - script friendly
> - show driver name
> - list supported device id / name
> - list driver options
> - show driver version if available
> - show dpdk version
> - show kernel dependencies (vfio/uio_pci_generic/etc)
> - room for extra information?
> 
> Please ack or comment items of this list, thanks.

That's quite a laundry list of requirements! I would view the following as core
requirements:
 - query all drivers in static binary or shared library
 - stripping resiliency
 - human friendly
 - script friendly
 - show driver name
 - list supported device id / name

and the rest as nice-to-have's that are not needed for a first version.
That being said, I would expect those nice-to-have's to be fairly easy to add on
once the base solution is in place.

On a semi-related note, I assume this discussion and a solution here is not 
going
to block the merging of the other clean-up patches in the driver/pci area?


[dpdk-dev] [PATCH 1/5] bonding: replace spinlock with read/write lock

2016-05-05 Thread Stephen Hemminger
On Thu,  5 May 2016 16:14:56 +0100
Bernard Iremonger  wrote:

> Fixes: a45b288ef21a ("bond: support link status polling")
> Signed-off-by: Bernard Iremonger 

You know an uncontested reader/writer lock is significantly slower
than a spinlock.



[dpdk-dev] [PATCH 3/3] virtio-user: add mq in virtual pci driver

2016-05-05 Thread Jianfeng Tan
Partially implement ctrl-queue to handle control command with class
of VIRTIO_NET_CTRL_MQ and with cmd of VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
to handle mq support. After filling the command into ctrl-queue, we
dequeue it when notify_queue(), and invoke method from device
emulation to enable/disable queues.

Signed-off-by: Jianfeng Tan 
---
 drivers/net/virtio/virtio_user/virtio_user_pci.c | 89 +++-
 1 file changed, 87 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_pci.c 
b/drivers/net/virtio/virtio_user/virtio_user_pci.c
index 873e619..aa02c60 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_pci.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_pci.c
@@ -38,6 +38,7 @@
 #include "../virtio_logs.h"
 #include "../virtio_pci.h"
 #include "../virtqueue.h"
+#include "../virtio_ring.h"
 #include "virtio_user_dev.h"

 static void
@@ -157,8 +158,10 @@ vdev_setup_queue(struct virtio_hw *hw __rte_unused, struct 
virtqueue *vq)
if (vq->virtio_net_hdr_mz) {
vq->virtio_net_hdr_mem =
(phys_addr_t)vq->virtio_net_hdr_mz->addr;
-   /* Do it one more time after we reset virtio_net_hdr_mem */
-   vring_hdr_desc_init(vq);
+
+   /* Do it again after we reset virtio_net_hdr_mem for tx */
+   if ((vq->vq_queue_index % VTNET_CQ) == VTNET_TQ)
+   vring_hdr_desc_init(vq);
}
vq->offset = offsetof(struct rte_mbuf, buf_addr);
return 0;
@@ -182,11 +185,93 @@ vdev_del_queue(struct virtio_hw *hw, struct virtqueue *vq)
close(uhw->kickfds[vq->vq_queue_index]);
 }

+static uint8_t
+handle_mq(struct virtqueue *vq, uint16_t queues)
+{
+   struct virtio_hw *hw = vq->hw;
+   struct virtio_user_hw *uhw = (struct virtio_user_hw *)hw->vdev_private;
+   uint32_t i;
+   uint8_t ret = 0;
+
+   if (queues > uhw->max_queue_pairs) {
+   PMD_INIT_LOG(ERR, "multi-q config %u, but only %u supported",
+queues, uhw->max_queue_pairs);
+   return -1;
+   }
+
+   for (i = 0; i < queues; ++i)
+   ret |= virtio_user_enable_queue_pair(uhw, i, 1);
+   for (i = queues; i < uhw->max_queue_pairs; ++i)
+   ret |= virtio_user_enable_queue_pair(uhw, i, 0);
+
+   return ret;
+}
+
+static uint32_t
+handle_ctrl(struct virtqueue *vq, uint16_t desc_idx_hdr)
+{
+   struct virtio_net_ctrl_hdr *hdr;
+   virtio_net_ctrl_ack status = ~0;
+   uint16_t i, desc_idx_data, desc_idx_status;
+   uint32_t num_of_descs = 0;
+
+   /* locate desc for header, data, and status */
+   desc_idx_data = vq->vq_ring.desc[desc_idx_hdr].next;
+   num_of_descs++;
+
+
+   i = desc_idx_data;
+   while (vq->vq_ring.desc[i].flags == VRING_DESC_F_NEXT) {
+   i = vq->vq_ring.desc[i].next;
+   num_of_descs++;
+   }
+
+   /* locate desc for status */
+   desc_idx_status = i;
+   num_of_descs++;
+
+   hdr = (struct virtio_net_ctrl_hdr *)vq->vq_ring.desc[desc_idx_hdr].addr;
+   if (hdr->class == VIRTIO_NET_CTRL_MQ &&
+   hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) {
+   uint16_t queues;
+
+   queues = *(uint16_t *)vq->vq_ring.desc[desc_idx_data].addr;
+   status = handle_mq(vq, queues);
+   }
+
+   /* Update status */
+   *(virtio_net_ctrl_ack *)vq->vq_ring.desc[desc_idx_status].addr = status;
+
+   return num_of_descs;
+}
+
 static void
 vdev_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 {
uint64_t buf = 1;
struct virtio_user_hw *uhw = (struct virtio_user_hw *)hw->vdev_private;
+   uint16_t avail_idx, desc_idx;
+   struct vring_used_elem *uep;
+   uint32_t num_of_descs;
+
+   if (vq == hw->cvq) {
+   /* Consume avail ring, using used ring idx as first one */
+   while (vq->vq_ring.used->idx != vq->vq_ring.avail->idx) {
+   avail_idx = (vq->vq_ring.used->idx) &
+   (vq->vq_nentries - 1);
+   desc_idx = vq->vq_ring.avail->ring[avail_idx];
+
+   num_of_descs = handle_ctrl(vq, desc_idx);
+
+   /* Update used ring */
+   uep = >vq_ring.used->ring[avail_idx];
+   uep->id = avail_idx;
+   uep->len = num_of_descs;
+
+   vq->vq_ring.used->idx++;
+   }
+   return;
+   }

if (write(uhw->kickfds[vq->vq_queue_index], , sizeof(buf)) < 0)
PMD_DRV_LOG(ERR, "failed to kick backend: %s\n", 
strerror(errno));
-- 
2.1.4



[dpdk-dev] [PATCH 2/3] virtio-user: add mq in device emulation

2016-05-05 Thread Jianfeng Tan
Multi-queue requires VIRTIO_NET_F_MQ and VIRTIO_NET_F_CTRL_VQ in
feature negotiation. Mainly two changes in virtio-user device
emulation layer.
  - Multi-queue requires ctrl-queue. So ctrl-queue will by enabled
automatically when multi-queue is specified.
  - Provide a method virtio_user_enable_queue_pair() for virtio-user
driver to enable/disable queues.

Note: Do not support multiple queue for vhost kernel backend.
Signed-off-by: Jianfeng Tan 
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 65 
 drivers/net/virtio/virtio_user/virtio_user_dev.h |  2 +
 2 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c 
b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index a8e58c0..ea0d4c4 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -136,11 +136,14 @@ virtio_user_start_device(struct virtio_user_hw *hw)
}
}

-   /* After setup all virtqueues, we need to set_features so that
-* these features can be set into each virtqueue in vhost side.
-* And before that, make sure VIRTIO_NET_F_MAC is stripped.
+   /* After setup all virtqueues, we need to set_features so that these
+* features can be set into each virtqueue in vhost side. And before
+* that, make sure VHOST_USER_F_PROTOCOL_FEATURES is added if mq is
+* enabled, and VIRTIO_NET_F_MAC is stripped.
 */
features = hw->features;
+   if (hw->type == VHOST_USER && hw->max_queue_pairs > 1)
+   features |= VHOST_USER_MQ;
features &= ~(1ull << VIRTIO_NET_F_MAC);
ret = vhost_call(hw->vhostfd, hw->type,
 VHOST_MSG_SET_FEATURES, );
@@ -161,6 +164,18 @@ error:
return -1;
 }

+int
+virtio_user_enable_queue_pair(struct virtio_user_hw *hw,
+ unsigned pair_idx, int enable)
+{
+   int r = -1;
+
+   if (hw->type == VHOST_USER)
+   r = vhost_user_enable_queue_pair(hw->vhostfd, pair_idx, enable);
+
+   return r;
+}
+
 int virtio_user_stop_device(struct virtio_user_hw *hw)
 {
return vhost_call(hw->vhostfd, hw->type, VHOST_MSG_RESET_OWNER, NULL);
@@ -188,7 +203,7 @@ static inline void parse_mac(struct virtio_user_hw *hw, 
const char *mac)

 static int
 virtio_vdev_init(struct rte_eth_dev_data *data, char *path,
-int queues, int nb_cq __rte_unused,
+int queues, int enable_ctrl_q,
 int queue_size, const char *mac, char *ifname)
 {
struct stat s;
@@ -204,8 +219,6 @@ virtio_vdev_init(struct rte_eth_dev_data *data, char *path,
uhw->vhostfd = -1;
uhw->tapfd = -1;

-   /* TODO: cq */
-
if (stat(uhw->path, ) < 0) {
PMD_INIT_LOG(ERR, "stat: %s failed, %s", uhw->path,
 strerror(errno));
@@ -243,9 +256,36 @@ virtio_vdev_init(struct rte_eth_dev_data *data, char *path,
}
if (uhw->mac_specified)
uhw->features |= (1ull << VIRTIO_NET_F_MAC);
-   /* disable it until we support CQ */
-   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ);
-   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_RX);
+
+   if (!enable_ctrl_q) {
+   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ);
+   /* Also disable features depends on VIRTIO_NET_F_CTRL_VQ */
+   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_RX);
+   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_VLAN);
+   uhw->features &= ~(1ull << VIRTIO_NET_F_GUEST_ANNOUNCE);
+   uhw->features &= ~(1ull << VIRTIO_NET_F_MQ);
+   uhw->features &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR);
+   } else {
+   /* vhost user backend does not need to know ctrl-q, so
+* actually we need add this bit into features. However,
+* DPDK vhost-user does send features with this bit, so we
+* check it instead of OR it for now.
+*/
+   if (!(uhw->features & (1ull << VIRTIO_NET_F_CTRL_VQ)))
+   PMD_INIT_LOG(INFO, "vhost does not support ctrl-q");
+   }
+
+   if (uhw->max_queue_pairs > 1) {
+   if (uhw->type == VHOST_KERNEL) {
+   PMD_INIT_LOG(ERR, "MQ not supported for vhost kernel");
+   return -1;
+   }
+
+   if (!(uhw->features & VHOST_USER_MQ)) {
+   PMD_INIT_LOG(ERR, "MQ not supported by the backend");
+   return -1;
+   }
+   }

return 0;

@@ -411,6 +451,13 @@ rte_virtio_user_pmd_devinit(const char *name, const char 
*params)
if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_CQ_NUM) == 1)
rte_kvargs_process(kvlist, VIRTIO_USER_ARG_CQ_NUM,
   _integer_arg, _cq);

[dpdk-dev] [PATCH 1/3] virtio-user: add mq in vhost user adapter

2016-05-05 Thread Jianfeng Tan
This patch mainly adds method in vhost user adapter to communicate
enable/disable queues messages with vhost user backend.

Signed-off-by: Jianfeng Tan 
---
 drivers/net/virtio/virtio_user/vhost.h  |  4 
 drivers/net/virtio/virtio_user/vhost_user.c | 21 +
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/virtio/virtio_user/vhost.h 
b/drivers/net/virtio/virtio_user/vhost.h
index 5cd3543..fe236a7 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -209,8 +209,12 @@ enum {
 #define VHOST_KERNEL   0
 #define VHOST_USER 1

+#define VHOST_USER_F_PROTOCOL_FEATURES 30
+#define VHOST_USER_MQ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)
+
 int vhost_user_sock(int vhostfd, unsigned long int req, void *arg);
 int vhost_user_setup(const char *path);
+int vhost_user_enable_queue_pair(int vhostfd, unsigned pair_idx, int enable);

 int vhost_kernel_ioctl(int vhostfd, unsigned long int req, void *arg);
 int vhost_kernel_setup(const char *path, const char *ifname, int *p_tapfd);
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c 
b/drivers/net/virtio/virtio_user/vhost_user.c
index 6fd648c..d8f7996 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -263,6 +263,7 @@ vhost_user_sock(int vhostfd, unsigned long int req, void 
*arg)

case VHOST_USER_SET_VRING_NUM:
case VHOST_USER_SET_VRING_BASE:
+   case VHOST_USER_SET_VRING_ENABLE:
memcpy(, arg, sizeof(msg.payload.state));
msg.size = sizeof(m.payload.state);
break;
@@ -373,3 +374,23 @@ vhost_user_setup(const char *path)

return fd;
 }
+
+int
+vhost_user_enable_queue_pair(int vhostfd, unsigned pair_idx, int enable)
+{
+   int i;
+
+   for (i = 0; i < 2; ++i) {
+   struct vhost_vring_state state = {
+   .index = pair_idx * 2 + i,
+   .num   = enable,
+   };
+
+   if (vhost_user_sock(vhostfd,
+   VHOST_USER_SET_VRING_ENABLE, ))
+   return -1;
+   }
+
+   return 0;
+
+}
-- 
2.1.4



[dpdk-dev] [PATCH 0/3] add multi queue support for virtio-user

2016-05-05 Thread Jianfeng Tan
This patch set depends on below patch sets:
  - http://dpdk.org/ml/archives/dev/2016-April/038111.html
  - http://dpdk.org/ml/archives/dev/2016-April/038118.html
  - http://dpdk.org/ml/archives/dev/2016-April/038121.html

Add multi queue support for virtio-user virtual port. Patch 1 adds vhost
user adapter communications for enable/disable queues. Patch 2 adds features
check for multi queue and provides a method for virtio-user driver to
enable/disable queues. Patch 3 partially implements ctrl-q to handle
VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command from PMD.

Test case:
1. start testpmd with a vhost-user port:
 $ TESTPMD -c 0x7 -n 4 --socket-mem 1024,0 --no-pci \
  --vdev 'eth_vhost0,iface=/tmp/sock0,queues=2' \
  -- -i --rxq=2 --txq=2 --nb-cores=2
2. start testpmd with a virtio-user port:
 $ TESTPMD -c 0x70 -n 4 --socket-mem 1024,0 --no-pci --file-prefix=testpmd \
  --vdev=virtio-user0,mac=00:01:02:03:04:05,path=/tmp/sock0,queues=2 \
  -- -i --rxq=2 --txq=2 --nb-cores=2 --txqflags=0xf01 --disable-hw-vlan
3. use below commands to see if all queues are working:
 testpmd> show port xstats all


Jianfeng Tan (3):
  virtio-user: add mq in vhost user adapter
  virtio-user: add mq in device emulation
  virtio-user: add mq in virtual pci driver

 drivers/net/virtio/virtio_user/vhost.h   |  4 ++
 drivers/net/virtio/virtio_user/vhost_user.c  | 21 ++
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 65 ++---
 drivers/net/virtio/virtio_user/virtio_user_dev.h |  2 +
 drivers/net/virtio/virtio_user/virtio_user_pci.c | 89 +++-
 5 files changed, 170 insertions(+), 11 deletions(-)

-- 
2.1.4



[dpdk-dev] [RFC PATCH 0/4]: Implement module information export

2016-05-05 Thread Neil Horman
On Wed, May 04, 2016 at 11:16:42PM +0200, Thomas Monjalon wrote:
> This discussion requires more opinions.
> Please everybody, READ and COMMENT. Thanks
> 
> If it is not enough visible, a new thread could be started later.
> 
> 2016-05-04 07:43, Neil Horman:
> > On Wed, May 04, 2016 at 10:24:18AM +0200, David Marchand wrote:
> > > On Tue, May 3, 2016 at 1:57 PM, Neil Horman  
> > > wrote:
> > > >> This approach has a few pros and cons:
> > > >>
> > > >> pros:
> > > >> 1) Its simple, and doesn't require extra infrastructure to implement.  
> > > >> E.g. we
> > > >> don't need a new tool to extract driver information and emit the C 
> > > >> code to build
> > > >> the binary data for the special section, nor do we need a custom 
> > > >> linker script
> > > >> to link said special section in place
> > > >>
> > > >> 2) Its stable.  Because the marker symbols are explicitly exported, 
> > > >> this
> > > >> approach is resilient against stripping.
> 
> It is a good point. We need something resilient against stripping.
> 
> > > >> cons:
> > > >> 1) It creates an artifact in that PMD_REGISTER_DRIVER has to be used 
> > > >> in one
> > > >> compilation unit per DSO.  As an example em and igb effectively merge 
> > > >> two
> > > >> drivers into one DSO, and the uses of PMD_REGISTER_DRIVER occur in two 
> > > >> separate
> > > >> C files for the same single linked DSO.  Because of the use of the 
> > > >> __COUNTER__
> > > >> macro we get multiple definitions of the same marker symbols.
> > > >>
> > > >> I would make the argument that the downside of the above artifact 
> > > >> isn't that big
> > > >> a deal.  Traditionally in other projects a unit like a module (or DSO 
> > > >> in our
> > > >> case) only ever codifies a single driver (e.g. module_init() in the 
> > > >> linux kernel
> > > >> is only ever used once per built module).  If we have code like igb/em 
> > > >> that
> > > >> shares some core code, we should build the shared code to object files 
> > > >> and link
> > > >> them twice, once to an em.so pmd and again to an igb.so pmd.
> 
> It is also a problem for compilation units having PF and VF drivers.
> 
Thats exactly the problem in the two cases I encountered.  The common code
between the PF and VF drivers was handled by simply building the whole driver
together, which is problematic because it make both drivers bigger than they
need to be.  But its somewhat moot, as the problem is orthogonal to this one if
we have to go with a 'special section' approach to implementing this.

> > > >> But regardless, I thought I would propose this to see what you all 
> > > >> thought of
> > > >> it.
> 
> Thanks for proposing.
> 
> > > - This implementation does not support binaries, so it is not suitable
> > > for people who don't want dso, this is partially why I used bfd rather
> > > than just dlopen.
> > 
> > If you're statically linking an application, you should know what hardware 
> > you
> > support already.  Its going to be very hard, if not impossible to develop a
> > robust solution that works with static binaries (the prior solutions don't 
> > work
> > consistently with static binaries either).  I really think the static 
> > solution
> > needs to just be built into the application (i.e. the application needs to 
> > add a
> > command line option to dump out the pci id's that are registered).
> 
> No, we need a tool to know what are the supported devices before running
> the application (e.g. for binding).
> This tool should not behave differently depending of how DPDK was compiled
> (static or shared).
> 
Very well.

> [...]
> > > - How does it behave if we strip the dsos ?
> > 
> > I described this above, its invariant to stripping, because the symbols for 
> > each
> > pmd are explicitly exported, so strip doesn't touch the symbols that pmdinfo
> > keys off of.
> > 
> [...]
> > > - The tool output format is not script friendly from my pov.
> > 
> > Don't think it really needs to be script friendly, it was meant to provide 
> > human
> > readable output, but script friendly output can be added easily enough if 
> > you
> > want.
> 
> Yes it needs to be script friendly.
> 
Thats easy enough.

> It appears that we must agree on a set of requirements first.
> Please let's forget the implementation until we have collected enough
> feedbacks on the needs.
> I suggest these items to start the list:
> 
> - query all drivers in static binary or shared library
This does require a some sort of special section then, but thats fine

> - stripping resiliency
easy enough
> - human friendly
done
> - script friendly
Can be done easily
> - show driver name
Thats somewhat orthogonal to this problem, the driver name is codified in the
rte_driver struct, we just have to be sure that driver writers fill that out

> - list supported device id / name
> - list driver options
Hadn't thought of that, but its a good idea.
> - show driver version if available
Can be done.
> - show dpdk version
This is tricky as its not 

[dpdk-dev] [PATCH v2] lib: fix DCB config issue on ixgbe

2016-05-05 Thread Wenzhuo Lu
An issue is found that DCB cannot be configged on ixgbe
NICs. It's said the TX queue number is not right.
On ixgbe the max TX queue number is not fixed, it depends
on the multi-queue mode. The API rte_eth_dev_configure
should be used to config this mode. But the input of this
API includes TX queue number. The problem is before the
mode is configged, we cannot decide the TX queue number.

This patch adds an API to config RX & TX multi-queue mode
separately. After the mode is configged, the max RX & TX
queue number is decided. Then we can set the appropriate
RX & TX queue number.

v2:
- Changed the release to 16.07.

Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx queues)
Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/testpmd.c | 40 +++---
 lib/librte_ether/rte_ethdev.c  | 17 +++
 lib/librte_ether/rte_ethdev.h  | 19 
 lib/librte_ether/rte_ether_version.map |  7 ++
 4 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 26a174c..733f760 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1924,17 +1924,31 @@ init_port_dcb_config(portid_t pid,
 uint8_t pfc_en)
 {
struct rte_eth_conf port_conf;
-   struct rte_eth_dev_info dev_info;
struct rte_port *rte_port;
int retval;
uint16_t i;

-   rte_eth_dev_info_get(pid, _info);
+   rte_port = [pid];
+
+   memset(_conf, 0, sizeof(struct rte_eth_conf));
+   /* Enter DCB configuration status */
+   dcb_config = 1;
+
+   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
+   retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs, pfc_en);
+   if (retval < 0)
+   return retval;
+
+   rte_eth_dev_mq_mode_set(pid,
+   port_conf.rxmode.mq_mode,
+   port_conf.txmode.mq_mode);
+   rte_eth_dev_info_get(pid, _port->dev_info);

/* If dev_info.vmdq_pool_base is greater than 0,
 * the queue id of vmdq pools is started after pf queues.
 */
-   if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base > 0) {
+   if (dcb_mode == DCB_VT_ENABLED &&
+   rte_port->dev_info.vmdq_pool_base > 0) {
printf("VMDQ_DCB multi-queue mode is nonsensical"
" for port %d.", pid);
return -1;
@@ -1944,13 +1958,13 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = dev_info.max_rx_queues;
-   nb_txq = dev_info.max_tx_queues;
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
} else {
/*if vt is disabled, use all pf queues */
-   if (dev_info.vmdq_pool_base == 0) {
-   nb_rxq = dev_info.max_rx_queues;
-   nb_txq = dev_info.max_tx_queues;
+   if (rte_port->dev_info.vmdq_pool_base == 0) {
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
} else {
nb_rxq = (queueid_t)num_tcs;
nb_txq = (queueid_t)num_tcs;
@@ -1959,16 +1973,6 @@ init_port_dcb_config(portid_t pid,
}
rx_free_thresh = 64;

-   memset(_conf, 0, sizeof(struct rte_eth_conf));
-   /* Enter DCB configuration status */
-   dcb_config = 1;
-
-   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
-   retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs, pfc_en);
-   if (retval < 0)
-   return retval;
-
-   rte_port = [pid];
memcpy(_port->dev_conf, _conf, sizeof(struct rte_eth_conf));

rxtx_port_config(rte_port);
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..b4eaa29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3369,3 +3369,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
 }
+
+int
+rte_eth_dev_mq_mode_set(uint8_t port_id,
+   enum rte_eth_rx_mq_mode rx_mq_mode,
+   enum rte_eth_tx_mq_mode tx_mq_mode)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+
+   dev->data->dev_conf.rxmode.mq_mode = rx_mq_mode;
+   dev->data->dev_conf.txmode.mq_mode = tx_mq_mode;
+
+   return 0;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2757510..3015cec 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h

[dpdk-dev] [PATCH] virtio: split virtio rx/tx queue

2016-05-05 Thread Xie, Huawei
On 5/5/2016 11:46 AM, Yuanhan Liu wrote:
> On Thu, May 05, 2016 at 03:29:44AM +, Xie, Huawei wrote:
>> On 5/5/2016 11:03 AM, Yuanhan Liu wrote:
>>> On Thu, May 05, 2016 at 01:54:25AM +, Xie, Huawei wrote:
 On 5/5/2016 7:59 AM, Yuanhan Liu wrote:
> On Wed, May 04, 2016 at 08:50:27AM +0800, Huawei Xie wrote:
>> -int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>> -int queue_type,
>> -uint16_t queue_idx,
>> +static int
>> +virtio_dev_cq_queue_setup(struct rte_eth_dev *dev,
> While it's good to split Rx/Tx specific stuff, but why are you trying to
> remove a common queue_setup function that does common setups, such as 
> vring
> memory allocation.
>
> This results to much duplicated code: following diff summary also shows
> it clearly:
 The motivation to do this is we need separate RX/TX queue setup.
>>> We actually have done that. If you look at current rx/tx/ctrl_queue_setup()
>>> code, we invoked the common function; we also did some queue specific
>>> settings. It has not been done in a very clean way though: there are quite
>>> many "if .. else .." as you stated. And that's what you are going to 
>>> resolve,
>>> but IMO, you went far: you made __same__ code 3 copies, one for rx, tx and
>>> ctrl queue, respectively.
>>>
 The switch/case in the common queue setup looks bad.
>>> Assuming you are talking about the "if .. else .." ...
>>>
>>> While I agree with you on that, introducing so many duplicated code is 
>>> worse.
>>>
 I am aware of the common operations, and i had planned to extract them,
 maybe i could do this in this patchset.
>>> If you meant to do in another patch on top of this patch, then it looks
>>> like the wrong way to go: breaking something first and then fixing it
>>> later does not sound a good practice to me.
>> To your later comment, we could split first, then do the queue setup rework.
> Well, if you insist, I'm Okay. But please don't do it in the way this
> patch does, that introduces quite many duplicated codes.

Yuanhan, I have no insist.

Our target is 1) remove the queue type if else checking in the
virtio_dev_queue_setup 2) extract the common setup for vq and call them
in specific RX/TX/CQ setup.
For 2, which is really meaningful to me is the queue size retrieve,
queue allocation

What I mean is firstly we split the queue, without breaking the common
setup; then introduce RX/TX specific setup calling extracted common
setup, so we don't have a chance to introduce duplicated code.


>   --yliu
>



[dpdk-dev] [PATCH 4/4] igb: automatic link recovery on VF

2016-05-05 Thread Wenzhuo Lu
When the physical link is down and recover later,
the VF link cannot recover until the user stop and
start it manually.
This patch implements the automatic recovery of VF
port.
The automatic recovery bases on the link up/down
message received from PF. When VF receives the link
up/down message, it will replace the RX/TX and
operation functions with fake ones to stop RX/TX
and any future operation. Then reset the VF port.
After successfully resetting the port, recover the
RX/TX and operation functions.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_07.rst |  2 +-
 drivers/net/e1000/e1000_ethdev.h   | 14 ++
 drivers/net/e1000/igb_ethdev.c | 87 +-
 drivers/net/e1000/igb_rxtx.c   | 38 +++
 4 files changed, 139 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index d80f449..8144450 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -40,7 +40,7 @@ This section should contain new features added in this 
release. Sample format:
   VF. To handle this link up/down event, add the mailbox interruption
   support to receive the message.

-* **Added the support of automatic link recovery for ixgbe VF.**
+* **Added the support of automatic link recovery for ixgbe/igb VF.**

   When the physical link becomes down and recover later, VF will receive
   the mailbox message for that. VF handles this message by resetting the
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index e8bf8da..1b71f9b 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -34,6 +34,7 @@
 #ifndef _E1000_ETHDEV_H_
 #define _E1000_ETHDEV_H_
 #include 
+#include 

 /* need update link, bit flag */
 #define E1000_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
@@ -261,6 +262,9 @@ struct e1000_adapter {
struct rte_timecounter  systime_tc;
struct rte_timecounter  rx_tstamp_tc;
struct rte_timecounter  tx_tstamp_tc;
+   eth_rx_burst_t rx_backup;
+   eth_tx_burst_t tx_backup;
+   rte_spinlock_t vf_reset_lock;
 };

 #define E1000_DEV_PRIVATE(adapter) \
@@ -316,6 +320,14 @@ uint16_t eth_igb_xmit_pkts(void *txq, struct rte_mbuf 
**tx_pkts,
 uint16_t eth_igb_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);

+uint16_t eth_igbvf_xmit_pkts_fake(void *txq,
+ struct rte_mbuf **tx_pkts,
+ uint16_t nb_pkts);
+
+uint16_t eth_igbvf_recv_pkts_fake(void *rxq,
+ struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts);
+
 uint16_t eth_igb_recv_scattered_pkts(void *rxq,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

@@ -388,4 +400,6 @@ void em_txq_info_get(struct rte_eth_dev *dev, uint16_t 
queue_id,

 void igb_pf_host_uninit(struct rte_eth_dev *dev);

+void igbvf_dev_link_up_down_handler(struct rte_eth_dev *dev);
+
 #endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b0e5e6a..5dc3182 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -411,6 +411,8 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
.get_reg  = igbvf_get_regs,
 };

+static const struct eth_dev_ops igbvf_eth_dev_ops_fake = {NULL};
+
 /* store statistics names and its offset in stats structure */
 struct rte_igb_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -911,6 +913,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->dev_ops = _eth_dev_ops;
eth_dev->rx_pkt_burst = _igb_recv_pkts;
eth_dev->tx_pkt_burst = _igb_xmit_pkts;
+   rte_spinlock_init(>vf_reset_lock);

/* for secondary processes, we don't initialise any further as primary
 * has already done this work. Only check we don't need a different
@@ -2641,6 +2644,8 @@ eth_igbvf_interrupt_get_status(struct rte_eth_dev *dev)

 void igbvf_mbx_process(struct rte_eth_dev *dev)
 {
+   struct e1000_adapter *adapter =
+   (struct e1000_adapter *)dev->data->dev_private;
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct e1000_mbx_info *mbx = >mbx;
@@ -2650,8 +2655,88 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)
return;

/* PF reset VF event */
-   if (in_msg == E1000_PF_CONTROL_MSG)
+   if (in_msg == E1000_PF_CONTROL_MSG) {
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+
+   /* Stop the ops and rx/tx */
+   if (dev->data->dev_started) {
+   PMD_DRV_LOG(DEBUG, "Link up/down event detected.");
+   dev->dev_ops = _eth_dev_ops_fake;
+
+   adapter->rx_backup = dev->rx_pkt_burst;
+ 

[dpdk-dev] [PATCH 3/4] ixgbe: automatic link recovery on VF

2016-05-05 Thread Wenzhuo Lu
When the physical link is down and recover later,
the VF link cannot recover until the user stop and
start it manually.
This patch implements the automatic recovery of VF
port.
The automatic recovery bases on the link up/down
message received from PF. When VF receives the link
up/down message, it will replace the RX/TX and
operation functions with fake ones to stop RX/TX
and any future operation. Then reset the VF port.
After successfully resetting the port, recover the
RX/TX and operation functions.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_07.rst |  5 ++
 drivers/net/ixgbe/ixgbe_ethdev.c   | 86 +-
 drivers/net/ixgbe/ixgbe_ethdev.h   | 14 ++
 drivers/net/ixgbe/ixgbe_rxtx.c | 34 ++
 drivers/net/ixgbe/ixgbe_rxtx.h |  2 +
 5 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 8d45915..d80f449 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -40,6 +40,11 @@ This section should contain new features added in this 
release. Sample format:
   VF. To handle this link up/down event, add the mailbox interruption
   support to receive the message.

+* **Added the support of automatic link recovery for ixgbe VF.**
+
+  When the physical link becomes down and recover later, VF will receive
+  the mailbox message for that. VF handles this message by resetting the
+  VF port. Then the VF link can recover automatically.

 Resolved Issues
 ---
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 8e5f64f..f1f67f2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -589,6 +589,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
.rss_hash_conf_get= ixgbe_dev_rss_hash_conf_get,
 };

+static const struct eth_dev_ops ixgbevf_eth_dev_ops_fake = {NULL};
+
 /* store statistics names and its offset in stats structure */
 struct rte_ixgbe_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -1322,12 +1324,15 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
struct ixgbe_hwstrip *hwstrip =
IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr;
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)eth_dev->data->dev_private;

PMD_INIT_FUNC_TRACE();

eth_dev->dev_ops = _eth_dev_ops;
eth_dev->rx_pkt_burst = _recv_pkts;
eth_dev->tx_pkt_burst = _xmit_pkts;
+   rte_spinlock_init(>vf_reset_lock);

/* for secondary processes, we don't initialise any further as primary
 * has already done this work. Only check we don't need a different
@@ -7152,14 +7157,93 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev 
*dev)
 static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
 {
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)dev->data->dev_private;
u32 in_msg = 0;

if (ixgbe_read_mbx(hw, _msg, 1, 0))
return;

/* PF reset VF event */
-   if (in_msg == IXGBE_PF_CONTROL_MSG)
+   if (in_msg == IXGBE_PF_CONTROL_MSG) {
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+
+   /* Stop the ops and rx/tx */
+   if (dev->data->dev_started) {
+   PMD_DRV_LOG(DEBUG, "Link up/down event detected.");
+   dev->dev_ops = _eth_dev_ops_fake;
+
+   adapter->rx_backup = dev->rx_pkt_burst;
+   adapter->tx_backup = dev->tx_pkt_burst;
+   dev->rx_pkt_burst = ixgbevf_recv_pkts_fake;
+   dev->tx_pkt_burst = ixgbevf_xmit_pkts_fake;
+   }
+   }
+}
+
+void
+ixgbevf_dev_link_up_down_handler(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)dev->data->dev_private;
+   int diag;
+   uint32_t vteiam;
+
+   /* Only one working core need to performance VF reset */
+   if (rte_spinlock_trylock(>vf_reset_lock)) {
+   /**
+* When fake rec/xmit is replaced, working thread may is running
+* into real RX/TX func, so wait long enough to assume all
+* working thread exit. The assumption is it will spend less
+* than 100us for each execution of RX and TX func.
+*/
+   rte_delay_us(100);
+
+   do {
+   dev->data->dev_started = 0;
+   ixgbevf_dev_stop(dev);
+   rte_delay_us(100);

[dpdk-dev] [PATCH 2/4] igb: VF supports mailbox interruption for PF link up/down

2016-05-05 Thread Wenzhuo Lu
In this scenario, kernel PF + DPDK VF, when PF finds the link
state is changed, up -> down or down -> up, it will send a
mailbox message to VF.
This patch enables the support of the interruption of mailbox,
so VF can receive the message for link up/down.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_07.rst |   2 +-
 drivers/net/e1000/igb_ethdev.c | 159 +
 2 files changed, 160 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index be702fd..8d45915 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -34,7 +34,7 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

-* **Added mailbox interruption support for ixgbe VF.**
+* **Added mailbox interruption support for ixgbe/igb VF.**

   When the link becomes down or up, PF will use mailbox message to notice
   VF. To handle this link up/down event, add the mailbox interruption
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index f0921ee..b0e5e6a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -86,6 +86,12 @@
 #define E1000_INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
 #define E1000_TSAUXC_DISABLE_SYSTIME 0x8000

+#define E1000_VTIVAR_MISC0x01740
+#define E1000_VTIVAR_MISC_MASK   0xFF
+#define E1000_VTIVAR_VALID   0x80
+#define E1000_VTIVAR_MISC_MAILBOX0
+#define E1000_VTIVAR_MISC_INTR_MASK  0x3
+
 static int  eth_igb_configure(struct rte_eth_dev *dev);
 static int  eth_igb_start(struct rte_eth_dev *dev);
 static void eth_igb_stop(struct rte_eth_dev *dev);
@@ -259,6 +265,9 @@ static void eth_igb_assign_msix_vector(struct e1000_hw *hw, 
int8_t direction,
 static void eth_igb_write_ivar(struct e1000_hw *hw, uint8_t msix_vector,
   uint8_t index, uint8_t offset);
 static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);
+static void eth_igbvf_interrupt_handler(struct rte_intr_handle *handle,
+   void *param);
+static void igbvf_mbx_process(struct rte_eth_dev *dev);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -554,6 +563,41 @@ igb_intr_disable(struct e1000_hw *hw)
E1000_WRITE_FLUSH(hw);
 }

+static inline void
+igbvf_intr_enable(struct rte_eth_dev *dev)
+{
+   struct e1000_hw *hw =
+   E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* only for mailbox */
+   E1000_WRITE_REG(hw, E1000_EIAM, 1 << E1000_VTIVAR_MISC_MAILBOX);
+   E1000_WRITE_REG(hw, E1000_EIAC, 1 << E1000_VTIVAR_MISC_MAILBOX);
+   E1000_WRITE_REG(hw, E1000_EIMS, 1 << E1000_VTIVAR_MISC_MAILBOX);
+   E1000_WRITE_FLUSH(hw);
+}
+
+/* only for mailbox now. If RX/TX needed, should extend this function.  */
+static void
+igbvf_set_ivar_map(struct e1000_hw *hw, uint8_t msix_vector)
+{
+   uint32_t tmp = 0;
+
+   /* mailbox */
+   tmp |= (msix_vector & E1000_VTIVAR_MISC_INTR_MASK);
+   tmp |= E1000_VTIVAR_VALID;
+   E1000_WRITE_REG(hw, E1000_VTIVAR_MISC, tmp);
+}
+
+static void
+eth_igbvf_configure_msix_intr(struct rte_eth_dev *dev)
+{
+   struct e1000_hw *hw =
+   E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* Configure VF other cause ivar */
+   igbvf_set_ivar_map(hw, E1000_VTIVAR_MISC_MAILBOX);
+}
+
 static inline int32_t
 igb_pf_reset_hw(struct e1000_hw *hw)
 {
@@ -942,6 +986,10 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
 eth_dev->data->port_id, pci_dev->id.vendor_id,
 pci_dev->id.device_id, "igb_mac_82576_vf");

+   rte_intr_callback_register(_dev->intr_handle,
+  eth_igbvf_interrupt_handler,
+  (void *)eth_dev);
+
return 0;
 }

@@ -950,6 +998,7 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
struct e1000_adapter *adapter =
E1000_DEV_PRIVATE(eth_dev->data->dev_private);
+   struct rte_pci_device *pci_dev = eth_dev->pci_dev;

PMD_INIT_FUNC_TRACE();

@@ -966,6 +1015,12 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;

+   /* disable uio intr before callback unregister */
+   rte_intr_disable(_dev->intr_handle);
+   rte_intr_callback_unregister(_dev->intr_handle,
+eth_igbvf_interrupt_handler,
+(void *)eth_dev);
+
return 0;
 }

@@ -2564,6 +2619,69 @@ eth_igb_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,
 }

 static int
+eth_igbvf_interrupt_get_status(struct rte_eth_dev *dev)
+{
+   uint32_t eicr;
+   struct e1000_hw *hw =
+   

[dpdk-dev] [PATCH 1/4] ixgbe: VF supports mailbox interruption for PF link up/down

2016-05-05 Thread Wenzhuo Lu
In this scenario, kernel PF + DPDK VF, when PF finds the link
state is changed, up -> down or down -> up, it will send a
mailbox message to VF.
This patch enables the support of the interruption of mailbox,
so VF can receive the message for link up/down.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_07.rst |  6 +++
 drivers/net/ixgbe/ixgbe_ethdev.c   | 85 --
 2 files changed, 88 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 83c841b..be702fd 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -34,6 +34,12 @@ This section should contain new features added in this 
release. Sample format:

   Refer to the previous release notes for examples.

+* **Added mailbox interruption support for ixgbe VF.**
+
+  When the link becomes down or up, PF will use mailbox message to notice
+  VF. To handle this link up/down event, add the mailbox interruption
+  support to receive the message.
+

 Resolved Issues
 ---
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index eec607c..8e5f64f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -151,6 +151,8 @@
 #define IXGBE_VMTIR(_i) (0x00017000 + ((_i) * 4)) /* 64 of these (0-63) */
 #define IXGBE_QDE_STRIP_TAG0x0004

+#define IXGBE_VTEICR_MASK0x07
+
 enum ixgbevf_xcast_modes {
IXGBEVF_XCAST_MODE_NONE = 0,
IXGBEVF_XCAST_MODE_MULTI,
@@ -361,6 +363,8 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev *dev,
   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
   const struct timespec *timestamp);
+static void ixgbevf_dev_interrupt_handler(struct rte_intr_handle *handle,
+ void *param);

 static int ixgbe_dev_l2_tunnel_eth_type_conf
(struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
@@ -1441,6 +1445,12 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
return -EIO;
}

+   rte_intr_callback_register(_dev->intr_handle,
+  ixgbevf_dev_interrupt_handler,
+  (void *)eth_dev);
+   rte_intr_enable(_dev->intr_handle);
+   ixgbevf_intr_enable(hw);
+
PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x mac.type=%s",
 eth_dev->data->port_id, pci_dev->id.vendor_id,
 pci_dev->id.device_id, "ixgbe_mac_82599_vf");
@@ -1454,6 +1464,7 @@ static int
 eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
struct ixgbe_hw *hw;
+   struct rte_pci_device *pci_dev = eth_dev->pci_dev;

PMD_INIT_FUNC_TRACE();

@@ -1475,6 +1486,11 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;

+   rte_intr_disable(_dev->intr_handle);
+   rte_intr_callback_unregister(_dev->intr_handle,
+ixgbevf_dev_interrupt_handler,
+(void *)eth_dev);
+
return 0;
 }

@@ -4073,6 +4089,8 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)

PMD_INIT_FUNC_TRACE();

+   ixgbevf_intr_disable(hw);
+
hw->adapter_stopped = 1;
ixgbe_stop_adapter(hw);

@@ -4796,6 +4814,9 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)
uint32_t q_idx;
uint32_t vector_idx = IXGBE_MISC_VEC_ID;

+   /* Configure VF other cause ivar */
+   ixgbevf_set_ivar_map(hw, -1, 1, vector_idx);
+
/* won't configure msix register if no mapping is done
 * between intr vector and event fd.
 */
@@ -4810,9 +4831,6 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)
ixgbevf_set_ivar_map(hw, 0, q_idx, vector_idx);
intr_handle->intr_vec[q_idx] = vector_idx;
}
-
-   /* Configure VF other cause ivar */
-   ixgbevf_set_ivar_map(hw, -1, 1, vector_idx);
 }

 /**
@@ -7131,6 +7149,67 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
 }

+static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   u32 in_msg = 0;
+
+   if (ixgbe_read_mbx(hw, _msg, 1, 0))
+   return;
+
+   /* PF reset VF event */
+   if (in_msg == IXGBE_PF_CONTROL_MSG)
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+}
+
+static int
+ixgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev)
+{
+   uint32_t eicr;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct ixgbe_interrupt *intr =
+   

[dpdk-dev] [PATCH 0/4] automatic link recovery on ixgbe/igb VF

2016-05-05 Thread Wenzhuo Lu
Now if the PF link is down and up, VF doesn't handle this event,
user need to reset the VF port to let it recover.
This patch set addes the support of the mailbox interruption on
VF. So, VF can receice the messges for physical link down/up.
And VF will handle this event and let the VF link recover
automatically.

Wenzhuo Lu (4):
  ixgbe: VF supports mailbox interruption for PF link up/down
  igb: VF supports mailbox interruption for PF link up/down
  ixgbe: automatic link recovery on VF
  igb: automatic link recovery on VF

 doc/guides/rel_notes/release_16_07.rst |  11 ++
 drivers/net/e1000/e1000_ethdev.h   |  14 ++
 drivers/net/e1000/igb_ethdev.c | 244 +
 drivers/net/e1000/igb_rxtx.c   |  38 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 169 ++-
 drivers/net/ixgbe/ixgbe_ethdev.h   |  14 ++
 drivers/net/ixgbe/ixgbe_rxtx.c |  34 +
 drivers/net/ixgbe/ixgbe_rxtx.h |   2 +
 8 files changed, 523 insertions(+), 3 deletions(-)

-- 
1.9.3



[dpdk-dev] [PATCH v3 2/2] virtio: fix memory leak of virtqueue memzones

2016-05-05 Thread Tan, Jianfeng
Hi Yuanhan,

> -Original Message-
> From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> Sent: Thursday, May 5, 2016 11:28 AM
> To: Tan, Jianfeng
> Cc: dev at dpdk.org; Xie, Huawei
> Subject: Re: [dpdk-dev] [PATCH v3 2/2] virtio: fix memory leak of virtqueue
> memzones
> 
> ping...
> 
> On Thu, Apr 28, 2016 at 10:33:08PM -0700, Yuanhan Liu wrote:
> > On Fri, Apr 29, 2016 at 12:48:46AM +, Jianfeng Tan wrote:
> > > @@ -447,6 +453,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev
> *dev,
> > >
> > >   hw->vtpci_ops->setup_queue(hw, vq);
> > >
> > > + vq->started = 1;
> >
> > Judging that this is in the "_queue_setup" stage, and we have another
> > stage called "_dev_start", naming it to "started" seems confusing then.
> >
> > So, how about naming it to something like "configured"? Besides that,
> > this patch set looks good to me. If you agree the name change, or have
> > better idea, I could fix it while applying it.

Yes, I agree _configured_ would be better.

Thanks,
Jianfeng 

> >
> > --yliu


[dpdk-dev] [PATCH] virtio: split virtio rx/tx queue

2016-05-05 Thread Xie, Huawei
On 5/5/2016 11:03 AM, Yuanhan Liu wrote:
> On Thu, May 05, 2016 at 01:54:25AM +, Xie, Huawei wrote:
>> On 5/5/2016 7:59 AM, Yuanhan Liu wrote:
>>> On Wed, May 04, 2016 at 08:50:27AM +0800, Huawei Xie wrote:
 -int virtio_dev_queue_setup(struct rte_eth_dev *dev,
 -  int queue_type,
 -  uint16_t queue_idx,
 +static int
 +virtio_dev_cq_queue_setup(struct rte_eth_dev *dev,
>>> While it's good to split Rx/Tx specific stuff, but why are you trying to
>>> remove a common queue_setup function that does common setups, such as vring
>>> memory allocation.
>>>
>>> This results to much duplicated code: following diff summary also shows
>>> it clearly:
>> The motivation to do this is we need separate RX/TX queue setup.
> We actually have done that. If you look at current rx/tx/ctrl_queue_setup()
> code, we invoked the common function; we also did some queue specific
> settings. It has not been done in a very clean way though: there are quite
> many "if .. else .." as you stated. And that's what you are going to resolve,
> but IMO, you went far: you made __same__ code 3 copies, one for rx, tx and
> ctrl queue, respectively.
>
>> The switch/case in the common queue setup looks bad.
> Assuming you are talking about the "if .. else .." ...
>
> While I agree with you on that, introducing so many duplicated code is worse.
>
>> I am aware of the common operations, and i had planned to extract them,
>> maybe i could do this in this patchset.
> If you meant to do in another patch on top of this patch, then it looks
> like the wrong way to go: breaking something first and then fixing it
> later does not sound a good practice to me.

To your later comment, we could split first, then do the queue setup rework.

>
>>> 7 files changed, 655 insertions(+), 422 deletions(-)
>>>
>>> which makes it harder for maintaining.
>>>
 -}
 +  rxvq = (struct virtnet_rx *)RTE_PTR_ADD(vq,
 +  sizeof(*vq) + vq_size * sizeof(struct vq_desc_extra));
 +  rxvq->vq = vq;
 +  vq->sw_ring = sw_ring;
>>> sw_ring is needed for rx queue only, why not moving it to rx queue struct?
>> Actually this is not about sw_ring.
>> I had planned to use sw_ring for both RX/TX and remove the vq_desc_extra.
>> Two issues
>> 1. RX uses both sw_ring and vq_desc_extra
>> 2. ndescs in vq_desc_extra isn't really needed, we could simply
>> calculate this when we walk through the desc chain, and in most cases,
>> it is 1 or 2.
>>
>> As it is not related to this rework, will do this in a separate patch.
> Yes, it's not related to this patch, and this patch does rx/tx split
> only. So, thinking that sw_ring is for rx only, you should move there.
>
> It will not against with your plan; you can make corresponding change
> there. But for this patch, let's do the split only.
>
> BTW, I still would suggest you to build the patch on top of the cleanup
> and memory leak fix patches from Jianfeng. Your patch won't apply on
> top of current dpdk-next-virtio, and one way or another, you need do
> a rebase.
>
> Last, if I were you, I would split this patch in two: one to move
> the queue specific settings to it's queue setup function, another
> to split rx/tx fields. That would make it easier for review.
>
>   --yliu
>



[dpdk-dev] [PATCH] virtio: split virtio rx/tx queue

2016-05-05 Thread Xie, Huawei
On 5/5/2016 7:59 AM, Yuanhan Liu wrote:
> On Wed, May 04, 2016 at 08:50:27AM +0800, Huawei Xie wrote:
>> -int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>> -int queue_type,
>> -uint16_t queue_idx,
>> +static int
>> +virtio_dev_cq_queue_setup(struct rte_eth_dev *dev,
> While it's good to split Rx/Tx specific stuff, but why are you trying to
> remove a common queue_setup function that does common setups, such as vring
> memory allocation.
>
> This results to much duplicated code: following diff summary also shows
> it clearly:

The motivation to do this is we need separate RX/TX queue setup.
The switch/case in the common queue setup looks bad.

I am aware of the common operations, and i had planned to extract them,
maybe i could do this in this patchset.


>
> 7 files changed, 655 insertions(+), 422 deletions(-)
>
> which makes it harder for maintaining.
>
>> -}
>> +rxvq = (struct virtnet_rx *)RTE_PTR_ADD(vq,
>> +sizeof(*vq) + vq_size * sizeof(struct vq_desc_extra));
>> +rxvq->vq = vq;
>> +vq->sw_ring = sw_ring;
> sw_ring is needed for rx queue only, why not moving it to rx queue struct?

Actually this is not about sw_ring.
I had planned to use sw_ring for both RX/TX and remove the vq_desc_extra.
Two issues
1. RX uses both sw_ring and vq_desc_extra
2. ndescs in vq_desc_extra isn't really needed, we could simply
calculate this when we walk through the desc chain, and in most cases,
it is 1 or 2.

As it is not related to this rework, will do this in a separate patch.

>
>>  static void
>> -virtio_update_packet_stats(struct virtqueue *vq, struct rte_mbuf *mbuf)
>> +virtio_update_rxq_stats(struct virtnet_rx *rxvq, struct rte_mbuf *mbuf)
>>  {
>>  uint32_t s = mbuf->pkt_len;
>>  struct ether_addr *ea;
>>  
>>  if (s == 64) {
>> -vq->size_bins[1]++;
>> +rxvq->stats.size_bins[1]++;
>>  } else if (s > 64 && s < 1024) {
>>  uint32_t bin;
>>  
>>  /* count zeros, and offset into correct bin */
>>  bin = (sizeof(s) * 8) - __builtin_clz(s) - 5;
>> -vq->size_bins[bin]++;
>> +rxvq->stats.size_bins[bin]++;
>>  } else {
>>  if (s < 64)
>> -vq->size_bins[0]++;
>> +rxvq->stats.size_bins[0]++;
>>  else if (s < 1519)
>> -vq->size_bins[6]++;
>> +rxvq->stats.size_bins[6]++;
>>  else if (s >= 1519)
>> -vq->size_bins[7]++;
>> +rxvq->stats.size_bins[7]++;
>>  }
>>  
>>  ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *);
>>  if (is_multicast_ether_addr(ea)) {
>>  if (is_broadcast_ether_addr(ea))
>> -vq->broadcast++;
>> +rxvq->stats.broadcast++;
>>  else
>> -vq->multicast++;
>> +rxvq->stats.multicast++;
>> +}
>> +}
>> +
>> +static void
>> +virtio_update_txq_stats(struct virtnet_tx *txvq, struct rte_mbuf *mbuf)
> Why not taking "struct virtnet_stats *stats" as the arg, so that we
> don't have to implment two exactly same functions.

ok to me.

>
>> diff --git a/drivers/net/virtio/virtio_rxtx.h 
>> b/drivers/net/virtio/virtio_rxtx.h
>> index a76c3e5..ced55a3 100644
>> --- a/drivers/net/virtio/virtio_rxtx.h
>> +++ b/drivers/net/virtio/virtio_rxtx.h
>> @@ -34,7 +34,59 @@
>>  #define RTE_PMD_VIRTIO_RX_MAX_BURST 64
>>  
>>  #ifdef RTE_MACHINE_CPUFLAG_SSSE3
>> -int virtio_rxq_vec_setup(struct virtqueue *rxq);
>> +
>> +struct virtnet_stats {
> Another remind again: you should put following codes before the
> "#ifdef".
>
>   --yliu
>



[dpdk-dev] [RFC PATCH 0/4]: Implement module information export

2016-05-05 Thread Thomas Monjalon
This discussion requires more opinions.
Please everybody, READ and COMMENT. Thanks

If it is not enough visible, a new thread could be started later.

2016-05-04 07:43, Neil Horman:
> On Wed, May 04, 2016 at 10:24:18AM +0200, David Marchand wrote:
> > On Tue, May 3, 2016 at 1:57 PM, Neil Horman  
> > wrote:
> > >> This approach has a few pros and cons:
> > >>
> > >> pros:
> > >> 1) Its simple, and doesn't require extra infrastructure to implement.  
> > >> E.g. we
> > >> don't need a new tool to extract driver information and emit the C code 
> > >> to build
> > >> the binary data for the special section, nor do we need a custom linker 
> > >> script
> > >> to link said special section in place
> > >>
> > >> 2) Its stable.  Because the marker symbols are explicitly exported, this
> > >> approach is resilient against stripping.

It is a good point. We need something resilient against stripping.

> > >> cons:
> > >> 1) It creates an artifact in that PMD_REGISTER_DRIVER has to be used in 
> > >> one
> > >> compilation unit per DSO.  As an example em and igb effectively merge two
> > >> drivers into one DSO, and the uses of PMD_REGISTER_DRIVER occur in two 
> > >> separate
> > >> C files for the same single linked DSO.  Because of the use of the 
> > >> __COUNTER__
> > >> macro we get multiple definitions of the same marker symbols.
> > >>
> > >> I would make the argument that the downside of the above artifact isn't 
> > >> that big
> > >> a deal.  Traditionally in other projects a unit like a module (or DSO in 
> > >> our
> > >> case) only ever codifies a single driver (e.g. module_init() in the 
> > >> linux kernel
> > >> is only ever used once per built module).  If we have code like igb/em 
> > >> that
> > >> shares some core code, we should build the shared code to object files 
> > >> and link
> > >> them twice, once to an em.so pmd and again to an igb.so pmd.

It is also a problem for compilation units having PF and VF drivers.

> > >> But regardless, I thought I would propose this to see what you all 
> > >> thought of
> > >> it.

Thanks for proposing.

> > - This implementation does not support binaries, so it is not suitable
> > for people who don't want dso, this is partially why I used bfd rather
> > than just dlopen.
> 
> If you're statically linking an application, you should know what hardware you
> support already.  Its going to be very hard, if not impossible to develop a
> robust solution that works with static binaries (the prior solutions don't 
> work
> consistently with static binaries either).  I really think the static solution
> needs to just be built into the application (i.e. the application needs to 
> add a
> command line option to dump out the pci id's that are registered).

No, we need a tool to know what are the supported devices before running
the application (e.g. for binding).
This tool should not behave differently depending of how DPDK was compiled
(static or shared).

[...]
> > - How does it behave if we strip the dsos ?
> 
> I described this above, its invariant to stripping, because the symbols for 
> each
> pmd are explicitly exported, so strip doesn't touch the symbols that pmdinfo
> keys off of.
> 
[...]
> > - The tool output format is not script friendly from my pov.
> 
> Don't think it really needs to be script friendly, it was meant to provide 
> human
> readable output, but script friendly output can be added easily enough if you
> want.

Yes it needs to be script friendly.

It appears that we must agree on a set of requirements first.
Please let's forget the implementation until we have collected enough
feedbacks on the needs.
I suggest these items to start the list:

- query all drivers in static binary or shared library
- stripping resiliency
- human friendly
- script friendly
- show driver name
- list supported device id / name
- list driver options
- show driver version if available
- show dpdk version
- show kernel dependencies (vfio/uio_pci_generic/etc)
- room for extra information?

Please ack or comment items of this list, thanks.