[dpdk-dev] [PATCH v3 6/6] mk: prevent overlinking in applications

2016-06-11 Thread Thomas Monjalon
Hi Ferruh,

2016-06-10 19:32, Ferruh Yigit:
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),)
>  LDSCRIPT = $(RTE_LDSCRIPT)
>  endif
>  
> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> +# Workaround to eal <-> mempool cyclic dependency
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)+= -lrte_mempool
> +endif
> +
> +# Link only the libraries used in the application
> +_LDLIBS-y += --as-needed

I think we do not need this workaround.
The dependency of EAL logs on mempool is now removed.
We only have the dependency of EAL ivshmem on librte_ivshmem header
(which needs mempool and rings headers).



[dpdk-dev] [PATCH] ip_pipeline: fix false cacheline sharing among threads

2016-06-11 Thread Jasvinder Singh
In ip_pipeline app, the structure app_thread_data needs to be aligned to
the cache line boundary as threads on different cpu cores are accessing
fields of the app->thread_data and having this structure not aligned on
cacheline boundary leads to false cacheline sharing.

Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
 examples/ip_pipeline/app.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h
index 848244a..c51fc7f 100644
--- a/examples/ip_pipeline/app.h
+++ b/examples/ip_pipeline/app.h
@@ -300,7 +300,7 @@ struct app_thread_data {
uint64_t headroom_time;
uint64_t headroom_cycles;
double headroom_ratio;
-};
+}__rte_cache_aligned;

 #ifndef APP_MAX_LINKS
 #define APP_MAX_LINKS16
-- 
2.5.5



[dpdk-dev] [PATCH v4 1/2] enic: fix seg fault when releasing queues

2016-06-11 Thread John Daley
If device configuration failed due to a lack of resources, such as
if more queues are requested than are available, the queue release
functions are called with NULL pointers which were being dereferenced.

Skip releasing queues if they are NULL pointers.

Fixes: fefed3d1e62c ("enic: new driver")
Signed-off-by: John Daley 
---

v4: fix check for NULL before pointer is set

 drivers/net/enic/enic_main.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 996f999..738792e 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -426,9 +426,14 @@ int enic_alloc_intr_resources(struct enic *enic)

 void enic_free_rq(void *rxq)
 {
-   struct vnic_rq *rq = (struct vnic_rq *)rxq;
-   struct enic *enic = vnic_dev_priv(rq->vdev);
+   struct vnic_rq *rq;
+   struct enic *enic;

+   if (rxq == NULL)
+   return;
+
+   rq = (struct vnic_rq *)rxq;
+   enic = vnic_dev_priv(rq->vdev);
enic_rxmbuf_queue_release(enic, rq);
rte_free(rq->mbuf_ring);
rq->mbuf_ring = NULL;
@@ -514,9 +519,14 @@ err_exit:

 void enic_free_wq(void *txq)
 {
-   struct vnic_wq *wq = (struct vnic_wq *)txq;
-   struct enic *enic = vnic_dev_priv(wq->vdev);
+   struct vnic_wq *wq;
+   struct enic *enic;
+
+   if (txq == NULL)
+   return;

+   wq = (struct vnic_wq *)txq;
+   enic = vnic_dev_priv(wq->vdev);
rte_memzone_free(wq->cqmsg_rz);
vnic_wq_free(wq);
vnic_cq_free(&enic->cq[enic->rq_count + wq->index]);
-- 
2.7.0



[dpdk-dev] [PATCH v4 2/2] enic: improve out of resources error handling

2016-06-11 Thread John Daley
If configuration fails due to lack of resources, be more specific
about which resources are lacking - work queues, read queues or
completion queues. Return -EINVAL instead of -1 if more queeues
are requested than are available.

Fixes: fefed3d1e62c ("enic: new driver")
Signed-off-by: John Daley 
---

v4: only modify wq/rq/cq counts on success, return -EINVAL on error.

 drivers/net/enic/enic_main.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 738792e..32ecdae 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -826,22 +826,32 @@ static void enic_dev_deinit(struct enic *enic)
 int enic_set_vnic_res(struct enic *enic)
 {
struct rte_eth_dev *eth_dev = enic->rte_dev;
+   int rc = 0;

-   if ((enic->rq_count < eth_dev->data->nb_rx_queues) ||
-   (enic->wq_count < eth_dev->data->nb_tx_queues)) {
-   dev_err(dev, "Not enough resources configured, aborting\n");
-   return -1;
+   if (enic->rq_count < eth_dev->data->nb_rx_queues) {
+   dev_err(dev, "Not enough Receive queues. Requested:%u, 
Configured:%u\n",
+   eth_dev->data->nb_rx_queues, enic->rq_count);
+   rc = -EINVAL;
+   }
+   if (enic->wq_count < eth_dev->data->nb_tx_queues) {
+   dev_err(dev, "Not enough Transmit queues. Requested:%u, 
Configured:%u\n",
+   eth_dev->data->nb_tx_queues, enic->wq_count);
+   rc = -EINVAL;
}

-   enic->rq_count = eth_dev->data->nb_rx_queues;
-   enic->wq_count = eth_dev->data->nb_tx_queues;
if (enic->cq_count < (enic->rq_count + enic->wq_count)) {
-   dev_err(dev, "Not enough resources configured, aborting\n");
-   return -1;
+   dev_err(dev, "Not enough Completion queues. Required:%u, 
Configured:%u\n",
+   enic->rq_count + enic->wq_count, enic->cq_count);
+   rc = -EINVAL;
}

-   enic->cq_count = enic->rq_count + enic->wq_count;
-   return 0;
+   if (rc == 0) {
+   enic->rq_count = eth_dev->data->nb_rx_queues;
+   enic->wq_count = eth_dev->data->nb_tx_queues;
+   enic->cq_count = enic->rq_count + enic->wq_count;
+   }
+
+   return rc;
 }

 static int enic_dev_init(struct enic *enic)
-- 
2.7.0