[dpdk-dev] [PATCH] net/avf: fix missing offload capabilities

2018-07-25 Thread Xiaoyun Li
There are several tx/rx offload capabilities missing in AVF.
Add them in this patch since AVF supports them.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: sta...@dpdk.org

Signed-off-by: Xiaoyun Li 
---
 drivers/net/avf/avf_ethdev.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 0e21f8c..3a2baaf 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -518,16 +518,30 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
dev_info->max_mac_addrs = AVF_NUM_MACADDR_MAX;
dev_info->rx_offload_capa =
DEV_RX_OFFLOAD_VLAN_STRIP |
+   DEV_RX_OFFLOAD_QINQ_STRIP |
DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM |
-   DEV_RX_OFFLOAD_TCP_CKSUM;
+   DEV_RX_OFFLOAD_TCP_CKSUM |
+   DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+   DEV_RX_OFFLOAD_CRC_STRIP |
+   DEV_RX_OFFLOAD_KEEP_CRC |
+   DEV_RX_OFFLOAD_SCATTER |
+   DEV_RX_OFFLOAD_JUMBO_FRAME |
+   DEV_RX_OFFLOAD_VLAN_FILTER;
dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_VLAN_INSERT |
+   DEV_TX_OFFLOAD_QINQ_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
DEV_TX_OFFLOAD_TCP_CKSUM |
DEV_TX_OFFLOAD_SCTP_CKSUM |
-   DEV_TX_OFFLOAD_TCP_TSO;
+   DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+   DEV_TX_OFFLOAD_TCP_TSO |
+   DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+   DEV_TX_OFFLOAD_GRE_TNL_TSO |
+   DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+   DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+   DEV_TX_OFFLOAD_MULTI_SEGS;
 
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = AVF_DEFAULT_RX_FREE_THRESH,
-- 
2.7.4



[dpdk-dev] [PATCH 1/3] net/virtio: remove unnecessary assignments

2018-07-25 Thread Tiwei Bie
Remove the unnecessary assignments in Rx functions
as they are useless and misleading.

Signed-off-by: Tiwei Bie 
---
 drivers/net/virtio/virtio_rxtx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 7c105229e..eb891433e 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -960,7 +960,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
rxvq->stats.packets += nb_rx;
 
/* Allocate new mbuf for the used descriptor */
-   error = ENOSPC;
while (likely(!virtqueue_full(vq))) {
new_mbuf = rte_mbuf_raw_alloc(rxvq->mpool);
if (unlikely(new_mbuf == NULL)) {
@@ -1319,7 +1318,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
rxvq->stats.packets += nb_rx;
 
/* Allocate new mbuf for the used descriptor */
-   error = ENOSPC;
while (likely(!virtqueue_full(vq))) {
new_mbuf = rte_mbuf_raw_alloc(rxvq->mpool);
if (unlikely(new_mbuf == NULL)) {
-- 
2.18.0



[dpdk-dev] [PATCH 3/3] net/virtio: remove an unused macro

2018-07-25 Thread Tiwei Bie
This macro isn't used any more after below commit:
commit a4996bd89c42 ("ethdev: new Rx/Tx offloads API")

Signed-off-by: Tiwei Bie 
---
 drivers/net/virtio/virtio_ethdev.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index f4d09df71..b726ad108 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -42,13 +42,6 @@
 1u << VIRTIO_NET_F_GUEST_TSO4 |\
 1u << VIRTIO_NET_F_GUEST_TSO6)
 
-#define VIRTIO_PMD_PER_DEVICE_RX_OFFLOADS  \
-   (DEV_RX_OFFLOAD_TCP_CKSUM | \
-DEV_RX_OFFLOAD_UDP_CKSUM | \
-DEV_RX_OFFLOAD_TCP_LRO |   \
-DEV_RX_OFFLOAD_VLAN_FILTER |   \
-DEV_RX_OFFLOAD_VLAN_STRIP)
-
 /*
  * CQ function prototype
  */
-- 
2.18.0



[dpdk-dev] [PATCH 2/3] vhost: remove an unused variable

2018-07-25 Thread Tiwei Bie
The nr_updated is just increased and not really used.

Signed-off-by: Tiwei Bie 
---
 lib/librte_vhost/virtio_net.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 2b7ffcf92..b17c3e907 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1343,7 +1343,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
 
if (unlikely(dev->dequeue_zero_copy)) {
struct zcopy_mbuf *zmbuf, *next;
-   int nr_updated = 0;
 
for (zmbuf = TAILQ_FIRST(&vq->zmbuf_list);
 zmbuf != NULL; zmbuf = next) {
@@ -1352,8 +1351,6 @@ virtio_dev_tx_split(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
if (mbuf_is_consumed(zmbuf->mbuf)) {
update_shadow_used_ring_split(vq,
zmbuf->desc_idx, 0);
-   nr_updated += 1;
-
TAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next);
restore_mbuf(zmbuf->mbuf);
rte_pktmbuf_free(zmbuf->mbuf);
-- 
2.18.0



[dpdk-dev] [Bug 75] 16.11 compile fail on RHEL 6.9

2018-07-25 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=75

Bug ID: 75
   Summary: 16.11 compile fail on RHEL 6.9
   Product: DPDK
   Version: 16.11
  Hardware: x86
OS: Linux
Status: CONFIRMED
  Severity: normal
  Priority: Normal
 Component: core
  Assignee: dev@dpdk.org
  Reporter: easethewo...@gmail.com
  Target Milestone: ---

I recently updated RHEL 6.7 to 6.9 then dpdk compile failed.

== Build lib/librte_eal/linuxapp/kni
dpdk-stable-16.11.7/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h:2837:2:
error: implicit declaration of function 'vlan_tx_tag_present'

The reason is that
vlan_tx_tag_* macros renamed to skb_vlan_tag_* in (>RHEL6.8 && 

[dpdk-dev] [PATCH] vhost: fix return value

2018-07-25 Thread Jiayu Hu
This patch fixes the incorrect return value for rte_vhost_dequeue_burst()
when virtqueue is not enabled or virtqueue address translation fails.

Fixes: 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx 
functions")

Signed-off-by: Jiayu Hu 
---
 lib/librte_vhost/virtio_net.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 2b7ffcf..5d4b975 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1592,15 +1592,19 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
if (unlikely(rte_spinlock_trylock(&vq->access_lock) == 0))
return 0;
 
-   if (unlikely(vq->enabled == 0))
+   if (unlikely(vq->enabled == 0)) {
+   count = 0;
goto out_access_unlock;
+   }
 
if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
vhost_user_iotlb_rd_lock(vq);
 
if (unlikely(vq->access_ok == 0))
-   if (unlikely(vring_translate(dev, vq) < 0))
+   if (unlikely(vring_translate(dev, vq) < 0)) {
+   count = 0;
goto out;
+   }
 
/*
 * Construct a RARP broadcast packet, and inject it to the "pkts"
-- 
2.7.4



Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Thomas Monjalon
24/07/2018 18:59, Dumitrescu, Cristian:
> From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > 
> > Even after this fix we still have setups that use netvsc  for example,  on
> > which testpmd exits with rte_panic right after loading it even without
> > touching the KBD.
> > 
> > I recommend returning the previous prompt routine in test-pmd/cmdline.c
> > and rework the SOFTNIC section there, preferably moving its poll section to
> > use rte_service in a separate file cleaning the CLI files from PMD-specific
> > implementation.
> > 
> > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > >
> > > Important note:
> > >   testpmd is currently really broken.
> > >   We cannot have a RC2 until it is fixed.
> > >
> 
> First, testpmd is not really broken, as only thing that changed is the Ctrl + 
> D behavior. I agree this is an issue that we need to fix, as it looks that it 
> is breaking some automation scripts for some people.
> 
> The change in behavior for Ctrl + D exit is caused by replacing the call to 
> cmdline_interact() with calling cmdline_poll() in a loop. These two 
> approaches should be identical in behavior, but it looks like they are not 
> due to some issue in the cmdline library. Jasvinder proposed a quick patch, 
> but it looks like something else needs to be fixed in cmdline library in 
> order to bring cmdline_poll() on parity with cmdline_interact(). Any advice 
> from Olivier would be very much appreciated!
> 
> It is really a bad practice to use cmdline_interact() in testpmd, as it is a 
> blocking call that prohibits doing other things on the same thread that runs 
> the CLI. Sometimes we need to run other things on the same core, e.g. the 
> slow softnic_manage() function.
> 
> Worst case scenario: We can revert the cmdline_poll() back to 
> cmdline_interact(), this is a small change, but not the proper way of doing 
> things, as this is simply hiding the issue in cmdline library. It would also 
> prevent us from testing some Soft NIC functionality.

There are some crashes, even without touching the keyboard.
So yes, we should revert.




Re: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: workaround softnic CLI modifications

2018-07-25 Thread Thomas Monjalon
24/07/2018 19:39, Dumitrescu, Cristian:
> 
> > -Original Message-
> > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Moti Haimovsky
> > Sent: Tuesday, July 24, 2018 5:21 PM
> > To: tho...@monjalon.net
> > Cc: dev@dpdk.org; sta...@dpdk.org; Moti Haimovsky
> > 
> > Subject: [dpdk-dev] [PATCH] app/testpmd: workaround softnic CLI
> > modifications
> > 
> > This patch returns the previous testpmd command line handling
> > routines (namely cmdline_interact and cmdline_stdin_exit) to the
> > prompt routine in order to overcome testpmd abnormal exit observed on
> > several setups.
> > These routines will only by used when testpmd is compiled without
> > support for RTE_LIBRTE_PMD_SOFTNIC
> > 
> > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> > Cc: sta...@dpdk.org
> > 
> > Signed-off-by: Moti Haimovsky 
> > ---
> >  app/test-pmd/cmdline.c | 18 +-
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> 
> We should probably fix the issue in the cmdline library to bring 
> cmdline_poll() on parity with cmdline_interact(), but this is a decent 
> workaround to avoid breaking those automation scripts that rely on Ctrl+D 
> behavior.

This workaround works only when disabling softnic.
It means:
1/ softnic usage is not fixed
2/ we need to disable softnic for all other usages

I think it is not good enough.




Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Singh, Jasvinder



> -Original Message-
> From: Thomas Monjalon [mailto:tho...@monjalon.net]
> Sent: Wednesday, July 25, 2018 9:19 AM
> To: Dumitrescu, Cristian 
> Cc: dev@dpdk.org; Mordechay Haimovsky ; Singh,
> Jasvinder ; Iremonger, Bernard
> ; Pattan, Reshma
> ; olivier.m...@6wind.com
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 24/07/2018 18:59, Dumitrescu, Cristian:
> > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > >
> > > Even after this fix we still have setups that use netvsc  for
> > > example,  on which testpmd exits with rte_panic right after loading
> > > it even without touching the KBD.
> > >
> > > I recommend returning the previous prompt routine in
> > > test-pmd/cmdline.c and rework the SOFTNIC section there, preferably
> > > moving its poll section to use rte_service in a separate file
> > > cleaning the CLI files from PMD-specific implementation.
> > >
> > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > >
> > > > Important note:
> > > > testpmd is currently really broken.
> > > > We cannot have a RC2 until it is fixed.
> > > >
> >
> > First, testpmd is not really broken, as only thing that changed is the Ctrl 
> > + D
> behavior. I agree this is an issue that we need to fix, as it looks that it is
> breaking some automation scripts for some people.
> >
> > The change in behavior for Ctrl + D exit is caused by replacing the call to
> cmdline_interact() with calling cmdline_poll() in a loop. These two approaches
> should be identical in behavior, but it looks like they are not due to some 
> issue
> in the cmdline library. Jasvinder proposed a quick patch, but it looks like
> something else needs to be fixed in cmdline library in order to bring
> cmdline_poll() on parity with cmdline_interact(). Any advice from Olivier 
> would
> be very much appreciated!
> >
> > It is really a bad practice to use cmdline_interact() in testpmd, as it is a
> blocking call that prohibits doing other things on the same thread that runs 
> the
> CLI. Sometimes we need to run other things on the same core, e.g. the slow
> softnic_manage() function.
> >
> > Worst case scenario: We can revert the cmdline_poll() back to
> cmdline_interact(), this is a small change, but not the proper way of doing
> things, as this is simply hiding the issue in cmdline library. It would also 
> prevent
> us from testing some Soft NIC functionality.
> 
> There are some crashes, even without touching the keyboard.

Thomas, could you be specific here so that we can reproduce the issues you are 
mentioning? Thanks.

> So yes, we should revert.
> 



[dpdk-dev] [PATCH] ethdev: remove unused forward declaration.

2018-07-25 Thread Rami Rosen
The forward declaraion of rte_pci_device in rte_ethdev.h
is not needed anymore.
Fixes: cd8c7c7ce241 ("replace bus specific struct with generic dev")

Signed-off-by: Rami Rosen 
---
 lib/librte_ethdev/rte_ethdev.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f5f593b..b146dc6 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -964,8 +964,6 @@ struct rte_eth_conf {
  * mentioned in rte_tx_offload_names in rte_ethdev.c file.
  */
 
-struct rte_pci_device;
-
 /*
  * Fallback default preferred Rx/Tx port parameters.
  * These are used if an application requests default parameters
-- 
1.9.1



[dpdk-dev] [PATCH] net/mlx5: fix count query when flow has not counters

2018-07-25 Thread Nelio Laranjeiro
Querying a counters on a flow without counter is ending with a
segmentation fault.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")

Signed-off-by: Nelio Laranjeiro 
---
 drivers/net/mlx5/mlx5_flow.c | 56 
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 6fa4e30ae..efaa8b4fb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3192,32 +3192,40 @@ mlx5_flow_query_count(struct rte_flow *flow 
__rte_unused,
  struct rte_flow_error *error)
 {
 #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
-   struct rte_flow_query_count *qc = data;
-   uint64_t counters[2] = {0, 0};
-   struct ibv_query_counter_set_attr query_cs_attr = {
-   .cs = flow->counter->cs,
-   .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
-   };
-   struct ibv_counter_set_data query_out = {
-   .out = counters,
-   .outlen = 2 * sizeof(uint64_t),
-   };
-   int err = mlx5_glue->query_counter_set(&query_cs_attr, &query_out);
+   if (flow->modifier & MLX5_FLOW_MOD_COUNT) {
+   struct rte_flow_query_count *qc = data;
+   uint64_t counters[2] = {0, 0};
+   struct ibv_query_counter_set_attr query_cs_attr = {
+   .cs = flow->counter->cs,
+   .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
+   };
+   struct ibv_counter_set_data query_out = {
+   .out = counters,
+   .outlen = 2 * sizeof(uint64_t),
+   };
+   int err = mlx5_glue->query_counter_set(&query_cs_attr,
+  &query_out);
 
-   if (err)
-   return rte_flow_error_set(error, err,
- RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
- NULL,
- "cannot read counter");
-   qc->hits_set = 1;
-   qc->bytes_set = 1;
-   qc->hits = counters[0] - flow->counter->hits;
-   qc->bytes = counters[1] - flow->counter->bytes;
-   if (qc->reset) {
-   flow->counter->hits = counters[0];
-   flow->counter->bytes = counters[1];
+   if (err)
+   return rte_flow_error_set
+   (error, err,
+RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+NULL,
+"cannot read counter");
+   qc->hits_set = 1;
+   qc->bytes_set = 1;
+   qc->hits = counters[0] - flow->counter->hits;
+   qc->bytes = counters[1] - flow->counter->bytes;
+   if (qc->reset) {
+   flow->counter->hits = counters[0];
+   flow->counter->bytes = counters[1];
+   }
+   return 0;
}
-   return 0;
+   return rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ "flow does not have counter");
 #endif
return rte_flow_error_set(error, ENOTSUP,
  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-- 
2.18.0



Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Singh, Jasvinder
> Sent: Wednesday, July 25, 2018 9:31 AM
> To: Thomas Monjalon ; Dumitrescu, Cristian
> 
> Cc: dev@dpdk.org; Mordechay Haimovsky ;
> Iremonger, Bernard ; Pattan, Reshma
> ; olivier.m...@6wind.com
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > Sent: Wednesday, July 25, 2018 9:19 AM
> > To: Dumitrescu, Cristian 
> > Cc: dev@dpdk.org; Mordechay Haimovsky ; Singh,
> > Jasvinder ; Iremonger, Bernard
> > ; Pattan, Reshma
> > ; olivier.m...@6wind.com
> > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> > 24/07/2018 18:59, Dumitrescu, Cristian:
> > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > >
> > > > Even after this fix we still have setups that use netvsc  for
> > > > example,  on which testpmd exits with rte_panic right after loading
> > > > it even without touching the KBD.
> > > >
> > > > I recommend returning the previous prompt routine in
> > > > test-pmd/cmdline.c and rework the SOFTNIC section there, preferably
> > > > moving its poll section to use rte_service in a separate file
> > > > cleaning the CLI files from PMD-specific implementation.
> > > >
> > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > >
> > > > > Important note:
> > > > >   testpmd is currently really broken.
> > > > >   We cannot have a RC2 until it is fixed.
> > > > >
> > >
> > > First, testpmd is not really broken, as only thing that changed is the 
> > > Ctrl +
> D
> > behavior. I agree this is an issue that we need to fix, as it looks that it 
> > is
> > breaking some automation scripts for some people.
> > >
> > > The change in behavior for Ctrl + D exit is caused by replacing the call 
> > > to
> > cmdline_interact() with calling cmdline_poll() in a loop. These two
> approaches
> > should be identical in behavior, but it looks like they are not due to some
> issue
> > in the cmdline library. Jasvinder proposed a quick patch, but it looks like
> > something else needs to be fixed in cmdline library in order to bring
> > cmdline_poll() on parity with cmdline_interact(). Any advice from Olivier
> would
> > be very much appreciated!
> > >
> > > It is really a bad practice to use cmdline_interact() in testpmd, as it 
> > > is a
> > blocking call that prohibits doing other things on the same thread that runs
> the
> > CLI. Sometimes we need to run other things on the same core, e.g. the
> slow
> > softnic_manage() function.
> > >
> > > Worst case scenario: We can revert the cmdline_poll() back to
> > cmdline_interact(), this is a small change, but not the proper way of doing
> > things, as this is simply hiding the issue in cmdline library. It would also
> prevent
> > us from testing some Soft NIC functionality.
> >
> > There are some crashes, even without touching the keyboard.
> 
> Thomas, could you be specific here so that we can reproduce the issues you
> are mentioning? Thanks.
> 

Yeah, I think the crash mention was about a custom automation script relying on 
Ctrl+D behavior, not about tespmd crash. Moti, please clarify.

> > So yes, we should revert.
> >



Re: [dpdk-dev] [PATCH] net/bonding: set started flag at the end of dev start

2018-07-25 Thread Radu Nicolau




On 7/24/2018 3:34 PM, Chas Williams wrote:
I think this adds another race.  In 
bond_ethdev_slave_link_status_change_monitor(), it checks to see if 
bonding is started, if not it exits.  So you need to have dev_started 
= 1 set before you enable this callback.



Indeed, I will have another look at this. Thanks for reviewing!
Can you also have a look at this one? https://patches.dpdk.org/patch/43187/
I think I addressed all your previous feedback.


Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Mordechay Haimovsky
Hi,
This issue happens on some of our setups sometimes without even pressing any 
key.
I will try to create a minimalistic setup which will show the problem and will 
be easy to construct by you.
Will send you all the details later on today.

Moti

> -Original Message-
> From: Singh, Jasvinder [mailto:jasvinder.si...@intel.com]
> Sent: Wednesday, July 25, 2018 11:31 AM
> To: Thomas Monjalon ; Dumitrescu, Cristian
> 
> Cc: dev@dpdk.org; Mordechay Haimovsky ;
> Iremonger, Bernard ; Pattan, Reshma
> ; olivier.m...@6wind.com
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > Sent: Wednesday, July 25, 2018 9:19 AM
> > To: Dumitrescu, Cristian 
> > Cc: dev@dpdk.org; Mordechay Haimovsky ; Singh,
> > Jasvinder ; Iremonger, Bernard
> > ; Pattan, Reshma
> > ; olivier.m...@6wind.com
> > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> >
> > 24/07/2018 18:59, Dumitrescu, Cristian:
> > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > >
> > > > Even after this fix we still have setups that use netvsc  for
> > > > example,  on which testpmd exits with rte_panic right after
> > > > loading it even without touching the KBD.
> > > >
> > > > I recommend returning the previous prompt routine in
> > > > test-pmd/cmdline.c and rework the SOFTNIC section there,
> > > > preferably moving its poll section to use rte_service in a
> > > > separate file cleaning the CLI files from PMD-specific implementation.
> > > >
> > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > >
> > > > > Important note:
> > > > >   testpmd is currently really broken.
> > > > >   We cannot have a RC2 until it is fixed.
> > > > >
> > >
> > > First, testpmd is not really broken, as only thing that changed is
> > > the Ctrl + D
> > behavior. I agree this is an issue that we need to fix, as it looks
> > that it is breaking some automation scripts for some people.
> > >
> > > The change in behavior for Ctrl + D exit is caused by replacing the
> > > call to
> > cmdline_interact() with calling cmdline_poll() in a loop. These two
> > approaches should be identical in behavior, but it looks like they are
> > not due to some issue in the cmdline library. Jasvinder proposed a
> > quick patch, but it looks like something else needs to be fixed in
> > cmdline library in order to bring
> > cmdline_poll() on parity with cmdline_interact(). Any advice from
> > Olivier would be very much appreciated!
> > >
> > > It is really a bad practice to use cmdline_interact() in testpmd, as
> > > it is a
> > blocking call that prohibits doing other things on the same thread
> > that runs the CLI. Sometimes we need to run other things on the same
> > core, e.g. the slow
> > softnic_manage() function.
> > >
> > > Worst case scenario: We can revert the cmdline_poll() back to
> > cmdline_interact(), this is a small change, but not the proper way of
> > doing things, as this is simply hiding the issue in cmdline library.
> > It would also prevent us from testing some Soft NIC functionality.
> >
> > There are some crashes, even without touching the keyboard.
> 
> Thomas, could you be specific here so that we can reproduce the issues you
> are mentioning? Thanks.
> 
> > So yes, we should revert.
> >



Re: [dpdk-dev] [dpdk-stable] [PATCH] doc: fix incorrect create bonding command in testpmd

2018-07-25 Thread Iremonger, Bernard
Hi Shreyansh,

> -Original Message-
> From: Yigit, Ferruh
> Sent: Monday, July 23, 2018 9:49 PM
> To: Shreyansh Jain ; dev@dpdk.org
> Cc: Iremonger, Bernard ; Wu, Jingjing
> ; Lu, Wenzhuo ;
> Mcnamara, John ; sta...@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH] doc: fix incorrect create bonding
> command in testpmd
> 
> On 7/23/2018 12:27 PM, Shreyansh Jain wrote:
> > Fixes: e76d7a768ce0 ("doc: fix syntax in testpmd user guide")
> > Cc: john.mcnam...@intel.com
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Shreyansh Jain 
> > ---
> > Note: Though the git blame suggest e76d7a768c as the last modification
> >   for fixes, this actually existed when testpmd doc was added.
> 
> You are right, I think fixes should be initial commit:
> Fixes: ac718398f477 ("doc: testpmd application user guide")
> 
> Reviewed-by: Ferruh Yigit 

Could you send a v2 with the correct Fixes line.

Otherwise

Acked-by: Bernard Iremonger 


Re: [dpdk-dev] [PATCH] sched: add 64-bit counter retrieval API

2018-07-25 Thread Alan Dewar
Hi Stephen,

Sorry about the delay in responding to your comment.

Maybe I'm missing something but I don't consider 64-bit counter
rollover to be a problem.
The DPDK QoS stats are just 32-bits wide and are zeroed when read.  So
if we read them frequently enough the 32-bit counters won't wrap.

This new API is just a convenient way to read the 32-bit counters into
variables that are 64-bit wide which allows Vyatta to have a common
API slightly above the DPDK.

I'd hope that at some point in time the DPDK will move to 64-bit
counters, but there may be technical reasons why this can't happen
that I'm not aware of (support for 32-bit CPUs??)

Regards
Alan

On Mon, Jul 23, 2018 at 5:52 PM, Stephen Hemminger
 wrote:
> On Wed, 18 Jul 2018 15:51:39 +0100
> alangordonde...@gmail.com wrote:
>
>> From: Alan Dewar 
>>
>> Add new APIs to retrieve counters in 64-bit wide fields.
>>
>> Signed-off-by: Alan Dewar 
>
> Do you want to consider 64 bit counter roll over on 32 bit platform?
> The problem is that incrementing an 64 bit value is not atomic on
> 32 bit cpu. The carry operation can race with reading.
>
> The kernel has special case code to do restartable sequence for
> accessing 64 bit counter on 32 bit CPU. These functions become
> nop's on 64bit.


Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Ananyev, Konstantin



> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu, Cristian
> Sent: Tuesday, July 24, 2018 5:59 PM
> To: Mordechay Haimovsky ; Thomas Monjalon 
> ; Singh, Jasvinder
> 
> Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan, 
> Reshma ;
> olivier.m...@6wind.com
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > Sent: Tuesday, July 24, 2018 3:37 PM
> > To: Thomas Monjalon ; Singh, Jasvinder
> > 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ; olivier.m...@6wind.com;
> > Dumitrescu, Cristian 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> > Even after this fix we still have setups that use netvsc  for example,  on
> > which testpmd exits with rte_panic right after loading it even without
> > touching the KBD.
> >
> > I recommend returning the previous prompt routine in test-pmd/cmdline.c
> > and rework the SOFTNIC section there, preferably moving its poll section to
> > use rte_service in a separate file cleaning the CLI files from PMD-specific
> > implementation.
> >
> > > -Original Message-
> > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > To: Jasvinder Singh 
> > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > reshma.pat...@intel.com; Mordechay Haimovsky
> > ;
> > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> > >
> > > Important note:
> > >   testpmd is currently really broken.
> > >   We cannot have a RC2 until it is fixed.
> > >
> > >
> > > 24/07/2018 13:25, Thomas Monjalon:
> > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > character (EOT) on the empty command line.
> > > >
> > > > Please describe what is the issue and what is the cause.
> > > >
> > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> > > > >
> > > > > Reported-by: Mordechay Haimovsky 
> > > > > Signed-off-by: Jasvinder Singh 
> > > > > ---
> > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > >
> > > > It is very suspicious to change the cmdline library.
> > > > If there is a bug in this library, it deserves a separate fix.
> > >
> > >
> 
> 
> First, testpmd is not really broken, as only thing that changed is the Ctrl + 
> D behavior. I agree this is an issue that we need to fix, as
> it looks that it is breaking some automation scripts for some people.
> 
> The change in behavior for Ctrl + D exit is caused by replacing the call to 
> cmdline_interact() with calling cmdline_poll() in a loop.
> These two approaches should be identical in behavior, but it looks like they 
> are not due to some issue in the cmdline library.
> Jasvinder proposed a quick patch, but it looks like something else needs to 
> be fixed in cmdline library in order to bring
> cmdline_poll() on parity with cmdline_interact(). Any advice from Olivier 
> would be very much appreciated!
> 
> It is really a bad practice to use cmdline_interact() in testpmd, as it is a 
> blocking call that prohibits doing other things on the same
> thread that runs the CLI. Sometimes we need to run other things on the same 
> core, e.g. the slow softnic_manage() function.

Curious why not use a service core for softnic background stuff, and leave CLI 
one for CLI? 
Konstantin

> 
> Worst case scenario: We can revert the cmdline_poll() back to 
> cmdline_interact(), this is a small change, but not the proper way of
> doing things, as this is simply hiding the issue in cmdline library. It would 
> also prevent us from testing some Soft NIC functionality.



Re: [dpdk-dev] [PATCH] mk: fix application compilation with lmnl and mlx5

2018-07-25 Thread Adrien Mazarguil
On Wed, Jul 25, 2018 at 06:39:32AM +, Shahaf Shuler wrote:
> Tuesday, July 24, 2018 6:14 PM, Adrien Mazarguil:
> > Subject: Re: [PATCH] mk: fix application compilation with lmnl and mlx5
> > On Tue, Jul 24, 2018 at 01:03:28PM +, Shahaf Shuler wrote:
> > > Tuesday, July 24, 2018 3:56 PM, Adrien Mazarguil:
> > > > Subject: Re: [PATCH] mk: fix application compilation with lmnl and
> > > > mlx5
> 
> [...]
> 
> > > > > Can we consider different options:
> > > > > 1. always statically link libmnl
> > > > > 2. dlopen libmnl just like we do for verbs/mlx5
> > > >
> > > > Regarding 2, unlike rdma-core/MLNX_OFED, libmnl should be available
> > > > pretty much everywhere iproute2 can be found. The minimal version
> > > > supported
> > > > (1.0.3) was released in 2012.
> > > >
> > > > Using the glue approach for such a small library seems overkill;
> > > > should we choose this path, we must also consider to get rid of it
> > > > entirely since doing so would require more glue code than what mlx5
> > needs from this library.
> > > >
> > > > So with the current approach, either the application or the PMD
> > > > inherits a dependency to libmnl, depending on whether
> > > > CONFIG_RTE_BUILD_SHARED_LIB is respectively disabled or enabled.
> > > >
> > > > If disabled, applications that want static linkage can specify
> > > > -static as part of their compilation flags to let the compiler
> > > > automatically look for libmnl.a as needed.
> > >
> > > Can you confirm static compilation w/ libmnl is working w/o any issues?
> > 
> > Challenge accepted.
> 
> 😊
> 
>  Using -static is not something DPDK applications usually
> > do and needs a few tweaks to compile successfully though (unless you
> > meant something else by "static compilation"?)
> 
> Yes this is what I meant. However I was under the impression we can 
> statically link to libmnl while keeping the rdma-core w/ dynamic linkage. 

Hmm, a much simpler approach if you don't actually want to make the whole
binary static but only get rid of the libmnl.so run-time dependency is to
replace "-lmnl" with e.g. "-l:libmnl.a". Doing so makes it part of the
resulting binaries like any other DPDK libraries (librte_whatever.a).

This can also be achieved through a linker script or by simply removing the
.so version from the library search path.

However while users are free to compile DPDK however they want, we shouldn't
hard-code it this way since libmnl will eventually have multiple users in
DPDK, this will lead to inefficient symbol duplication and possible
link-time issues.

> > First you need to force rdma-core to generate static versions of
> > libmlx4/libmlx5 and libiberbs as it's not the default:
> > 
> >  $ cmake -DENABLE_STATIC=1 .
> > 
> > Next, patch DPDK to remove references to -lgcc_s, -fPIC and -export-
> > dynamic:
> > 
> >  $ sed -i 's/[[:space:]]*-lgcc_s//' $(git grep -l -- -lgcc_s)  $ sed -i 
> > 's/[[:space:]]*-
> > fPIC//' $(git grep -l -- -fPIC)  $ sed -i 's/[[:space:]]*-export-dynamic//' 
> > $(git
> > grep -l -- -export-dynamic)
> 
> It seems the fPIC and export-dynamic are defined only when compiling the DPDK 
> as shared library. 
> The gcc_s is from eal. Do you think it is correct to put it only when 
> compiling as shared library? It seems this approach was taken in the 
> rte.vars.mk files. 

Removing these flags is necessary even with CONFIG_RTE_BUILD_SHARED_LIB
disabled in order to use -static. They appear to be present regardless.

Besides -fPIC, they usually do not need to be specified when generating
shared libraries. I'm almost 100% sure we could get rid of -lgcc_s without
any impact. A bit less sure about -export-dynamic, however we now use map
files to export public symbols. Someone should try.

-fPIC can be kept when generating .a libraries by the way. It's a bit less
efficient when the resulting file is linked with a program but shouldn't
hurt much. It remains mandatory if the resulting library is to be made part
of a shared library. We should keep it just in case.

> > Then append rdma-core dependencies to libmnl users (mlx5) in order to
> > avoid undefined references to libnl/libm stuff normally pulled by 
> > libibverbs:
> > 
> >  $ sed -i 's/-lmnl/-lmnl -lnl-route-3 -lnl-3 -lm/' $(git grep -l -- -lmnl)
> > 
> > Configure DPDK with mlx5 enabled:
> > 
> >  $ make config T=x86_64-native-linuxapp-gcc  $ sed -i
> > 's/^\(CONFIG_RTE_LIBRTE_MLX5_PMD\)=.*/\1=y/' build/.config
> > 
> > Finally add -static to $CC (the easiest method I could find) while compiling
> > DPDK:
> > 
> >  $ make CC='gcc -static'
> > 
> > You can ignore warnings about statically linking "getaddrinfo" and friends.
> > What matters is we now have a testpmd binary with no dependencies:
> > 
> >  $ readelf -d build/app/testpmd | grep NEEDED  $
> > 
> >  $ ldd build/app/testpmd
> >  not a dynamic executable
> >  $
> > 
> > Now start testpmd with a mlx5 adapter and a couple of representors for fun:
> > 
> >  # ./build/app/testpmd -w 06:00.0,representor=[0-1] -n 

Re: [dpdk-dev] [PATCH v2] ip_frag: extend rte_ipv6_frag_get_ipv6_fragment_header()

2018-07-25 Thread Ananyev, Konstantin
Hi Cody,

> -Original Message-
> From: Cody Doucette [mailto:douce...@bu.edu]
> Sent: Thursday, July 19, 2018 4:58 PM
> To: Ananyev, Konstantin ; Olivier Matz 
> ; Dumitrescu, Cristian
> 
> Cc: dev@dpdk.org; mic...@digirati.com.br; Cody Doucette ; 
> Qiaobin Fu 
> Subject: [PATCH v2] ip_frag: extend rte_ipv6_frag_get_ipv6_fragment_header()
> 
> Extend rte_ipv6_frag_get_ipv6_fragment_header() to skip over any
> other IPv6 extension headers when finding the fragment header.
> 
> According to RFC 8200, there is no guarantee that the IPv6
> Fragment extension header will come before any other extension
> header, even though it is recommended.
> 
> Signed-off-by: Cody Doucette 
> Signed-off-by: Qiaobin Fu 
> Reviewed-by: Michel Machado 
> ---
> v2:
> * Moved IPv6 extension header definitions to lib_net.
> 

Looks ok to me, though now drivers/net/failsafe fails to build on freebsd:
http://mails.dpdk.org/archives/test-report/2018-July/060532.html

I fixed that locally by commenting out:
CFLAGS += -D_XOPEN_SOURCE=700
at drivers/net/failsafe/Makefile

Not sure what is the root cause here.
Gaetan, do you remember why we need it for failsafe driver?
Konstantin



>  examples/ip_reassembly/main.c   |  6 ++--
>  lib/librte_ip_frag/rte_ip_frag.h| 23 ++---
>  lib/librte_ip_frag/rte_ip_frag_version.map  |  1 +
>  lib/librte_ip_frag/rte_ipv6_fragmentation.c | 38 +
>  lib/librte_ip_frag/rte_ipv6_reassembly.c|  4 +--
>  lib/librte_net/rte_ip.h | 27 +++
>  lib/librte_port/rte_port_ras.c  |  6 ++--
>  7 files changed, 86 insertions(+), 19 deletions(-)
> 
> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
> index b830f67a5..58c388708 100644
> --- a/examples/ip_reassembly/main.c
> +++ b/examples/ip_reassembly/main.c
> @@ -366,12 +366,14 @@ reassemble(struct rte_mbuf *m, uint16_t portid, 
> uint32_t queue,
>   eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4);
>   } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
>   /* if packet is IPv6 */
> - struct ipv6_extension_fragment *frag_hdr;
> + const struct ipv6_extension_fragment *frag_hdr;
> + struct ipv6_extension_fragment frag_hdr_buf;
>   struct ipv6_hdr *ip_hdr;
> 
>   ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
> 
> - frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr);
> + frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(m,
> + ip_hdr, &frag_hdr_buf);
> 
>   if (frag_hdr != NULL) {
>   struct rte_mbuf *mo;
> diff --git a/lib/librte_ip_frag/rte_ip_frag.h 
> b/lib/librte_ip_frag/rte_ip_frag.h
> index b3f3f78df..bd6f02a16 100644
> --- a/lib/librte_ip_frag/rte_ip_frag.h
> +++ b/lib/librte_ip_frag/rte_ip_frag.h
> @@ -208,28 +208,25 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
>  struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
>   struct rte_ip_frag_death_row *dr,
>   struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr,
> - struct ipv6_extension_fragment *frag_hdr);
> + const struct ipv6_extension_fragment *frag_hdr);
> 
>  /**
>   * Return a pointer to the packet's fragment header, if found.
> - * It only looks at the extension header that's right after the fixed IPv6
> - * header, and doesn't follow the whole chain of extension headers.
>   *
> - * @param hdr
> + * @param pkt
> + *   Pointer to the mbuf of the packet.
> + * @param ip_hdr
>   *   Pointer to the IPv6 header.
> + * @param frag_hdr
> + *   A pointer to the buffer where the fragment header
> + *   will be copied if it is not contiguous in mbuf data.
>   * @return
>   *   Pointer to the IPv6 fragment extension header, or NULL if it's not
>   *   present.
>   */
> -static inline struct ipv6_extension_fragment *
> -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr)
> -{
> - if (hdr->proto == IPPROTO_FRAGMENT) {
> - return (struct ipv6_extension_fragment *) ++hdr;
> - }
> - else
> - return NULL;
> -}
> +const struct ipv6_extension_fragment *rte_ipv6_frag_get_ipv6_fragment_header(
> + struct rte_mbuf *pkt, const struct ipv6_hdr *ip_hdr,
> + struct ipv6_extension_fragment *frag_hdr);
> 
>  /**
>   * IPv4 fragmentation.
> diff --git a/lib/librte_ip_frag/rte_ip_frag_version.map 
> b/lib/librte_ip_frag/rte_ip_frag_version.map
> index d1acf07cb..98fe4f2d4 100644
> --- a/lib/librte_ip_frag/rte_ip_frag_version.map
> +++ b/lib/librte_ip_frag/rte_ip_frag_version.map
> @@ -8,6 +8,7 @@ DPDK_2.0 {
>   rte_ipv4_fragment_packet;
>   rte_ipv6_frag_reassemble_packet;
>   rte_ipv6_fragment_packet;
> + rte_ipv6_frag_get_ipv6_fragment_header;
> 
>   local: *;
>  };
> diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c 
> b/lib/librte_ip_frag/rte_ipv6_fra

Re: [dpdk-dev] [PATCH] vhost: fix return value

2018-07-25 Thread Jens Freimann

On Wed, Jul 25, 2018 at 04:21:42PM +0800, Jiayu Hu wrote:

This patch fixes the incorrect return value for rte_vhost_dequeue_burst()
when virtqueue is not enabled or virtqueue address translation fails.

Fixes: 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx 
functions")


An alternative would be to add a new variable and not reuse the count
parameter as the return value, but your version is the minimal change
and fixes the bug, so

Reviewed-by: Jens Freimann  


regards,
Jens 


Signed-off-by: Jiayu Hu 
---
lib/librte_vhost/virtio_net.c | 8 ++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 2b7ffcf..5d4b975 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1592,15 +1592,19 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
if (unlikely(rte_spinlock_trylock(&vq->access_lock) == 0))
return 0;

-   if (unlikely(vq->enabled == 0))
+   if (unlikely(vq->enabled == 0)) {
+   count = 0;
goto out_access_unlock;
+   }

if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
vhost_user_iotlb_rd_lock(vq);

if (unlikely(vq->access_ok == 0))
-   if (unlikely(vring_translate(dev, vq) < 0))
+   if (unlikely(vring_translate(dev, vq) < 0)) {
+   count = 0;
goto out;
+   }

/*
 * Construct a RARP broadcast packet, and inject it to the "pkts"
--
2.7.4



[dpdk-dev] [Bug 76] 2MB hugepages with IOMMU and passthrough not working

2018-07-25 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=76

Bug ID: 76
   Summary: 2MB hugepages with IOMMU and passthrough not working
   Product: DPDK
   Version: 18.05
  Hardware: All
OS: All
Status: CONFIRMED
  Severity: normal
  Priority: Normal
 Component: core
  Assignee: dev@dpdk.org
  Reporter: kevu...@gmail.com
  Target Milestone: ---

With this combination, when testpmd is run in the guest after some initial
packets (< 1000), all other packets are Rx-missed. Working in 18.02.0, not
working in 18.05.0 or master (711f43ba568ac). 

i.e. combination of below in libvirt xml, with 2MB hugepages in guest not
working.


  
  

  
  


  
  

  
  


...


  



Working if remove IOMMU or switch to 1GB hugepages in guest. Tested with
82599ES.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Re: [dpdk-dev] [PATCH] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Adrien Mazarguil
On Wed, Jul 25, 2018 at 07:38:39AM +, Yaroslav Brustinov (ybrustin) wrote:
> +Hanoch
> 
> I've added -std=c11 flag to our compilation to check.
> 
> Without alignas(max_align_t):
> /usr/bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in 
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o
> 
> With alignas(max_align_t):
> /usr/bin/ld: Warning: alignment 16 of symbol `mlx5_glue' in 
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o
> 
> Using alignas(64) does not produce linker warning.

OK, let's forget max_align_t. Even better, how about
alignas(RTE_CACHE_LINE_SIZE) just in case the same GCC version complains
about the lack of a 128 byte alignment on architectures like IBM POWER8.

(remember to #include  for RTE_CACHE_LINE_SIZE)

> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com] 
> Sent: Tuesday, July 24, 2018 19:04
> To: Yaroslav Brustinov (ybrustin) 
> Cc: Shahaf Shuler ; Yongseok Koh ; 
> dev@dpdk.org; sta...@dpdk.org; Nélio Laranjeiro 
> Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> 
> On Tue, Jul 24, 2018 at 02:24:12PM +, Yaroslav Brustinov (ybrustin) wrote:
> > Hi,
> > 
> > Are you OK with C11?
> > I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c:
> > 
> >  * C11 code would include stdalign.h and use alignof(max_align_t) 
> > however
> >  * we'll stick with C99 for the time being.
> > 
> > :)
> 
> Hah, this code was originally intended to become a generic EAL function hence 
> the C99 but got rejected. Mellanox PMDs otherwise rely on C11 features 
> already.
> 
> > As far as I understand, the issue is alignment of the pointer itself, not 
> > the struct.
> > I'm not familiar with this command: "alignof(max_align_t)".
> > Applying this on the struct:
> > 
> > struct mlx5_glue {
> > ...
> > } __attribute__((__aligned__(64)));
> > 
> > struct __attribute__((__aligned__(64))) mlx5_glue {
> > ...
> > };
> > 
> > ...still keeps the linker unhappy.
> 
> Right, this was my first (wrong) suggestion that doesn't work on types. How 
> about the second one instead? Here's how the diff on mlx5_glue.h should look
> like:
> 
>  +#include 
>   #include 
>   #include 
> 
>  [...]
>   
>  +alignas(max_align_t)
>   const struct mlx5_glue *mlx5_glue;
> 
> Another comment regarding this patch, commit log should probably mention it 
> addresses a GCC bug that cannot be reproduced with latter versions. Keep in 
> mind DPDK recommends to use at least GCC version 4.9.
> 
> > -Original Message-
> > From: Shahaf Shuler [mailto:shah...@mellanox.com]
> > Sent: Tuesday, July 24, 2018 16:51
> > To: Adrien Mazarguil 
> > Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav 
> > Brustinov (ybrustin) ; sta...@dpdk.org; Nélio 
> > Laranjeiro 
> > Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib
> > 
> > Yaroslav,
> > 
> > Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil:
> > > Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> > > > Odd, how could this happen assuming both files are compiled during 
> > > > the same run using identical flags? Looks like a compiler issue.
> > > >
> > > > Anyway, may I suggest an alignment constraint on the structure 
> > > > type in mlx5_glue.h instead, so that all users inherit it. E.g. using 
> > > > C11 syntax:
> > > >
> > > >  #include 
> > > >  #include 
> > > >
> > > >  [...]
> > > >  alignas(max_align_t)
> > > >  struct mlx5_glue {
> > > >  [...]
> > > >  };
> > > 
> > > My bad, this is not a correct use for alignas(), it doesn't work on types.
> > > How about this instead:
> > > 
> > >  alignas(max_align_t)
> > >  const struct mlx5_glue *mlx5_glue;
> > 
> > Can you confirm the above suggestion fixes your issue? 
> > 
> > > 
> > > >
> 
> --
> Adrien Mazarguil
> 6WIND

-- 
Adrien Mazarguil
6WIND


[dpdk-dev] [PATCH] doc: add note for builtin-net-driver option

2018-07-25 Thread Marvin Liu
If builtin-net-driver option is enabled, simple vhost device will not
enable protocol feature bit. QEMU vhost net device startup will be
failed without protocol feature. Then QEMU process will be aborted when
reloading virtio net driver due to previous failure.

Signed-off-by: Marvin Liu 

diff --git a/doc/guides/sample_app_ug/vhost.rst 
b/doc/guides/sample_app_ug/vhost.rst
index 9112e7897..01adae408 100644
--- a/doc/guides/sample_app_ug/vhost.rst
+++ b/doc/guides/sample_app_ug/vhost.rst
@@ -158,6 +158,10 @@ when disabling VLAN strip. Such feature, which heavily 
depends on hardware,
 should be removed from this example to reduce confusion. Now, VLAN strip is
 enabled and cannot be disabled.
 
+**--builtin-net-driver**
+The builtin-net-driver option enabled very simple enqueue and dequeue function.
+This option is disabled by default.
+
 Common Issues
 -
 
@@ -192,3 +196,10 @@ Common Issues
   according to the NIC's property. ::
 
   make EXTRA_CFLAGS="-DMAX_QUEUES=320"
+
+* QEMU abort when builtin-net-driver option enabled
+
+  QEMU vhost net device startup will be failed without
+  VHOST_USER_F_PROTOCOL_FEATURES feature bit. Thus will cause QEMU process
+  abort when reloading virtio driver. DPDK vhost-user can be the replacement
+  of QEMU.
-- 
2.17.0



Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Ananyev, Konstantin
> Sent: Wednesday, July 25, 2018 10:04 AM
> To: Dumitrescu, Cristian ; Mordechay
> Haimovsky ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ; olivier.m...@6wind.com
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> Cristian
> > Sent: Tuesday, July 24, 2018 5:59 PM
> > To: Mordechay Haimovsky ; Thomas Monjalon
> ; Singh, Jasvinder
> > 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ;
> > olivier.m...@6wind.com
> > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > To: Thomas Monjalon ; Singh, Jasvinder
> > > 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > Pattan, Reshma ; olivier.m...@6wind.com;
> > > Dumitrescu, Cristian 
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > >
> > > Even after this fix we still have setups that use netvsc  for example,  on
> > > which testpmd exits with rte_panic right after loading it even without
> > > touching the KBD.
> > >
> > > I recommend returning the previous prompt routine in test-
> pmd/cmdline.c
> > > and rework the SOFTNIC section there, preferably moving its poll section
> to
> > > use rte_service in a separate file cleaning the CLI files from 
> > > PMD-specific
> > > implementation.
> > >
> > > > -Original Message-
> > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > To: Jasvinder Singh 
> > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > ;
> > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > > >
> > > > Important note:
> > > > testpmd is currently really broken.
> > > > We cannot have a RC2 until it is fixed.
> > > >
> > > >
> > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > character (EOT) on the empty command line.
> > > > >
> > > > > Please describe what is the issue and what is the cause.
> > > > >
> > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> mode")
> > > > > >
> > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > Signed-off-by: Jasvinder Singh 
> > > > > > ---
> > > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > > >
> > > > > It is very suspicious to change the cmdline library.
> > > > > If there is a bug in this library, it deserves a separate fix.
> > > >
> > > >
> >
> >
> > First, testpmd is not really broken, as only thing that changed is the Ctrl 
> > +
> D behavior. I agree this is an issue that we need to fix, as
> > it looks that it is breaking some automation scripts for some people.
> >
> > The change in behavior for Ctrl + D exit is caused by replacing the call to
> cmdline_interact() with calling cmdline_poll() in a loop.
> > These two approaches should be identical in behavior, but it looks like they
> are not due to some issue in the cmdline library.
> > Jasvinder proposed a quick patch, but it looks like something else needs to
> be fixed in cmdline library in order to bring
> > cmdline_poll() on parity with cmdline_interact(). Any advice from Olivier
> would be very much appreciated!
> >
> > It is really a bad practice to use cmdline_interact() in testpmd, as it is a
> blocking call that prohibits doing other things on the same
> > thread that runs the CLI. Sometimes we need to run other things on the
> same core, e.g. the slow softnic_manage() function.
> 
> Curious why not use a service core for softnic background stuff, and leave CLI
> one for CLI?
> Konstantin

I guess for a test application you can do anything you want, but in real life 
CPU cores are really expensive and dedicating a CPU core just for CLI is a 
colossal waste.

We did use the non-blocking cmdline_poll() function instead of the blocking 
cmdline_interact() in the past without any issues. The issues reported by Moti 
come as a surprise. It is probably good to see what this is about and see if we 
can quickly fix the issue in cmdline library. Otherwise, we can revert the 
usage of cmdline_poll() with cmdline_interact().


> 
> >
> > Worst case scenario: We can revert the cmdline_poll() back to
> cmdline_interact(), this is a small change, but not the proper way of
> > doing things, as this is simply hiding the issue in cmdline library. It 
> > would
> also prevent us from testing some Soft NIC functionality.



[dpdk-dev] [PATCH v2] net/bonding: fix race condition

2018-07-25 Thread Radu Nicolau
Race condition can appear in the bond_mode_8023ad_periodic_cb()
callback when bonding port is stopped, reconfigured and restarted.

Re-ordered calls in bond_ethdev_start() to have callback alarm set
after slave ports are reconfigured.

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: sta...@dpdk.org

Signed-off-by: Radu Nicolau 
---
v2: reworked patch

 drivers/net/bonding/rte_eth_bond_pmd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index fc4d4fd..70ec728 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2113,10 +2113,6 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
}
}
 
-   /* Update all slave devices MACs*/
-   if (mac_address_slaves_update(eth_dev) != 0)
-   goto out_err;
-
/* If bonded device is configure in promiscuous mode then re-apply 
config */
if (internals->promiscuous_en)
bond_ethdev_promiscuous_enable(eth_dev);
@@ -2157,6 +2153,10 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)
(void *)&rte_eth_devices[internals->port_id]);
}
 
+   /* Update all slave devices MACs*/
+   if (mac_address_slaves_update(eth_dev) != 0)
+   goto out_err;
+
if (internals->user_defined_primary_port)
bond_ethdev_primary_set(internals, internals->primary_port);
 
-- 
2.7.5



[dpdk-dev] [PATCH] examples/ipsec-secgw: add 3des-cbc support

2018-07-25 Thread Hemant Agrawal
Signed-off-by: Hemant Agrawal 
---
 doc/guides/sample_app_ug/ipsec_secgw.rst |  3 ++-
 examples/ipsec-secgw/esp.c   |  3 +++
 examples/ipsec-secgw/sa.c| 11 ++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/doc/guides/sample_app_ug/ipsec_secgw.rst 
b/doc/guides/sample_app_ug/ipsec_secgw.rst
index 46696f2..4869a01 100644
--- a/doc/guides/sample_app_ug/ipsec_secgw.rst
+++ b/doc/guides/sample_app_ug/ipsec_secgw.rst
@@ -67,7 +67,7 @@ Constraints
 
 *  No IPv6 options headers.
 *  No AH mode.
-*  Supported algorithms: AES-CBC, AES-CTR, AES-GCM, HMAC-SHA1 and NULL.
+*  Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, HMAC-SHA1 and 
NULL.
 *  Each SA must be handle by a unique lcore (*1 RX queue per port*).
 *  No chained mbufs.
 
@@ -397,6 +397,7 @@ where each options means:
* *aes-128-cbc*: AES-CBC 128-bit algorithm
* *aes-256-cbc*: AES-CBC 256-bit algorithm
* *aes-128-ctr*: AES-CTR 128-bit algorithm
+   * *3des-cbc*: 3DES-CBC 192-bit algorithm
 
  * Syntax: *cipher_algo *
 
diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
index ee9e590..e33232c 100644
--- a/examples/ipsec-secgw/esp.c
+++ b/examples/ipsec-secgw/esp.c
@@ -96,6 +96,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,
 
switch (sa->cipher_algo) {
case RTE_CRYPTO_CIPHER_NULL:
+   case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_CBC:
/* Copy IV at the end of crypto operation */
rte_memcpy(iv_ptr, iv, sa->iv_len);
@@ -326,6 +327,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
} else {
switch (sa->cipher_algo) {
case RTE_CRYPTO_CIPHER_NULL:
+   case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_CBC:
memset(iv, 0, sa->iv_len);
break;
@@ -387,6 +389,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
} else {
switch (sa->cipher_algo) {
case RTE_CRYPTO_CIPHER_NULL:
+   case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_CBC:
sym_cop->cipher.data.offset = ip_hdr_len +
sizeof(struct esp_hdr);
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 4ab8e09..d2d3550 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -81,6 +81,13 @@ const struct supported_cipher_algo cipher_algos[] = {
.iv_len = 8,
.block_size = 16, /* XXX AESNI MB limition, should be 4 */
.key_len = 20
+   },
+   {
+   .keyword = "3des-cbc",
+   .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
+   .iv_len = 8,
+   .block_size = 8,
+   .key_len = 24
}
 };
 
@@ -327,7 +334,8 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens,
if (status->status < 0)
return;
 
-   if (algo->algo == RTE_CRYPTO_CIPHER_AES_CBC)
+   if (algo->algo == RTE_CRYPTO_CIPHER_AES_CBC ||
+   algo->algo == RTE_CRYPTO_CIPHER_3DES_CBC)
rule->salt = (uint32_t)rte_rand();
 
if (algo->algo == RTE_CRYPTO_CIPHER_AES_CTR) {
@@ -810,6 +818,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa 
entries[],
} else {
switch (sa->cipher_algo) {
case RTE_CRYPTO_CIPHER_NULL:
+   case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_CBC:
iv_length = sa->iv_len;
break;
-- 
2.7.4



Re: [dpdk-dev] Accessing "device_id" from "rte_pci_device"

2018-07-25 Thread santhosh K.S
Hi  Rami Rosen, et al,

Thanks for the response. Yes I can see in the code that rte_device struct
is part of rte_eth_dev_info. I tried to apply the patch you pointed o
n 17.11.3. But it failed at many
places. We don't want to migrate to 18.05 as it is not a stable release.
I've been asked to migrate to a stable version only. I also noticed from
the release note
 that
*rte_ctrlmbuf_init()
API *is deprecated in 18.05. Which results in breaking our code, which
means more re-work; which we are trying our best to avoid at this point in
time. Hence We are not interested in migrating to 18.05. Can you please
suggest a safer alternative patch, which I can use to get around this
problem?

Best Regards,
Santhosh K S

On Wed, Jul 25, 2018 at 12:11 PM Rosen, Rami  wrote:

> Hi Santhos.
>
>
>
> >There is no member named "*device*" in "*rte_eth_dev_info*" struct. I
> looked at both 17.11 API documentation
>  and 18.05
> API documentation
> .
>
>
>
> This is not accurate. There is no “device” in rte_eth_dev_info
>
> In 17.11, but there is a “device” in rte_eth_dev_info
>
>   in 18.05  (this is exactly what Ferru pathc did)
>
> See for example:
>
> http://doc.dpdk.org/api-18.05/rte__ethdev_8h_source.html
>
>
>
> and look for the first member of rte_eth_dev_info:
>
>
>
> truct rte_eth_dev_info
>  {
>
> 1055  struct rte_device
>  *device;
>
>
>
> (Or download 18.05 and look in the header file)
>
>
>
> It seems that the 18.05 API documentation
>  is not
> complete,
>
> should be fixed.
>
>
>
> Regards,
>
> Rami Rosen
>
> Intel Corporation
>
>
>


Re: [dpdk-dev] Accessing "device_id" from "rte_pci_device"

2018-07-25 Thread Rosen, Rami
Hi Santosh,
My personal opinion is:
Look at the patch in
http://patchwork.dpdk.org/patch/37654/

Three lines were changes in rte_ethdev.c and rte_ethdev.h:
lib/librte_ether/rte_ethdev.c   |  1 +
lib/librte_ether/rte_ethdev.h   |  2 +-

Take these changes as a basis, and add everything else which
is mandatory. To reduce the work, you can disable build of
unneeded PMD or apps (by editing build/.config), if it is an option for you.

Hope this sounds reasonable.

Regards,
Rami Rosen



From: santhosh K.S [mailto:santhoshacha...@gmail.com]
Sent: Wednesday, July 25, 2018 13:28
To: Rosen, Rami 
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] Accessing "device_id" from "rte_pci_device"

Hi  Rami Rosen, et al,

Thanks for the response. Yes I can see in the code that rte_device struct is 
part of rte_eth_dev_info. I tried to apply the patch you pointed 
o<%20http:/patchwork.dpdk.org/patch/37654/>n 17.11.3. But it failed at many 
places. We don't want to migrate to 18.05 as it is not a stable release. I've 
been asked to migrate to a stable version only. I also noticed from the release 
note that 
rte_ctrlmbuf_init() API is deprecated in 18.05. Which results in breaking our 
code, which means more re-work; which we are trying our best to avoid at this 
point in time. Hence We are not interested in migrating to 18.05. Can you 
please suggest a safer alternative patch, which I can use to get around this 
problem?

Best Regards,
Santhosh K S

On Wed, Jul 25, 2018 at 12:11 PM Rosen, Rami 
mailto:rami.ro...@intel.com>> wrote:
Hi Santhos.

>There is no member named "device" in "rte_eth_dev_info" struct. I looked at 
>both 17.11 API 
>documentation 
>and 18.05 API 
>documentation.

This is not accurate. There is no “device” in rte_eth_dev_info
In 17.11, but there is a “device” in rte_eth_dev_info
  in 18.05  (this is exactly what Ferru pathc did)
See for example:
http://doc.dpdk.org/api-18.05/rte__ethdev_8h_source.html

and look for the first member of rte_eth_dev_info:

truct 
rte_eth_dev_info {
1055  struct rte_device 
*device;

(Or download 18.05 and look in the header file)

It seems that the 18.05 API 
documentation is 
not complete,
should be fixed.

Regards,
Rami Rosen
Intel Corporation



[dpdk-dev] [PATCH] net/mlx5: fix invalid network interface index value

2018-07-25 Thread Adrien Mazarguil
Network interface indices being unsigned, an invalid index or error is
normally expressed through a zero value (see if_nametoindex()).

mlx5_ifindex() has a signed return type for negative values in case of
error. Since mlx5_nl.c does not check for errors, these may be fed back as
invalid interfaces indices to subsequent system calls. This usage would
have been correct if mlx5_ifindex() returned a zero value instead.

This patch makes mlx5_ifindex() unsigned for convenience.

Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
Cc: Nelio Laranjeiro 
Cc: sta...@dpdk.org

Signed-off-by: Adrien Mazarguil 
Acked-by: Nelio Laranjeiro 
---
 drivers/net/mlx5/mlx5.h|  2 +-
 drivers/net/mlx5/mlx5_ethdev.c | 20 
 drivers/net/mlx5/mlx5_nl.c |  6 +++---
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index db8a5fa01..25345baea 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -243,7 +243,7 @@ int mlx5_getenv_int(const char *);
 int mlx5_get_master_ifname(const struct rte_eth_dev *dev,
   char (*ifname)[IF_NAMESIZE]);
 int mlx5_get_ifname(const struct rte_eth_dev *dev, char 
(*ifname)[IF_NAMESIZE]);
-int mlx5_ifindex(const struct rte_eth_dev *dev);
+unsigned int mlx5_ifindex(const struct rte_eth_dev *dev);
 int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr,
   int master);
 int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 9cf2dc5f1..a1c1b50a6 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -245,24 +245,20 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char 
(*ifname)[IF_NAMESIZE])
  *   Pointer to Ethernet device.
  *
  * @return
- *   Interface index on success, a negative errno value otherwise and
- *   rte_errno is set.
+ *   Nonzero interface index on success, zero otherwise and rte_errno is set.
  */
-int
+unsigned int
 mlx5_ifindex(const struct rte_eth_dev *dev)
 {
char ifname[IF_NAMESIZE];
-   unsigned int ret;
+   unsigned int ifindex;
 
-   ret = mlx5_get_ifname(dev, &ifname);
-   if (ret)
-   return ret;
-   ret = if_nametoindex(ifname);
-   if (ret == 0) {
+   if (mlx5_get_ifname(dev, &ifname))
+   return 0;
+   ifindex = if_nametoindex(ifname);
+   if (!ifindex)
rte_errno = errno;
-   return -rte_errno;
-   }
-   return ret;
+   return ifindex;
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
index 008cd2c31..cc562dfc9 100644
--- a/drivers/net/mlx5/mlx5_nl.c
+++ b/drivers/net/mlx5/mlx5_nl.c
@@ -365,7 +365,7 @@ mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct 
ether_addr (*mac)[],
  int *mac_n)
 {
struct priv *priv = dev->data->dev_private;
-   int iface_idx = mlx5_ifindex(dev);
+   unsigned int iface_idx = mlx5_ifindex(dev);
struct {
struct nlmsghdr hdr;
struct ifinfomsg ifm;
@@ -424,7 +424,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct 
ether_addr *mac,
int add)
 {
struct priv *priv = dev->data->dev_private;
-   int iface_idx = mlx5_ifindex(dev);
+   unsigned int iface_idx = mlx5_ifindex(dev);
struct {
struct nlmsghdr hdr;
struct ndmsg ndm;
@@ -603,7 +603,7 @@ static int
 mlx5_nl_device_flags(struct rte_eth_dev *dev, uint32_t flags, int enable)
 {
struct priv *priv = dev->data->dev_private;
-   int iface_idx = mlx5_ifindex(dev);
+   unsigned int iface_idx = mlx5_ifindex(dev);
struct {
struct nlmsghdr hdr;
struct ifinfomsg ifi;
-- 
2.11.0


[dpdk-dev] [PATCH v2] doc: fix incorrect create bonding command in testpmd

2018-07-25 Thread Shreyansh Jain
Fixes: ac718398f477 ("doc: testpmd application user guide")
Cc: bernard.iremon...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Shreyansh Jain 
Reviewed-by: Ferruh Yigit 
Acked-by: Bernard Iremonger 
---
v2:
   Update the Fixes line to represent the first commit
   rather than the formatting patch (e76d7a76).

 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 1d6bdf9b3..16af95035 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1993,7 +1993,7 @@ Create a new bonding device::
 
 For example, to create a bonded device in mode 1 on socket 0::
 
-   testpmd> create bonded 1 0
+   testpmd> create bonded device 1 0
created new bonded device (port X)
 
 add bonding slave
-- 
2.17.1



Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Ananyev, Konstantin



> -Original Message-
> From: Dumitrescu, Cristian
> Sent: Wednesday, July 25, 2018 10:36 AM
> To: Ananyev, Konstantin ; Mordechay Haimovsky 
> ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan, 
> Reshma ;
> olivier.m...@6wind.com
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Ananyev, Konstantin
> > Sent: Wednesday, July 25, 2018 10:04 AM
> > To: Dumitrescu, Cristian ; Mordechay
> > Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ; olivier.m...@6wind.com
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> > Cristian
> > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > To: Mordechay Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder
> > > 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ;
> > > olivier.m...@6wind.com
> > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > > Pattan, Reshma ; olivier.m...@6wind.com;
> > > > Dumitrescu, Cristian 
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > >
> > > > Even after this fix we still have setups that use netvsc  for example,  
> > > > on
> > > > which testpmd exits with rte_panic right after loading it even without
> > > > touching the KBD.
> > > >
> > > > I recommend returning the previous prompt routine in test-
> > pmd/cmdline.c
> > > > and rework the SOFTNIC section there, preferably moving its poll section
> > to
> > > > use rte_service in a separate file cleaning the CLI files from 
> > > > PMD-specific
> > > > implementation.
> > > >
> > > > > -Original Message-
> > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > To: Jasvinder Singh 
> > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > ;
> > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > > >
> > > > > Important note:
> > > > >   testpmd is currently really broken.
> > > > >   We cannot have a RC2 until it is fixed.
> > > > >
> > > > >
> > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > > character (EOT) on the empty command line.
> > > > > >
> > > > > > Please describe what is the issue and what is the cause.
> > > > > >
> > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > mode")
> > > > > > >
> > > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > > Signed-off-by: Jasvinder Singh 
> > > > > > > ---
> > > > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > > > >
> > > > > > It is very suspicious to change the cmdline library.
> > > > > > If there is a bug in this library, it deserves a separate fix.
> > > > >
> > > > >
> > >
> > >
> > > First, testpmd is not really broken, as only thing that changed is the 
> > > Ctrl +
> > D behavior. I agree this is an issue that we need to fix, as
> > > it looks that it is breaking some automation scripts for some people.
> > >
> > > The change in behavior for Ctrl + D exit is caused by replacing the call 
> > > to
> > cmdline_interact() with calling cmdline_poll() in a loop.
> > > These two approaches should be identical in behavior, but it looks like 
> > > they
> > are not due to some issue in the cmdline library.
> > > Jasvinder proposed a quick patch, but it looks like something else needs 
> > > to
> > be fixed in cmdline library in order to bring
> > > cmdline_poll() on parity with cmdline_interact(). Any advice from Olivier
> > would be very much appreciated!
> > >
> > > It is really a bad practice to use cmdline_interact() in testpmd, as it 
> > > is a
> > blocking call that prohibits doing other things on the same
> > > thread that runs the CLI. Sometimes we need to run other things on the
> > same core, e.g. the slow softnic_manage() function.
> >
> > Curious why not use a service core for softnic background stuff, and leave 
> > CLI
> > one for CLI?
> > Konstantin
> 
> I guess for a test application you can do anything you want, but in real life 
> CPU cores are really expensive and dedicating a CPU core
> just for CLI is a colossal waste.

Ok, but let's application developer to decide how to use (waste) the cores he

Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Mordechay Haimovsky
This is how we reproduce the issue :
app/testpmd -n 4   --vdev="net_tap0,iface=tap0,remote=eth1"  -- --burst=64 
--mbcache=512 -i   --rxq=2 --txq=2 --txd=512 --rxd=512  --port-topology=chained 
--forward-mode=rxonly

> -Original Message-
> From: Ananyev, Konstantin [mailto:konstantin.anan...@intel.com]
> Sent: Wednesday, July 25, 2018 2:39 PM
> To: Dumitrescu, Cristian ; Mordechay
> Haimovsky ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ; olivier.m...@6wind.com; Van
> Haaren, Harry 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Dumitrescu, Cristian
> > Sent: Wednesday, July 25, 2018 10:36 AM
> > To: Ananyev, Konstantin ; Mordechay
> > Haimovsky ; Thomas Monjalon
> ;
> > Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ; olivier.m...@6wind.com
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > To: Dumitrescu, Cristian ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > Pattan, Reshma ; olivier.m...@6wind.com
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> > > Cristian
> > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > To: Mordechay Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder
> > > > 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > ;
> > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com
> > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > > using ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > > ; Pattan, Reshma
> > > > > ; olivier.m...@6wind.com; Dumitrescu,
> > > > > Cristian 
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > > > using
> > > ctrl+d
> > > > >
> > > > > Even after this fix we still have setups that use netvsc  for
> > > > > example,  on which testpmd exits with rte_panic right after
> > > > > loading it even without touching the KBD.
> > > > >
> > > > > I recommend returning the previous prompt routine in test-
> > > pmd/cmdline.c
> > > > > and rework the SOFTNIC section there, preferably moving its poll
> > > > > section
> > > to
> > > > > use rte_service in a separate file cleaning the CLI files from
> > > > > PMD-specific implementation.
> > > > >
> > > > > > -Original Message-
> > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > To: Jasvinder Singh 
> > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > ;
> > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > > > > using
> > > ctrl+d
> > > > > >
> > > > > > Important note:
> > > > > > testpmd is currently really broken.
> > > > > > We cannot have a RC2 until it is fixed.
> > > > > >
> > > > > >
> > > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > > Fix testpmd app exit by pressing ctrl+d,
> > > > > > > > End-of-Transmission character (EOT) on the empty command
> line.
> > > > > > >
> > > > > > > Please describe what is the issue and what is the cause.
> > > > > > >
> > > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > > mode")
> > > > > > > >
> > > > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > > > Signed-off-by: Jasvinder Singh 
> > > > > > > > ---
> > > > > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > > > > >
> > > > > > > It is very suspicious to change the cmdline library.
> > > > > > > If there is a bug in this library, it deserves a separate fix.
> > > > > >
> > > > > >
> > > >
> > > >
> > > > First, testpmd is not really broken, as only thing that changed is
> > > > the Ctrl +
> > > D behavior. I agree this is an issue that we need to fix, as
> > > > it looks that it is breaking some automation scripts for some people.
> > > >
> > > > The change in behavior for Ctrl + D exit is caused by replacing
> > > > the call to
> > > cmdline_interact() with calling cmdline_poll() in a loop.
> > > > These two approaches should be identical in behavior, but it looks
> > > > like they
> > > are not due to some issue in the cmdline library.
> > > > Jasvinder proposed a quick pa

Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Ananyev, Konstantin
> Sent: Wednesday, July 25, 2018 12:39 PM
> To: Dumitrescu, Cristian ; Mordechay
> Haimovsky ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ; olivier.m...@6wind.com; Van
> Haaren, Harry 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Dumitrescu, Cristian
> > Sent: Wednesday, July 25, 2018 10:36 AM
> > To: Ananyev, Konstantin ; Mordechay
> Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ;
> > olivier.m...@6wind.com
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > To: Dumitrescu, Cristian ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > Pattan, Reshma ; olivier.m...@6wind.com
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> > > Cristian
> > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > To: Mordechay Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder
> > > > 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com
> > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > > > Pattan, Reshma ;
> olivier.m...@6wind.com;
> > > > > Dumitrescu, Cristian 
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > ctrl+d
> > > > >
> > > > > Even after this fix we still have setups that use netvsc  for example,
> on
> > > > > which testpmd exits with rte_panic right after loading it even
> without
> > > > > touching the KBD.
> > > > >
> > > > > I recommend returning the previous prompt routine in test-
> > > pmd/cmdline.c
> > > > > and rework the SOFTNIC section there, preferably moving its poll
> section
> > > to
> > > > > use rte_service in a separate file cleaning the CLI files from PMD-
> specific
> > > > > implementation.
> > > > >
> > > > > > -Original Message-
> > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > To: Jasvinder Singh 
> > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > ;
> > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > ctrl+d
> > > > > >
> > > > > > Important note:
> > > > > > testpmd is currently really broken.
> > > > > > We cannot have a RC2 until it is fixed.
> > > > > >
> > > > > >
> > > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > > > character (EOT) on the empty command line.
> > > > > > >
> > > > > > > Please describe what is the issue and what is the cause.
> > > > > > >
> > > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > > mode")
> > > > > > > >
> > > > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > > > Signed-off-by: Jasvinder Singh 
> > > > > > > > ---
> > > > > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > > > > >
> > > > > > > It is very suspicious to change the cmdline library.
> > > > > > > If there is a bug in this library, it deserves a separate fix.
> > > > > >
> > > > > >
> > > >
> > > >
> > > > First, testpmd is not really broken, as only thing that changed is the 
> > > > Ctrl
> +
> > > D behavior. I agree this is an issue that we need to fix, as
> > > > it looks that it is breaking some automation scripts for some people.
> > > >
> > > > The change in behavior for Ctrl + D exit is caused by replacing the call
> to
> > > cmdline_interact() with calling cmdline_poll() in a loop.
> > > > These two approaches should be identical in behavior, but it looks like
> they
> > > are not due to some issue in the cmdline library.
> > > > Jasvinder proposed a quick patch, but it looks like something else needs
> to
> > > be fixed in cmdline library in order to bring
> > > > cmdline_poll() on parity with cmdline_interact(). Any advice from
> Olivier
> > > would be very much appreciated!
> > > >
> > > > It is really a bad practice to use cmdline_interact() in testpmd, as it 
> 

Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Ananyev, Konstantin



> -Original Message-
> From: Dumitrescu, Cristian
> Sent: Wednesday, July 25, 2018 12:57 PM
> To: Ananyev, Konstantin ; Mordechay Haimovsky 
> ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan, 
> Reshma ;
> olivier.m...@6wind.com; Van Haaren, Harry 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Ananyev, Konstantin
> > Sent: Wednesday, July 25, 2018 12:39 PM
> > To: Dumitrescu, Cristian ; Mordechay
> > Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ; olivier.m...@6wind.com; Van
> > Haaren, Harry 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Dumitrescu, Cristian
> > > Sent: Wednesday, July 25, 2018 10:36 AM
> > > To: Ananyev, Konstantin ; Mordechay
> > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ;
> > > olivier.m...@6wind.com
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Ananyev, Konstantin
> > > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > > To: Dumitrescu, Cristian ; Mordechay
> > > > Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > > Pattan, Reshma ; olivier.m...@6wind.com
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> > > > Cristian
> > > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > > To: Mordechay Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder
> > > > > 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > ;
> > > > Pattan, Reshma ;
> > > > > olivier.m...@6wind.com
> > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > > 
> > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > ;
> > > > > > Pattan, Reshma ;
> > olivier.m...@6wind.com;
> > > > > > Dumitrescu, Cristian 
> > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > > ctrl+d
> > > > > >
> > > > > > Even after this fix we still have setups that use netvsc  for 
> > > > > > example,
> > on
> > > > > > which testpmd exits with rte_panic right after loading it even
> > without
> > > > > > touching the KBD.
> > > > > >
> > > > > > I recommend returning the previous prompt routine in test-
> > > > pmd/cmdline.c
> > > > > > and rework the SOFTNIC section there, preferably moving its poll
> > section
> > > > to
> > > > > > use rte_service in a separate file cleaning the CLI files from PMD-
> > specific
> > > > > > implementation.
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > > To: Jasvinder Singh 
> > > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > > ;
> > > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > using
> > > > ctrl+d
> > > > > > >
> > > > > > > Important note:
> > > > > > >   testpmd is currently really broken.
> > > > > > >   We cannot have a RC2 until it is fixed.
> > > > > > >
> > > > > > >
> > > > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > > > > character (EOT) on the empty command line.
> > > > > > > >
> > > > > > > > Please describe what is the issue and what is the cause.
> > > > > > > >
> > > > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > > > mode")
> > > > > > > > >
> > > > > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > > > > Signed-off-by: Jasvinder Singh 
> > > > > > > > > ---
> > > > > > > > >  app/test-pmd/cmdline.c   | 10 ++
> > > > > > > > >  lib/librte_cmdline/cmdline.c |  2 +-
> > > > > > > >
> > > > > > > > It is very suspicious to change the cmdline library.
> > > > > > > > If there is a bug in this library, it deserves a separate fix.
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > > First, testpmd is not really broken, as only thing that changed is 
> > > > > the Ctrl
> > +
> > > > D behavior. I agree this is an issue that we need to fix, as
> > > > > it looks that it is breaking some automation scripts for some people.
> > > > >

Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Van Haaren, Harry
> -Original Message-
> From: Ananyev, Konstantin
> Sent: Wednesday, July 25, 2018 1:18 PM
> To: Dumitrescu, Cristian ; Mordechay Haimovsky
> ; Thomas Monjalon ; Singh, Jasvinder
> 
> Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan,
> Reshma ; olivier.m...@6wind.com; Van Haaren, Harry
> 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Dumitrescu, Cristian
> > Sent: Wednesday, July 25, 2018 12:57 PM
> > To: Ananyev, Konstantin ; Mordechay Haimovsky
> ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan,
> Reshma ;
> > olivier.m...@6wind.com; Van Haaren, Harry 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, July 25, 2018 12:39 PM
> > > To: Dumitrescu, Cristian ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > Pattan, Reshma ; olivier.m...@6wind.com; Van
> > > Haaren, Harry 
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Dumitrescu, Cristian
> > > > Sent: Wednesday, July 25, 2018 10:36 AM
> > > > To: Ananyev, Konstantin ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Ananyev, Konstantin
> > > > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > > > To: Dumitrescu, Cristian ; Mordechay
> > > > > Haimovsky ; Thomas Monjalon
> > > > > ; Singh, Jasvinder 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > > > Pattan, Reshma ; olivier.m...@6wind.com
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > ctrl+d
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Dumitrescu,
> > > > > Cristian
> > > > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > > > To: Mordechay Haimovsky ; Thomas Monjalon
> > > > > ; Singh, Jasvinder
> > > > > > 
> > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > ;
> > > > > Pattan, Reshma ;
> > > > > > olivier.m...@6wind.com
> > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > ctrl+d
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > > > 
> > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > ;
> > > > > > > Pattan, Reshma ;
> > > olivier.m...@6wind.com;
> > > > > > > Dumitrescu, Cristian 
> > > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > > > ctrl+d
> > > > > > >
> > > > > > > Even after this fix we still have setups that use netvsc  for
> example,
> > > on
> > > > > > > which testpmd exits with rte_panic right after loading it even
> > > without
> > > > > > > touching the KBD.
> > > > > > >
> > > > > > > I recommend returning the previous prompt routine in test-
> > > > > pmd/cmdline.c
> > > > > > > and rework the SOFTNIC section there, preferably moving its poll
> > > section
> > > > > to
> > > > > > > use rte_service in a separate file cleaning the CLI files from
> PMD-
> > > specific
> > > > > > > implementation.
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > > > To: Jasvinder Singh 
> > > > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > > > ;
> > > > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > using
> > > > > ctrl+d
> > > > > > > >
> > > > > > > > Important note:
> > > > > > > > testpmd is currently really broken.
> > > > > > > > We cannot have a RC2 until it is fixed.
> > > > > > > >
> > > > > > > >
> > > > > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > > > > > character (EOT) on the empty command line.
> > > > > > > > >
> > > > > > > > > Please describe what is the issue and what is the cause.
> > > > > > > > >
> > > > > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > > > > mode")
> > > > > > > > > >
> > > > > > > > > > Reported-by: Mordechay Haimovsky 
> > > > > > > > > > Signed-off-by: Jasvind

[dpdk-dev] [pull-request] next-eventdev 18.08 RC2

2018-07-25 Thread Jerin Jacob
The following changes since commit 711f43ba568acadf6cbccb9f8a29abf0fb3baa25:

  examples/vm_power: make branch ratio configurable (2018-07-21 00:00:43 +0200)

are available in the Git repository at:

  http://dpdk.org/git/next/dpdk-next-eventdev 

for you to fetch changes up to f094d5a870e88536eab6210f5eb8586906563809:

  app/eventdev: use proper teardown sequence (2018-07-25 17:59:55 +0530)


Pavan Nikhilesh (4):
  app/eventdev: fix order test service init
  event/octeontx: prefetch mbuf instead of wqe
  event/octeontx: remove unnecessary port start and stop
  app/eventdev: use proper teardown sequence

 app/test-eventdev/evt_main.c | 42 
 app/test-eventdev/test_order_atq.c   | 12 ++---
 app/test-eventdev/test_order_queue.c | 12 ++---
 app/test-eventdev/test_perf_common.c |  1 -
 app/test-eventdev/test_pipeline_common.c |  1 -
 drivers/event/octeontx/ssovf_evdev.c | 14 ++-
 drivers/event/octeontx/ssovf_worker.h|  2 +-
 7 files changed, 46 insertions(+), 38 deletions(-)


Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Ananyev, Konstantin
> Sent: Wednesday, July 25, 2018 1:18 PM
> To: Dumitrescu, Cristian ; Mordechay
> Haimovsky ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ; olivier.m...@6wind.com; Van
> Haaren, Harry 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Dumitrescu, Cristian
> > Sent: Wednesday, July 25, 2018 12:57 PM
> > To: Ananyev, Konstantin ; Mordechay
> Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ;
> > olivier.m...@6wind.com; Van Haaren, Harry
> 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, July 25, 2018 12:39 PM
> > > To: Dumitrescu, Cristian ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > Pattan, Reshma ; olivier.m...@6wind.com;
> Van
> > > Haaren, Harry 
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Dumitrescu, Cristian
> > > > Sent: Wednesday, July 25, 2018 10:36 AM
> > > > To: Ananyev, Konstantin ; Mordechay
> > > Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder
> 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Ananyev, Konstantin
> > > > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > > > To: Dumitrescu, Cristian ;
> Mordechay
> > > > > Haimovsky ; Thomas Monjalon
> > > > > ; Singh, Jasvinder
> 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > > > Pattan, Reshma ;
> olivier.m...@6wind.com
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > ctrl+d
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of
> Dumitrescu,
> > > > > Cristian
> > > > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > > > To: Mordechay Haimovsky ; Thomas
> Monjalon
> > > > > ; Singh, Jasvinder
> > > > > > 
> > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > ;
> > > > > Pattan, Reshma ;
> > > > > > olivier.m...@6wind.com
> > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > ctrl+d
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > > > 
> > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > ;
> > > > > > > Pattan, Reshma ;
> > > olivier.m...@6wind.com;
> > > > > > > Dumitrescu, Cristian 
> > > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > > > ctrl+d
> > > > > > >
> > > > > > > Even after this fix we still have setups that use netvsc  for
> example,
> > > on
> > > > > > > which testpmd exits with rte_panic right after loading it even
> > > without
> > > > > > > touching the KBD.
> > > > > > >
> > > > > > > I recommend returning the previous prompt routine in test-
> > > > > pmd/cmdline.c
> > > > > > > and rework the SOFTNIC section there, preferably moving its poll
> > > section
> > > > > to
> > > > > > > use rte_service in a separate file cleaning the CLI files from 
> > > > > > > PMD-
> > > specific
> > > > > > > implementation.
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > > > To: Jasvinder Singh 
> > > > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > > > ;
> > > > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > using
> > > > > ctrl+d
> > > > > > > >
> > > > > > > > Important note:
> > > > > > > > testpmd is currently really broken.
> > > > > > > > We cannot have a RC2 until it is fixed.
> > > > > > > >
> > > > > > > >
> > > > > > > > 24/07/2018 13:25, Thomas Monjalon:
> > > > > > > > > 23/07/2018 12:44, Jasvinder Singh:
> > > > > > > > > > Fix testpmd app exit by pressing ctrl+d, End-of-Transmission
> > > > > > > > > > character (EOT) on the empty command line.
> > > > > > > > >
> > > > > > > > > Please describe what is the issue and what is the cause.
> > > > > > > > >
> > > > > > > > > > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward
> > > > > mode")
> > > > > > > > > >
> > > > > > > > > > Reported-by: Mordechay Haimovsky
> 

Re: [dpdk-dev] [PATCH] net/i40e: fix multiple device arguments parsing error

2018-07-25 Thread Zhang, Qi Z
Hi Beilei

> -Original Message-
> From: Xing, Beilei
> Sent: Wednesday, July 25, 2018 2:37 PM
> To: Zhang, Qi Z 
> Cc: dev@dpdk.org; Stillwell Jr, Paul M ;
> sta...@dpdk.org
> Subject: [PATCH] net/i40e: fix multiple device arguments parsing error
> 
> There will be parsing error when using multiple device arguments. This patch
> fixes the issue

Could you explain more about what is the issue this patch is going to fix.
Though I think the patch looks make things better, but I can't figure out what 
is the issue to fix.
Maybe you can add an example of the devargs with problem and the error message 

Regards
Qi

> 
> Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")
> Fixes: ee653bd80044 ("net/i40e: determine number of queues per VF at run
> time")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Beilei Xing 
> ---
>  drivers/net/i40e/i40e_ethdev.c | 45
> ++
>  1 file changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 66431e0..e3063cc 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -42,6 +42,8 @@
> 
>  #define ETH_I40E_FLOATING_VEB_ARG"enable_floating_veb"
>  #define ETH_I40E_FLOATING_VEB_LIST_ARG   "floating_veb_list"
> +#define ETH_I40E_SUPPORT_MULTI_DRIVER"support-multi-driver"
> +#define ETH_I40E_QUEUE_NUM_PER_VF_ARG"queue-num-per-vf"
> 
>  #define I40E_CLEAR_PXE_WAIT_MS 200
> 
> @@ -401,6 +403,13 @@ static void i40e_notify_all_vfs_link_status(struct
> rte_eth_dev *dev);  int i40e_logtype_init;  int i40e_logtype_driver;
> 
> +static const char *const valid_keys[] = {
> + ETH_I40E_FLOATING_VEB_ARG,
> + ETH_I40E_FLOATING_VEB_LIST_ARG,
> + ETH_I40E_SUPPORT_MULTI_DRIVER,
> + ETH_I40E_QUEUE_NUM_PER_VF_ARG,
> + NULL};
> +
>  static const struct rte_pci_id pci_id_i40e_map[] = {
>   { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) },
>   { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) }, @@
> -852,7 +861,7 @@ config_vf_floating_veb(struct rte_devargs *devargs,
>   if (devargs == NULL)
>   return;
> 
> - kvlist = rte_kvargs_parse(devargs->args, NULL);
> + kvlist = rte_kvargs_parse(devargs->args, valid_keys);
>   if (kvlist == NULL)
>   return;
> 
> @@ -893,7 +902,7 @@ is_floating_veb_supported(struct rte_devargs
> *devargs)
>   if (devargs == NULL)
>   return 0;
> 
> - kvlist = rte_kvargs_parse(devargs->args, NULL);
> + kvlist = rte_kvargs_parse(devargs->args, valid_keys);
>   if (kvlist == NULL)
>   return 0;
> 
> @@ -1100,8 +1109,6 @@ i40e_init_queue_region_conf(struct rte_eth_dev
> *dev)
>   memset(info, 0, sizeof(struct i40e_queue_regions));  }
> 
> -#define ETH_I40E_SUPPORT_MULTI_DRIVER"support-multi-driver"
> -
>  static int
>  i40e_parse_multi_drv_handler(__rte_unused const char *key,
>  const char *value,
> @@ -1133,9 +1140,8 @@ static int
>  i40e_support_multi_driver(struct rte_eth_dev *dev)  {
>   struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> - static const char *const valid_keys[] = {
> - ETH_I40E_SUPPORT_MULTI_DRIVER, NULL};
>   struct rte_kvargs *kvlist;
> + int kvargs_count;
> 
>   /* Enable global configuration by default */
>   pf->support_multi_driver = false;
> @@ -1147,7 +1153,13 @@ i40e_support_multi_driver(struct rte_eth_dev
> *dev)
>   if (!kvlist)
>   return -EINVAL;
> 
> - if (rte_kvargs_count(kvlist, ETH_I40E_SUPPORT_MULTI_DRIVER) > 1)
> + kvargs_count = rte_kvargs_count(kvlist,
> ETH_I40E_SUPPORT_MULTI_DRIVER);
> + if (!kvargs_count) {
> + rte_kvargs_free(kvlist);
> + return 0;
> + }
> +
> + if (kvargs_count > 1)
>   PMD_DRV_LOG(WARNING, "More than one argument \"%s\" and
> only "
>   "the first invalid or last valid one is used !",
>   ETH_I40E_SUPPORT_MULTI_DRIVER);
> @@ -4357,7 +4369,6 @@ i40e_get_cap(struct i40e_hw *hw)  }
> 
>  #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
> -#define QUEUE_NUM_PER_VF_ARG "queue-num-per-vf"
> 
>  static int i40e_pf_parse_vf_queue_number_handler(const char *key,
>   const char *value,
> @@ -4391,9 +4402,9 @@ static int
> i40e_pf_parse_vf_queue_number_handler(const char *key,
> 
>  static int i40e_pf_config_vf_rxq_number(struct rte_eth_dev *dev)  {
> - static const char * const valid_keys[] = {QUEUE_NUM_PER_VF_ARG,
> NULL};
>   struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
>   struct rte_kvargs *kvlist;
> + int kvargs_count;
> 
>   /* set default queue number per VF as 4 */
>   pf->vf_nb_qp_max = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF; @@
> -4405,12 +4416,18 @@ static int i40e_pf_config_vf_rxq_number(struct
> rte_eth_dev *dev)
>   if (

[dpdk-dev] [PATCH v3 2/2] app/testpmd: fix help string for tm commit cmd

2018-07-25 Thread Krzysztof Kanas
Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and hierarchy 
commit")
Cc: jasvinder.si...@intel.com

Signed-off-by: Krzysztof Kanas 
---
 app/test-pmd/cmdline_tm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 4f515241703a..09acc1b87293 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -2172,7 +2172,7 @@ static void cmd_port_tm_hierarchy_commit_parsed(void 
*parsed_result,
 cmdline_parse_inst_t cmd_port_tm_hierarchy_commit = {
.f = cmd_port_tm_hierarchy_commit_parsed,
.data = NULL,
-   .help_str = "Set port tm node shaper profile",
+   .help_str = "Commit port tm hierarchy",
.tokens = {
(void *)&cmd_port_tm_hierarchy_commit_port,
(void *)&cmd_port_tm_hierarchy_commit_tm,
-- 
2.18.0



[dpdk-dev] [PATCH v3 1/2] app/testpmd: fix use of uninitialized field

2018-07-25 Thread Krzysztof Kanas
print_err_msg uses message field that may be not initialized causing
segmentation fault.

Fixes: 12f76f5247e2 ("app/testpmd: add command to resume a TM node")
Cc: t...@semihalf.com

Signed-off-by: Krzysztof Kanas 
---
v3: Fix the Fixes: commit message line
---
 app/test-pmd/cmdline_tm.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index c904e44f0f2f..4f515241703a 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -234,6 +234,7 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
return;
 
memset(&cap, 0, sizeof(struct rte_tm_capabilities));
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_capabilities_get(port_id, &cap, &error);
if (ret) {
print_err_msg(&error);
@@ -374,6 +375,7 @@ static void cmd_show_port_tm_level_cap_parsed(void 
*parsed_result,
return;
 
memset(&lcap, 0, sizeof(struct rte_tm_level_capabilities));
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_level_capabilities_get(port_id, level_id, &lcap, &error);
if (ret) {
print_err_msg(&error);
@@ -498,6 +500,7 @@ static void cmd_show_port_tm_node_cap_parsed(void 
*parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
/* Node id must be valid */
ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
if (ret != 0) {
@@ -615,6 +618,7 @@ static void cmd_show_port_tm_node_stats_parsed(void 
*parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (!port_is_started(port_id)) {
printf(" Port %u not started (error)\n", port_id);
@@ -727,6 +731,7 @@ static void cmd_show_port_tm_node_type_parsed(void 
*parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
if (ret != 0) {
print_err_msg(&error);
@@ -832,6 +837,7 @@ static void cmd_add_port_tm_node_shaper_profile_parsed(void 
*parsed_result,
 
/* Private shaper profile params */
memset(&sp, 0, sizeof(struct rte_tm_shaper_params));
+   memset(&error, 0, sizeof(struct rte_tm_error));
sp.peak.rate = res->tb_rate;
sp.peak.size = res->tb_size;
sp.pkt_length_adjust = pkt_len_adjust;
@@ -919,6 +925,7 @@ static void cmd_del_port_tm_node_shaper_profile_parsed(void 
*parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_shaper_profile_delete(port_id, shaper_id, &error);
if (ret != 0) {
print_err_msg(&error);
@@ -1004,6 +1011,7 @@ static void 
cmd_add_port_tm_node_shared_shaper_parsed(void *parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
/* Command type: add */
if ((strcmp(res->cmd_type, "add") == 0) &&
(port_is_started(port_id))) {
@@ -1098,6 +1106,7 @@ static void 
cmd_del_port_tm_node_shared_shaper_parsed(void *parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_shared_shaper_delete(port_id, shared_shaper_id, &error);
if (ret != 0) {
print_err_msg(&error);
@@ -1254,6 +1263,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void 
*parsed_result,
return;
 
memset(&wp, 0, sizeof(struct rte_tm_wred_params));
+   memset(&error, 0, sizeof(struct rte_tm_error));
 
/* WRED Params  (Green Color)*/
color = RTE_TM_GREEN;
@@ -1369,6 +1379,7 @@ static void cmd_del_port_tm_node_wred_profile_parsed(void 
*parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
ret = rte_tm_wred_profile_delete(port_id, wred_profile_id, &error);
if (ret != 0) {
print_err_msg(&error);
@@ -1455,6 +1466,7 @@ static void 
cmd_set_port_tm_node_shaper_profile_parsed(void *parsed_result,
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
 
+   memset(&error, 0, sizeof(struct rte_tm_error));
/* Port status */
if (!port_is_started(port_id)) {
printf(" Port %u not started (error)\n", port_id);
@@ -1571,6 +1583,7 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void 
*parsed_result,
return;
 
memset(&np, 0, s

Re: [dpdk-dev] [PATCH] net/mlx5: fix count query when flow has not counters

2018-07-25 Thread Ori Kam



> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Nelio Laranjeiro
> Sent: Wednesday, July 25, 2018 11:46 AM
> To: dev@dpdk.org; Shahaf Shuler ; Yongseok Koh
> 
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix count query when flow has not
> counters
> 
> Querying a counters on a flow without counter is ending with a
> segmentation fault.
> 
> Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
> 
> Signed-off-by: Nelio Laranjeiro 
> ---
>  drivers/net/mlx5/mlx5_flow.c | 56 
>  1 file changed, 32 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 6fa4e30ae..efaa8b4fb 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -3192,32 +3192,40 @@ mlx5_flow_query_count(struct rte_flow *flow
> __rte_unused,
> struct rte_flow_error *error)
>  {
>  #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
> - struct rte_flow_query_count *qc = data;
> - uint64_t counters[2] = {0, 0};
> - struct ibv_query_counter_set_attr query_cs_attr = {
> - .cs = flow->counter->cs,
> - .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> - };
> - struct ibv_counter_set_data query_out = {
> - .out = counters,
> - .outlen = 2 * sizeof(uint64_t),
> - };
> - int err = mlx5_glue->query_counter_set(&query_cs_attr,
> &query_out);
> + if (flow->modifier & MLX5_FLOW_MOD_COUNT) {
> + struct rte_flow_query_count *qc = data;
> + uint64_t counters[2] = {0, 0};
> + struct ibv_query_counter_set_attr query_cs_attr = {
> + .cs = flow->counter->cs,
> + .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> + };
> + struct ibv_counter_set_data query_out = {
> + .out = counters,
> + .outlen = 2 * sizeof(uint64_t),
> + };
> + int err = mlx5_glue->query_counter_set(&query_cs_attr,
> +&query_out);
> 
> - if (err)
> - return rte_flow_error_set(error, err,
> -
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -   NULL,
> -   "cannot read counter");
> - qc->hits_set = 1;
> - qc->bytes_set = 1;
> - qc->hits = counters[0] - flow->counter->hits;
> - qc->bytes = counters[1] - flow->counter->bytes;
> - if (qc->reset) {
> - flow->counter->hits = counters[0];
> - flow->counter->bytes = counters[1];
> + if (err)
> + return rte_flow_error_set
> + (error, err,
> +  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +  NULL,
> +  "cannot read counter");
> + qc->hits_set = 1;
> + qc->bytes_set = 1;
> + qc->hits = counters[0] - flow->counter->hits;
> + qc->bytes = counters[1] - flow->counter->bytes;
> + if (qc->reset) {
> + flow->counter->hits = counters[0];
> + flow->counter->bytes = counters[1];
> + }
> + return 0;
>   }
> - return 0;
> + return rte_flow_error_set(error, ENOTSUP,
> +   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +   NULL,
> +   "flow does not have counter");
>  #endif
>   return rte_flow_error_set(error, ENOTSUP,
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> --
> 2.18.0

Acked-by: Ori Kam 

Best,
Ori


[dpdk-dev] [PATCH v1] doc/samples: update vm power manager sample docs

2018-07-25 Thread David Hunt
Add information on the ability of guest app to sent
a policy to the host app.

Add information on the branch ratio out-of-band method
of workload monitoring and power management.

Signed-off-by: David Hunt 
---
 .../sample_app_ug/vm_power_management.rst | 165 --
 1 file changed, 150 insertions(+), 15 deletions(-)

diff --git a/doc/guides/sample_app_ug/vm_power_management.rst 
b/doc/guides/sample_app_ug/vm_power_management.rst
index cd7c7f341..855570d6b 100644
--- a/doc/guides/sample_app_ug/vm_power_management.rst
+++ b/doc/guides/sample_app_ug/vm_power_management.rst
@@ -20,7 +20,7 @@ running on Virtual Machines(VMs).
 
 The Virtual Machine Power Management solution shows an example of
 how a DPDK application can indicate its processing requirements using VM local
-only information(vCPU/lcore) to a Host based Monitor which is responsible
+only information(vCPU/lcore, etc.) to a Host based Monitor which is responsible
 for accepting requests for frequency changes for a vCPU, translating the vCPU
 to a pCPU via libvirt and affecting the change in frequency.
 
@@ -38,6 +38,26 @@ The solution is comprised of two high-level components:
to the librte_power ACPI cpufreq sysfs based library.
The Host Application relies on both qemu-kvm and libvirt to function.
 
+   This monitoring application is responsible for:
+
+   - Accepting requests from client applications: Client applications can
+ request frequency changes for a vCPU, translating
+ the vCPU to a pCPU via libvirt and affecting the change in frequency.
+
+   - Accepting policies from client applications: Client application can
+ send a policy to the host application. The
+ host application will then apply the rules of the policy independent
+ of the application. For example, the policy can contain time-of-day
+ information for busy/quiet periods, and the host application can scale
+ up/down the relevant cores when required. See the details of the guest
+ application below for more information on setting the policy values.
+
+   - Out-of-band monitoring of workloads via cores hardware event counters:
+ The host application can manage power for an application in a virtualised
+ OR non-virtualised environment by looking at the event counters of the
+ cores and taking action based on the branch hit/miss ratio. See the host
+ application '--core-list' command line parameter below.
+
 #. librte_power for Virtual Machines
 
Using an alternate implementation for the librte_power API, requests for
@@ -174,13 +194,20 @@ Compiling and Running the Host Application
 Compiling
 ~
 
-Compiling the Application
--
-
-To compile the sample application see :doc:`compiling`.
+For information on compiling DPDK and the sample applications
+see :doc:`compiling`.
 
 The application is located in the ``vm_power_manager`` sub-directory.
 
+To build just the ``vm_power_manager`` application:
+
+.. code-block:: console
+
+  export RTE_SDK=/path/to/rte_sdk
+  export RTE_TARGET=build
+  cd ${RTE_SDK}/examples/vm_power_manager/
+  make
+
 Running
 ~~~
 
@@ -287,38 +314,129 @@ Manual control and inspection can also be carried in 
relation CPU frequency scal
 
 set_cpu_freq {core_num} up|down|min|max
 
+There are also some command line parameters for enabling the out-of-band
+monitoring of branch ratio on cores doing busy polling via PMDs.
+
+  .. code-block:: console
+
+--core-list {list of cores}
+
+  When this parameter is used, the list of cores specified will monitor the 
ratio
+  between branch hits and branch misses. A tightly polling PMD thread will 
have a
+  very low branch ratio, so the core frequency will be scaled down to the 
minimim
+  allowed value. When packets are received, the code path will alter, causing 
the
+  branch ratio to increase. When the ratio goes above the ratio threshold, the
+  core frequency will be scaled up to the maximum allowed value.
+
+  .. code-block:: console
+
+--branch-ratio {ratio}
+
+  The branch ratio is a floating point number that specifies the threshold at 
which
+  to scale up or down for the given workload. The default branch ratio is 0.01,
+  and will need to be adjusted for different workloads.
+
+
 Compiling and Running the Guest Applications
 
 
-For compiling and running l3fwd-power, see :doc:`l3_forward_power_man`.
+l3fwd-power is one sample application that can be used with vm_power_manager.
 
 A guest CLI is also provided for validating the setup.
 
 For both l3fwd-power and guest CLI, the channels for the VM must be monitored 
by the
-host application using the *add_channels* command on the host.
+host application using the *add_channels* command on the host. This typically 
uses
+the following commands in the host application:
+
+.. code-block:: console
+
+  vm_power> add_vm vmname
+  vm_power> add_channels vmname all
+  vm_power> set_channel_status vmname a

Re: [dpdk-dev] [PATCH] net/mlx5: fix possible endless loop when clearing flow flags

2018-07-25 Thread Shahaf Shuler
Wednesday, July 25, 2018 9:59 AM, Nélio Laranjeiro:
> Subject: Re: [PATCH] net/mlx5: fix possible endless loop when clearing flow
> flags
> 
> On Tue, Jul 24, 2018 at 09:47:19PM +, Yongseok Koh wrote:
> >
> > > On Jul 23, 2018, at 11:57 PM, Nélio Laranjeiro
>  wrote:
> > >
> > > On Mon, Jul 23, 2018 at 11:27:44AM -0700, Yongseok Koh wrote:
> > >> If one of (*priv->rxqs)[] is null, the for loop can iterate
> > >> infinitely as idx can't be increased.
> > >>
> > >> Fixes: cd24d526395e ("net/mlx5: add mark/flag flow action")
> > >> Cc: Nelio Laranjeiro 
> > >>
> > >> Signed-off-by: Yongseok Koh 
> > >> ---
> > >> drivers/net/mlx5/mlx5_flow.c | 8 +++-
> > >> 1 file changed, 3 insertions(+), 5 deletions(-)
> > >>
> > >> diff --git a/drivers/net/mlx5/mlx5_flow.c
> > >> b/drivers/net/mlx5/mlx5_flow.c index 32854198b..c156f01eb 100644
> > >> --- a/drivers/net/mlx5/mlx5_flow.c
> > >> +++ b/drivers/net/mlx5/mlx5_flow.c
> > >> @@ -2762,22 +2762,20 @@ mlx5_flow_rxq_flags_clear(struct
> > >> rte_eth_dev *dev) {
> > >>  struct priv *priv = dev->data->dev_private;
> > >>  unsigned int i;
> > >> -unsigned int idx;
> > >>
> > >> -for (idx = 0, i = 0; idx != priv->rxqs_n; ++i) {
> > >> +for (i = 0; i != priv->rxqs_n; ++i) {
> > >>  struct mlx5_rxq_ctrl *rxq_ctrl;
> > >>  unsigned int j;
> > >>
> > >> -if (!(*priv->rxqs)[idx])
> > >> +if (!(*priv->rxqs)[i])
> > >>  continue;
> > >> -rxq_ctrl = container_of((*priv->rxqs)[idx],
> > >> +rxq_ctrl = container_of((*priv->rxqs)[i],
> > >>  struct mlx5_rxq_ctrl, rxq);
> > >>  rxq_ctrl->flow_mark_n = 0;
> > >>  rxq_ctrl->rxq.mark = 0;
> > >>  for (j = 0; j != MLX5_FLOW_TUNNEL; ++j)
> > >>  rxq_ctrl->flow_tunnels_n[j] = 0;
> > >>  rxq_ctrl->rxq.tunnel = 0;
> > >> -++idx;
> > >>  }
> > >> }
> > >>
> > >> --
> > >> 2.11.0
> > >
> > > This patch is wrong, (*priv->rxqs)[i] may un-initialised by the
> > > application, the number of queues says how are in used, it does not
> > > mean they are contiguous in the rxqs arrays and this due to the DPDK
> > > API which configure the number of queues with
> > > rte_eth_dev_configure() whereas queues are instantiated with
> > > rte_eth_rx_queue_setup() which takes an position in the array as
> parameter.
> > >
> > > Indeed this code is wrong, idx should always increase whereas i
> > > should only increase if the (*priv->rxqs)[idx] is non null.
> >
> > I don't understand what you mean. In rte_eth_rx_queue_setup(),
> > rx_queue_id is checked against dev->data->nb_rx_queues.
> >
> > if (rx_queue_id >= dev->data->nb_rx_queues) {
> > RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n",
> rx_queue_id);
> > return -EINVAL;
> > }
> >
> > This means the index should be [0, priv->rxqs_n) anyway. There is the
> > same check in mlx5_rx_queue_setup(). If user mistakenly doesn't
> > configure some of queues, then the corresponding slots could be null
> > but indexes are still within the range.
> >
> > Then, what's your point of having both i and idx?
> 
> I remember I've face some issue while I've re-write the PMD to work on top
> of flow API.  That's why I've introduce such logic, but it seems not necessary
> as it comply with the documentation of the function and the code itself.
> 
> Acked-by: Nelio Laranjeiro 

Applied to next-net-mlx, thanks. 

> 
> --
> Nélio Laranjeiro
> 6WIND


Re: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence

2018-07-25 Thread Jerin Jacob
-Original Message-
> Date: Tue, 24 Jul 2018 21:09:50 +0530
> From: Jerin Jacob 
> To: Pavan Nikhilesh 
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown
>  sequence
> User-Agent: Mutt/1.10.1 (2018-07-13)
> 
> -Original Message-
> > Date: Tue, 24 Jul 2018 17:44:50 +0530
> > From: Pavan Nikhilesh 
> > To: jerin.ja...@caviumnetworks.com
> > Cc: dev@dpdk.org, Pavan Nikhilesh 
> > Subject: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence
> > X-Mailer: git-send-email 2.18.0
> > 
> > Use proper teardown sequence when SIGINT is caught to prevent
> > eventdev from going into undefined state.
> > 
> > Signed-off-by: Pavan Nikhilesh 
> 
> Acked-by: Jerin Jacob 

Applied to dpdk-next-eventdev/master. Thanks.

> 
> > ---
> >  v4 Changes:
> >  - Check opts before closing ethdev.
> > 
> >  v3 Changes:
> >  - Segregate ethdev_stop and close to prevent possible SEGFAULT.
> >  - handle early shutdown.
> > 
> >  v2 Changes:
> >  - Only stopping the ethdev(producer) is sufficient.(Jerin)
> > 
> >  app/test-eventdev/evt_main.c | 42 +++-
> >  app/test-eventdev/test_perf_common.c |  1 -
> >  app/test-eventdev/test_pipeline_common.c |  1 -
> >  3 files changed, 27 insertions(+), 17 deletions(-)
> > 
> > diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
> > index 57bb94570..a8d304bab 100644
> > --- a/app/test-eventdev/evt_main.c
> > +++ b/app/test-eventdev/evt_main.c
> > @@ -20,29 +20,41 @@ struct evt_test *test;
> >  static void
> >  signal_handler(int signum)
> >  {
> > -   if (signum == SIGINT || signum == SIGTERM) {
> > +   int i;
> > +   static uint8_t once;
> > +
> > +   if ((signum == SIGINT || signum == SIGTERM) && !once) {
> > +   once = true;
> > printf("\nSignal %d received, preparing to exit...\n",
> > signum);
> > -   /* request all lcores to exit from the main loop */
> > -   *(int *)test->test_priv = true;
> > -   rte_wmb();
> > 
> > -   rte_eal_mp_wait_lcore();
> > +   if (test != NULL) {
> > +   /* request all lcores to exit from the main loop */
> > +   *(int *)test->test_priv = true;
> > +   rte_wmb();
> > +
> > +   if (test->ops.ethdev_destroy)
> > +   test->ops.ethdev_destroy(test, &opt);
> > 
> > -   if (test->ops.test_result)
> > -   test->ops.test_result(test, &opt);
> > +   rte_eal_mp_wait_lcore();
> > 
> > -   if (test->ops.eventdev_destroy)
> > -   test->ops.eventdev_destroy(test, &opt);
> > +   if (test->ops.test_result)
> > +   test->ops.test_result(test, &opt);
> > 
> > -   if (test->ops.ethdev_destroy)
> > -   test->ops.ethdev_destroy(test, &opt);
> > +   if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
> > +   RTE_ETH_FOREACH_DEV(i)
> > +   rte_eth_dev_close(i);
> > +   }
> > 
> > -   if (test->ops.mempool_destroy)
> > -   test->ops.mempool_destroy(test, &opt);
> > +   if (test->ops.eventdev_destroy)
> > +   test->ops.eventdev_destroy(test, &opt);
> > 
> > -   if (test->ops.test_destroy)
> > -   test->ops.test_destroy(test, &opt);
> > +   if (test->ops.mempool_destroy)
> > +   test->ops.mempool_destroy(test, &opt);
> > +
> > +   if (test->ops.test_destroy)
> > +   test->ops.test_destroy(test, &opt);
> > +   }
> > 
> > /* exit with the expected status */
> > signal(signum, SIG_DFL);
> > diff --git a/app/test-eventdev/test_perf_common.c 
> > b/app/test-eventdev/test_perf_common.c
> > index d00f91802..6d39f98e0 100644
> > --- a/app/test-eventdev/test_perf_common.c
> > +++ b/app/test-eventdev/test_perf_common.c
> > @@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct 
> > evt_options *opt)
> > RTE_ETH_FOREACH_DEV(i) {
> > rte_event_eth_rx_adapter_stop(i);
> > rte_eth_dev_stop(i);
> > -   rte_eth_dev_close(i);
> > }
> > }
> >  }
> > diff --git a/app/test-eventdev/test_pipeline_common.c 
> > b/app/test-eventdev/test_pipeline_common.c
> > index 719518ff3..96e7c9882 100644
> > --- a/app/test-eventdev/test_pipeline_common.c
> > +++ b/app/test-eventdev/test_pipeline_common.c
> > @@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct 
> > evt_options *opt)
> > RTE_ETH_FOREACH_DEV(i) {
> > rte_event_eth_rx_adapter_stop(i);
> > rte_eth_dev_stop(i);
> > -   rte_eth_dev_close(i);
> > }
> >  }
> > 
> > --
> > 2.18.0
> > 


Re: [dpdk-dev] [PATCH] net/mlx5: fix queue rollback when starting device

2018-07-25 Thread Shahaf Shuler
Monday, July 23, 2018 11:57 PM, Yongseok Koh:
> Subject: [PATCH] net/mlx5: fix queue rollback when starting device
> 
> mlx5_rxq_start() and mlx5_rxq_stop() must be strictly paired because
> internal reference counter is increased or decreased inside. Also,
> mlx5_rxq_get() must be paired with mlx5_rxq_release().
> 
> Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")
> Fixes: a1366b1a2be3 ("net/mlx5: add reference counter on DPDK Rx
> queues")
> Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx
> queues")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Yongseok Koh 

Applied to next-net-mlx, thanks. 


Re: [dpdk-dev] [PATCH] event/octeontx: remove unnecessary port start and stop in Rx adapter

2018-07-25 Thread Jerin Jacob
-Original Message-
> Date: Tue, 24 Jul 2018 21:08:04 +0530
> From: Jerin Jacob 
> To: Pavan Nikhilesh 
> Cc: dev@dpdk.org, sta...@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] event/octeontx: remove unnecessary port
>  start and stop in Rx adapter
> User-Agent: Mutt/1.10.1 (2018-07-13)
> 
> -Original Message-
> > Date: Thu, 19 Jul 2018 17:17:47 +0530
> > From: Pavan Nikhilesh 
> > To: jerin.ja...@caviumnetworks.com
> > Cc: dev@dpdk.org, Pavan Nikhilesh ,
> >  sta...@dpdk.org
> > Subject: [dpdk-dev] [PATCH] event/octeontx: remove unnecessary port start
> >  and stop in Rx adapter
> > X-Mailer: git-send-email 2.18.0
> > 
> > Modifying port state is not necessary when starting/stopping Rx adapter
> > as it is same as starting/stopping ethdev.
> > 
> > Fixes: 45a914c5bd71 ("event/octeontx: support event Rx adapter")
> > Cc: sta...@dpdk.org
> > 
> > Signed-off-by: Pavan Nikhilesh 
> 
> Acked-by: Jerin Jacob 

Fixed check-git-log.sh issues.

Applied to dpdk-next-eventdev/master. Thanks.

> 
> > ---
> >  drivers/event/octeontx/ssovf_evdev.c | 14 ++
> >  1 file changed, 2 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/event/octeontx/ssovf_evdev.c 
> > b/drivers/event/octeontx/ssovf_evdev.c
> > index 2df70b52a..f98296f18 100644
> > --- a/drivers/event/octeontx/ssovf_evdev.c
> > +++ b/drivers/event/octeontx/ssovf_evdev.c
> > @@ -476,14 +476,9 @@ static int
> >  ssovf_eth_rx_adapter_start(const struct rte_eventdev *dev,
> > const struct rte_eth_dev *eth_dev)
> >  {
> > -   int ret;
> > -   const struct octeontx_nic *nic = eth_dev->data->dev_private;
> > RTE_SET_USED(dev);
> > +   RTE_SET_USED(eth_dev);
> >  
> > -   ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> > -   if (ret)
> > -   return 0;
> > -   octeontx_pki_port_start(nic->port_id);
> > return 0;
> >  }
> >  
> > @@ -492,14 +487,9 @@ static int
> >  ssovf_eth_rx_adapter_stop(const struct rte_eventdev *dev,
> > const struct rte_eth_dev *eth_dev)
> >  {
> > -   int ret;
> > -   const struct octeontx_nic *nic = eth_dev->data->dev_private;
> > RTE_SET_USED(dev);
> > +   RTE_SET_USED(eth_dev);
> >  
> > -   ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> > -   if (ret)
> > -   return 0;
> > -   octeontx_pki_port_stop(nic->port_id);
> > return 0;
> >  }
> >  
> > -- 
> > 2.18.0
> > 


[dpdk-dev] [PATCH v2] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Shahaf Shuler
From: Yaroslav Brustinov 

addressing a gcc 4.7.2 bug that cannot be reproduced with latter
versions:

"bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"

Fix it be forcing the alignment of the glue lib.

Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate file")
Cc: sta...@dpdk.org
Cc: nelio.laranje...@6wind.com
Cc: adrien.mazarg...@6wind.com

Signed-off-by: Yaroslav Brustinov 
Signed-off-by: Shahaf Shuler 
---
On v2:
 - Forced alignment using alignas to the size of the cacheline.

---
 drivers/net/mlx5/mlx5_glue.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index c7965e51fe..705232f614 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Not needed by this file; included to work around the lack of off_t
@@ -23,6 +24,8 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
+#include 
+
 #include "mlx5_autoconf.h"
 #include "mlx5_glue.h"
 
@@ -343,7 +346,8 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
 #endif
 }
 
-const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
+alignas(RTE_CACHE_LINE_SIZE)
+const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.version = MLX5_GLUE_VERSION,
.fork_init = mlx5_glue_fork_init,
.alloc_pd = mlx5_glue_alloc_pd,
-- 
2.12.0



Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Van Haaren, Harry
> Sent: Wednesday, July 25, 2018 1:27 PM
> To: Ananyev, Konstantin ; Dumitrescu,
> Cristian ; Mordechay Haimovsky
> ; Thomas Monjalon ;
> Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan, Reshma ; olivier.m...@6wind.com
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> > -Original Message-
> > From: Ananyev, Konstantin
> > Sent: Wednesday, July 25, 2018 1:18 PM
> > To: Dumitrescu, Cristian ; Mordechay
> Haimovsky
> > ; Thomas Monjalon ;
> Singh, Jasvinder
> > 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan,
> > Reshma ; olivier.m...@6wind.com; Van
> Haaren, Harry
> > 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Dumitrescu, Cristian
> > > Sent: Wednesday, July 25, 2018 12:57 PM
> > > To: Ananyev, Konstantin ; Mordechay
> Haimovsky
> > ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> Pattan,
> > Reshma ;
> > > olivier.m...@6wind.com; Van Haaren, Harry
> 
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Ananyev, Konstantin
> > > > Sent: Wednesday, July 25, 2018 12:39 PM
> > > > To: Dumitrescu, Cristian ; Mordechay
> > > > Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder
> 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > > Pattan, Reshma ;
> olivier.m...@6wind.com; Van
> > > > Haaren, Harry 
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Dumitrescu, Cristian
> > > > > Sent: Wednesday, July 25, 2018 10:36 AM
> > > > > To: Ananyev, Konstantin ;
> Mordechay
> > > > Haimovsky ; Thomas Monjalon
> > > > > ; Singh, Jasvinder
> 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > > Pattan, Reshma ;
> > > > > olivier.m...@6wind.com
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Ananyev, Konstantin
> > > > > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > > > > To: Dumitrescu, Cristian ;
> Mordechay
> > > > > > Haimovsky ; Thomas Monjalon
> > > > > > ; Singh, Jasvinder
> 
> > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> ;
> > > > > > Pattan, Reshma ;
> olivier.m...@6wind.com
> > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > > ctrl+d
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of
> Dumitrescu,
> > > > > > Cristian
> > > > > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > > > > To: Mordechay Haimovsky ; Thomas
> Monjalon
> > > > > > ; Singh, Jasvinder
> > > > > > > 
> > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > ;
> > > > > > Pattan, Reshma ;
> > > > > > > olivier.m...@6wind.com
> > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> using
> > > > ctrl+d
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > > > > To: Thomas Monjalon ; Singh,
> Jasvinder
> > > > > > > > 
> > > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > ;
> > > > > > > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com;
> > > > > > > > Dumitrescu, Cristian 
> > > > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > using
> > > > > > ctrl+d
> > > > > > > >
> > > > > > > > Even after this fix we still have setups that use netvsc  for
> > example,
> > > > on
> > > > > > > > which testpmd exits with rte_panic right after loading it even
> > > > without
> > > > > > > > touching the KBD.
> > > > > > > >
> > > > > > > > I recommend returning the previous prompt routine in test-
> > > > > > pmd/cmdline.c
> > > > > > > > and rework the SOFTNIC section there, preferably moving its
> poll
> > > > section
> > > > > > to
> > > > > > > > use rte_service in a separate file cleaning the CLI files from
> > PMD-
> > > > specific
> > > > > > > > implementation.
> > > > > > > >
> > > > > > > > > -Original Message-
> > > > > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > > > > To: Jasvinder Singh 
> > > > > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > > > > ;
> > > > > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd
> exit
> > > > using
> > > > > > ctrl+d
> > > > > > > > >
> > > > > > > > > Important note:
> > > > > > > > >   testpmd is currently rea

Re: [dpdk-dev] [PATCH v2] ip_frag: extend rte_ipv6_frag_get_ipv6_fragment_header()

2018-07-25 Thread Gaëtan Rivet
Hi Konstantin,

On Wed, Jul 25, 2018 at 09:11:30AM +, Ananyev, Konstantin wrote:
> Hi Cody,
> 
> > -Original Message-
> > From: Cody Doucette [mailto:douce...@bu.edu]
> > Sent: Thursday, July 19, 2018 4:58 PM
> > To: Ananyev, Konstantin ; Olivier Matz 
> > ; Dumitrescu, Cristian
> > 
> > Cc: dev@dpdk.org; mic...@digirati.com.br; Cody Doucette ; 
> > Qiaobin Fu 
> > Subject: [PATCH v2] ip_frag: extend rte_ipv6_frag_get_ipv6_fragment_header()
> > 
> > Extend rte_ipv6_frag_get_ipv6_fragment_header() to skip over any
> > other IPv6 extension headers when finding the fragment header.
> > 
> > According to RFC 8200, there is no guarantee that the IPv6
> > Fragment extension header will come before any other extension
> > header, even though it is recommended.
> > 
> > Signed-off-by: Cody Doucette 
> > Signed-off-by: Qiaobin Fu 
> > Reviewed-by: Michel Machado 
> > ---
> > v2:
> > * Moved IPv6 extension header definitions to lib_net.
> > 
> 
> Looks ok to me, though now drivers/net/failsafe fails to build on freebsd:
> http://mails.dpdk.org/archives/test-report/2018-July/060532.html
> 
> I fixed that locally by commenting out:
> CFLAGS += -D_XOPEN_SOURCE=700
> at drivers/net/failsafe/Makefile
> 
> Not sure what is the root cause here.
> Gaetan, do you remember why we need it for failsafe driver?
> Konstantin
> 

IIRC, I was using it during the parameters parsing.
I don't see this reason anymore.

Removing it I don't see any issue so if you need to, have at it!

-- 
Gaëtan Rivet
6WIND


Re: [dpdk-dev] [PATCH v3 1/2] app/testpmd: fix use of uninitialized field

2018-07-25 Thread Iremonger, Bernard
> -Original Message-
> From: Krzysztof Kanas [mailto:krzysztof.ka...@caviumnetworks.com]
> Sent: Wednesday, July 25, 2018 1:42 PM
> To: Iremonger, Bernard ;
> krzysztof.ka...@caviumnetworks.com; dev@dpdk.org; Lu, Wenzhuo
> ; Wu, Jingjing 
> Cc: Nithin Dabilpuram ; Singh, Jasvinder
> ; t...@semihalf.com
> Subject: [PATCH v3 1/2] app/testpmd: fix use of uninitialized field
> 
> print_err_msg uses message field that may be not initialized causing
> segmentation fault.
> 
> Fixes: 12f76f5247e2 ("app/testpmd: add command to resume a TM node")
> Cc: t...@semihalf.com
> 
> Signed-off-by: Krzysztof Kanas 

Acked-by: Bernard Iremonger 




Re: [dpdk-dev] [PATCH v2] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Adrien Mazarguil
On Wed, Jul 25, 2018 at 04:18:54PM +0300, Shahaf Shuler wrote:
> From: Yaroslav Brustinov 
> 
> addressing a gcc 4.7.2 bug that cannot be reproduced with latter
> versions:
> 
> "bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"
> 
> Fix it be forcing the alignment of the glue lib.
> 
> Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate file")
> Cc: sta...@dpdk.org
> Cc: nelio.laranje...@6wind.com
> Cc: adrien.mazarg...@6wind.com
> 
> Signed-off-by: Yaroslav Brustinov 
> Signed-off-by: Shahaf Shuler 

Except for a couple of minor nits below,

Acked-by: Adrien Mazarguil 

> ---
> On v2:
>  - Forced alignment using alignas to the size of the cacheline.
> 
> ---
>  drivers/net/mlx5/mlx5_glue.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
> index c7965e51fe..705232f614 100644
> --- a/drivers/net/mlx5/mlx5_glue.c
> +++ b/drivers/net/mlx5/mlx5_glue.c
> @@ -6,6 +6,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

You should keep alphabetical order.

>  
>  /*
>   * Not needed by this file; included to work around the lack of off_t
> @@ -23,6 +24,8 @@
>  #pragma GCC diagnostic error "-Wpedantic"
>  #endif
>  
> +#include 
> +
>  #include "mlx5_autoconf.h"
>  #include "mlx5_glue.h"
>  
> @@ -343,7 +346,8 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
>  #endif
>  }
>  
> -const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
> +alignas(RTE_CACHE_LINE_SIZE)
> +const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {

Extra space added before opening brace :)

>   .version = MLX5_GLUE_VERSION,
>   .fork_init = mlx5_glue_fork_init,
>   .alloc_pd = mlx5_glue_alloc_pd,
> -- 
> 2.12.0
> 

-- 
Adrien Mazarguil
6WIND


Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: fix help string for tm commit cmd

2018-07-25 Thread Iremonger, Bernard



> -Original Message-
> From: Krzysztof Kanas [mailto:krzysztof.ka...@caviumnetworks.com]
> Sent: Wednesday, July 25, 2018 1:42 PM
> To: Iremonger, Bernard ;
> krzysztof.ka...@caviumnetworks.com; dev@dpdk.org; Lu, Wenzhuo
> ; Wu, Jingjing 
> Cc: Nithin Dabilpuram ; Singh, Jasvinder
> 
> Subject: [PATCH v3 2/2] app/testpmd: fix help string for tm commit cmd
> 
> Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and
> hierarchy commit")
> Cc: jasvinder.si...@intel.com
> 
> Signed-off-by: Krzysztof Kanas 

Acked-by: Bernard Iremonger 



Re: [dpdk-dev] [PATCH] mk: fix application compilation with lmnl and mlx5

2018-07-25 Thread Shahaf Shuler
Wednesday, July 25, 2018 12:07 PM, Adrien Mazarguil:
> Subject: Re: [PATCH] mk: fix application compilation with lmnl and mlx5
> 
> The approach of linking .a files instead of .so and still generate a dynamic
> program also has drawbacks: duplication and link time issues with multiple
> users. For instance, this may cause mlx4 and mlx5 to conflict on libibverbs 
> and
> libmnl symbols, leaving one unable to include both PMDs into their program
> or prevent it from linking with these libraries for its own needs.
> I don't think it's worth the trouble.
> 

OK,

Acked-by: Shahaf Shuler 




Re: [dpdk-dev] [PATCH] event/octeontx: prefetch mbuf instead of wqe

2018-07-25 Thread Jerin Jacob
-Original Message-
> Date: Tue, 17 Jul 2018 22:08:30 +0530
> From: santosh 
> To: Pavan Nikhilesh ,
>  jerin.ja...@caviumnetworks.com
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] event/octeontx: prefetch mbuf instead of wqe
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
>  Thunderbird/52.8.0
> 
> 
> On Tuesday 17 July 2018 08:03 PM, Pavan Nikhilesh wrote:
> > Prefetch mbuf pointer instead of wqe when SSO receives pkt from PKI.
> >
> > Signed-off-by: Pavan Nikhilesh 
> > ---
> 
> Acked-by: Santosh Shukla 

Applied to dpdk-next-eventdev/master. Thanks.

> 


Re: [dpdk-dev] [PATCH] app/eventdev: fix order test service init

2018-07-25 Thread Jerin Jacob
-Original Message-
> Date: Fri, 13 Jul 2018 17:52:42 +
> From: "Eads, Gage" 
> To: Pavan Nikhilesh ,
>  "jerin.ja...@caviumnetworks.com" 
> CC: "dev@dpdk.org" , "sta...@dpdk.org" 
> Subject: RE: [dpdk-dev] [PATCH] app/eventdev: fix order test service init
> 
> External Email
> 
> > -Original Message-
> > From: Pavan Nikhilesh [mailto:pbhagavat...@caviumnetworks.com]
> > Sent: Friday, July 13, 2018 3:51 AM
> > To: jerin.ja...@caviumnetworks.com; Eads, Gage 
> > Cc: dev@dpdk.org; sta...@dpdk.org; Pavan Nikhilesh
> > 
> > Subject: [dpdk-dev] [PATCH] app/eventdev: fix order test service init
> >
> > Previous modification to evt_service_setup() broke order_queue/atq tests.
> >
> > Fixes: b0333c55dfa5 ("app/eventdev: add service core configuration")
> > Cc: sta...@dpdk.org
> >
> > Reported-by: Gage Eads 
> > Signed-off-by: Pavan Nikhilesh 
> > ---
> 
> Acked-by: Gage Eads 

Applied to dpdk-next-eventdev/master. Thanks.

> 
> Thanks for the quick turnaround,
> Gage


Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

2018-07-25 Thread Ananyev, Konstantin



> -Original Message-
> From: Dumitrescu, Cristian
> Sent: Wednesday, July 25, 2018 1:41 PM
> To: Ananyev, Konstantin ; Mordechay Haimovsky 
> ; Thomas Monjalon
> ; Singh, Jasvinder 
> Cc: dev@dpdk.org; Iremonger, Bernard ; Pattan, 
> Reshma ;
> olivier.m...@6wind.com; Van Haaren, Harry 
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> 
> 
> > -Original Message-
> > From: Ananyev, Konstantin
> > Sent: Wednesday, July 25, 2018 1:18 PM
> > To: Dumitrescu, Cristian ; Mordechay
> > Haimovsky ; Thomas Monjalon
> > ; Singh, Jasvinder 
> > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ; olivier.m...@6wind.com; Van
> > Haaren, Harry 
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> >
> >
> >
> > > -Original Message-
> > > From: Dumitrescu, Cristian
> > > Sent: Wednesday, July 25, 2018 12:57 PM
> > > To: Ananyev, Konstantin ; Mordechay
> > Haimovsky ; Thomas Monjalon
> > > ; Singh, Jasvinder 
> > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > Pattan, Reshma ;
> > > olivier.m...@6wind.com; Van Haaren, Harry
> > 
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Ananyev, Konstantin
> > > > Sent: Wednesday, July 25, 2018 12:39 PM
> > > > To: Dumitrescu, Cristian ; Mordechay
> > > > Haimovsky ; Thomas Monjalon
> > > > ; Singh, Jasvinder 
> > > > Cc: dev@dpdk.org; Iremonger, Bernard ;
> > > > Pattan, Reshma ; olivier.m...@6wind.com;
> > Van
> > > > Haaren, Harry 
> > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Dumitrescu, Cristian
> > > > > Sent: Wednesday, July 25, 2018 10:36 AM
> > > > > To: Ananyev, Konstantin ; Mordechay
> > > > Haimovsky ; Thomas Monjalon
> > > > > ; Singh, Jasvinder
> > 
> > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > ;
> > > > Pattan, Reshma ;
> > > > > olivier.m...@6wind.com
> > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > ctrl+d
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Ananyev, Konstantin
> > > > > > Sent: Wednesday, July 25, 2018 10:04 AM
> > > > > > To: Dumitrescu, Cristian ;
> > Mordechay
> > > > > > Haimovsky ; Thomas Monjalon
> > > > > > ; Singh, Jasvinder
> > 
> > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > ;
> > > > > > Pattan, Reshma ;
> > olivier.m...@6wind.com
> > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using
> > > > ctrl+d
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of
> > Dumitrescu,
> > > > > > Cristian
> > > > > > > Sent: Tuesday, July 24, 2018 5:59 PM
> > > > > > > To: Mordechay Haimovsky ; Thomas
> > Monjalon
> > > > > > ; Singh, Jasvinder
> > > > > > > 
> > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > ;
> > > > > > Pattan, Reshma ;
> > > > > > > olivier.m...@6wind.com
> > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > using
> > > > ctrl+d
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Mordechay Haimovsky [mailto:mo...@mellanox.com]
> > > > > > > > Sent: Tuesday, July 24, 2018 3:37 PM
> > > > > > > > To: Thomas Monjalon ; Singh, Jasvinder
> > > > > > > > 
> > > > > > > > Cc: dev@dpdk.org; Iremonger, Bernard
> > > > ;
> > > > > > > > Pattan, Reshma ;
> > > > olivier.m...@6wind.com;
> > > > > > > > Dumitrescu, Cristian 
> > > > > > > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > using
> > > > > > ctrl+d
> > > > > > > >
> > > > > > > > Even after this fix we still have setups that use netvsc  for
> > example,
> > > > on
> > > > > > > > which testpmd exits with rte_panic right after loading it even
> > > > without
> > > > > > > > touching the KBD.
> > > > > > > >
> > > > > > > > I recommend returning the previous prompt routine in test-
> > > > > > pmd/cmdline.c
> > > > > > > > and rework the SOFTNIC section there, preferably moving its poll
> > > > section
> > > > > > to
> > > > > > > > use rte_service in a separate file cleaning the CLI files from 
> > > > > > > > PMD-
> > > > specific
> > > > > > > > implementation.
> > > > > > > >
> > > > > > > > > -Original Message-
> > > > > > > > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > > > > > > > Sent: Tuesday, July 24, 2018 3:34 PM
> > > > > > > > > To: Jasvinder Singh 
> > > > > > > > > Cc: dev@dpdk.org; bernard.iremon...@intel.com;
> > > > > > > > > reshma.pat...@intel.com; Mordechay Haimovsky
> > > > > > > > ;
> > > > > > > > > olivier.m...@6wind.com; cristian.dumitre...@intel.com
> > > > > > > > > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit
> > > > using
> > > > > > ctrl+d
> > > > > > > > >
> > > > > > > > > Important note:
> > > > > > > > >   testpmd

[dpdk-dev] [PATCH v2] test: fix prefix discovery

2018-07-25 Thread Anatoly Burakov
Config file has moved, but the tests weren't updated to point to
its new location. Update the code to find current prefix.

Also, this function is duplicated across multiple tests, so move it
into process.h and force compile failures for any attempts to use
it on platforms other than Linux.

Fixes: adf1d867361c ("eal: move runtime config file to new location")

Signed-off-by: Anatoly Burakov 
Acked-by: Reshma Pattan 
---
 test/test/process.h   | 29 
 test/test/test_eal_flags.c| 42 +--
 test/test/test_mp_secondary.c | 26 --
 3 files changed, 39 insertions(+), 58 deletions(-)

diff --git a/test/test/process.h b/test/test/process.h
index 11986d5c2..ba3a18502 100644
--- a/test/test/process.h
+++ b/test/test/process.h
@@ -5,6 +5,11 @@
 #ifndef _PROCESS_H_
 #define _PROCESS_H_
 
+#include  /* PATH_MAX */
+#include  /* basename et al */
+#include  /* NULL */
+#include  /* readlink */
+
 #ifdef RTE_EXEC_ENV_BSDAPP
 #define self "curproc"
 #define exe "file"
@@ -61,4 +66,28 @@ process_dup(const char *const argv[], int numargs, const 
char *env_value)
return status;
 }
 
+/* FreeBSD doesn't support file prefixes, so force compile failures for any
+ * tests attempting to use this function on FreeBSD.
+ */
+#ifdef RTE_EXEC_ENV_LINUXAPP
+static char *
+get_current_prefix(char *prefix, int size)
+{
+   char path[PATH_MAX] = {0};
+   char buf[PATH_MAX] = {0};
+
+   /* get file for config (fd is always 3) */
+   snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
+
+   /* return NULL on error */
+   if (readlink(path, buf, sizeof(buf)) == -1)
+   return NULL;
+
+   /* get the prefix */
+   snprintf(prefix, size, "%s", basename(dirname(buf)));
+
+   return prefix;
+}
+#endif
+
 #endif /* _PROCESS_H_ */
diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c
index f840ca50b..c9a1d3a12 100644
--- a/test/test/test_eal_flags.c
+++ b/test/test/test_eal_flags.c
@@ -221,30 +221,6 @@ get_number_of_sockets(void)
 }
 #endif
 
-static char*
-get_current_prefix(char * prefix, int size)
-{
-   char path[PATH_MAX] = {0};
-   char buf[PATH_MAX] = {0};
-
-   /* get file for config (fd is always 3) */
-   snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
-
-   /* return NULL on error */
-   if (readlink(path, buf, sizeof(buf)) == -1)
-   return NULL;
-
-   /* get the basename */
-   snprintf(buf, sizeof(buf), "%s", basename(buf));
-
-   /* copy string all the way from second char up to start of _config */
-   snprintf(prefix, size, "%.*s",
-   (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
-   &buf[1]);
-
-   return prefix;
-}
-
 /*
  * Test that the app doesn't run with invalid whitelist option.
  * Final tests ensures it does run with valid options as sanity check (one
@@ -697,16 +673,18 @@ test_invalid_n_flag(void)
 static int
 test_no_hpet_flag(void)
 {
-   char prefix[PATH_MAX], tmp[PATH_MAX];
+   char prefix[PATH_MAX] = "";
 
 #ifdef RTE_EXEC_ENV_BSDAPP
return 0;
-#endif
+#else
+   char tmp[PATH_MAX];
if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
printf("Error - unable to get current prefix!\n");
return -1;
}
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
+#endif
 
/* With --no-hpet */
const char *argv1[] = {prgname, prefix, mp_flag, no_hpet, "-c", "1", 
"-n", "2"};
@@ -977,9 +955,15 @@ test_file_prefix(void)
 * 6. run a primary process with memtest2 prefix
 * 7. check that only memtest2 hugefiles are present in the hugedir
 */
+   char prefix[PATH_MAX] = "";
 
 #ifdef RTE_EXEC_ENV_BSDAPP
return 0;
+#else
+   if (get_current_prefix(prefix, sizeof(prefix)) == NULL) {
+   printf("Error - unable to get current prefix!\n");
+   return -1;
+   }
 #endif
 
/* this should fail unless the test itself is run with "memtest" prefix 
*/
@@ -994,12 +978,6 @@ test_file_prefix(void)
const char *argv2[] = {prgname, "-c", "1", "-n", "2", "-m", 
DEFAULT_MEM_SIZE,
"--file-prefix=" memtest2 };
 
-   char prefix[32];
-   if (get_current_prefix(prefix, sizeof(prefix)) == NULL) {
-   printf("Error - unable to get current prefix!\n");
-   return -1;
-   }
-
/* check if files for current prefix are present */
if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) {
printf("Error - hugepage files for %s were not created!\n", 
prefix);
diff --git a/test/test/test_mp_secondary.c b/test/test/test_mp_secondary.c
index cc46cf4de..b597dfcdf 100644
--- a/test/test/test_mp_secondary.c
+++ b/test/test/test_mp_secondary.c
@@ -50,32 +50,6 @@
 #define launch_proc(ARGV) process_dup(ARGV, \
sizeof(ARGV)/(s

[dpdk-dev] [PATCH v2] app/testpmd: removed softnic CLI modifications

2018-07-25 Thread Moti Haimovsky
This patch reverts the testpmd CLI prompt routine modifications done
in order to support softnic.
The reason of doing so is due to testpmd abnormal exit observed on
several setups caused by the softnic modifications to this routine,
for example: When running testpmd with tap interface
(/app/testpmd
 -n 4 --vdev=net_tap0,iface=tap0,remote=eth1 -- --burst=64
 --mbcache=512 -i --nb-cores=7 --rxq=2 --txq=2 --txd=512
 --rxd=512 --port-topology=chained --forward-mode=rxonly)
testpmd crashes seconds after presenting its prompt with the following
error:
  testpmd> PANIC in prompt():
  CLI poll error (-1)

  Thread 1 "testpmd" received signal SIGABRT, Aborted.
  0x7668e0d0 in raise () from /lib64/libc.so.6
  (gdb) bt
  #0  0x7668e0d0 in raise () from /lib64/libc.so.6
  #1  0x7668f6b1 in abort () from /lib64/libc.so.6
  #2  0x00468027 in __rte_panic ()
  #3  0x004876ed in prompt ()
  #4  0x0046dffc in main ()

When running testpmd with bare-metal device
(app/testpmd -n 4 --socket-mem=1024,1024 -w 04:00.0  --
 --burst=64 --mbcache=512 -i  --nb-cores=7
 --rxq=64  --txq=4 --txd=16 --rxd=16)
and pressing CTRL+D right after testpmd prompt is presented then
the program crashes while presenting the same messages as above.

Needless to say that this behavior is not observed when using the
previous CLI prompt routine.

Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
Cc: sta...@dpdk.org

Signed-off-by: Moti Haimovsky 
---
v2:
* Removed softnic modifications altogether.
v1:
* Wrapped softnic modifications with compilation switch.
---
 app/test-pmd/cmdline.c | 39 ++-
 1 file changed, 2 insertions(+), 37 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2c32029..d058860 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -17896,50 +17896,15 @@ struct cmd_config_per_queue_tx_offload_result {
 void
 prompt(void)
 {
-   int status;
-
/* initialize non-constant commands */
cmd_set_fwd_mode_init();
cmd_set_fwd_retry_mode_init();
 
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-   portid_t softnic_portid, pid;
-   uint8_t softnic_enable = 0;
-
-   if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
-   RTE_ETH_FOREACH_DEV(pid) {
-   struct rte_port *port = &ports[pid];
-   const char *driver = port->dev_info.driver_name;
-
-   if (strcmp(driver, "net_softnic") == 0) {
-   softnic_portid = pid;
-   softnic_enable = 1;
-   break;
-   }
-   }
-   }
-#endif
-
testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
if (testpmd_cl == NULL)
return;
-
-   for (;;) {
-   status = cmdline_poll(testpmd_cl);
-   if (status < 0)
-   rte_panic("CLI poll error (%" PRId32 ")\n", status);
-   else if (status == RDLINE_EXITED) {
-   cmdline_stdin_exit(testpmd_cl);
-   rte_exit(0, "\n");
-   }
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-
-   if ((softnic_enable == 1) &&
-   (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
-   rte_pmd_softnic_manage(softnic_portid);
-#endif
-   }
+   cmdline_interact(testpmd_cl);
+   cmdline_stdin_exit(testpmd_cl);
 }
 
 void
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH v2] app/testpmd: removed softnic CLI modifications

2018-07-25 Thread Thomas Monjalon
+Cc

25/07/2018 16:40, Moti Haimovsky:
> This patch reverts the testpmd CLI prompt routine modifications done
> in order to support softnic.
> The reason of doing so is due to testpmd abnormal exit observed on
> several setups caused by the softnic modifications to this routine,
> for example: When running testpmd with tap interface
> (/app/testpmd
>  -n 4 --vdev=net_tap0,iface=tap0,remote=eth1 -- --burst=64
>  --mbcache=512 -i --nb-cores=7 --rxq=2 --txq=2 --txd=512
>  --rxd=512 --port-topology=chained --forward-mode=rxonly)
> testpmd crashes seconds after presenting its prompt with the following
> error:
>   testpmd> PANIC in prompt():
>   CLI poll error (-1)
> 
>   Thread 1 "testpmd" received signal SIGABRT, Aborted.
>   0x7668e0d0 in raise () from /lib64/libc.so.6
>   (gdb) bt
>   #0  0x7668e0d0 in raise () from /lib64/libc.so.6
>   #1  0x7668f6b1 in abort () from /lib64/libc.so.6
>   #2  0x00468027 in __rte_panic ()
>   #3  0x004876ed in prompt ()
>   #4  0x0046dffc in main ()
> 
> When running testpmd with bare-metal device
> (app/testpmd -n 4 --socket-mem=1024,1024 -w 04:00.0  --
>  --burst=64 --mbcache=512 -i  --nb-cores=7
>  --rxq=64  --txq=4 --txd=16 --rxd=16)
> and pressing CTRL+D right after testpmd prompt is presented then
> the program crashes while presenting the same messages as above.
> 
> Needless to say that this behavior is not observed when using the
> previous CLI prompt routine.
> 
> Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Moti Haimovsky 
> ---
> v2:
> * Removed softnic modifications altogether.
> v1:
> * Wrapped softnic modifications with compilation switch.
> ---
>  app/test-pmd/cmdline.c | 39 ++-
>  1 file changed, 2 insertions(+), 37 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 2c32029..d058860 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -17896,50 +17896,15 @@ struct cmd_config_per_queue_tx_offload_result {
>  void
>  prompt(void)
>  {
> - int status;
> -
>   /* initialize non-constant commands */
>   cmd_set_fwd_mode_init();
>   cmd_set_fwd_retry_mode_init();
>  
> -#if defined RTE_LIBRTE_PMD_SOFTNIC
> - portid_t softnic_portid, pid;
> - uint8_t softnic_enable = 0;
> -
> - if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
> - RTE_ETH_FOREACH_DEV(pid) {
> - struct rte_port *port = &ports[pid];
> - const char *driver = port->dev_info.driver_name;
> -
> - if (strcmp(driver, "net_softnic") == 0) {
> - softnic_portid = pid;
> - softnic_enable = 1;
> - break;
> - }
> - }
> - }
> -#endif
> -
>   testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
>   if (testpmd_cl == NULL)
>   return;
> -
> - for (;;) {
> - status = cmdline_poll(testpmd_cl);
> - if (status < 0)
> - rte_panic("CLI poll error (%" PRId32 ")\n", status);
> - else if (status == RDLINE_EXITED) {
> - cmdline_stdin_exit(testpmd_cl);
> - rte_exit(0, "\n");
> - }
> -
> -#if defined RTE_LIBRTE_PMD_SOFTNIC
> -
> - if ((softnic_enable == 1) &&
> - (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
> - rte_pmd_softnic_manage(softnic_portid);
> -#endif
> - }
> + cmdline_interact(testpmd_cl);
> + cmdline_stdin_exit(testpmd_cl);
>  }
>  
>  void
> 







[dpdk-dev] [PATCH] net/mlx4: verify RSS supports num Rx Qs being used

2018-07-25 Thread Moti Haimovsky
This patch verifies that the number of Rx queues configured for RSS
is supported by the device hardware.
RSS support in mlx4 requires contiguous chunk of QPs to be reserved,
there is a hardware limitation on the amount of contiguous QPs which
is reported by the hardware. Ignoring this value will cause Rx queues
creation to fail.

Signed-off-by: Moti Haimovsky 
---
 drivers/net/mlx4/mlx4.c | 3 +++
 drivers/net/mlx4/mlx4.h | 1 +
 drivers/net/mlx4/mlx4_rxq.c | 6 ++
 3 files changed, 10 insertions(+)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index c67d2c0..defc0d4 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -673,6 +673,9 @@ struct mlx4_conf {
   &device_attr_ex);
DEBUG("supported RSS hash fields mask: %016" PRIx64,
  priv->hw_rss_sup);
+   priv->hw_rss_max_qps =
+   device_attr_ex.rss_caps.max_rwq_indirection_table_size;
+   DEBUG("MAX RSS queues %d", priv->hw_rss_max_qps);
priv->hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &
IBV_RAW_PACKET_CAP_SCATTER_FCS);
DEBUG("FCS stripping toggling is %ssupported",
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 89d8c38..e6fb934 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -95,6 +95,7 @@ struct priv {
uint32_t hw_fcs_strip:1; /**< FCS stripping toggling is supported. */
uint32_t tso:1; /**< Transmit segmentation offload is supported. */
uint32_t tso_max_payload_sz; /**< Max supported TSO payload size. */
+   uint32_t hw_rss_max_qps; /**< Max Rx Queues supported by RSS. */
uint64_t hw_rss_sup; /**< Supported RSS hash fields (Verbs format). */
struct rte_intr_handle intr_handle; /**< Port interrupt handle. */
struct mlx4_drop *drop; /**< Shared resources for drop flow rules. */
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 0cd9560..e8bef1d 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -338,6 +338,12 @@ struct mlx4_rss *
 
if (priv->rss_init)
return 0;
+   if (priv->dev->data->nb_rx_queues > priv->hw_rss_max_qps) {
+   ERROR("RSS does not support more than %d queues",
+ priv->hw_rss_max_qps);
+   rte_errno = EINVAL;
+   return -rte_errno;
+   }
/* Prepare range for RSS contexts before creating the first WQ. */
ret = mlx4_glue->dv_set_context_attr
(priv->ctx,
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH v2] app/testpmd: removed softnic CLI modifications

2018-07-25 Thread Singh, Jasvinder


> -Original Message-
> From: Thomas Monjalon [mailto:tho...@monjalon.net]
> Sent: Wednesday, July 25, 2018 3:43 PM
> To: Moti Haimovsky 
> Cc: dev@dpdk.org; sta...@dpdk.org; Singh, Jasvinder
> ; Dumitrescu, Cristian
> ; Ananyev, Konstantin
> 
> Subject: Re: [PATCH v2] app/testpmd: removed softnic CLI modifications
> 
> +Cc
> 
> 25/07/2018 16:40, Moti Haimovsky:
> > This patch reverts the testpmd CLI prompt routine modifications done
> > in order to support softnic.
> > The reason of doing so is due to testpmd abnormal exit observed on
> > several setups caused by the softnic modifications to this routine,
> > for example: When running testpmd with tap interface (/app/testpmd  -n
> > 4 --vdev=net_tap0,iface=tap0,remote=eth1 -- --burst=64
> >  --mbcache=512 -i --nb-cores=7 --rxq=2 --txq=2 --txd=512
> >  --rxd=512 --port-topology=chained --forward-mode=rxonly) testpmd
> > crashes seconds after presenting its prompt with the following
> > error:
> >   testpmd> PANIC in prompt():
> >   CLI poll error (-1)
> >
> >   Thread 1 "testpmd" received signal SIGABRT, Aborted.
> >   0x7668e0d0 in raise () from /lib64/libc.so.6
> >   (gdb) bt
> >   #0  0x7668e0d0 in raise () from /lib64/libc.so.6
> >   #1  0x7668f6b1 in abort () from /lib64/libc.so.6
> >   #2  0x00468027 in __rte_panic ()
> >   #3  0x004876ed in prompt ()
> >   #4  0x0046dffc in main ()
> >
> > When running testpmd with bare-metal device (app/testpmd -n 4
> > --socket-mem=1024,1024 -w 04:00.0  --
> >  --burst=64 --mbcache=512 -i  --nb-cores=7
> >  --rxq=64  --txq=4 --txd=16 --rxd=16)
> > and pressing CTRL+D right after testpmd prompt is presented then the
> > program crashes while presenting the same messages as above.
> >
> > Needless to say that this behavior is not observed when using the
> > previous CLI prompt routine.
> >
> > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Moti Haimovsky 
> > ---
> > v2:
> > * Removed softnic modifications altogether.
> > v1:
> > * Wrapped softnic modifications with compilation switch.
> > ---
> >  app/test-pmd/cmdline.c | 39 ++-
> >  1 file changed, 2 insertions(+), 37 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 2c32029..d058860 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -17896,50 +17896,15 @@ struct
> > cmd_config_per_queue_tx_offload_result {  void
> >  prompt(void)
> >  {
> > -   int status;
> > -
> > /* initialize non-constant commands */
> > cmd_set_fwd_mode_init();
> > cmd_set_fwd_retry_mode_init();
> >
> > -#if defined RTE_LIBRTE_PMD_SOFTNIC
> > -   portid_t softnic_portid, pid;
> > -   uint8_t softnic_enable = 0;
> > -
> > -   if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
> > -   RTE_ETH_FOREACH_DEV(pid) {
> > -   struct rte_port *port = &ports[pid];
> > -   const char *driver = port->dev_info.driver_name;
> > -
> > -   if (strcmp(driver, "net_softnic") == 0) {
> > -   softnic_portid = pid;
> > -   softnic_enable = 1;
> > -   break;
> > -   }
> > -   }
> > -   }
> > -#endif
> > -
> > testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
> > if (testpmd_cl == NULL)
> > return;
> > -
> > -   for (;;) {
> > -   status = cmdline_poll(testpmd_cl);
> > -   if (status < 0)
> > -   rte_panic("CLI poll error (%" PRId32 ")\n", status);
> > -   else if (status == RDLINE_EXITED) {
> > -   cmdline_stdin_exit(testpmd_cl);
> > -   rte_exit(0, "\n");
> > -   }
> > -
> > -#if defined RTE_LIBRTE_PMD_SOFTNIC
> > -
> > -   if ((softnic_enable == 1) &&
> > -   (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
> > -   rte_pmd_softnic_manage(softnic_portid);
> > -#endif
> > -   }
> > +   cmdline_interact(testpmd_cl);
> > +   cmdline_stdin_exit(testpmd_cl);
> >  }
> >
> >  void
> >

With above changes in cmdline.c, you should also consider removing following 
from the file -

#ifdef RTE_LIBRTE_PMD_SOFTNIC
#include 
#endif
 



[dpdk-dev] [PATCH v3] app/testpmd: removed softnic CLI modifications

2018-07-25 Thread Moti Haimovsky
This patch reverts the testpmd CLI prompt routine modifications done
in order to support softnic.
The reason of doing so is due to testpmd abnormal exit observed on
several setups caused by the softnic modifications to this routine,
for example: When running testpmd with tap interface
(/app/testpmd
 -n 4 --vdev=net_tap0,iface=tap0,remote=eth1 -- --burst=64
 --mbcache=512 -i --nb-cores=7 --rxq=2 --txq=2 --txd=512
 --rxd=512 --port-topology=chained --forward-mode=rxonly)
testpmd crashes seconds after presenting its prompt with the following
error:
  testpmd> PANIC in prompt():
  CLI poll error (-1)

  Thread 1 "testpmd" received signal SIGABRT, Aborted.
  0x7668e0d0 in raise () from /lib64/libc.so.6
  (gdb) bt
  #0  0x7668e0d0 in raise () from /lib64/libc.so.6
  #1  0x7668f6b1 in abort () from /lib64/libc.so.6
  #2  0x00468027 in __rte_panic ()
  #3  0x004876ed in prompt ()
  #4  0x0046dffc in main ()

When running testpmd with bare-metal device
(app/testpmd -n 4 --socket-mem=1024,1024 -w 04:00.0  --
 --burst=64 --mbcache=512 -i  --nb-cores=7
 --rxq=64  --txq=4 --txd=16 --rxd=16)
and pressing CTRL+D right after testpmd prompt is presented then
the program crashes while presenting the same messages as above.

Needless to say that this behavior is not observed when using the
previous CLI prompt routine.

Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
Cc: sta...@dpdk.org

Signed-off-by: Moti Haimovsky 
---
v3:
* Removed unneeded include file.

v2:
* Removed softnic modifications altogether.

v1:
* Wrapped softnic modifications with compilation switch.
---
 app/test-pmd/cmdline.c | 42 ++
 1 file changed, 2 insertions(+), 40 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2c32029..8708875 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -69,9 +69,6 @@
 #ifdef RTE_LIBRTE_I40E_PMD
 #include 
 #endif
-#ifdef RTE_LIBRTE_PMD_SOFTNIC
-#include 
-#endif
 #ifdef RTE_LIBRTE_BNXT_PMD
 #include 
 #endif
@@ -17896,50 +17893,15 @@ struct cmd_config_per_queue_tx_offload_result {
 void
 prompt(void)
 {
-   int status;
-
/* initialize non-constant commands */
cmd_set_fwd_mode_init();
cmd_set_fwd_retry_mode_init();
 
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-   portid_t softnic_portid, pid;
-   uint8_t softnic_enable = 0;
-
-   if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
-   RTE_ETH_FOREACH_DEV(pid) {
-   struct rte_port *port = &ports[pid];
-   const char *driver = port->dev_info.driver_name;
-
-   if (strcmp(driver, "net_softnic") == 0) {
-   softnic_portid = pid;
-   softnic_enable = 1;
-   break;
-   }
-   }
-   }
-#endif
-
testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
if (testpmd_cl == NULL)
return;
-
-   for (;;) {
-   status = cmdline_poll(testpmd_cl);
-   if (status < 0)
-   rte_panic("CLI poll error (%" PRId32 ")\n", status);
-   else if (status == RDLINE_EXITED) {
-   cmdline_stdin_exit(testpmd_cl);
-   rte_exit(0, "\n");
-   }
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-
-   if ((softnic_enable == 1) &&
-   (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
-   rte_pmd_softnic_manage(softnic_portid);
-#endif
-   }
+   cmdline_interact(testpmd_cl);
+   cmdline_stdin_exit(testpmd_cl);
 }
 
 void
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH v3] app/testpmd: removed softnic CLI modifications

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Moti Haimovsky
> Sent: Wednesday, July 25, 2018 4:30 PM
> To: tho...@monjalon.net
> Cc: Singh, Jasvinder ; dev@dpdk.org;
> sta...@dpdk.org; Moti Haimovsky 
> Subject: [dpdk-dev] [PATCH v3] app/testpmd: removed softnic CLI
> modifications
> 
> This patch reverts the testpmd CLI prompt routine modifications done
> in order to support softnic.
> The reason of doing so is due to testpmd abnormal exit observed on
> several setups caused by the softnic modifications to this routine,
> for example: When running testpmd with tap interface
> (/app/testpmd
>  -n 4 --vdev=net_tap0,iface=tap0,remote=eth1 -- --burst=64
>  --mbcache=512 -i --nb-cores=7 --rxq=2 --txq=2 --txd=512
>  --rxd=512 --port-topology=chained --forward-mode=rxonly)
> testpmd crashes seconds after presenting its prompt with the following
> error:
>   testpmd> PANIC in prompt():
>   CLI poll error (-1)
> 
>   Thread 1 "testpmd" received signal SIGABRT, Aborted.
>   0x7668e0d0 in raise () from /lib64/libc.so.6
>   (gdb) bt
>   #0  0x7668e0d0 in raise () from /lib64/libc.so.6
>   #1  0x7668f6b1 in abort () from /lib64/libc.so.6
>   #2  0x00468027 in __rte_panic ()
>   #3  0x004876ed in prompt ()
>   #4  0x0046dffc in main ()
> 
> When running testpmd with bare-metal device
> (app/testpmd -n 4 --socket-mem=1024,1024 -w 04:00.0  --
>  --burst=64 --mbcache=512 -i  --nb-cores=7
>  --rxq=64  --txq=4 --txd=16 --rxd=16)
> and pressing CTRL+D right after testpmd prompt is presented then
> the program crashes while presenting the same messages as above.
> 
> Needless to say that this behavior is not observed when using the
> previous CLI prompt routine.
> 
> Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Moti Haimovsky 
> ---
> v3:
> * Removed unneeded include file.
> 
> v2:
> * Removed softnic modifications altogether.
> 
> v1:
> * Wrapped softnic modifications with compilation switch.
> ---
>  app/test-pmd/cmdline.c | 42 ++
>  1 file changed, 2 insertions(+), 40 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 2c32029..8708875 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -69,9 +69,6 @@
>  #ifdef RTE_LIBRTE_I40E_PMD
>  #include 
>  #endif
> -#ifdef RTE_LIBRTE_PMD_SOFTNIC
> -#include 
> -#endif
>  #ifdef RTE_LIBRTE_BNXT_PMD
>  #include 
>  #endif
> @@ -17896,50 +17893,15 @@ struct
> cmd_config_per_queue_tx_offload_result {
>  void
>  prompt(void)
>  {
> - int status;
> -
>   /* initialize non-constant commands */
>   cmd_set_fwd_mode_init();
>   cmd_set_fwd_retry_mode_init();
> 
> -#if defined RTE_LIBRTE_PMD_SOFTNIC
> - portid_t softnic_portid, pid;
> - uint8_t softnic_enable = 0;
> -
> - if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
> - RTE_ETH_FOREACH_DEV(pid) {
> - struct rte_port *port = &ports[pid];
> - const char *driver = port->dev_info.driver_name;
> -
> - if (strcmp(driver, "net_softnic") == 0) {
> - softnic_portid = pid;
> - softnic_enable = 1;
> - break;
> - }
> - }
> - }
> -#endif
> -
>   testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
>   if (testpmd_cl == NULL)
>   return;
> -
> - for (;;) {
> - status = cmdline_poll(testpmd_cl);
> - if (status < 0)
> - rte_panic("CLI poll error (%" PRId32 ")\n", status);
> - else if (status == RDLINE_EXITED) {
> - cmdline_stdin_exit(testpmd_cl);
> - rte_exit(0, "\n");
> - }
> -
> -#if defined RTE_LIBRTE_PMD_SOFTNIC
> -
> - if ((softnic_enable == 1) &&
> - (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
> - rte_pmd_softnic_manage(softnic_portid);
> -#endif
> - }
> + cmdline_interact(testpmd_cl);
> + cmdline_stdin_exit(testpmd_cl);
>  }
> 
>  void
> --
> 1.8.3.1

We could not reproduce this in our setup, but we'll give the benefit of the 
doubt in favor of Moti, as we are running out of time for RC2.

We are not fixing the real issue in cmdline library, but it is likely that 
replacing cmdline_interactive() with cmdline_poll() might have more challenges 
difficult to predict.

This revert prevents us from using test-pmd CLI to configure some Soft NCI 
features such as the Traffic Manager, so we preparing a patch set to expose 
some of these features though Soft NIC firmware scripts.

Therefore, reluctantly,

Acked-by: Cristian Dumitrescu 



Re: [dpdk-dev] [PATCH] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Yaroslav Brustinov (ybrustin)
+Hanoch

I've added -std=c11 flag to our compilation to check.

Without alignas(max_align_t):
/usr/bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in 
src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o

With alignas(max_align_t):
/usr/bin/ld: Warning: alignment 16 of symbol `mlx5_glue' in 
src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o

Using alignas(64) does not produce linker warning.

Thanks,
Yaroslav.


-Original Message-
From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com] 
Sent: Tuesday, July 24, 2018 19:04
To: Yaroslav Brustinov (ybrustin) 
Cc: Shahaf Shuler ; Yongseok Koh ; 
dev@dpdk.org; sta...@dpdk.org; Nélio Laranjeiro 
Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib

On Tue, Jul 24, 2018 at 02:24:12PM +, Yaroslav Brustinov (ybrustin) wrote:
> Hi,
> 
> Are you OK with C11?
> I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c:
> 
>  * C11 code would include stdalign.h and use alignof(max_align_t) however
>  * we'll stick with C99 for the time being.
> 
> :)

Hah, this code was originally intended to become a generic EAL function hence 
the C99 but got rejected. Mellanox PMDs otherwise rely on C11 features already.

> As far as I understand, the issue is alignment of the pointer itself, not the 
> struct.
> I'm not familiar with this command: "alignof(max_align_t)".
> Applying this on the struct:
> 
> struct mlx5_glue {
> ...
> } __attribute__((__aligned__(64)));
> 
> struct __attribute__((__aligned__(64))) mlx5_glue {
> ...
> };
> 
> ...still keeps the linker unhappy.

Right, this was my first (wrong) suggestion that doesn't work on types. How 
about the second one instead? Here's how the diff on mlx5_glue.h should look
like:

 +#include 
  #include 
  #include 

 [...]
  
 +alignas(max_align_t)
  const struct mlx5_glue *mlx5_glue;

Another comment regarding this patch, commit log should probably mention it 
addresses a GCC bug that cannot be reproduced with latter versions. Keep in 
mind DPDK recommends to use at least GCC version 4.9.

> -Original Message-
> From: Shahaf Shuler [mailto:shah...@mellanox.com]
> Sent: Tuesday, July 24, 2018 16:51
> To: Adrien Mazarguil 
> Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav 
> Brustinov (ybrustin) ; sta...@dpdk.org; Nélio 
> Laranjeiro 
> Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib
> 
> Yaroslav,
> 
> Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil:
> > Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> > > Odd, how could this happen assuming both files are compiled during 
> > > the same run using identical flags? Looks like a compiler issue.
> > >
> > > Anyway, may I suggest an alignment constraint on the structure 
> > > type in mlx5_glue.h instead, so that all users inherit it. E.g. using C11 
> > > syntax:
> > >
> > >  #include 
> > >  #include 
> > >
> > >  [...]
> > >  alignas(max_align_t)
> > >  struct mlx5_glue {
> > >  [...]
> > >  };
> > 
> > My bad, this is not a correct use for alignas(), it doesn't work on types.
> > How about this instead:
> > 
> >  alignas(max_align_t)
> >  const struct mlx5_glue *mlx5_glue;
> 
> Can you confirm the above suggestion fixes your issue? 
> 
> > 
> > >

--
Adrien Mazarguil
6WIND


Re: [dpdk-dev] [PATCH] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Yaroslav Brustinov (ybrustin)
Hi,

Are you OK with C11?
I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c:

 * C11 code would include stdalign.h and use alignof(max_align_t) however
 * we'll stick with C99 for the time being.

:)

As far as I understand, the issue is alignment of the pointer itself, not the 
struct.
I'm not familiar with this command: "alignof(max_align_t)".
Applying this on the struct:

struct mlx5_glue {
...
} __attribute__((__aligned__(64)));

struct __attribute__((__aligned__(64))) mlx5_glue {
...
};

...still keeps the linker unhappy.

Thanks,
Yaroslav.


-Original Message-
From: Shahaf Shuler [mailto:shah...@mellanox.com] 
Sent: Tuesday, July 24, 2018 16:51
To: Adrien Mazarguil 
Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav Brustinov 
(ybrustin) ; sta...@dpdk.org; Nélio Laranjeiro 

Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib

Yaroslav, 

Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil:
> Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> > Odd, how could this happen assuming both files are compiled during 
> > the same run using identical flags? Looks like a compiler issue.
> >
> > Anyway, may I suggest an alignment constraint on the structure type 
> > in mlx5_glue.h instead, so that all users inherit it. E.g. using C11 syntax:
> >
> >  #include 
> >  #include 
> >
> >  [...]
> >  alignas(max_align_t)
> >  struct mlx5_glue {
> >  [...]
> >  };
> 
> My bad, this is not a correct use for alignas(), it doesn't work on types.
> How about this instead:
> 
>  alignas(max_align_t)
>  const struct mlx5_glue *mlx5_glue;

Can you confirm the above suggestion fixes your issue? 

> 
> >


Re: [dpdk-dev] [PATCH] net/mlx5: fix linkage error for glue lib

2018-07-25 Thread Yaroslav Brustinov (ybrustin)
Hi,

Sounds good to me.

Thanks,
Yaroslav.


-Original Message-
From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com] 
Sent: Wednesday, July 25, 2018 12:25
To: Yaroslav Brustinov (ybrustin) 
Cc: Shahaf Shuler ; Yongseok Koh ; 
dev@dpdk.org; sta...@dpdk.org; Nélio Laranjeiro ; 
Hanoch Haim (hhaim) 
Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib

On Wed, Jul 25, 2018 at 07:38:39AM +, Yaroslav Brustinov (ybrustin) wrote:
> +Hanoch
> 
> I've added -std=c11 flag to our compilation to check.
> 
> Without alignas(max_align_t):
> /usr/bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in 
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o
> 
> With alignas(max_align_t):
> /usr/bin/ld: Warning: alignment 16 of symbol `mlx5_glue' in 
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in 
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o
> 
> Using alignas(64) does not produce linker warning.

OK, let's forget max_align_t. Even better, how about
alignas(RTE_CACHE_LINE_SIZE) just in case the same GCC version complains about 
the lack of a 128 byte alignment on architectures like IBM POWER8.

(remember to #include  for RTE_CACHE_LINE_SIZE)

> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com]
> Sent: Tuesday, July 24, 2018 19:04
> To: Yaroslav Brustinov (ybrustin) 
> Cc: Shahaf Shuler ; Yongseok Koh 
> ; dev@dpdk.org; sta...@dpdk.org; Nélio Laranjeiro 
> 
> Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> 
> On Tue, Jul 24, 2018 at 02:24:12PM +, Yaroslav Brustinov (ybrustin) wrote:
> > Hi,
> > 
> > Are you OK with C11?
> > I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c:
> > 
> >  * C11 code would include stdalign.h and use alignof(max_align_t) 
> > however
> >  * we'll stick with C99 for the time being.
> > 
> > :)
> 
> Hah, this code was originally intended to become a generic EAL function hence 
> the C99 but got rejected. Mellanox PMDs otherwise rely on C11 features 
> already.
> 
> > As far as I understand, the issue is alignment of the pointer itself, not 
> > the struct.
> > I'm not familiar with this command: "alignof(max_align_t)".
> > Applying this on the struct:
> > 
> > struct mlx5_glue {
> > ...
> > } __attribute__((__aligned__(64)));
> > 
> > struct __attribute__((__aligned__(64))) mlx5_glue {
> > ...
> > };
> > 
> > ...still keeps the linker unhappy.
> 
> Right, this was my first (wrong) suggestion that doesn't work on 
> types. How about the second one instead? Here's how the diff on 
> mlx5_glue.h should look
> like:
> 
>  +#include 
>   #include 
>   #include 
> 
>  [...]
>   
>  +alignas(max_align_t)
>   const struct mlx5_glue *mlx5_glue;
> 
> Another comment regarding this patch, commit log should probably mention it 
> addresses a GCC bug that cannot be reproduced with latter versions. Keep in 
> mind DPDK recommends to use at least GCC version 4.9.
> 
> > -Original Message-
> > From: Shahaf Shuler [mailto:shah...@mellanox.com]
> > Sent: Tuesday, July 24, 2018 16:51
> > To: Adrien Mazarguil 
> > Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav 
> > Brustinov (ybrustin) ; sta...@dpdk.org; Nélio 
> > Laranjeiro 
> > Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib
> > 
> > Yaroslav,
> > 
> > Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil:
> > > Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> > > > Odd, how could this happen assuming both files are compiled 
> > > > during the same run using identical flags? Looks like a compiler issue.
> > > >
> > > > Anyway, may I suggest an alignment constraint on the structure 
> > > > type in mlx5_glue.h instead, so that all users inherit it. E.g. using 
> > > > C11 syntax:
> > > >
> > > >  #include 
> > > >  #include 
> > > >
> > > >  [...]
> > > >  alignas(max_align_t)
> > > >  struct mlx5_glue {
> > > >  [...]
> > > >  };
> > > 
> > > My bad, this is not a correct use for alignas(), it doesn't work on types.
> > > How about this instead:
> > > 
> > >  alignas(max_align_t)
> > >  const struct mlx5_glue *mlx5_glue;
> > 
> > Can you confirm the above suggestion fixes your issue? 
> > 
> > > 
> > > >
> 
> --
> Adrien Mazarguil
> 6WIND

--
Adrien Mazarguil
6WIND


[dpdk-dev] [PATCH v4 0/6] compress: add Octeontx ZIP compression PMD

2018-07-25 Thread Ashish Gupta
From: Shally Verma 

This patch series add compression PMD for cavium octeontx ZIP module
in DPDK compress drivers.
Currently PMD only tested for deflate, stateless compression
and decompression with direct memory buffers.

Changes in v4:
- removed scatter-gather implementation as not tested
- revisit qp stats enqd and enqd_err count update condition
  after seeking more clarification about its intended purpose

Changes in v3:
- update doc
- add comp feature flags
- remove stateful pmd ops
- update pmd name and logtype as per naming conventions

Changes in v2:
- enable OCTEONTX_ZIPVF bydefault, and remove static debug flag
- fix meson build in compress/driver/octeontx
- fix 32-bit compiler error
- remove global declared data structure
- header files in alphabetical order
- update doc with correct feature support

V1 support:
Octeontx ZIP PMD implementation
Confuguration and Makefile changes to build Octeontx ZIP PMD
Documentation ZIP PMD
Build support in driver/compress meson for Octeontx ZIP PMD

TBDs:
Enqueue error stats logic needs to be revisited
Scatter Gather support,
Stateful compression/decompression,
test for performance

Ashish Gupta (4):
  compress/octeontx: add device setup PMD ops
  compress/octeontx: create private xform
  compress/octeontx: support burst enqueue/dequeue
  doc: add Octeonx zip guide

Sunila Sahu (2):
  compress/octeontx: add octeontx zip PMD
  usertools: update devbind for octeontx zip device

 MAINTAINERS|   5 +
 config/common_base |   5 +
 doc/guides/compressdevs/features/octeontx.ini  |  10 +
 doc/guides/compressdevs/index.rst  |   1 +
 doc/guides/compressdevs/octeontx.rst   | 107 
 drivers/compress/Makefile  |   1 +
 drivers/compress/meson.build   |   2 +-
 drivers/compress/octeontx/Makefile |  30 +
 drivers/compress/octeontx/include/zip_regs.h   | 711 +
 drivers/compress/octeontx/meson.build  |   9 +
 drivers/compress/octeontx/otx_zip.c| 180 ++
 drivers/compress/octeontx/otx_zip.h| 277 
 drivers/compress/octeontx/otx_zip_pmd.c| 656 +++
 .../octeontx/rte_pmd_octeontx_compress_version.map |   3 +
 mk/rte.app.mk  |   1 +
 usertools/dpdk-devbind.py  |   9 +
 16 files changed, 2006 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/compressdevs/features/octeontx.ini
 create mode 100644 doc/guides/compressdevs/octeontx.rst
 create mode 100644 drivers/compress/octeontx/Makefile
 create mode 100644 drivers/compress/octeontx/include/zip_regs.h
 create mode 100644 drivers/compress/octeontx/meson.build
 create mode 100644 drivers/compress/octeontx/otx_zip.c
 create mode 100644 drivers/compress/octeontx/otx_zip.h
 create mode 100644 drivers/compress/octeontx/otx_zip_pmd.c
 create mode 100644 
drivers/compress/octeontx/rte_pmd_octeontx_compress_version.map

-- 
2.9.5



[dpdk-dev] [PATCH v4 1/6] compress/octeontx: add octeontx zip PMD

2018-07-25 Thread Ashish Gupta
From: Sunila Sahu 

Octentx zipvf PMD provides hardware acceleration for
deflate and lzs compression and decompression operations
using Octeontx zip co-processor, which provide 8
virtualized zip devices.

This patch add basic initialization routine to register zip VFs
to compressdev library.

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 MAINTAINERS|   3 +
 config/common_base |   5 +
 drivers/compress/Makefile  |   1 +
 drivers/compress/meson.build   |   2 +-
 drivers/compress/octeontx/Makefile |  30 +
 drivers/compress/octeontx/include/zip_regs.h   | 711 +
 drivers/compress/octeontx/meson.build  |   9 +
 drivers/compress/octeontx/otx_zip.c|  62 ++
 drivers/compress/octeontx/otx_zip.h| 113 
 drivers/compress/octeontx/otx_zip_pmd.c| 118 
 .../octeontx/rte_pmd_octeontx_compress_version.map |   3 +
 mk/rte.app.mk  |   1 +
 12 files changed, 1057 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7e3c450..16cbfd0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -855,6 +855,9 @@ F: drivers/crypto/zuc/
 F: doc/guides/cryptodevs/zuc.rst
 F: doc/guides/cryptodevs/features/zuc.ini
 
+Cavium OCTEONTX zipvf
+M: Ashish Gupta 
+F: drivers/compress/octeontx
 
 Compression Drivers
 ---
diff --git a/config/common_base b/config/common_base
index 662da4d..4bcbaf9 100644
--- a/config/common_base
+++ b/config/common_base
@@ -578,6 +578,11 @@ CONFIG_RTE_COMPRESS_MAX_DEVS=64
 CONFIG_RTE_COMPRESSDEV_TEST=n
 
 #
+# Compile PMD for Octeontx ZIPVF compression device
+#
+CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF=y
+
+#
 # Compile PMD for ISA-L compression device
 #
 CONFIG_RTE_LIBRTE_PMD_ISAL=n
diff --git a/drivers/compress/Makefile b/drivers/compress/Makefile
index 1f159a5..af26060 100644
--- a/drivers/compress/Makefile
+++ b/drivers/compress/Makefile
@@ -5,5 +5,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += isal
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += zlib
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += octeontx
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build
index d2ca8fc..0b428ba 100644
--- a/drivers/compress/meson.build
+++ b/drivers/compress/meson.build
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-drivers = ['isal', 'qat', 'zlib']
+drivers = ['isal', 'qat', 'zlib', 'octeontx']
 
 std_deps = ['compressdev'] # compressdev pulls in all other needed deps
 config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
diff --git a/drivers/compress/octeontx/Makefile 
b/drivers/compress/octeontx/Makefile
new file mode 100644
index 000..f34424c
--- /dev/null
+++ b/drivers/compress/octeontx/Makefile
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Cavium, Inc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_octeontx_zip.a
+
+# library version
+LIBABIVER := 1
+
+# build flags
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -O3
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I$(RTE_SDK)/drivers/compress/octeontx/include
+
+# external library include paths
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_compressdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += otx_zip_pmd.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += otx_zip.c
+
+# versioning export map
+EXPORT_MAP := rte_pmd_octeontx_compress_version.map
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/compress/octeontx/include/zip_regs.h 
b/drivers/compress/octeontx/include/zip_regs.h
new file mode 100644
index 000..1e74db4
--- /dev/null
+++ b/drivers/compress/octeontx/include/zip_regs.h
@@ -0,0 +1,711 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Cavium, Inc
+ */
+
+#ifndef _RTE_OCTEONTX_ZIP_REGS_H_
+#define _RTE_OCTEONTX_ZIP_REGS_H_
+
+
+/**
+ * Enumeration zip_cc
+ *
+ * ZIP compression coding Enumeration
+ * Enumerates ZIP_INST_S[CC].
+ */
+enum {
+   ZIP_CC_DEFAULT = 0,
+   ZIP_CC_DYN_HUFF,
+   ZIP_CC_FIXED_HUFF,
+   ZIP_CC_LZS
+} zip_cc;
+
+/**
+ * Register (NCB) zip_vq#_ena
+ *
+ * ZIP VF Queue Enable Register
+ * If a queue is disabled, ZIP CTL stops fetching instructions from the queue.
+ */
+typedef union {
+   uint64_t u;
+   struct zip_vqx_ena_s {
+#if defined(__BIG_ENDIAN_BITFIELD) /* Word 0 - Big Endian */
+   uint64_t reserved_1_63 : 63;
+   uint64_t ena   : 1;
+#else /* Word 0 - Little Endian */
+   uint64_t ena   : 1;
+   uint64_t reserved_1_63 : 63;
+#endif /* Word 0 - End */
+   } s;
+   /* struct zip_vqx_ena_s cn; */

[dpdk-dev] [PATCH v4 2/6] compress/octeontx: add device setup PMD ops

2018-07-25 Thread Ashish Gupta
Add compression PMD device and queue pair setup ops.

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 drivers/compress/octeontx/otx_zip.c |  71 +
 drivers/compress/octeontx/otx_zip.h |  57 ++-
 drivers/compress/octeontx/otx_zip_pmd.c | 253 
 3 files changed, 379 insertions(+), 2 deletions(-)

diff --git a/drivers/compress/octeontx/otx_zip.c 
b/drivers/compress/octeontx/otx_zip.c
index 7a1dd58..7c81db1 100644
--- a/drivers/compress/octeontx/otx_zip.c
+++ b/drivers/compress/octeontx/otx_zip.c
@@ -18,6 +18,77 @@ zip_reg_write64(uint8_t *hw_addr, uint64_t offset, uint64_t 
val)
*(uint64_t *)(base + offset) = val;
 }
 
+static void
+zip_q_enable(struct zipvf_qp *qp)
+{
+   zip_vqx_ena_t que_ena;
+
+   /*ZIP VFx command queue init*/
+   que_ena.u = 0ull;
+   que_ena.s.ena = 1;
+
+   zip_reg_write64(qp->vf->vbar0, ZIP_VQ_ENA, que_ena.u);
+   rte_wmb();
+}
+
+/* initialize given qp on zip device */
+int
+zipvf_q_init(struct zipvf_qp *qp)
+{
+   zip_vqx_sbuf_addr_t que_sbuf_addr;
+
+   uint64_t size;
+   void *cmdq_addr;
+   uint64_t iova;
+   struct zipvf_cmdq *cmdq = &qp->cmdq;
+   struct zip_vf *vf = qp->vf;
+
+   /* allocate and setup instruction queue */
+   size = ZIP_MAX_CMDQ_SIZE;
+   size = ZIP_ALIGN_ROUNDUP(size, ZIP_CMDQ_ALIGN);
+
+   cmdq_addr = rte_zmalloc(qp->name, size, ZIP_CMDQ_ALIGN);
+   if (cmdq_addr == NULL)
+   return -1;
+
+   cmdq->sw_head = (uint64_t *)cmdq_addr;
+   cmdq->va = (uint8_t *)cmdq_addr;
+   iova = rte_mem_virt2iova(cmdq_addr);
+
+   cmdq->iova = iova;
+
+   que_sbuf_addr.u = 0ull;
+   que_sbuf_addr.s.ptr = (cmdq->iova >> 7);
+   zip_reg_write64(vf->vbar0, ZIP_VQ_SBUF_ADDR, que_sbuf_addr.u);
+
+   zip_q_enable(qp);
+
+   memset(cmdq->va, 0, ZIP_MAX_CMDQ_SIZE);
+   rte_spinlock_init(&cmdq->qlock);
+
+   return 0;
+}
+
+int
+zipvf_q_term(struct zipvf_qp *qp)
+{
+   struct zipvf_cmdq *cmdq = &qp->cmdq;
+   zip_vqx_ena_t que_ena;
+   struct zip_vf *vf = qp->vf;
+
+   if (cmdq->va != NULL) {
+   memset(cmdq->va, 0, ZIP_MAX_CMDQ_SIZE);
+   rte_free(cmdq->va);
+   }
+
+   /*Disabling the ZIP queue*/
+   que_ena.u = 0ull;
+   zip_reg_write64(vf->vbar0, ZIP_VQ_ENA, que_ena.u);
+
+   return 0;
+}
+
+
 int
 zipvf_create(struct rte_compressdev *compressdev)
 {
diff --git a/drivers/compress/octeontx/otx_zip.h 
b/drivers/compress/octeontx/otx_zip.h
index 8a58f31..1289919 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -77,8 +77,54 @@ int octtx_zip_logtype_driver;
ZIP_PMD_LOG(INFO, fmt, ## args)
 #define ZIP_PMD_ERR(fmt, args...) \
ZIP_PMD_LOG(ERR, fmt, ## args)
-#define ZIP_PMD_WARN(fmt, args...) \
-   ZIP_PMD_LOG(WARNING, fmt, ## args)
+
+/* resources required to process stream */
+enum {
+   RES_BUF = 0,
+   CMD_BUF,
+   HASH_CTX_BUF,
+   DECOMP_CTX_BUF,
+   IN_DATA_BUF,
+   OUT_DATA_BUF,
+   HISTORY_DATA_BUF,
+   MAX_BUFS_PER_STREAM
+} NUM_BUFS_PER_STREAM;
+
+
+struct zipvf_qp;
+
+
+/**
+ * ZIP instruction Queue
+ */
+struct zipvf_cmdq {
+   rte_spinlock_t qlock;
+   /* queue lock */
+   uint64_t *sw_head;
+   /* pointer to start of 8-byte word length queue-head */
+   uint8_t *va;
+   /* pointer to instruction queue virtual address */
+   rte_iova_t iova;
+   /* iova addr of cmdq head*/
+};
+
+/**
+ * ZIP device queue structure
+ */
+struct zipvf_qp {
+   struct zipvf_cmdq cmdq;
+   /* Hardware instruction queue structure */
+   struct rte_ring *processed_pkts;
+   /* Ring for placing processed packets */
+   struct rte_compressdev_stats qp_stats;
+   /* Queue pair statistics */
+   uint16_t id;
+   /* Queue Pair Identifier */
+   const char *name;
+   /* Unique Queue Pair Name */
+   struct zip_vf *vf;
+   /* pointer to device, queue belongs to */
+} __rte_cache_aligned;
 
 /**
  * ZIP VF device structure.
@@ -104,6 +150,13 @@ zipvf_create(struct rte_compressdev *compressdev);
 int
 zipvf_destroy(struct rte_compressdev *compressdev);
 
+int
+zipvf_q_init(struct zipvf_qp *qp);
+
+int
+zipvf_q_term(struct zipvf_qp *qp);
+
+
 uint64_t
 zip_reg_read64(uint8_t *hw_addr, uint64_t offset);
 
diff --git a/drivers/compress/octeontx/otx_zip_pmd.c 
b/drivers/compress/octeontx/otx_zip_pmd.c
index 4d92c9d..b670f87 100644
--- a/drivers/compress/octeontx/otx_zip_pmd.c
+++ b/drivers/compress/octeontx/otx_zip_pmd.c
@@ -11,8 +11,261 @@
 
 #include "otx_zip.h"
 
+static const struct rte_compressdev_capabilities
+   octtx_zip_pmd_capabilities[] = {
+   {   .algo = RTE_COMP_ALGO_DEFLATE,
+   /* Deflate */
+   .comp_feature_flags =   RTE_COMP_FF_HUFFMAN_FIXED |
+ 

[dpdk-dev] [PATCH v4 3/6] compress/octeontx: create private xform

2018-07-25 Thread Ashish Gupta
Create non-shareable private xform for applications to
perform stateless compression/decompression.

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 drivers/compress/octeontx/otx_zip.h |  19 +++-
 drivers/compress/octeontx/otx_zip_pmd.c | 149 
 2 files changed, 167 insertions(+), 1 deletion(-)

diff --git a/drivers/compress/octeontx/otx_zip.h 
b/drivers/compress/octeontx/otx_zip.h
index 1289919..3fcd86a 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -90,9 +90,24 @@ enum {
MAX_BUFS_PER_STREAM
 } NUM_BUFS_PER_STREAM;
 
-
+struct zip_stream;
 struct zipvf_qp;
 
+/* Algorithm handler function prototype */
+typedef int (*comp_func_t)(struct rte_comp_op *op,
+  struct zipvf_qp *qp, struct zip_stream *zstrm);
+
+/**
+ * ZIP private stream structure
+ */
+struct zip_stream {
+   union zip_inst_s *inst;
+   /* zip instruction pointer */
+   comp_func_t func;
+   /* function to process comp operation */
+   void *bufs[MAX_BUFS_PER_STREAM];
+} _rte_cache_aligned;
+
 
 /**
  * ZIP instruction Queue
@@ -156,6 +171,8 @@ zipvf_q_init(struct zipvf_qp *qp);
 int
 zipvf_q_term(struct zipvf_qp *qp);
 
+int
+zipvf_push_command(struct zipvf_qp *qp, union zip_inst_s *zcmd);
 
 uint64_t
 zip_reg_read64(uint8_t *hw_addr, uint64_t offset);
diff --git a/drivers/compress/octeontx/otx_zip_pmd.c 
b/drivers/compress/octeontx/otx_zip_pmd.c
index b670f87..16f581b 100644
--- a/drivers/compress/octeontx/otx_zip_pmd.c
+++ b/drivers/compress/octeontx/otx_zip_pmd.c
@@ -28,6 +28,103 @@ static const struct rte_compressdev_capabilities
RTE_COMP_END_OF_CAPABILITIES_LIST()
 };
 
+/** Parse xform parameters and setup a stream */
+static int
+zip_set_stream_parameters(struct rte_compressdev *dev,
+   const struct rte_comp_xform *xform,
+   struct zip_stream *z_stream)
+{
+   int ret;
+   union zip_inst_s *inst;
+   struct zip_vf *vf = (struct zip_vf *)dev->data->dev_private;
+   void *res;
+
+   /* Allocate resources required by a stream */
+   ret = rte_mempool_get_bulk(vf->zip_mp,
+   z_stream->bufs, MAX_BUFS_PER_STREAM);
+   if (ret < 0)
+   return -1;
+
+   /* get one command buffer from pool and set up */
+   inst = (union zip_inst_s *)z_stream->bufs[CMD_BUF];
+   res = z_stream->bufs[RES_BUF];
+
+   memset(inst->u, 0, sizeof(inst->u));
+
+   /* set bf for only first ops of stream */
+   inst->s.bf = 1;
+
+   if (xform->type == RTE_COMP_COMPRESS) {
+   inst->s.op = ZIP_OP_E_COMP;
+
+   switch (xform->compress.deflate.huffman) {
+   case RTE_COMP_HUFFMAN_DEFAULT:
+   inst->s.cc = ZIP_CC_DEFAULT;
+   break;
+   case RTE_COMP_HUFFMAN_FIXED:
+   inst->s.cc = ZIP_CC_FIXED_HUFF;
+   break;
+   case RTE_COMP_HUFFMAN_DYNAMIC:
+   inst->s.cc = ZIP_CC_DYN_HUFF;
+   break;
+   default:
+   ret = -1;
+   goto err;
+   }
+
+   switch (xform->compress.level) {
+   case RTE_COMP_LEVEL_MIN:
+   inst->s.ss = ZIP_COMP_E_LEVEL_MIN;
+   break;
+   case RTE_COMP_LEVEL_MAX:
+   inst->s.ss = ZIP_COMP_E_LEVEL_MAX;
+   break;
+   case RTE_COMP_LEVEL_NONE:
+   ZIP_PMD_ERR("Compression level not supported");
+   ret = -1;
+   goto err;
+   default:
+   /* for any value between min and max , choose
+* PMD default.
+*/
+   inst->s.ss = ZIP_COMP_E_LEVEL_MED; /** PMD default **/
+   break;
+   }
+   } else if (xform->type == RTE_COMP_DECOMPRESS) {
+   inst->s.op = ZIP_OP_E_DECOMP;
+   /* from HRM,
+* For DEFLATE decompression, [CC] must be 0x0.
+* For decompression, [SS] must be 0x0
+*/
+   inst->s.cc = 0;
+   /* Speed bit should not be set for decompression */
+   inst->s.ss = 0;
+   /* decompression context is supported only for STATEFUL
+* operations. Currently we support STATELESS ONLY so
+* skip setting of ctx pointer
+*/
+
+   } else {
+   ZIP_PMD_ERR("\nxform type not supported");
+   ret = -1;
+   goto err;
+   }
+
+   inst->s.res_ptr_addr.s.addr = rte_mempool_virt2iova(res);
+   inst->s.res_ptr_ctl.s.length = 0;
+
+   z_stream->inst = inst;
+
+   return 0;
+
+err:
+   rte_m

[dpdk-dev] [PATCH v4 5/6] doc: add Octeonx zip guide

2018-07-25 Thread Ashish Gupta
Add Octeontx ZIP PMD feature specification and user guide
with build and run instructions.

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 MAINTAINERS   |   2 +
 doc/guides/compressdevs/features/octeontx.ini |  10 +++
 doc/guides/compressdevs/index.rst |   1 +
 doc/guides/compressdevs/octeontx.rst  | 107 ++
 4 files changed, 120 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 16cbfd0..18a78be 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -858,6 +858,8 @@ F: doc/guides/cryptodevs/features/zuc.ini
 Cavium OCTEONTX zipvf
 M: Ashish Gupta 
 F: drivers/compress/octeontx
+F: doc/guides/compressdevs/octeontx.rst
+F: doc/guides/compressdevs/features/octeontx.ini
 
 Compression Drivers
 ---
diff --git a/doc/guides/compressdevs/features/octeontx.ini 
b/doc/guides/compressdevs/features/octeontx.ini
new file mode 100644
index 000..884a8b0
--- /dev/null
+++ b/doc/guides/compressdevs/features/octeontx.ini
@@ -0,0 +1,10 @@
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+; Supported features of 'OCTEONTX ZIP' compression driver.
+;
+[Features]
+HW Accelerated = Y
+Deflate= Y
+Fixed  = Y
+Dynamic= Y
diff --git a/doc/guides/compressdevs/index.rst 
b/doc/guides/compressdevs/index.rst
index 6ba6641..1f37e26 100644
--- a/doc/guides/compressdevs/index.rst
+++ b/doc/guides/compressdevs/index.rst
@@ -11,5 +11,6 @@ Compression Device Drivers
 
 overview
 isal
+octeontx
 qat_comp
 zlib
diff --git a/doc/guides/compressdevs/octeontx.rst 
b/doc/guides/compressdevs/octeontx.rst
new file mode 100644
index 000..0b53f9b
--- /dev/null
+++ b/doc/guides/compressdevs/octeontx.rst
@@ -0,0 +1,107 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2018 Cavium Networks.
+
+Octeontx ZIP Compression Poll Mode Driver
+=
+
+The Octeontx ZIP PMD (**librte_pmd_octeontx_zip**) provides poll mode
+compression & decompression driver for ZIP HW offload device, found in
+**Cavium OCTEONTX** SoC family.
+
+More information can be found at `Cavium, Inc Official Website
+`_.
+
+Features
+
+
+Octeontx ZIP PMD has support for:
+
+Compression/Decompression algorithm:
+
+* DEFLATE
+
+Huffman code type:
+
+* FIXED
+* DYNAMIC
+
+Window size support:
+
+* 2 to 2^14
+
+Limitations
+---
+
+* Chained mbufs are not supported.
+
+Supported OCTEONTX SoCs
+---
+
+- CN83xx
+
+Steps To Setup Platform
+---
+
+   Octeontx SDK includes kernel image which provides Octeontx ZIP PF
+   driver to manage configuration of ZIPVF device
+   Required version of SDK is "OCTEONTX-SDK-6.2.0-build35" or above.
+
+   SDK can be install by using below command.
+   #rpm -ivh CTEONTX-SDK-6.2.0-build35.x86_64.rpm --force --nodeps
+   It will install OCTEONTX-SDK at following default location
+   /usr/local/Cavium_Networks/OCTEONTX-SDK/
+
+   For more information on building and booting linux kernel on OCTEONTX
+   please refer 
/usr/local/Cavium_Networks/OCTEONTX-SDK/docs/OcteonTX-SDK-UG_6.2.0.pdf.
+
+   SDK and related information can be obtained from: `Cavium support site 
`_.
+
+Installation
+
+
+Driver Compilation
+~~
+
+To compile the OCTEONTX ZIP PMD for Linux arm64 gcc target, run the
+following ``make`` command:
+
+   .. code-block:: console
+
+  cd 
+  make config T=arm64-thunderx-linuxapp-gcc install
+
+
+Initialization
+--
+
+The octeontx zip is exposed as pci device which consists of a set of
+PCIe VF devices. On EAL initialization, ZIP PCIe VF devices will be
+probed. To use the PMD in an application, user must:
+
+* run dev_bind script to bind eight ZIP PCIe VFs to the ``vfio-pci`` driver:
+
+   .. code-block:: console
+
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.1
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.2
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.3
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.4
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.5
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.6
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:00.7
+  ./usertools/dpdk-devbind.py -b vfio-pci 0001:04:01.0
+
+* The unit test cases can be tested as below:
+
+   .. code-block:: console
+
+  reserve enough huge pages
+  cd to the top-level DPDK directory
+  export RTE_TARGET=arm64-thunderx-linuxapp-gcc
+  export RTE_SDK=`pwd`
+  cd to test/test
+  type the command "make" to compile
+  run the tests with "./test"
+  type the command "compressdev_autotest" to test
+
+
-- 
2.9.5



[dpdk-dev] [PATCH v4 4/6] compress/octeontx: support burst enqueue/dequeue

2018-07-25 Thread Ashish Gupta
Implement enqueue/dequeue APIs to perform compression/decompression
operations

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 drivers/compress/octeontx/otx_zip.c |  47 +++
 drivers/compress/octeontx/otx_zip.h |  96 +-
 drivers/compress/octeontx/otx_zip_pmd.c | 136 
 3 files changed, 278 insertions(+), 1 deletion(-)

diff --git a/drivers/compress/octeontx/otx_zip.c 
b/drivers/compress/octeontx/otx_zip.c
index 7c81db1..a9046ff 100644
--- a/drivers/compress/octeontx/otx_zip.c
+++ b/drivers/compress/octeontx/otx_zip.c
@@ -88,6 +88,53 @@ zipvf_q_term(struct zipvf_qp *qp)
return 0;
 }
 
+void
+zipvf_push_command(struct zipvf_qp *qp, union zip_inst_s *cmd)
+{
+   zip_quex_doorbell_t dbell;
+   union zip_nptr_s ncp;
+   uint64_t *ncb_ptr;
+   struct zipvf_cmdq *cmdq = &qp->cmdq;
+   void *reg_base = qp->vf->vbar0;
+
+   /*Held queue lock*/
+   rte_spinlock_lock(&(cmdq->qlock));
+
+   /* Check space availability in zip cmd queue */
+   if cmdq->sw_head - (uint64_t *)cmdq->va) * sizeof(uint64_t *)) +
+   ZIP_CMD_SIZE) == (ZIP_MAX_CMDQ_SIZE - ZIP_MAX_NCBP_SIZE)) {
+   /*Last buffer of the command queue*/
+   memcpy((uint8_t *)cmdq->sw_head,
+   (uint8_t *)cmd,
+   sizeof(union zip_inst_s));
+   /* move pointer to next loc in unit of 64-bit word */
+   cmdq->sw_head += ZIP_CMD_SIZE_WORDS;
+
+   /* now, point the "Next-Chunk Buffer Ptr" to sw_head */
+   ncb_ptr = cmdq->sw_head;
+   /* Pointing head again to cmdqueue base*/
+   cmdq->sw_head = (uint64_t *)cmdq->va;
+
+   ncp.u = 0ull;
+   ncp.s.addr = cmdq->iova;
+   *ncb_ptr = ncp.u;
+   } else {
+   /*Enough buffers available in the command queue*/
+   memcpy((uint8_t *)cmdq->sw_head,
+   (uint8_t *)cmd,
+   sizeof(union zip_inst_s));
+   cmdq->sw_head += ZIP_CMD_SIZE_WORDS;
+   }
+
+   rte_wmb();
+
+   /* Ringing ZIP VF doorbell */
+   dbell.u = 0ull;
+   dbell.s.dbell_cnt = 1;
+   zip_reg_write64(reg_base, ZIP_VQ_DOORBELL, dbell.u);
+
+   rte_spinlock_unlock(&(cmdq->qlock));
+}
 
 int
 zipvf_create(struct rte_compressdev *compressdev)
diff --git a/drivers/compress/octeontx/otx_zip.h 
b/drivers/compress/octeontx/otx_zip.h
index 3fcd86a..fc2dfe4 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -159,6 +159,95 @@ struct zip_vf {
/* pointer to pools */
 } __rte_cache_aligned;
 
+
+static inline void
+zipvf_prepare_in_buf(struct zip_stream *zstrm, struct rte_comp_op *op)
+{
+   uint32_t offset, inlen;
+   struct rte_mbuf *m_src;
+   union zip_inst_s *inst = zstrm->inst;
+
+   inlen = op->src.length;
+   offset = op->src.offset;
+   m_src = op->m_src;
+
+   /* Prepare direct input data pointer */
+   inst->s.dg = 0;
+   inst->s.inp_ptr_addr.s.addr =
+   rte_pktmbuf_iova_offset(m_src, offset);
+   inst->s.inp_ptr_ctl.s.length = inlen;
+}
+
+static inline void
+zipvf_prepare_out_buf(struct zip_stream *zstrm, struct rte_comp_op *op)
+{
+   uint32_t offset;
+   struct rte_mbuf *m_dst;
+   union zip_inst_s *inst = zstrm->inst;
+
+   offset = op->dst.offset;
+   m_dst = op->m_dst;
+
+   /* Prepare direct input data pointer */
+   inst->s.ds = 0;
+   inst->s.out_ptr_addr.s.addr =
+   rte_pktmbuf_iova_offset(m_dst, offset);
+   inst->s.totaloutputlength = rte_pktmbuf_pkt_len(m_dst) -
+   op->dst.offset;
+   inst->s.out_ptr_ctl.s.length = inst->s.totaloutputlength;
+}
+
+static inline void
+zipvf_prepare_cmd_stateless(struct rte_comp_op *op, struct zip_stream *zstrm)
+{
+   union zip_inst_s *inst = zstrm->inst;
+
+   /* set flush flag to always 1*/
+   inst->s.ef = 1;
+
+   if (inst->s.op == ZIP_OP_E_DECOMP)
+   inst->s.sf = 1;
+   else
+   inst->s.sf = 0;
+
+   /* Set input checksum */
+   inst->s.adlercrc32 = op->input_chksum;
+
+   /* Prepare gather buffers */
+   zipvf_prepare_in_buf(zstrm, op);
+   zipvf_prepare_out_buf(zstrm, op);
+}
+
+#ifdef ZIP_DBG
+static inline void
+zip_dump_instruction(void *inst)
+{
+   union zip_inst_s *cmd83 = (union zip_inst_s *)inst;
+   printf("### START \n");
+   printf("doneint:%d totaloutputlength:%d\n", cmd83->s.doneint,
+   cmd83->s.totaloutputlength);
+   printf("exnum:%d iv:%d exbits:%d hmif:%d halg:%d\n", cmd83->s.exn,
+   cmd83->s.iv, cmd83->s.exbits, cmd83->s.hmif, cmd83->s.halg);
+   printf("flush:%d speed:%d cc:%d\n", cmd83->s.sf,
+   cmd83->s.ss, cmd83->s.cc);
+   p

[dpdk-dev] [PATCH v4 6/6] usertools: update devbind for octeontx zip device

2018-07-25 Thread Ashish Gupta
From: Sunila Sahu 

Add the cavium octeontx zip pci device details.

Signed-off-by: Ashish Gupta 
Signed-off-by: Shally Verma 
Signed-off-by: Sunila Sahu 
---
 usertools/dpdk-devbind.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index d0c4209..1d48a6c 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -24,6 +24,8 @@
   'SVendor': None, 'SDevice': None}
 cavium_tim = {'Class': '08', 'Vendor': '177d', 'Device': 'a051',
   'SVendor': None, 'SDevice': None}
+cavium_zip = {'Class': '12', 'Vendor': '177d', 'Device': 'a037',
+  'SVendor': None, 'SDevice': None}
 avp_vnic = {'Class': '05', 'Vendor': '1af4', 'Device': '1110',
   'SVendor': None, 'SDevice': None}
 
@@ -31,6 +33,7 @@
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim]
 mempool_devices = [cavium_fpa]
+compress_devices = [cavium_zip]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -569,6 +572,10 @@ def show_status():
 if status_dev == "mempool" or status_dev == "all":
 show_device_status(mempool_devices, "Mempool")
 
+if status_dev == "compress" or status_dev == "all":
+show_device_status(compress_devices , "Compress")
+
+
 def parse_args():
 '''Parses the command-line arguments given by the user and takes the
 appropriate action for each'''
@@ -642,6 +649,7 @@ def do_arg_actions():
 get_device_details(crypto_devices)
 get_device_details(eventdev_devices)
 get_device_details(mempool_devices)
+get_device_details(compress_devices)
 show_status()
 
 
@@ -654,6 +662,7 @@ def main():
 get_device_details(crypto_devices)
 get_device_details(eventdev_devices)
 get_device_details(mempool_devices)
+get_device_details(compress_devices)
 do_arg_actions()
 
 if __name__ == "__main__":
-- 
2.9.5



Re: [dpdk-dev] [PATCH] net/mlx5: fix invalid network interface index value

2018-07-25 Thread Yongseok Koh


> On Jul 25, 2018, at 4:24 AM, Adrien Mazarguil  
> wrote:
> 
> Network interface indices being unsigned, an invalid index or error is
> normally expressed through a zero value (see if_nametoindex()).
> 
> mlx5_ifindex() has a signed return type for negative values in case of
> error. Since mlx5_nl.c does not check for errors, these may be fed back as
> invalid interfaces indices to subsequent system calls. This usage would
> have been correct if mlx5_ifindex() returned a zero value instead.
> 
> This patch makes mlx5_ifindex() unsigned for convenience.
> 
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: Nelio Laranjeiro 
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Adrien Mazarguil 
> Acked-by: Nelio Laranjeiro 
> ---
Acked-by: Yongseok Koh 
 
Thanks

[dpdk-dev] [PATCH v6 1/4] test: add ring pmd based packet rx/tx for UT

2018-07-25 Thread Naga Suresh Somarowthu
Added ring pmd based packet rx/tx helper functions
for verifying Latency, Bitrate and pdump lib UTs.

Signed-off-by: Naga Suresh Somarowthu 
Reviewed-by: Reshma Pattan 
---
 test/test/Makefile|   1 +
 test/test/sample_packet_forward.c | 115 ++
 test/test/sample_packet_forward.h |  40 +
 3 files changed, 156 insertions(+)
 create mode 100644 test/test/sample_packet_forward.c
 create mode 100644 test/test/sample_packet_forward.h

diff --git a/test/test/Makefile b/test/test/Makefile
index e6967bab6..9f7d398e4 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -165,6 +165,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) += test_reorder.c
 
 SRCS-y += virtual_pmd.c
 SRCS-y += packet_burst_generator.c
+SRCS-y += sample_packet_forward.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c
 
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
diff --git a/test/test/sample_packet_forward.c 
b/test/test/sample_packet_forward.c
new file mode 100644
index 0..467735264
--- /dev/null
+++ b/test/test/sample_packet_forward.c
@@ -0,0 +1,115 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sample_packet_forward.h"
+#include "test.h"
+
+/* Sample test to create virtual rings and tx,rx portid from rings */
+int
+test_ring_setup(struct rte_ring **ring, uint16_t *portid)
+{
+   *ring = rte_ring_create("R0", RING_SIZE, rte_socket_id(),
+ RING_F_SP_ENQ | RING_F_SC_DEQ);
+   if (*ring == NULL) {
+   printf("%s() line %u: rte_ring_create R0 failed",
+  __func__, __LINE__);
+   return -1;
+   }
+   *portid = rte_eth_from_rings("net_ringa", ring, NUM_QUEUES,
+   ring, NUM_QUEUES, rte_socket_id());
+
+   return 0;
+}
+
+/* Sample test to free the mempool */
+void
+test_mp_free(struct rte_mempool *mp)
+{
+   rte_mempool_free(mp);
+}
+
+/* Sample test to free the virtual rings */
+void
+test_ring_free(struct rte_ring *rxtx)
+{
+   rte_ring_free(rxtx);
+}
+
+/* Sample test to release the vdev */
+void
+test_vdev_uninit(const char *vdev)
+{
+   rte_vdev_uninit(vdev);
+}
+
+/* sample test to deallocate the allocated buffers */
+int
+test_get_mempool(struct rte_mempool **mp, char *poolname)
+{
+   *mp = rte_pktmbuf_pool_create(poolname, NB_MBUF, 32, 0,
+   RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
+   if (*mp == NULL)
+   return -1;
+   return 0;
+}
+
+/* sample test to allocate buffer for pkts */
+int
+test_get_mbuf_from_pool(struct rte_mempool **mp, struct rte_mbuf **pbuf,
+   char *poolname)
+{
+   int ret = 0;
+
+   ret = test_get_mempool(mp, poolname);
+   if (ret < 0)
+   return -1;
+   if (rte_pktmbuf_alloc_bulk(*mp, pbuf, NUM_PACKETS) != 0) {
+   printf("%s() line %u: rte_pktmbuf_alloc_bulk failed", __func__,
+  __LINE__);
+   return -1;
+   }
+   return 0;
+}
+
+/* sample test to deallocate the allocated buffers */
+void
+test_put_mbuf_to_pool(struct rte_mempool *mp, struct rte_mbuf **pbuf)
+{
+   int itr = 0;
+
+   for (itr = 0; itr < NUM_PACKETS; itr++)
+   rte_pktmbuf_free(pbuf[itr]);
+   rte_mempool_free(mp);
+}
+
+/* Sample test to forward packets using virtual portids */
+int
+test_packet_forward(struct rte_mbuf **pbuf, uint16_t portid, uint16_t queue_id)
+{
+   /* send and receive packet and check for stats update */
+   if (rte_eth_tx_burst(portid, queue_id, pbuf, NUM_PACKETS)
+   < NUM_PACKETS) {
+   printf("%s() line %u: Error sending packet to"
+  " port %d\n", __func__, __LINE__, portid);
+   return -1;
+   }
+   if (rte_eth_rx_burst(portid, queue_id, pbuf, NUM_PACKETS)
+   < NUM_PACKETS) {
+   printf("%s() line %u: Error receiving packet from"
+  " port %d\n", __func__, __LINE__, portid);
+   return -1;
+   }
+   return 0;
+}
diff --git a/test/test/sample_packet_forward.h 
b/test/test/sample_packet_forward.h
new file mode 100644
index 0..0f0ecf877
--- /dev/null
+++ b/test/test/sample_packet_forward.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#ifndef _SAMPLE_PACKET_FORWARD_H_
+#define _SAMPLE_PACKET_FORWARD_H_
+
+/* MACROS to support virtual ring creation */
+#define RING_SIZE 256
+#define NUM_QUEUES 1
+#define NB_MBUF 512
+
+#define NUM_PACKETS 10
+
+/* Sample test to create virtual rings and tx,rx portid from rings */
+int test_ring_setup(struct rte_ring **ring, uint16_t *portid);
+
+/* Sample test to free the virtual rings */
+void test_ring_free(struct rte_ring *rxtx);
+
+/* Sample test to forward packet u

[dpdk-dev] [PATCH v6 2/4] test: add unit tests for bitrate library

2018-07-25 Thread Naga Suresh Somarowthu
Unit Test Cases for BitRate library.

Signed-off-by: Naga Suresh Somarowthu 
Reviewed-by: Reshma Pattan 
Reviewed-by: Remy Horton 
---
 test/test/Makefile|   1 +
 test/test/autotest_data.py|   6 ++
 test/test/test_bitratestats.c | 227 ++
 3 files changed, 234 insertions(+)
 create mode 100644 test/test/test_bitratestats.c

diff --git a/test/test/Makefile b/test/test/Makefile
index 9f7d398e4..c619877f0 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -183,6 +183,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
+SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.c
 
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
diff --git a/test/test/autotest_data.py b/test/test/autotest_data.py
index aacfe0a66..419520342 100644
--- a/test/test/autotest_data.py
+++ b/test/test/autotest_data.py
@@ -293,6 +293,12 @@ def per_sockets(num):
 "Tests":
 [
 {
+"Name":"Bitratestats autotest",
+"Command": "bitratestats_autotest",
+"Func":default_autotest,
+"Report":  None,
+},
+{
 "Name":"PMD ring autotest",
 "Command": "ring_pmd_autotest",
 "Func":default_autotest,
diff --git a/test/test/test_bitratestats.c b/test/test/test_bitratestats.c
new file mode 100644
index 0..62a175865
--- /dev/null
+++ b/test/test/test_bitratestats.c
@@ -0,0 +1,227 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test.h"
+#include "sample_packet_forward.h"
+
+#define BIT_NUM_PACKETS 10
+#define QUEUE_ID 0
+
+uint16_t portid;
+struct rte_stats_bitrates *bitrate_data;
+struct rte_ring *ring;
+
+/* To test whether rte_stats_bitrate_create is successful */
+static int
+test_stats_bitrate_create(void)
+{
+   bitrate_data = rte_stats_bitrate_create();
+   TEST_ASSERT(bitrate_data != NULL, "rte_stats_bitrate_create failed");
+
+   return TEST_SUCCESS;
+}
+
+/* To test bit rate registration */
+static int
+test_stats_bitrate_reg(void)
+{
+   int ret = 0;
+
+   /* Test to register bit rate without metrics init */
+   ret = rte_stats_bitrate_reg(bitrate_data);
+   TEST_ASSERT(ret < 0, "Test Failed: rte_stats_bitrate_reg succeeded "
+   "without metrics init, ret:%d", ret);
+
+   /* Metrics initialization */
+   rte_metrics_init(rte_socket_id());
+   /* Test to register bit rate after metrics init */
+   ret = rte_stats_bitrate_reg(bitrate_data);
+   TEST_ASSERT((ret >= 0), "Test Failed: rte_stats_bitrate_reg %d", ret);
+
+   return TEST_SUCCESS;
+}
+
+/* To test the bit rate registration with invalid pointer */
+static int
+test_stats_bitrate_reg_invalidpointer(void)
+{
+   int ret = 0;
+
+   ret = rte_stats_bitrate_reg(NULL);
+   TEST_ASSERT(ret < 0, "Test Failed: Expected failure < 0 but "
+   "got %d", ret);
+
+   return TEST_SUCCESS;
+}
+
+/* To test bit rate calculation with invalid bit rate data pointer */
+static int
+test_stats_bitrate_calc_invalid_bitrate_data(void)
+{
+   int ret = 0;
+
+   ret = rte_stats_bitrate_calc(NULL, portid);
+   TEST_ASSERT(ret < 0, "Test Failed: rte_stats_bitrate_calc "
+   "ret:%d", ret);
+
+   return TEST_SUCCESS;
+}
+
+/* To test the bit rate calculation with invalid portid
+ * (higher than max ports)
+ */
+static int
+test_stats_bitrate_calc_invalid_portid_1(void)
+{
+   int ret = 0;
+
+   ret = rte_stats_bitrate_calc(bitrate_data, 33);
+   TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for higher "
+   "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+
+   return TEST_SUCCESS;
+}
+
+/* To test the bit rate calculation with invalid portid (lesser than 0) */
+static int
+test_stats_bitrate_calc_invalid_portid_2(void)
+{
+   int ret = 0;
+
+   ret = rte_stats_bitrate_calc(bitrate_data, -1);
+   TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for invalid "
+   "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+
+   return TEST_SUCCESS;
+}
+
+/* To test the bit rate calculation with non-existing portid */
+static int
+test_stats_bitrate_calc_non_existing_portid(void)
+{
+   int ret = 0;
+
+   ret = rte_stats_bitrate_calc(bitrate_data, 31);
+   TEST_ASSERT(ret ==  -EINVAL, "Test Failed: Expected -%d for "
+   "non-existing portid rte_stats_bitrate_calc ret:%d",
+   EINVAL,

[dpdk-dev] [PATCH v6 4/4] test: add unit test for pdump library

2018-07-25 Thread Naga Suresh Somarowthu
Unit test cases are added for pdump library.
Primary process will act as server, forks a child secondary process.
Secondary process acts as client.
Server will do pdump init to serve any pdump client requests.
Server will create a vdev, send/receive packets continuously
in a separate thread.
Client will create virtual rings to receive the packet dump.
Client sends pdump enable/disable requests using either port/device id.
Packet flow direction can be tx/rx/tx&rx.
In Server, appropriate pdump callbacks are triggered,
when packets are transmitted/received.
Pdump packet is copied to client rings.

Signed-off-by: Naga Suresh Somarowthu 
Reviewed-by: Reshma Pattan 
---
 test/test/Makefile |   6 ++
 test/test/process.h|  12 +++
 test/test/test.c   |   2 +
 test/test/test_pdump.c | 232 +
 test/test/test_pdump.h |  40 +
 5 files changed, 292 insertions(+)
 create mode 100644 test/test/test_pdump.c
 create mode 100644 test/test/test_pdump.h

diff --git a/test/test/Makefile b/test/test/Makefile
index bba3be1be..3e7baef76 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -185,6 +185,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
 SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.c
 SRCS-$(CONFIG_RTE_LIBRTE_LATENCY_STATS) += test_latencystats.c
+SRCS-$(CONFIG_RTE_LIBRTE_PDUMP) += test_pdump.c
 
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
@@ -214,6 +215,11 @@ CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -D_GNU_SOURCE
 
 LDLIBS += -lm
+
+ifeq ($(CONFIG_RTE_LIBRTE_PDUMP),y)
+LDLIBS += -lpthread
+endif
+
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y)
 LDLIBS += -lz
diff --git a/test/test/process.h b/test/test/process.h
index 11986d5c2..1e7adde0e 100644
--- a/test/test/process.h
+++ b/test/test/process.h
@@ -13,6 +13,10 @@
 #define exe "exe"
 #endif
 
+#include 
+extern void *send_pkts(void *empty);
+extern uint16_t flag_for_send_pkts;
+
 /*
  * launches a second copy of the test process using the given argv parameters,
  * which should include argv[0] as the process name. To identify in the
@@ -26,6 +30,7 @@ process_dup(const char *const argv[], int numargs, const char 
*env_value)
char *argv_cpy[numargs + 1];
int i, fd, status;
char path[32];
+   pthread_t thread;
 
pid_t pid = fork();
if (pid < 0)
@@ -56,8 +61,15 @@ process_dup(const char *const argv[], int numargs, const 
char *env_value)
rte_panic("Cannot exec\n");
}
/* parent process does a wait */
+   if ((strcmp(env_value, "run_pdump_server_tests") == 0))
+   pthread_create(&thread, NULL, &send_pkts, NULL);
+
while (wait(&status) != pid)
;
+   if ((strcmp(env_value, "run_pdump_server_tests") == 0)) {
+   flag_for_send_pkts = 0;
+   pthread_join(thread, NULL);
+   }
return status;
 }
 
diff --git a/test/test/test.c b/test/test/test.c
index 44dfe20ef..a54b0d142 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -30,6 +30,7 @@ extern cmdline_parse_ctx_t main_ctx[];
 #endif
 
 #include "test.h"
+#include "test_pdump.h"
 
 #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
 
@@ -49,6 +50,7 @@ do_recursive_call(void)
int (*action_fn)(void);
} actions[] =  {
{ "run_secondary_instances", test_mp_secondary },
+   { "run_pdump_server_tests", test_pdump },
{ "test_missing_c_flag", no_action },
{ "test_master_lcore_flag", no_action },
{ "test_invalid_n_flag", no_action },
diff --git a/test/test/test_pdump.c b/test/test/test_pdump.c
new file mode 100644
index 0..cfdda4d39
--- /dev/null
+++ b/test/test/test_pdump.c
@@ -0,0 +1,232 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test.h"
+#include "sample_packet_forward.h"
+#include "test_pdump.h"
+#include "process.h"
+
+#define launch_p(ARGV) process_dup(ARGV, \
+   sizeof(ARGV)/(sizeof(ARGV[0])), __func__)
+
+struct rte_ring *ring_server;
+uint16_t portid;
+uint16_t flag_for_send_pkts = 1;
+
+int
+test_pdump_init(void)
+{
+   int ret = 0;
+
+   ret = rte_pdump_init(NULL);
+   if (ret < 0) {
+   printf("rte_pdump_init failed\n");
+   return -1;
+   }
+   ret = test_ring_setup(&ring_server, &portid);
+   if (ret < 0) {
+   printf("test_ring_setup failed\n");
+   return -1;
+   }
+   printf("pdump_init 

[dpdk-dev] [PATCH v6 0/4] add unit tests for bitrate, latency and pdump libraries

2018-07-25 Thread Naga Suresh Somarowthu
1/4: add ring pmd based packet helper functions for UT
2/4: unit test cases added for bitrate library
3/4: unit test cases added for latencystats library
4/4: unit test cases added for pdump library

Patches 2/4,3/4 depends on 1/4
Patch 4/4 depends on 1/4 and the below patch
http://patches.dpdk.org/patch/43354/ 

Signed-off-by: Naga Suresh Somarowthu 
Reviewed-by: Reshma Pattan 
Reviewed-by: Remy Horton 

---
v6: updated ring variable appropriately
v5: rebased, freed pools and rings, created common patch set
---

Naga Suresh Somarowthu (4):
  test: add ring pmd based packet rx/tx for UT
  test: add unit tests for bitrate library
  test: add unit tests for latencystats library
  test: add unit test for pdump library

 test/test/Makefile|   9 ++
 test/test/autotest_data.py|  12 ++
 test/test/process.h   |  12 ++
 test/test/sample_packet_forward.c | 115 +++
 test/test/sample_packet_forward.h |  40 +++
 test/test/test.c  |   2 +
 test/test/test_bitratestats.c | 227 +
 test/test/test_latencystats.c | 216 +++
 test/test/test_pdump.c| 232 ++
 test/test/test_pdump.h|  40 +++
 10 files changed, 905 insertions(+)
 create mode 100644 test/test/sample_packet_forward.c
 create mode 100644 test/test/sample_packet_forward.h
 create mode 100644 test/test/test_bitratestats.c
 create mode 100644 test/test/test_latencystats.c
 create mode 100644 test/test/test_pdump.c
 create mode 100644 test/test/test_pdump.h

-- 
2.13.6



[dpdk-dev] [PATCH v6 3/4] test: add unit tests for latencystats library

2018-07-25 Thread Naga Suresh Somarowthu
Unit Test Cases added for latencystats library.

Signed-off-by: Naga Suresh Somarowthu 
Reviewed-by: Reshma Pattan 
---
 test/test/Makefile|   1 +
 test/test/autotest_data.py|   6 ++
 test/test/test_latencystats.c | 216 ++
 3 files changed, 223 insertions(+)
 create mode 100644 test/test/test_latencystats.c

diff --git a/test/test/Makefile b/test/test/Makefile
index c619877f0..bba3be1be 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -184,6 +184,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += 
test_cryptodev_blockcipher.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
 SRCS-$(CONFIG_RTE_LIBRTE_BITRATE) += test_bitratestats.c
+SRCS-$(CONFIG_RTE_LIBRTE_LATENCY_STATS) += test_latencystats.c
 
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
diff --git a/test/test/autotest_data.py b/test/test/autotest_data.py
index 419520342..3eccc4e1a 100644
--- a/test/test/autotest_data.py
+++ b/test/test/autotest_data.py
@@ -299,6 +299,12 @@ def per_sockets(num):
 "Report":  None,
 },
 {
+"Name":"Latencystats autotest",
+"Command": "latencystats_autotest",
+"Func":default_autotest,
+"Report":  None,
+},
+{
 "Name":"PMD ring autotest",
 "Command": "ring_pmd_autotest",
 "Func":default_autotest,
diff --git a/test/test/test_latencystats.c b/test/test/test_latencystats.c
new file mode 100644
index 0..f2287a2b7
--- /dev/null
+++ b/test/test/test_latencystats.c
@@ -0,0 +1,216 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "test.h"
+#include "sample_packet_forward.h"
+#define NUM_STATS 4
+#define LATENCY_NUM_PACKETS 10
+#define QUEUE_ID 0
+
+uint16_t portid;
+struct rte_ring *ring;
+
+struct rte_metric_name lat_stats_strings[] = {
+   {"min_latency_ns"},
+   {"avg_latency_ns"},
+   {"max_latency_ns"},
+   {"jitter_ns"},
+};
+
+/* Test case for latency init with metrics init */
+static int test_latency_init(void)
+{
+   int ret = 0;
+
+   /* Metrics Initialization */
+   rte_metrics_init(rte_socket_id());
+
+   ret = rte_latencystats_init(1, NULL);
+   TEST_ASSERT(ret >= 0, "Test Failed: rte_latencystats_init failed");
+
+   return TEST_SUCCESS;
+}
+
+/* Test case to update the latency stats */
+static int test_latency_update(void)
+{
+   int ret = 0;
+
+   ret = rte_latencystats_update();
+   TEST_ASSERT(ret >= 0, "Test Failed: rte_latencystats_update failed");
+
+   return TEST_SUCCESS;
+}
+
+/* Test case to uninit latency stats */
+static int test_latency_uninit(void)
+{
+   int ret = 0;
+
+   ret = rte_latencystats_uninit();
+   TEST_ASSERT(ret >= 0, "Test Failed: rte_latencystats_uninit failed");
+
+   return TEST_SUCCESS;
+}
+
+/* Test case to get names of latency stats */
+static int test_latencystats_get_names(void)
+{
+   int ret = 0;
+   int size = 0;
+   struct rte_metric_name names[NUM_STATS] = { 0 };
+   struct rte_metric_name wrongnames[NUM_STATS - 2] = { 0 };
+
+   /* Success Test: Valid names and size */
+   size = NUM_STATS;
+   ret = rte_latencystats_get_names(names, size);
+   for (int i = 0; i <= NUM_STATS; i++) {
+   if (strcmp(lat_stats_strings[i].name, names[i].name) == 0)
+   printf(" %s\n", names[i].name);
+   else
+   printf("Failed: Names are not matched\n");
+   }
+   TEST_ASSERT((ret == NUM_STATS), "Test Failed to get metrics names");
+
+   /* Failure Test: Invalid names and valid size */
+   ret = rte_latencystats_get_names(NULL, size);
+   TEST_ASSERT((ret == NUM_STATS), "Test Failed to get the metrics count,"
+   "Actual: %d Expected: %d", ret, NUM_STATS);
+
+   /* Failure Test: Valid names and invalid size */
+   size = 0;
+   ret = rte_latencystats_get_names(names, size);
+   TEST_ASSERT((ret == NUM_STATS), "Test Failed to get the metrics count,"
+   "Actual: %d Expected: %d", ret, NUM_STATS);
+
+   /* Failure Test: Invalid names (array size lesser than size) */
+   size = NUM_STATS + 1;
+   ret = rte_latencystats_get_names(wrongnames, size);
+   TEST_ASSERT((ret == NUM_STATS), "Test Failed to get metrics names");
+   return TEST_SUCCESS;
+}
+
+/* Test case to get latency stats values */
+static int test_latencystats_get(void)
+{
+   int ret = 0;
+   int size = 0;
+   struct rte_metric_value values[NUM_STATS] = { 0 };
+   struct rte_metric_value wrongvalues[NUM_STATS - 2] = { 0 };
+
+   

[dpdk-dev] [PATCH 0/6] net/softnic: expose tmgr through firmware

2018-07-25 Thread Jasvinder Singh
This patchset provide the necessary Soft NIC firmware CLI commands to
control the Traffic Manager (TMGR) through firmware.

The Soft NIC TMGR function can now be controlled through either Soft NIC
firmware or through the ethdev TM API (e.g. via test-pmd app).

Cristian Dumitrescu (6):
  net/softnic: add CLI command for tmgr create
  net/softnic: add CLI command for tmgr shaper profile
  net/softnic: add CLI command for tmgr shared shaper
  net/softnic: add CLI command for tmgr node addition
  net/softnic: add CLI command for tmgr hierarchy commit
  net/softnic: add CLI command for default tmgr hierarchy

 drivers/net/softnic/parser.c|  18 +
 drivers/net/softnic/parser.h|   2 +
 drivers/net/softnic/rte_eth_softnic.c   |  17 +-
 drivers/net/softnic/rte_eth_softnic_cli.c   | 917 
 drivers/net/softnic/rte_eth_softnic_internals.h |  14 +-
 drivers/net/softnic/rte_eth_softnic_tm.c| 205 +++---
 6 files changed, 1029 insertions(+), 144 deletions(-)

-- 
2.9.3



[dpdk-dev] [PATCH 1/6] net/softnic: add CLI command for tmgr create

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support to create Traffic Manager (TMGR) object through firmware
CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/rte_eth_softnic.c   |  17 +-
 drivers/net/softnic/rte_eth_softnic_cli.c   |  32 
 drivers/net/softnic/rte_eth_softnic_internals.h |  14 +-
 drivers/net/softnic/rte_eth_softnic_tm.c| 205 ++--
 4 files changed, 124 insertions(+), 144 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic.c 
b/drivers/net/softnic/rte_eth_softnic.c
index 2688e17..30fb395 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -156,14 +156,6 @@ pmd_dev_start(struct rte_eth_dev *dev)
struct pmd_internals *p = dev->data->dev_private;
int status;
 
-   /* TM */
-   if (tm_used(dev)) {
-   status = tm_start(p);
-
-   if (status)
-   return status;
-   }
-
/* Firmware */
status = softnic_cli_script_process(p,
p->params.firmware,
@@ -197,8 +189,7 @@ pmd_dev_stop(struct rte_eth_dev *dev)
softnic_softnic_swq_free_keep_rxq_txq(p);
softnic_mempool_free(p);
 
-   /* TM */
-   tm_stop(p);
+   tm_hierarchy_free(p);
 }
 
 static void
@@ -273,10 +264,11 @@ pmd_init(struct pmd_params *params)
memcpy(&p->params, params, sizeof(p->params));
 
/* Resources */
+   tm_hierarchy_init(p);
+
softnic_mempool_init(p);
softnic_swq_init(p);
softnic_link_init(p);
-   tm_init(p);
softnic_tmgr_init(p);
softnic_tap_init(p);
softnic_port_in_action_profile_init(p);
@@ -322,11 +314,12 @@ pmd_free(struct pmd_internals *p)
softnic_port_in_action_profile_free(p);
softnic_tap_free(p);
softnic_tmgr_free(p);
-   tm_free(p);
softnic_link_free(p);
softnic_swq_free(p);
softnic_mempool_free(p);
 
+   tm_hierarchy_free(p);
+
rte_free(p);
 }
 
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index 860d6a9..4a63b94 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -185,6 +185,33 @@ cmd_swq(struct pmd_internals *softnic,
 }
 
 /**
+ * tmgr 
+ */
+static void
+cmd_tmgr(struct pmd_internals *softnic,
+   char **tokens,
+   uint32_t n_tokens,
+   char *out,
+   size_t out_size)
+{
+   char *name;
+   struct softnic_tmgr_port *tmgr_port;
+
+   if (n_tokens != 2) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+   return;
+   }
+
+   name = tokens[1];
+
+   tmgr_port = softnic_tmgr_port_create(softnic, name);
+   if (tmgr_port == NULL) {
+   snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+   return;
+   }
+}
+
+/**
  * tap 
  */
 static void
@@ -3955,6 +3982,11 @@ softnic_cli_process(char *in, char *out, size_t 
out_size, void *arg)
return;
}
 
+   if (strcmp(tokens[0], "tmgr") == 0) {
+   cmd_tmgr(softnic, tokens, n_tokens, out, out_size);
+   return;
+   }
+
if (strcmp(tokens[0], "tap") == 0) {
cmd_tap(softnic, tokens, n_tokens, out, out_size);
return;
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h 
b/drivers/net/softnic/rte_eth_softnic_internals.h
index 4738cf3..a25eb87 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -203,7 +203,6 @@ struct tm_internals {
 
/** Blueprints */
struct tm_params params;
-   struct rte_sched_port *sched;
 };
 
 struct softnic_tmgr_port {
@@ -575,20 +574,13 @@ softnic_tmgr_port_find(struct pmd_internals *p,
 
 struct softnic_tmgr_port *
 softnic_tmgr_port_create(struct pmd_internals *p,
-   const char *name,
-   struct rte_sched_port *sched);
-
-int
-tm_init(struct pmd_internals *p);
+   const char *name);
 
 void
-tm_free(struct pmd_internals *p);
-
-int
-tm_start(struct pmd_internals *p);
+tm_hierarchy_init(struct pmd_internals *p);
 
 void
-tm_stop(struct pmd_internals *p);
+tm_hierarchy_free(struct pmd_internals *p);
 
 static inline int
 tm_used(struct rte_eth_dev *dev)
diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c 
b/drivers/net/softnic/rte_eth_softnic_tm.c
index 8e473c8..baaafbe 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -34,6 +34,7 @@ softnic_tmgr_free(struct pmd_internals *p)
break;
 
TAILQ_REMOVE(&p->tmgr_port_list, tmgr_port, node);
+   rte_sched_port_free(tmgr_port->s);
free(tmgr_port);
}
 }
@@ -56,23 +57,71 @@ softnic_tmgr_port_find(struct pmd_internals *p,
 
 struct softnic_tmgr_port *
 softnic_tmgr_port_create(struct 

[dpdk-dev] [PATCH 2/6] net/softnic: add CLI command for tmgr shaper profile

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support to create Traffic Manager (TMGR) shaper profile
through firmware CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/parser.c  |  18 ++
 drivers/net/softnic/parser.h  |   2 +
 drivers/net/softnic/rte_eth_softnic_cli.c | 100 +-
 3 files changed, 118 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c
index 7087b87..a8688a2 100644
--- a/drivers/net/softnic/parser.c
+++ b/drivers/net/softnic/parser.c
@@ -93,6 +93,24 @@ softnic_parser_read_arg_bool(const char *p)
 }
 
 int
+softnic_parser_read_int32(int32_t *value, const char *p)
+{
+   char *next;
+   int32_t val;
+
+   p = skip_white_spaces(p);
+   if (!isdigit(*p))
+   return -EINVAL;
+
+   val = strtol(p, &next, 10);
+   if (p == next)
+   return -EINVAL;
+
+   *value = val;
+   return 0;
+}
+
+int
 softnic_parser_read_uint64(uint64_t *value, const char *p)
 {
char *next;
diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h
index 5ab4763..1ee3f82 100644
--- a/drivers/net/softnic/parser.h
+++ b/drivers/net/softnic/parser.h
@@ -33,6 +33,8 @@ skip_digits(const char *src)
 
 int softnic_parser_read_arg_bool(const char *p);
 
+int softnic_parser_read_int32(int32_t *value, const char *p);
+
 int softnic_parser_read_uint64(uint64_t *value, const char *p);
 int softnic_parser_read_uint32(uint32_t *value, const char *p);
 int softnic_parser_read_uint16(uint16_t *value, const char *p);
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index 4a63b94..0a9ec01 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -185,6 +185,93 @@ cmd_swq(struct pmd_internals *softnic,
 }
 
 /**
+ * tmgr shaper profile
+ *  id 
+ *  rate  size 
+ *  adj 
+ */
+static void
+cmd_tmgr_shaper_profile(struct pmd_internals *softnic,
+   char **tokens,
+   uint32_t n_tokens,
+   char *out,
+   size_t out_size)
+{
+   struct rte_tm_shaper_params sp;
+   struct rte_tm_error error;
+   uint32_t shaper_profile_id;
+   uint16_t port_id;
+   int status;
+
+   memset(&sp, 0, sizeof(struct rte_tm_shaper_params));
+
+   if (n_tokens != 11) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+   return;
+   }
+
+   if (strcmp(tokens[1], "shaper") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "shaper");
+   return;
+   }
+
+   if (strcmp(tokens[2], "profile") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
+   return;
+   }
+
+   if (strcmp(tokens[3], "id") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "id");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&shaper_profile_id, tokens[4]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "profile_id");
+   return;
+   }
+
+   if (strcmp(tokens[5], "rate") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rate");
+   return;
+   }
+
+   if (softnic_parser_read_uint64(&sp.peak.rate, tokens[6]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "tb_rate");
+   return;
+   }
+
+   if (strcmp(tokens[7], "size") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size");
+   return;
+   }
+
+   if (softnic_parser_read_uint64(&sp.peak.size, tokens[8]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "tb_size");
+   return;
+   }
+
+   if (strcmp(tokens[9], "adj") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "adj");
+   return;
+   }
+
+   if (softnic_parser_read_int32(&sp.pkt_length_adjust, tokens[10]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, 
"packet_length_adjust");
+   return;
+   }
+
+   status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+   if (status)
+   return;
+
+   status = rte_tm_shaper_profile_add(port_id, shaper_profile_id, &sp, 
&error);
+   if (status != 0) {
+   snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+   return;
+   }
+}
+
+/**
  * tmgr 
  */
 static void
@@ -3983,8 +4070,17 @@ softnic_cli_process(char *in, char *out, size_t 
out_size, void *arg)
}
 
if (strcmp(tokens[0], "tmgr") == 0) {
-   cmd_tmgr(softnic, tokens, n_tokens, out, out_size);
-   return;
+   if (n_tokens == 2) {
+   cmd_tmgr(softnic, tokens, n_tokens, out, out_size);
+   return;
+   }
+
+   if (n_tokens >= 3 &&
+

[dpdk-dev] [PATCH 3/6] net/softnic: add CLI command for tmgr shared shaper

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support to create Traffic Manager (TMGR) shared shaper through
firmware CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 73 +++
 1 file changed, 73 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index 0a9ec01..73ea7bd 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -272,6 +272,72 @@ cmd_tmgr_shaper_profile(struct pmd_internals *softnic,
 }
 
 /**
+ * tmgr shared shaper
+ *  id 
+ *  profile 
+ */
+static void
+cmd_tmgr_shared_shaper(struct pmd_internals *softnic,
+   char **tokens,
+   uint32_t n_tokens,
+   char *out,
+   size_t out_size)
+{
+   struct rte_tm_error error;
+   uint32_t shared_shaper_id, shaper_profile_id;
+   uint16_t port_id;
+   int status;
+
+   if (n_tokens != 7) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+   return;
+   }
+
+   if (strcmp(tokens[1], "shared") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "shared");
+   return;
+   }
+
+   if (strcmp(tokens[2], "shaper") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "shaper");
+   return;
+   }
+
+   if (strcmp(tokens[3], "id") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "id");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&shared_shaper_id, tokens[4]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "shared_shaper_id");
+   return;
+   }
+
+   if (strcmp(tokens[5], "profile") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&shaper_profile_id, tokens[6]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "shaper_profile_id");
+   return;
+   }
+
+   status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+   if (status)
+   return;
+
+   status = rte_tm_shared_shaper_add_update(port_id,
+   shared_shaper_id,
+   shaper_profile_id,
+   &error);
+   if (status != 0) {
+   snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+   return;
+   }
+}
+
+/**
  * tmgr 
  */
 static void
@@ -4081,6 +4147,13 @@ softnic_cli_process(char *in, char *out, size_t 
out_size, void *arg)
cmd_tmgr_shaper_profile(softnic, tokens, n_tokens, out, 
out_size);
return;
}
+
+   if (n_tokens >= 3 &&
+   (strcmp(tokens[1], "shared") == 0) &&
+   (strcmp(tokens[2], "shaper") == 0)) {
+   cmd_tmgr_shared_shaper(softnic, tokens, n_tokens, out, 
out_size);
+   return;
+   }
}
 
if (strcmp(tokens[0], "tap") == 0) {
-- 
2.9.3



[dpdk-dev] [PATCH 4/6] net/softnic: add CLI command for tmgr node addition

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support for adding Traffic Manager (TMGR) hierarchy node through
firmware CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 171 ++
 1 file changed, 171 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index 73ea7bd..d5485b5 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -338,6 +338,171 @@ cmd_tmgr_shared_shaper(struct pmd_internals *softnic,
 }
 
 /**
+ * tmgr node
+ *   id 
+ *   parent 
+ *   priority 
+ *   weight 
+ *   [shaper profile ]
+ *   [shared shaper ]
+ *   [nonleaf sp ]
+ */
+static void
+cmd_tmgr_node(struct pmd_internals *softnic,
+   char **tokens,
+   uint32_t n_tokens,
+   char *out,
+   size_t out_size)
+{
+   struct rte_tm_error error;
+   struct rte_tm_node_params np;
+   uint32_t node_id, parent_node_id, priority, weight, shared_shaper_id;
+   uint16_t port_id;
+   int status;
+
+   memset(&np, 0, sizeof(struct rte_tm_node_params));
+   np.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
+   np.nonleaf.n_sp_priorities = 1;
+
+   if (n_tokens < 10) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+   return;
+   }
+
+   if (strcmp(tokens[1], "node") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "node");
+   return;
+   }
+
+   if (strcmp(tokens[2], "id") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "id");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&node_id, tokens[3]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "node_id");
+   return;
+   }
+
+   if (strcmp(tokens[4], "parent") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "parent");
+   return;
+   }
+
+   if (strcmp(tokens[5], "none") == 0)
+   parent_node_id = RTE_TM_NODE_ID_NULL;
+   else {
+   if (softnic_parser_read_uint32(&parent_node_id, tokens[5]) != 
0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, 
"parent_node_id");
+   return;
+   }
+   }
+
+   if (strcmp(tokens[6], "priority") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "priority");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&priority, tokens[7]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "priority");
+   return;
+   }
+
+   if (strcmp(tokens[8], "weight") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "weight");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&weight, tokens[9]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, "weight");
+   return;
+   }
+
+   tokens += 10;
+   n_tokens -= 10;
+
+   if (n_tokens >= 2 &&
+   (strcmp(tokens[0], "shaper") == 0) &&
+   (strcmp(tokens[1], "profile") == 0)) {
+   if (n_tokens < 3) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, "tmgr node");
+   return;
+   }
+
+   if (strcmp(tokens[2], "none") == 0) {
+   np.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
+   } else {
+   if (softnic_parser_read_uint32(&np.shaper_profile_id, 
tokens[2]) != 0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, 
"shaper_profile_id");
+   return;
+   }
+   }
+
+   tokens += 3;
+   n_tokens -= 3;
+   } /* shaper profile */
+
+   if (n_tokens >= 2 &&
+   (strcmp(tokens[0], "shared") == 0) &&
+   (strcmp(tokens[1], "shaper") == 0)) {
+   if (n_tokens < 3) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, "tmgr node");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&shared_shaper_id, tokens[2]) != 
0) {
+   snprintf(out, out_size, MSG_ARG_INVALID, 
"shared_shaper_id");
+   return;
+   }
+
+   np.shared_shaper_id = &shared_shaper_id;
+   np.n_shared_shapers = 1;
+
+   tokens += 3;
+   n_tokens -= 3;
+   } /* shared shaper */
+
+   if (n_tokens >= 2 &&
+   (strcmp(tokens[0], "nonleaf") == 0) &&
+   (strcmp(tokens[1], "sp") == 0)) {
+   if (n_tokens < 3) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, "tmgr node");
+   return;
+   }
+
+   if (softnic_parser_read_uint32(&np.non

[dpdk-dev] [PATCH 6/6] net/softnic: add CLI command for default tmgr hierarchy

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support for creating default Traffic Manager (TMGR) hierarchy through
firmware CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 498 ++
 1 file changed, 498 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index 4bd792b..0c7448c 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -502,6 +502,498 @@ cmd_tmgr_node(struct pmd_internals *softnic,
}
 }
 
+static uint32_t
+root_node_id(uint32_t n_spp,
+   uint32_t n_pps)
+{
+   uint32_t n_queues = n_spp * n_pps * RTE_SCHED_QUEUES_PER_PIPE;
+   uint32_t n_tc = n_spp * n_pps * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;
+   uint32_t n_pipes = n_spp * n_pps;
+
+   return n_queues + n_tc + n_pipes + n_spp;
+}
+
+static uint32_t
+subport_node_id(uint32_t n_spp,
+   uint32_t n_pps,
+   uint32_t subport_id)
+{
+   uint32_t n_pipes = n_spp * n_pps;
+   uint32_t n_tc = n_pipes * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;
+   uint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;
+
+   return n_queues + n_tc + n_pipes + subport_id;
+}
+
+static uint32_t
+pipe_node_id(uint32_t n_spp,
+   uint32_t n_pps,
+   uint32_t subport_id,
+   uint32_t pipe_id)
+{
+   uint32_t n_pipes = n_spp * n_pps;
+   uint32_t n_tc = n_pipes * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;
+   uint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;
+
+   return n_queues +
+   n_tc +
+   pipe_id +
+   subport_id * n_pps;
+}
+
+static uint32_t
+tc_node_id(uint32_t n_spp,
+   uint32_t n_pps,
+   uint32_t subport_id,
+   uint32_t pipe_id,
+   uint32_t tc_id)
+{
+   uint32_t n_pipes = n_spp * n_pps;
+   uint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;
+
+   return n_queues +
+   tc_id +
+   (pipe_id + subport_id * n_pps) * 
RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;
+}
+
+static uint32_t
+queue_node_id(uint32_t n_spp __rte_unused,
+   uint32_t n_pps,
+   uint32_t subport_id,
+   uint32_t pipe_id,
+   uint32_t tc_id,
+   uint32_t queue_id)
+{
+   return queue_id +
+   tc_id * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE +
+   (pipe_id + subport_id * n_pps) * RTE_SCHED_QUEUES_PER_PIPE;
+}
+
+struct tmgr_hierarchy_default_params {
+   uint32_t n_spp; /**< Number of subports per port. */
+   uint32_t n_pps; /**< Number of pipes per subport. */
+
+   struct {
+   uint32_t port;
+   uint32_t subport;
+   uint32_t pipe;
+   uint32_t tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+   } shaper_profile_id;
+
+   struct {
+   uint32_t tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+   uint32_t tc_valid[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+   } shared_shaper_id;
+
+   struct {
+   uint32_t queue[RTE_SCHED_QUEUES_PER_PIPE];
+   } weight;
+};
+
+static int
+tmgr_hierarchy_default(struct pmd_internals *softnic,
+   struct tmgr_hierarchy_default_params *params)
+{
+   struct rte_tm_node_params root_node_params = {
+   .shaper_profile_id = params->shaper_profile_id.port,
+   .nonleaf = {
+   .n_sp_priorities = 1,
+   },
+   };
+
+   struct rte_tm_node_params subport_node_params = {
+   .shaper_profile_id = params->shaper_profile_id.subport,
+   .nonleaf = {
+   .n_sp_priorities = 1,
+   },
+   };
+
+   struct rte_tm_node_params pipe_node_params = {
+   .shaper_profile_id = params->shaper_profile_id.pipe,
+   .nonleaf = {
+   .n_sp_priorities = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
+   },
+   };
+
+   struct rte_tm_node_params tc_node_params[] = {
+   [0] = {
+   .shaper_profile_id = params->shaper_profile_id.tc[0],
+   .shared_shaper_id = ¶ms->shared_shaper_id.tc[0],
+   .n_shared_shapers =
+   (¶ms->shared_shaper_id.tc_valid[0]) ? 1 : 0,
+   .nonleaf = {
+   .n_sp_priorities = 1,
+   },
+   },
+
+   [1] = {
+   .shaper_profile_id = params->shaper_profile_id.tc[1],
+   .shared_shaper_id = ¶ms->shared_shaper_id.tc[1],
+   .n_shared_shapers =
+   (¶ms->shared_shaper_id.tc_valid[1]) ? 1 : 0,
+   .nonleaf = {
+   .n_sp_priorities = 1,
+   },
+   },
+
+   [2] = {
+   .shaper_profile_id = params->shaper_profil

[dpdk-dev] [PATCH 5/6] net/softnic: add CLI command for tmgr hierarchy commit

2018-07-25 Thread Jasvinder Singh
From: Cristian Dumitrescu 

Add support for Traffic Manager (TMGR) hierarchy commit through
firmware CLI script.

Signed-off-by: Cristian Dumitrescu 
Signed-off-by: Jasvinder Singh 
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 47 +++
 1 file changed, 47 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c 
b/drivers/net/softnic/rte_eth_softnic_cli.c
index d5485b5..4bd792b 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -503,6 +503,46 @@ cmd_tmgr_node(struct pmd_internals *softnic,
 }
 
 /**
+ * tmgr hierarchy commit
+ */
+static void
+cmd_tmgr_hierarchy_commit(struct pmd_internals *softnic,
+   char **tokens,
+   uint32_t n_tokens,
+   char *out,
+   size_t out_size)
+{
+   struct rte_tm_error error;
+   uint16_t port_id;
+   int status;
+
+   if (n_tokens != 3) {
+   snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+   return;
+   }
+
+   if (strcmp(tokens[1], "hierarchy") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "hierarchy");
+   return;
+   }
+
+   if (strcmp(tokens[2], "commit") != 0) {
+   snprintf(out, out_size, MSG_ARG_NOT_FOUND, "commit");
+   return;
+   }
+
+   status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+   if (status != 0)
+   return;
+
+   status = rte_tm_hierarchy_commit(port_id, 1, &error);
+   if (status) {
+   snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
+   return;
+   }
+}
+
+/**
  * tmgr 
  */
 static void
@@ -4325,6 +4365,13 @@ softnic_cli_process(char *in, char *out, size_t 
out_size, void *arg)
cmd_tmgr_node(softnic, tokens, n_tokens, out, out_size);
return;
}
+
+   if (n_tokens >= 3 &&
+   (strcmp(tokens[1], "hierarchy") == 0) &&
+   (strcmp(tokens[2], "commit") == 0)) {
+   cmd_tmgr_hierarchy_commit(softnic, tokens, n_tokens, 
out, out_size);
+   return;
+   }
}
 
if (strcmp(tokens[0], "tap") == 0) {
-- 
2.9.3



Re: [dpdk-dev] [PATCH] net/mlx5: fix count query when flow has not counters

2018-07-25 Thread Yongseok Koh


> On Jul 25, 2018, at 1:46 AM, Nelio Laranjeiro  
> wrote:
> 
> Querying a counters on a flow without counter is ending with a
> segmentation fault.
> 
> Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
> 
> Signed-off-by: Nelio Laranjeiro 
> ---
> drivers/net/mlx5/mlx5_flow.c | 56 
> 1 file changed, 32 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 6fa4e30ae..efaa8b4fb 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -3192,32 +3192,40 @@ mlx5_flow_query_count(struct rte_flow *flow 
> __rte_unused,
> struct rte_flow_error *error)
> {
> #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
> - struct rte_flow_query_count *qc = data;
> - uint64_t counters[2] = {0, 0};
> - struct ibv_query_counter_set_attr query_cs_attr = {
> - .cs = flow->counter->cs,
> - .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> - };
> - struct ibv_counter_set_data query_out = {
> - .out = counters,
> - .outlen = 2 * sizeof(uint64_t),
> - };
> - int err = mlx5_glue->query_counter_set(&query_cs_attr, &query_out);
> + if (flow->modifier & MLX5_FLOW_MOD_COUNT) {

Instead of adding extra indentation, how about returning error immediately if
the flow doesn't have a counter? That looks more natural. But even if you insist
this way, I'm also okay. Please let Shahaf know if you will submit v2.

Acked-by: Yongseok Koh 
 
Thanks

> + struct rte_flow_query_count *qc = data;
> + uint64_t counters[2] = {0, 0};
> + struct ibv_query_counter_set_attr query_cs_attr = {
> + .cs = flow->counter->cs,
> + .query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> + };
> + struct ibv_counter_set_data query_out = {
> + .out = counters,
> + .outlen = 2 * sizeof(uint64_t),
> + };
> + int err = mlx5_glue->query_counter_set(&query_cs_attr,
> +&query_out);
> 
> - if (err)
> - return rte_flow_error_set(error, err,
> -   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -   NULL,
> -   "cannot read counter");
> - qc->hits_set = 1;
> - qc->bytes_set = 1;
> - qc->hits = counters[0] - flow->counter->hits;
> - qc->bytes = counters[1] - flow->counter->bytes;
> - if (qc->reset) {
> - flow->counter->hits = counters[0];
> - flow->counter->bytes = counters[1];
> + if (err)
> + return rte_flow_error_set
> + (error, err,
> +  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +  NULL,
> +  "cannot read counter");
> + qc->hits_set = 1;
> + qc->bytes_set = 1;
> + qc->hits = counters[0] - flow->counter->hits;
> + qc->bytes = counters[1] - flow->counter->bytes;
> + if (qc->reset) {
> + flow->counter->hits = counters[0];
> + flow->counter->bytes = counters[1];
> + }
> + return 0;
>   }
> - return 0;
> + return rte_flow_error_set(error, ENOTSUP,
> +   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +   NULL,
> +   "flow does not have counter");
> #endif
>   return rte_flow_error_set(error, ENOTSUP,
> RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -- 
> 2.18.0
> 



[dpdk-dev] [pull-request] next-pipeline 18.08 pre-rc2

2018-07-25 Thread Cristian Dumitrescu
The following changes since commit 9d6d5b4d470ba27243c42d1b369f098d8a6b9c60:

  app/crypto-perf: compile with -O3 (2018-07-24 01:48:10 +0200)

are available in the git repository at:

  http://dpdk.org/git/next/dpdk-next-pipeline 

for you to fetch changes up to d85cb1311a0068cd6177019649fc4ae5463e24d8:

  net/softnic: add CLI command for default tmgr hierarchy (2018-07-25 18:29:15 
+0100)


Cristian Dumitrescu (6):
  net/softnic: add CLI command for tmgr create
  net/softnic: add CLI command for tmgr shaper profile
  net/softnic: add CLI command for tmgr shared shaper
  net/softnic: add CLI command for tmgr node addition
  net/softnic: add CLI command for tmgr hierarchy commit
  net/softnic: add CLI command for default tmgr hierarchy

Kevin Laatz (1):
  examples/ip_pipeline: add help command to cli

 drivers/net/softnic/parser.c|  18 +
 drivers/net/softnic/parser.h|   2 +
 drivers/net/softnic/rte_eth_softnic.c   |  17 +-
 drivers/net/softnic/rte_eth_softnic_cli.c   | 917 
 drivers/net/softnic/rte_eth_softnic_internals.h |  14 +-
 drivers/net/softnic/rte_eth_softnic_tm.c| 205 +++---
 examples/ip_pipeline/cli.c  | 770 ++--
 7 files changed, 1582 insertions(+), 361 deletions(-)


Re: [dpdk-dev] [PATCH 0/6] net/softnic: expose tmgr through firmware

2018-07-25 Thread Dumitrescu, Cristian



> -Original Message-
> From: Singh, Jasvinder
> Sent: Wednesday, July 25, 2018 6:10 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian 
> Subject: [PATCH 0/6] net/softnic: expose tmgr through firmware
> 
> This patchset provide the necessary Soft NIC firmware CLI commands to
> control the Traffic Manager (TMGR) through firmware.
> 
> The Soft NIC TMGR function can now be controlled through either Soft NIC
> firmware or through the ethdev TM API (e.g. via test-pmd app).
> 
> Cristian Dumitrescu (6):
>   net/softnic: add CLI command for tmgr create
>   net/softnic: add CLI command for tmgr shaper profile
>   net/softnic: add CLI command for tmgr shared shaper
>   net/softnic: add CLI command for tmgr node addition
>   net/softnic: add CLI command for tmgr hierarchy commit
>   net/softnic: add CLI command for default tmgr hierarchy
> 
>  drivers/net/softnic/parser.c|  18 +
>  drivers/net/softnic/parser.h|   2 +
>  drivers/net/softnic/rte_eth_softnic.c   |  17 +-
>  drivers/net/softnic/rte_eth_softnic_cli.c   | 917
> 
>  drivers/net/softnic/rte_eth_softnic_internals.h |  14 +-
>  drivers/net/softnic/rte_eth_softnic_tm.c| 205 +++---
>  6 files changed, 1029 insertions(+), 144 deletions(-)
> 
> --
> 2.9.3

Applied to next-pipeline tree, thanks!


Re: [dpdk-dev] [PATCH] config: reduce memory requirements for DPDK

2018-07-25 Thread Kevin Traynor
On 07/24/2018 01:03 PM, Thomas Monjalon wrote:
> 24/07/2018 13:04, Burakov, Anatoly:
>> On 24-Jul-18 11:23 AM, Thomas Monjalon wrote:
>>> 24/07/2018 12:03, Anatoly Burakov:
 It has been reported that current memory limitations do not work
 well on an 8-socket machines in default configuration when big
 page sizes are used [1].

 Fix it by reducing memory amount reserved by DPDK by default to
 32G per page size per NUMA node. This translates to allowing us
 to reserve 32G per page size per NUMA node on 8 nodes with 2
 page sizes.

 [1] https://mails.dpdk.org/archives/dev/2018-July/108071.html

 Signed-off-by: Anatoly Burakov 
 ---

 Notes:
  We could have increased CONFIG_RTE_MAX_MEM_MB but this would've
  brought other potential problems due to increased memory
  preallocation, and secondary process initialization is flaky
  enough as it is. I am willing to bet that 32G per page size is
  more than enough for the majority of use cases, and any
  application with bigger requirements could adjust config options
  itself.
>>> [...]
 -CONFIG_RTE_MAX_MEMSEG_PER_TYPE=32768
 -CONFIG_RTE_MAX_MEM_MB_PER_TYPE=131072
 +CONFIG_RTE_MAX_MEMSEG_PER_TYPE=16384
 +CONFIG_RTE_MAX_MEM_MB_PER_TYPE=32768
>>>
>>> Ideally, it should be a run-time option.
>>>
>>
>> It can be, yes, and this can be worked on for next release. However, we 
>> also need to have good default values that work across all supported 
>> platforms.
> 
> Yes sure, we can wait the next release for a run-time option.
> 
> How can we be sure these default values are good enough?

Why add a new limitation? Why not take the other approach that was
suggested of increasing the max possible memory?

If there is new limitations or backwards compatibility issues with
default settings compared with before the large memory management
rework, then it would be good to have that clear in the docs at a high
level for the users who want to update.

It would also help a lot to add what the implications and limits for
changing the most important defines are - will it be slower? will it not
work above X? etc.

> It would be good to have several acks from various projects or companies.
> 
> 







[dpdk-dev] [PATCH] doc: fix spelling error in vdev_netvsc

2018-07-25 Thread Stephen Hemminger
Signed-off-by: Stephen Hemminger 
---
 doc/guides/nics/vdev_netvsc.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/nics/vdev_netvsc.rst b/doc/guides/nics/vdev_netvsc.rst
index e02ae9acbac6..d1da07118783 100644
--- a/doc/guides/nics/vdev_netvsc.rst
+++ b/doc/guides/nics/vdev_netvsc.rst
@@ -93,7 +93,7 @@ The following device parameters are supported:
 
 - ``ignore`` [int]
 
-  If nonzero, ignores the driver runnig (actually used to disable the
+  If nonzero, ignores the driver running (actually used to disable the
   auto-detection in Hyper-V VM).
 
 .. note::
-- 
2.17.1



Re: [dpdk-dev] [PATCH] ethdev: remove unused forward declaration.

2018-07-25 Thread Andrew Rybchenko

On 25.07.2018 11:30, Rami Rosen wrote:

The forward declaraion of rte_pci_device in rte_ethdev.h
is not needed anymore.
Fixes: cd8c7c7ce241 ("replace bus specific struct with generic dev")

Signed-off-by: Rami Rosen 

Acked-by: Andrew Rybchenko 


[dpdk-dev] [PATCH 0/4] small cleanups

2018-07-25 Thread Stephen Hemminger
These were discovered when running internal policy checker
to try and get rid of potentially offensive language in DPDK.
After looking at a couple of these places, they were also
places where some improvement could be made.

Stephen Hemminger (4):
  arm: remove profanity in comment
  bnx2x: remove profanity
  eal: don't crash if alarm set fails
  ixgbe: remove mild profanity

 drivers/net/bnx2x/elink.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx.c |  3 +--
 lib/librte_eal/common/eal_common_proc.c| 10 --
 lib/librte_eal/common/include/arch/arm/rte_cycles_32.h |  4 ++--
 4 files changed, 9 insertions(+), 12 deletions(-)

-- 
2.17.1



Re: [dpdk-dev] [PATCH] net/i40e: fix tx queue setup after stop queue

2018-07-25 Thread Kevin Traynor
On 07/10/2018 11:37 AM, Shaopeng He wrote:
> Currently, i40e_dev_tx_queue_setup_runtime checks simple tx and treats
> mbuf fast free offloading as No-simple, which is classified as simple tx
> in i40e_set_tx_function_flag. This inconsistent behavior causes tx queue
> setup fail after queue was stopped. This patch fixes this bug.
> 
> Fixes: 399421100e08 ("net/i40e: fix missing mbuf fast free offload")

Is it missing Cc: sta...@dpdk.org tag for 18.05 stable branch?

> 
> Signed-off-by: Shaopeng He 
> ---
>  drivers/net/i40e/i40e_rxtx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 6032d5541..2bbb82fc3 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -2087,7 +2087,7 @@ i40e_dev_tx_queue_setup_runtime(struct rte_eth_dev *dev,
>   }
>   /* check simple tx conflict */
>   if (ad->tx_simple_allowed) {
> - if (txq->offloads != 0 ||
> + if ((txq->offloads & ~DEV_TX_OFFLOAD_MBUF_FAST_FREE) != 0 ||
>   txq->tx_rs_thresh < RTE_PMD_I40E_TX_MAX_BURST) {
>   PMD_DRV_LOG(ERR, "No-simple tx is required.");
>   return -EINVAL;
> 



[dpdk-dev] [PATCH 2/4] bnx2x: remove profanity

2018-07-25 Thread Stephen Hemminger
No need for profanity in comments.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/bnx2x/elink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
index 34a29373af3b..08fe817720a1 100644
--- a/drivers/net/bnx2x/elink.c
+++ b/drivers/net/bnx2x/elink.c
@@ -3993,11 +3993,11 @@ static elink_status_t elink_get_mod_abs_int_cfg(struct 
bnx2x_softc *sc,
   PORT_HW_CFG_E3_MOD_ABS_MASK) >>
PORT_HW_CFG_E3_MOD_ABS_SHIFT;
 
-   /* Should not happen. This function called upon interrupt
+   /*
+* Should not happen. This function called upon interrupt
 * triggered by GPIO ( since EPIO can only generate interrupts
 * to MCP).
 * So if this function was called and none of the GPIOs was set,
-* it means the shit hit the fan.
 */
if ((cfg_pin < PIN_CFG_GPIO0_P0) ||
(cfg_pin > PIN_CFG_GPIO3_P1)) {
-- 
2.17.1



[dpdk-dev] [PATCH 1/4] arm: remove profanity in comment

2018-07-25 Thread Stephen Hemminger
Update comment to describe the problem better without
risk of being offensive.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/common/include/arch/arm/rte_cycles_32.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h 
b/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
index c4f974feb3da..859b09748c56 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
@@ -29,8 +29,8 @@ extern "C" {
 #ifndef RTE_ARM_EAL_RDTSC_USE_PMU
 
 /**
- * This call is easily portable to any ARM architecture, however,
- * it may be damn slow and inprecise for some tasks.
+ * This call is easily portable to any architecture, however,
+ * it may require a system call and inprecise for some tasks.
  */
 static inline uint64_t
 __rte_rdtsc_syscall(void)
-- 
2.17.1



[dpdk-dev] [PATCH 3/4] eal: don't crash if alarm set fails

2018-07-25 Thread Stephen Hemminger
There is no need to call rte_exit and crash the application here;
better to let the application handle the error itself.

Remove the gratuitous profanity which would be visible if
the rte_exit was still there.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/common/eal_common_proc.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_proc.c 
b/lib/librte_eal/common/eal_common_proc.c
index 9fcb9121908d..07b7579c565a 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -841,14 +841,12 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
 
param->user_reply.nb_sent++;
 
-   if (rte_eal_alarm_set(ts->tv_sec * 100 + ts->tv_nsec / 1000,
- async_reply_handle, pending_req) < 0) {
+   ret = rte_eal_alarm_set(ts->tv_sec * 100 + ts->tv_nsec / 1000,
+   async_reply_handle, pending_req);
+   if (ret < 0)
RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
dst, req->name);
-   rte_panic("Fix the above shit to properly free all memory\n");
-   }
-
-   return 0;
+   return ret;
 fail:
free(pending_req);
free(reply_msg);
-- 
2.17.1



[dpdk-dev] [PATCH 4/4] ixgbe: remove mild profanity

2018-07-25 Thread Stephen Hemminger
At the tail end of comment about barriers (I feel your pain);
remove mild profanity.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 354181664202..9e10e15cd34f 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2057,8 +2057,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf 
**rx_pkts, uint16_t nb_pkts,
 * of the ixgbe PMD.
 *
 * TODO:
-*- Get rid of "volatile" crap and let the compiler do its
-*  job.
+*- Get rid of "volatile"  and let the compiler do its job.
 *- Use the proper memory barrier (rte_rmb()) to ensure the
 *  memory ordering below.
 */
-- 
2.17.1



Re: [dpdk-dev] [PATCH v2 00/15] enic PMD fixes and performance improvements

2018-07-25 Thread Kevin Traynor
On 06/29/2018 10:29 AM, John Daley wrote:
> Updated a few commits in the patchset per suggestions by Ferrus Yigit.
> thanks,
> John
> 
> Hyong Youb Kim (12):
>   net/enic: fix receive packet types
>   net/enic: update the UDP RSS detection mechanism
>   net/enic: do not overwrite admin Tx queue limit
>   net/enic: initialize RQ fetch index before enabling RQ
>   net/enic: report ring limits and preferred default values
>   net/enic: add devarg to specify ingress VLAN rewrite mode
>   net/enic: add handlers to add/delete vxlan port number
>   net/enic: use mbuf pointer array for inflight Tx packets
>   net/enic: support mbuf fast free offload
>   net/enic: reduce Tx completion updates
>   net/enic: add the simple version of Tx handler
>   net/enic: check maximum packet size in Tx prepare handler
> 
> John Daley (3):
>   net/enic: add simple Rx handler
>   net/enic: cap Rx packet processing to end of desc ring
>   doc: update release notes with new enic features
> 

Hi John, seems like many of these would be candidates for stable branches?

>  doc/guides/nics/enic.rst   |  15 +-
>  doc/guides/nics/features/enic.ini  |   1 +
>  doc/guides/rel_notes/release_18_08.rst |   8 +
>  drivers/net/enic/base/cq_desc.h|   1 +
>  drivers/net/enic/base/vnic_dev.c   |  16 ++
>  drivers/net/enic/base/vnic_dev.h   |   4 +
>  drivers/net/enic/base/vnic_devcmd.h|  23 ++-
>  drivers/net/enic/base/vnic_enet.h  |   5 +-
>  drivers/net/enic/base/vnic_nic.h   |   4 +-
>  drivers/net/enic/base/vnic_rq.h|   2 +
>  drivers/net/enic/base/vnic_wq.c|   9 +-
>  drivers/net/enic/base/vnic_wq.h|  12 +-
>  drivers/net/enic/enic.h|  12 ++
>  drivers/net/enic/enic_compat.h |   5 +
>  drivers/net/enic/enic_ethdev.c | 168 +++--
>  drivers/net/enic/enic_main.c   | 125 ++---
>  drivers/net/enic/enic_res.c|  13 +-
>  drivers/net/enic/enic_res.h|  16 ++
>  drivers/net/enic/enic_rxtx.c   | 333 
> +
>  19 files changed, 668 insertions(+), 104 deletions(-)
> 



[dpdk-dev] deprecation of rte_pci_ioport_unmap()

2018-07-25 Thread Kevin Wilson
Hi dpdk-dev,
Shouldn't  rte_pci_ioport_unmap() be deprecated ?
No one calls this methods, still I did not find deprecation notice anywhere.

Regards,
Kevin


  1   2   >