DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
@ 2019-03-26 12:18 Hemant Agrawal
  2019-03-26 12:18 ` Hemant Agrawal
                   ` (6 more replies)
  0 siblings, 7 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile               |  1 -
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..3b6269a8f 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -8,7 +8,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_dpaa2_qdma.a
 
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
@ 2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile               |  1 -
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..3b6269a8f 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -8,7 +8,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_dpaa2_qdma.a
 
-CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
  2019-03-26 12:18 ` Hemant Agrawal
@ 2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18   ` Hemant Agrawal
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..a3f0f7fdd 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-03-26 12:18   ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..a3f0f7fdd 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
  2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18   ` Hemant Agrawal
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp " Hemant Agrawal
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 309 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 167 insertions(+), 148 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a3f0f7fdd..679bf66e9 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <rte_eal.h>
 #include <rte_fslmc.h>
@@ -13,6 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +398,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +433,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +441,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +533,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +541,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +550,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +563,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-03-26 12:18   ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 309 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 167 insertions(+), 148 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a3f0f7fdd..679bf66e9 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <rte_eal.h>
 #include <rte_fslmc.h>
@@ -13,6 +15,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +398,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +433,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +441,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +533,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +541,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +550,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +563,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp mode support
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                   ` (2 preceding siblings ...)
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18   ` Hemant Agrawal
  2019-03-29 13:53   ` Thomas Monjalon
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI addresss
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 3b6269a8f..a8e7643fc 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -25,7 +25,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 679bf66e9..7c547d55f 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -21,13 +21,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -347,14 +350,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -370,10 +388,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -398,31 +442,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -433,7 +503,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -441,6 +511,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -448,73 +520,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -522,16 +621,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -541,77 +642,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -666,9 +765,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -745,6 +844,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -941,6 +1069,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp mode support
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-03-26 12:18   ` Hemant Agrawal
  2019-03-29 13:53   ` Thomas Monjalon
  1 sibling, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI addresss
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 3b6269a8f..a8e7643fc 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -25,7 +25,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 679bf66e9..7c547d55f 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -21,13 +21,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -347,14 +350,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -370,10 +388,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -398,31 +442,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -433,7 +503,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -441,6 +511,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -448,73 +520,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -522,16 +621,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -541,77 +642,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -666,9 +765,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -745,6 +844,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -941,6 +1069,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                   ` (3 preceding siblings ...)
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-03-26 12:18 ` Hemant Agrawal
  2019-03-26 12:18   ` Hemant Agrawal
  2019-03-29 13:53 ` [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Thomas Monjalon
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
  6 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 7c547d55f..215396933 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -378,8 +378,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -557,8 +555,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -632,8 +628,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -803,8 +797,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-03-26 12:18   ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-03-26 12:18 UTC (permalink / raw)
  To: dev; +Cc: Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 7c547d55f..215396933 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -378,8 +378,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -557,8 +555,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -632,8 +628,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -803,8 +797,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                   ` (4 preceding siblings ...)
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-03-29 13:53 ` Thomas Monjalon
  2019-03-29 13:53   ` Thomas Monjalon
  2019-04-01 14:14   ` Hemant Agrawal
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
  6 siblings, 2 replies; 52+ messages in thread
From: Thomas Monjalon @ 2019-03-29 13:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Shreyansh Jain

26/03/2019 13:18, Hemant Agrawal:
> These APIs has been in the DPDK for few release now.
> This patch removes the experimental tags for the APIs.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> -CFLAGS += -DALLOW_EXPERIMENTAL_API

You cannot remove this if you still use experimental APIs from other libraries.
Have you seen the error reported by the CI?
	http://mails.dpdk.org/archives/test-report/2019-March/078034.html

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-03-29 13:53 ` [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Thomas Monjalon
@ 2019-03-29 13:53   ` Thomas Monjalon
  2019-04-01 14:14   ` Hemant Agrawal
  1 sibling, 0 replies; 52+ messages in thread
From: Thomas Monjalon @ 2019-03-29 13:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Shreyansh Jain

26/03/2019 13:18, Hemant Agrawal:
> These APIs has been in the DPDK for few release now.
> This patch removes the experimental tags for the APIs.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> -CFLAGS += -DALLOW_EXPERIMENTAL_API

You cannot remove this if you still use experimental APIs from other libraries.
Have you seen the error reported by the CI?
	http://mails.dpdk.org/archives/test-report/2019-March/078034.html




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp mode support
  2019-03-26 12:18 ` [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp " Hemant Agrawal
  2019-03-26 12:18   ` Hemant Agrawal
@ 2019-03-29 13:53   ` Thomas Monjalon
  2019-03-29 13:53     ` Thomas Monjalon
  1 sibling, 1 reply; 52+ messages in thread
From: Thomas Monjalon @ 2019-03-29 13:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Shreyansh Jain, M.h. Lian, Sachin Saxena

26/03/2019 13:18, Hemant Agrawal:
> Add support for route by port mode. The route by port
> feature in HW helps in translating the PCI addresss
> of connected device.
> 
> Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>

checkpatch complains about the mismatch between author and SoB.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp mode support
  2019-03-29 13:53   ` Thomas Monjalon
@ 2019-03-29 13:53     ` Thomas Monjalon
  0 siblings, 0 replies; 52+ messages in thread
From: Thomas Monjalon @ 2019-03-29 13:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Shreyansh Jain, M.h. Lian, Sachin Saxena

26/03/2019 13:18, Hemant Agrawal:
> Add support for route by port mode. The route by port
> feature in HW helps in translating the PCI addresss
> of connected device.
> 
> Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>

checkpatch complains about the mismatch between author and SoB.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-03-29 13:53 ` [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Thomas Monjalon
  2019-03-29 13:53   ` Thomas Monjalon
@ 2019-04-01 14:14   ` Hemant Agrawal
  2019-04-01 14:14     ` Hemant Agrawal
  1 sibling, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-01 14:14 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Shreyansh Jain


On 29-Mar-19 7:23 PM, Thomas Monjalon wrote:
> 26/03/2019 13:18, Hemant Agrawal:
>> These APIs has been in the DPDK for few release now.
>> This patch removes the experimental tags for the APIs.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> -CFLAGS += -DALLOW_EXPERIMENTAL_API
> You cannot remove this if you still use experimental APIs from other libraries.
> Have you seen the error reported by the CI?
> 	http://mails.dpdk.org/archives/test-report/2019-March/078034.html
>
I missed it. Yes, it can not be done unless experimental flags are 
removed from these old APIs.


>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-04-01 14:14   ` Hemant Agrawal
@ 2019-04-01 14:14     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-01 14:14 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Shreyansh Jain


On 29-Mar-19 7:23 PM, Thomas Monjalon wrote:
> 26/03/2019 13:18, Hemant Agrawal:
>> These APIs has been in the DPDK for few release now.
>> This patch removes the experimental tags for the APIs.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> -CFLAGS += -DALLOW_EXPERIMENTAL_API
> You cannot remove this if you still use experimental APIs from other libraries.
> Have you seen the error reported by the CI?
> 	http://mails.dpdk.org/archives/test-report/2019-March/078034.html
>
I missed it. Yes, it can not be done unless experimental flags are 
removed from these old APIs.


>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                   ` (5 preceding siblings ...)
  2019-03-29 13:53 ` [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Thomas Monjalon
@ 2019-04-04 11:04 ` Hemant Agrawal
  2019-04-04 11:04   ` Hemant Agrawal
                     ` (8 more replies)
  6 siblings, 9 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

The current value is 10, which is not sufficient for many use-cases.
e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
use-cases. So, making it to 64 to cover various cases.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/common_base | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/common_base b/config/common_base
index a0a9fe0c7..1e55c8076 100644
--- a/config/common_base
+++ b/config/common_base
@@ -709,7 +709,7 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n
 # EXPERIMENTAL: API may change without prior notice
 #
 CONFIG_RTE_LIBRTE_RAWDEV=y
-CONFIG_RTE_RAWDEV_MAX_DEVS=10
+CONFIG_RTE_RAWDEV_MAX_DEVS=64
 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y
 
 #
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

The current value is 10, which is not sufficient for many use-cases.
e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
use-cases. So, making it to 64 to cover various cases.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/common_base | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/common_base b/config/common_base
index a0a9fe0c7..1e55c8076 100644
--- a/config/common_base
+++ b/config/common_base
@@ -709,7 +709,7 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n
 # EXPERIMENTAL: API may change without prior notice
 #
 CONFIG_RTE_LIBRTE_RAWDEV=y
-CONFIG_RTE_RAWDEV_MAX_DEVS=10
+CONFIG_RTE_RAWDEV_MAX_DEVS=64
 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y
 
 #
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
  2019-04-04 11:04   ` Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
                     ` (6 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
  2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
                     ` (5 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..88c11a3d2 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..88c11a3d2 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (2 preceding siblings ...)
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
                     ` (4 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 305 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 164 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 88c11a3d2..a1351e648 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -13,6 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 305 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 164 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 88c11a3d2..a1351e648 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -13,6 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp mode support
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (3 preceding siblings ...)
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI address
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..ee95662f1 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -26,7 +26,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a1351e648..cf1a1aaa6 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -19,13 +19,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -345,14 +348,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -368,10 +386,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -396,31 +440,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -431,7 +501,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -439,6 +509,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -446,73 +518,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -520,16 +619,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -539,77 +640,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -664,9 +763,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -743,6 +842,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -939,6 +1067,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp mode support
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI address
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..ee95662f1 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -26,7 +26,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a1351e648..cf1a1aaa6 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -19,13 +19,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -345,14 +348,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -368,10 +386,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -396,31 +440,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -431,7 +501,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -439,6 +509,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -446,73 +518,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -520,16 +619,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -539,77 +640,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -664,9 +763,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -743,6 +842,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -939,6 +1067,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (4 preceding siblings ...)
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
                     ` (2 subsequent siblings)
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index cf1a1aaa6..38f329a50 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -376,8 +376,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -555,8 +553,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -630,8 +626,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -801,8 +795,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index cf1a1aaa6..38f329a50 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -376,8 +376,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -555,8 +553,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -630,8 +626,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -801,8 +795,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (5 preceding siblings ...)
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-04-04 11:04   ` Hemant Agrawal
  2019-04-04 11:04     ` Hemant Agrawal
  2019-04-04 11:07   ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Richardson, Bruce
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
  8 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

This patch add support for non prefetch mode in Rx functions.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile     |   1 +
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 215 +++++++++++++++++++++++++++-
 drivers/raw/dpaa2_qdma/meson.build  |   2 +-
 3 files changed, 212 insertions(+), 6 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index ee95662f1..450c76e76 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -21,6 +21,7 @@ LDLIBS += -lrte_eal
 LDLIBS += -lrte_mempool
 LDLIBS += -lrte_mempool_dpaa2
 LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_kvargs
 LDLIBS += -lrte_ring
 LDLIBS += -lrte_common_dpaax
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 38f329a50..a41c1e385 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -14,6 +14,7 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
+#include <rte_kvargs.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -23,6 +24,8 @@
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
 
+#define DPAA2_QDMA_NO_PREFETCH "no_prefetch"
+
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
@@ -43,6 +46,14 @@ static struct qdma_virt_queue *qdma_vqs;
 /* QDMA per core data */
 static struct qdma_per_core_info qdma_core_info[RTE_MAX_LCORE];
 
+typedef int (dpdmai_dev_dequeue_multijob_t)(struct dpaa2_dpdmai_dev *dpdmai_dev,
+					    uint16_t rxq_id,
+					    uint16_t *vq_id,
+					    struct rte_qdma_job **job,
+					    uint16_t nb_jobs);
+
+dpdmai_dev_dequeue_multijob_t *dpdmai_dev_dequeue_multijob;
+
 static struct qdma_hw_queue *
 alloc_hw_queue(uint32_t lcore_id)
 {
@@ -608,12 +619,156 @@ static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
 	return vqid;
 }
 
+/* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t rxq_id,
-		   uint16_t *vq_id,
-		   struct rte_qdma_job **job,
-		   uint16_t nb_jobs)
+dpdmai_dev_dequeue_multijob_prefetch(
+			struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t rxq_id,
+			uint16_t *vq_id,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct dpaa2_queue *rxq;
+	struct qbman_result *dq_storage, *dq_storage1 = NULL;
+	struct qbman_pull_desc pulldesc;
+	struct qbman_swp *swp;
+	struct queue_storage_info_t *q_storage;
+	uint32_t fqid;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, pull_size;
+
+	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_QDMA_ERR("Failure in affining portal");
+			return 0;
+		}
+	}
+	swp = DPAA2_PER_LCORE_PORTAL;
+
+	pull_size = (nb_jobs > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_jobs;
+	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
+	fqid = rxq->fqid;
+	q_storage = rxq->q_storage;
+
+	if (unlikely(!q_storage->active_dqs)) {
+		q_storage->toggle = 0;
+		dq_storage = q_storage->dq_storage[q_storage->toggle];
+		q_storage->last_num_pkts = pull_size;
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_numframes(&pulldesc,
+					      q_storage->last_num_pkts);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+				(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+		if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+			while (!qbman_check_command_complete(
+			       get_swp_active_dqs(
+			       DPAA2_PER_LCORE_DPIO->index)))
+				;
+			clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+		}
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN(
+					"VDQ command not issued.QBMAN busy\n");
+					/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
+		q_storage->active_dqs = dq_storage;
+		q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+		set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index,
+				   dq_storage);
+	}
+
+	dq_storage = q_storage->active_dqs;
+	rte_prefetch0((void *)(size_t)(dq_storage));
+	rte_prefetch0((void *)(size_t)(dq_storage + 1));
+
+	/* Prepare next pull descriptor. This will give space for the
+	 * prefething done on DQRR entries
+	 */
+	q_storage->toggle ^= 1;
+	dq_storage1 = q_storage->dq_storage[q_storage->toggle];
+	qbman_pull_desc_clear(&pulldesc);
+	qbman_pull_desc_set_numframes(&pulldesc, pull_size);
+	qbman_pull_desc_set_fq(&pulldesc, fqid);
+	qbman_pull_desc_set_storage(&pulldesc, dq_storage1,
+		(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1);
+
+	/* Check if the previous issued command is completed.
+	 * Also seems like the SWP is shared between the Ethernet Driver
+	 * and the SEC driver.
+	 */
+	while (!qbman_check_command_complete(dq_storage))
+		;
+	if (dq_storage == get_swp_active_dqs(q_storage->active_dpio_id))
+		clear_swp_active_dqs(q_storage->active_dpio_id);
+
+	pending = 1;
+
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
+
+		vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+		if (vq_id)
+			vq_id[num_rx] = vqid;
+
+		dq_storage++;
+		num_rx++;
+	} while (pending);
+
+	if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+		while (!qbman_check_command_complete(
+		       get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)))
+			;
+		clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+	}
+	/* issue a volatile dequeue command for next pull */
+	while (1) {
+		if (qbman_swp_pull(swp, &pulldesc)) {
+			DPAA2_QDMA_DP_WARN("VDQ command is not issued."
+					  "QBMAN is busy (2)\n");
+			continue;
+		}
+		break;
+	}
+
+	q_storage->active_dqs = dq_storage1;
+	q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+	set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1);
+
+	return num_rx;
+}
+
+static int
+dpdmai_dev_dequeue_multijob_no_prefetch(
+		struct dpaa2_dpdmai_dev *dpdmai_dev,
+		uint16_t rxq_id,
+		uint16_t *vq_id,
+		struct rte_qdma_job **job,
+		uint16_t nb_jobs)
 {
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
@@ -958,6 +1113,43 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 	return 0;
 }
 
+static int
+check_devargs_handler(__rte_unused const char *key, const char *value,
+		      __rte_unused void *opaque)
+{
+	if (strcmp(value, "1"))
+		return -1;
+
+	return 0;
+}
+
+static int
+dpaa2_get_devargs(struct rte_devargs *devargs, const char *key)
+{
+	struct rte_kvargs *kvlist;
+
+	if (!devargs)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (!kvlist)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, key)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	if (rte_kvargs_process(kvlist, key,
+			       check_devargs_handler, NULL) < 0) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	rte_kvargs_free(kvlist);
+
+	return 1;
+}
+
 static int
 dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 {
@@ -1060,6 +1252,17 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		goto init_err;
 	}
 
+	if (dpaa2_get_devargs(rawdev->device->devargs,
+		DPAA2_QDMA_NO_PREFETCH)) {
+		/* If no prefetch is configured. */
+		dpdmai_dev_dequeue_multijob =
+				dpdmai_dev_dequeue_multijob_no_prefetch;
+		DPAA2_QDMA_INFO("No Prefetch RX Mode enabled");
+	} else {
+		dpdmai_dev_dequeue_multijob =
+			dpdmai_dev_dequeue_multijob_prefetch;
+	}
+
 	if (!dpaa2_coherent_no_alloc_cache) {
 		if (dpaa2_svr_family == SVR_LX2160A) {
 			dpaa2_coherent_no_alloc_cache =
@@ -1139,6 +1342,8 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 };
 
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
+	"no_prefetch=<int> ");
 
 RTE_INIT(dpaa2_qdma_init_log)
 {
diff --git a/drivers/raw/dpaa2_qdma/meson.build b/drivers/raw/dpaa2_qdma/meson.build
index 2a4b69c16..1577946fa 100644
--- a/drivers/raw/dpaa2_qdma/meson.build
+++ b/drivers/raw/dpaa2_qdma/meson.build
@@ -4,7 +4,7 @@
 version = 2
 
 build = dpdk_conf.has('RTE_LIBRTE_DPAA2_MEMPOOL')
-deps += ['rawdev', 'mempool_dpaa2', 'ring']
+deps += ['rawdev', 'mempool_dpaa2', 'ring', 'kvargs']
 sources = files('dpaa2_qdma.c')
 
 allow_experimental_apis = true
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
@ 2019-04-04 11:04     ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:04 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

This patch add support for non prefetch mode in Rx functions.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile     |   1 +
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 215 +++++++++++++++++++++++++++-
 drivers/raw/dpaa2_qdma/meson.build  |   2 +-
 3 files changed, 212 insertions(+), 6 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index ee95662f1..450c76e76 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -21,6 +21,7 @@ LDLIBS += -lrte_eal
 LDLIBS += -lrte_mempool
 LDLIBS += -lrte_mempool_dpaa2
 LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_kvargs
 LDLIBS += -lrte_ring
 LDLIBS += -lrte_common_dpaax
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 38f329a50..a41c1e385 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -14,6 +14,7 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
+#include <rte_kvargs.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -23,6 +24,8 @@
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
 
+#define DPAA2_QDMA_NO_PREFETCH "no_prefetch"
+
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
@@ -43,6 +46,14 @@ static struct qdma_virt_queue *qdma_vqs;
 /* QDMA per core data */
 static struct qdma_per_core_info qdma_core_info[RTE_MAX_LCORE];
 
+typedef int (dpdmai_dev_dequeue_multijob_t)(struct dpaa2_dpdmai_dev *dpdmai_dev,
+					    uint16_t rxq_id,
+					    uint16_t *vq_id,
+					    struct rte_qdma_job **job,
+					    uint16_t nb_jobs);
+
+dpdmai_dev_dequeue_multijob_t *dpdmai_dev_dequeue_multijob;
+
 static struct qdma_hw_queue *
 alloc_hw_queue(uint32_t lcore_id)
 {
@@ -608,12 +619,156 @@ static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
 	return vqid;
 }
 
+/* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t rxq_id,
-		   uint16_t *vq_id,
-		   struct rte_qdma_job **job,
-		   uint16_t nb_jobs)
+dpdmai_dev_dequeue_multijob_prefetch(
+			struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t rxq_id,
+			uint16_t *vq_id,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct dpaa2_queue *rxq;
+	struct qbman_result *dq_storage, *dq_storage1 = NULL;
+	struct qbman_pull_desc pulldesc;
+	struct qbman_swp *swp;
+	struct queue_storage_info_t *q_storage;
+	uint32_t fqid;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, pull_size;
+
+	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_QDMA_ERR("Failure in affining portal");
+			return 0;
+		}
+	}
+	swp = DPAA2_PER_LCORE_PORTAL;
+
+	pull_size = (nb_jobs > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_jobs;
+	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
+	fqid = rxq->fqid;
+	q_storage = rxq->q_storage;
+
+	if (unlikely(!q_storage->active_dqs)) {
+		q_storage->toggle = 0;
+		dq_storage = q_storage->dq_storage[q_storage->toggle];
+		q_storage->last_num_pkts = pull_size;
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_numframes(&pulldesc,
+					      q_storage->last_num_pkts);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+				(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+		if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+			while (!qbman_check_command_complete(
+			       get_swp_active_dqs(
+			       DPAA2_PER_LCORE_DPIO->index)))
+				;
+			clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+		}
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN(
+					"VDQ command not issued.QBMAN busy\n");
+					/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
+		q_storage->active_dqs = dq_storage;
+		q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+		set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index,
+				   dq_storage);
+	}
+
+	dq_storage = q_storage->active_dqs;
+	rte_prefetch0((void *)(size_t)(dq_storage));
+	rte_prefetch0((void *)(size_t)(dq_storage + 1));
+
+	/* Prepare next pull descriptor. This will give space for the
+	 * prefething done on DQRR entries
+	 */
+	q_storage->toggle ^= 1;
+	dq_storage1 = q_storage->dq_storage[q_storage->toggle];
+	qbman_pull_desc_clear(&pulldesc);
+	qbman_pull_desc_set_numframes(&pulldesc, pull_size);
+	qbman_pull_desc_set_fq(&pulldesc, fqid);
+	qbman_pull_desc_set_storage(&pulldesc, dq_storage1,
+		(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1);
+
+	/* Check if the previous issued command is completed.
+	 * Also seems like the SWP is shared between the Ethernet Driver
+	 * and the SEC driver.
+	 */
+	while (!qbman_check_command_complete(dq_storage))
+		;
+	if (dq_storage == get_swp_active_dqs(q_storage->active_dpio_id))
+		clear_swp_active_dqs(q_storage->active_dpio_id);
+
+	pending = 1;
+
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
+
+		vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+		if (vq_id)
+			vq_id[num_rx] = vqid;
+
+		dq_storage++;
+		num_rx++;
+	} while (pending);
+
+	if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+		while (!qbman_check_command_complete(
+		       get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)))
+			;
+		clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+	}
+	/* issue a volatile dequeue command for next pull */
+	while (1) {
+		if (qbman_swp_pull(swp, &pulldesc)) {
+			DPAA2_QDMA_DP_WARN("VDQ command is not issued."
+					  "QBMAN is busy (2)\n");
+			continue;
+		}
+		break;
+	}
+
+	q_storage->active_dqs = dq_storage1;
+	q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+	set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1);
+
+	return num_rx;
+}
+
+static int
+dpdmai_dev_dequeue_multijob_no_prefetch(
+		struct dpaa2_dpdmai_dev *dpdmai_dev,
+		uint16_t rxq_id,
+		uint16_t *vq_id,
+		struct rte_qdma_job **job,
+		uint16_t nb_jobs)
 {
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
@@ -958,6 +1113,43 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 	return 0;
 }
 
+static int
+check_devargs_handler(__rte_unused const char *key, const char *value,
+		      __rte_unused void *opaque)
+{
+	if (strcmp(value, "1"))
+		return -1;
+
+	return 0;
+}
+
+static int
+dpaa2_get_devargs(struct rte_devargs *devargs, const char *key)
+{
+	struct rte_kvargs *kvlist;
+
+	if (!devargs)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (!kvlist)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, key)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	if (rte_kvargs_process(kvlist, key,
+			       check_devargs_handler, NULL) < 0) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	rte_kvargs_free(kvlist);
+
+	return 1;
+}
+
 static int
 dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 {
@@ -1060,6 +1252,17 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		goto init_err;
 	}
 
+	if (dpaa2_get_devargs(rawdev->device->devargs,
+		DPAA2_QDMA_NO_PREFETCH)) {
+		/* If no prefetch is configured. */
+		dpdmai_dev_dequeue_multijob =
+				dpdmai_dev_dequeue_multijob_no_prefetch;
+		DPAA2_QDMA_INFO("No Prefetch RX Mode enabled");
+	} else {
+		dpdmai_dev_dequeue_multijob =
+			dpdmai_dev_dequeue_multijob_prefetch;
+	}
+
 	if (!dpaa2_coherent_no_alloc_cache) {
 		if (dpaa2_svr_family == SVR_LX2160A) {
 			dpaa2_coherent_no_alloc_cache =
@@ -1139,6 +1342,8 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 };
 
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
+	"no_prefetch=<int> ");
 
 RTE_INIT(dpaa2_qdma_init_log)
 {
diff --git a/drivers/raw/dpaa2_qdma/meson.build b/drivers/raw/dpaa2_qdma/meson.build
index 2a4b69c16..1577946fa 100644
--- a/drivers/raw/dpaa2_qdma/meson.build
+++ b/drivers/raw/dpaa2_qdma/meson.build
@@ -4,7 +4,7 @@
 version = 2
 
 build = dpdk_conf.has('RTE_LIBRTE_DPAA2_MEMPOOL')
-deps += ['rawdev', 'mempool_dpaa2', 'ring']
+deps += ['rawdev', 'mempool_dpaa2', 'ring', 'kvargs']
 sources = files('dpaa2_qdma.c')
 
 allow_experimental_apis = true
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (6 preceding siblings ...)
  2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
@ 2019-04-04 11:07   ` Richardson, Bruce
  2019-04-04 11:07     ` Richardson, Bruce
  2019-04-04 11:52     ` Hemant Agrawal
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
  8 siblings, 2 replies; 52+ messages in thread
From: Richardson, Bruce @ 2019-04-04 11:07 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: thomas, Shreyansh Jain



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> Sent: Thursday, April 4, 2019 12:04 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to
> be 64
> 
> The current value is 10, which is not sufficient for many use-cases.
> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some use-
> cases. So, making it to 64 to cover various cases.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  config/common_base | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Need same change in config/rte_config.h for meson build.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:07   ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Richardson, Bruce
@ 2019-04-04 11:07     ` Richardson, Bruce
  2019-04-04 11:52     ` Hemant Agrawal
  1 sibling, 0 replies; 52+ messages in thread
From: Richardson, Bruce @ 2019-04-04 11:07 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: thomas, Shreyansh Jain



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> Sent: Thursday, April 4, 2019 12:04 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Shreyansh Jain <shreyansh.jain@nxp.com>
> Subject: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to
> be 64
> 
> The current value is 10, which is not sufficient for many use-cases.
> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some use-
> cases. So, making it to 64 to cover various cases.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  config/common_base | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Need same change in config/rte_config.h for meson build.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
                     ` (7 preceding siblings ...)
  2019-04-04 11:07   ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Richardson, Bruce
@ 2019-04-04 11:50   ` Hemant Agrawal
  2019-04-04 11:50     ` Hemant Agrawal
                       ` (7 more replies)
  8 siblings, 8 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

The current value is 10, which is not sufficient for many use-cases.
e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
use-cases. So, making it to 64 to cover various cases.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/common_base  | 2 +-
 config/rte_config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/common_base b/config/common_base
index a0a9fe0c7..1e55c8076 100644
--- a/config/common_base
+++ b/config/common_base
@@ -709,7 +709,7 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n
 # EXPERIMENTAL: API may change without prior notice
 #
 CONFIG_RTE_LIBRTE_RAWDEV=y
-CONFIG_RTE_RAWDEV_MAX_DEVS=10
+CONFIG_RTE_RAWDEV_MAX_DEVS=64
 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y
 
 #
diff --git a/config/rte_config.h b/config/rte_config.h
index cda51af47..0bbbe274f 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -82,7 +82,7 @@
 #define RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE 32
 
 /* rawdev defines */
-#define RTE_RAWDEV_MAX_DEVS 10
+#define RTE_RAWDEV_MAX_DEVS 64
 
 /* ip_fragmentation defines */
 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
                       ` (6 subsequent siblings)
  7 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

The current value is 10, which is not sufficient for many use-cases.
e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
use-cases. So, making it to 64 to cover various cases.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 config/common_base  | 2 +-
 config/rte_config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/common_base b/config/common_base
index a0a9fe0c7..1e55c8076 100644
--- a/config/common_base
+++ b/config/common_base
@@ -709,7 +709,7 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n
 # EXPERIMENTAL: API may change without prior notice
 #
 CONFIG_RTE_LIBRTE_RAWDEV=y
-CONFIG_RTE_RAWDEV_MAX_DEVS=10
+CONFIG_RTE_RAWDEV_MAX_DEVS=64
 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y
 
 #
diff --git a/config/rte_config.h b/config/rte_config.h
index cda51af47..0bbbe274f 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -82,7 +82,7 @@
 #define RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE 32
 
 /* rawdev defines */
-#define RTE_RAWDEV_MAX_DEVS 10
+#define RTE_RAWDEV_MAX_DEVS 64
 
 /* ip_fragmentation defines */
 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
  2019-04-04 11:50     ` Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
                       ` (5 subsequent siblings)
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

These APIs has been in the DPDK for few release now.
This patch removes the experimental tags for the APIs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c           | 20 ++++++-------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h   | 28 +++++++++----------
 .../dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map |  2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 60621eb85..afa5e5a3d 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -143,7 +143,7 @@ put_hw_queue(struct qdma_hw_queue *queue)
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_init(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -153,7 +153,7 @@ rte_qdma_init(void)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -161,7 +161,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr)
 	qdma_attr->num_hw_queues = qdma_dev.num_hw_queues;
 }
 
-int __rte_experimental
+int
 rte_qdma_reset(void)
 {
 	struct qdma_hw_queue *queue;
@@ -215,7 +215,7 @@ rte_qdma_reset(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
@@ -274,7 +274,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_start(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -284,7 +284,7 @@ rte_qdma_start(void)
 	return 0;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 {
 	char ring_name[32];
@@ -677,7 +677,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id)
 	return job;
 }
 
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_status)
 {
@@ -695,7 +695,7 @@ rte_qdma_vq_stats(uint16_t vq_id,
 	}
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
@@ -724,7 +724,7 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_stop(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
@@ -732,7 +732,7 @@ rte_qdma_stop(void)
 	qdma_dev.state = 0;
 }
 
-void __rte_experimental
+void
 rte_qdma_destroy(void)
 {
 	DPAA2_QDMA_FUNC_TRACE();
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index 17fffcb74..c9697b4d7 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #ifndef __RTE_PMD_DPAA2_QDMA_H__
@@ -113,7 +113,7 @@ struct rte_qdma_job {
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_init(void);
 
 /**
@@ -122,7 +122,7 @@ rte_qdma_init(void);
  * @param qdma_attr
  *   QDMA attributes providing total number of hw queues etc.
  */
-void __rte_experimental
+void
 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
 
 /**
@@ -134,7 +134,7 @@ rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_reset(void);
 
 /**
@@ -144,7 +144,7 @@ rte_qdma_reset(void);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_configure(struct rte_qdma_config *qdma_config);
 
 /**
@@ -154,7 +154,7 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config);
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_start(void);
 
 /**
@@ -171,7 +171,7 @@ rte_qdma_start(void);
  *   - >= 0: Virtual queue ID.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
 /**
@@ -190,7 +190,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -209,7 +209,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
  *   - >=0: Number of jobs successfully submitted
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job);
 
@@ -227,7 +227,7 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  * @returns
  *   Number of jobs actually dequeued.
  */
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs);
@@ -252,7 +252,7 @@ rte_qdma_vq_dequeue(uint16_t vq_id);
  * @param vq_stats
  *   VQ statistics structure which will be filled in by the driver.
  */
-void __rte_experimental
+void
 rte_qdma_vq_stats(uint16_t vq_id,
 		  struct rte_qdma_vq_stats *vq_stats);
 
@@ -268,19 +268,19 @@ rte_qdma_vq_stats(uint16_t vq_id,
  *   - 0: Success.
  *   - <0: Error code.
  */
-int __rte_experimental
+int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
 /**
  * Stop QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_stop(void);
 
 /**
  * Destroy the QDMA device.
  */
-void __rte_experimental
+void
 rte_qdma_destroy(void);
 
 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
index fe42a2276..d16a136fc 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma_version.map
@@ -1,4 +1,4 @@
-EXPERIMENTAL {
+DPDK_19.05 {
 	global:
 
 	rte_qdma_attr_get;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
  2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
                       ` (4 subsequent siblings)
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..88c11a3d2 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Fixes: c22fab9a6c34 ("raw/dpaa2_qdma: support configuration APIs")
Cc: nipun.gupta@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index afa5e5a3d..88c11a3d2 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <string.h>
@@ -219,6 +219,7 @@ int
 rte_qdma_configure(struct rte_qdma_config *qdma_config)
 {
 	int ret;
+	char fle_pool_name[32]; /* RTE_MEMZONE_NAMESIZE = 32 */
 
 	DPAA2_QDMA_FUNC_TRACE();
 
@@ -258,8 +259,12 @@ rte_qdma_configure(struct rte_qdma_config *qdma_config)
 	}
 	qdma_dev.max_vqs = qdma_config->max_vqs;
 
-	/* Allocate FLE pool */
-	qdma_dev.fle_pool = rte_mempool_create("qdma_fle_pool",
+	/* Allocate FLE pool; just append PID so that in case of
+	 * multiprocess, the pool's don't collide.
+	 */
+	snprintf(fle_pool_name, sizeof(fle_pool_name), "qdma_fle_pool%u",
+		 getpid());
+	qdma_dev.fle_pool = rte_mempool_create(fle_pool_name,
 			qdma_config->fle_pool_count, QDMA_FLE_POOL_SIZE,
 			QDMA_FLE_CACHE_SIZE(qdma_config->fle_pool_count), 0,
 			NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0);
@@ -303,6 +308,7 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 	/* Return in case no VQ is free */
 	if (i == qdma_dev.max_vqs) {
 		rte_spinlock_unlock(&qdma_dev.lock);
+		DPAA2_QDMA_ERR("Unable to get lock on QDMA device");
 		return -ENODEV;
 	}
 
@@ -793,9 +799,6 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Remove HW queues from global list */
 	remove_hw_queues_from_list(dpdmai_dev);
 
@@ -834,10 +837,6 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 
 	DPAA2_QDMA_FUNC_TRACE();
 
-	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return 0;
-
 	/* Open DPDMAI device */
 	dpdmai_dev->dpdmai_id = dpdmai_id;
 	dpdmai_dev->dpdmai.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX];
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
                       ` (2 preceding siblings ...)
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
                       ` (3 subsequent siblings)
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 305 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 164 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 88c11a3d2..a1351e648 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -13,6 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Yi Liu

This patch adds support the batch processing for the qdma jobs

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Yi Liu <yi.liu@nxp.com>
---
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 305 ++++++++++----------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |   6 +-
 2 files changed, 164 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 88c11a3d2..a1351e648 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -13,6 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_mempool.h>
+#include <rte_prefetch.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-static int
-dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t txq_id,
-		   uint16_t vq_id,
-		   struct rte_qdma_job *job)
+int
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd;
+	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
 	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
+	uint32_t num_to_send = 0;
+	uint16_t num_tx = 0;
+	uint16_t num_txed = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -1;
+	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[txq_id]);
+	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
-	/*
-	 * Get an FLE/SDD from FLE pool.
-	 * Note: IO metadata is before the FLE and SDD memory.
-	 */
-	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
-	if (ret) {
-		DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE");
-		return ret;
-	}
-
-	/* Set the metadata */
-	io_meta->cnxt = (size_t)job;
-	io_meta->id = vq_id;
-
-	fle = (struct qbman_fle *)(io_meta + 1);
-
-	/* populate Frame descriptor */
-	memset(&fd, 0, sizeof(struct qbman_fd));
-	DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle));
-	DPAA2_SET_FD_COMPOUND_FMT(&fd);
-	DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX);
+	while (nb_jobs > 0) {
+		uint32_t loop;
+
+		num_to_send = (nb_jobs > dpaa2_eqcr_size) ?
+			dpaa2_eqcr_size : nb_jobs;
+
+		for (loop = 0; loop < num_to_send; loop++) {
+			/*
+			 * Get an FLE/SDD from FLE pool.
+			 * Note: IO metadata is before the FLE and SDD memory.
+			 */
+			ret = rte_mempool_get(qdma_dev.fle_pool,
+					(void **)(&io_meta));
+			if (ret) {
+				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
+				return ret;
+			}
 
-	/* Populate FLE */
-	memset(fle, 0, QDMA_FLE_POOL_SIZE);
-	dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags);
+			/* Set the metadata */
+			io_meta->cnxt = (size_t)job[num_tx];
+			io_meta->id = vq_id;
 
-	/* Enqueue the packet to the QBMAN */
-	do {
-		ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1);
-		if (ret < 0 && ret != -EBUSY)
-			DPAA2_QDMA_ERR("Transmit failure with err: %d", ret);
-	} while (ret == -EBUSY);
+			fle = (struct qbman_fle *)(io_meta + 1);
 
-	DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet");
+			/* populate Frame descriptor */
+			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
+			DPAA2_SET_FD_ADDR(&fd_arr[loop],
+					DPAA2_VADDR_TO_IOVA(fle));
+			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
+			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
 
-	return ret;
-}
+			/* Populate FLE */
+			memset(fle, 0, QDMA_FLE_POOL_SIZE);
+			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
+						job[num_tx]->dest,
+						job[num_tx]->len,
+						job[num_tx]->flags);
 
-int __rte_experimental
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
-{
-	int i, ret;
+			num_tx++;
+		}
 
-	DPAA2_QDMA_FUNC_TRACE();
+		/* Enqueue the packet to the QBMAN */
+		uint32_t enqueue_loop = 0;
+		while (enqueue_loop < num_to_send) {
+			enqueue_loop += qbman_swp_enqueue_multiple(swp,
+						&eqdesc,
+						&fd_arr[enqueue_loop],
+						NULL,
+						num_to_send - enqueue_loop);
+		}
 
-	for (i = 0; i < nb_jobs; i++) {
-		ret = rte_qdma_vq_enqueue(vq_id, job[i]);
-		if (ret < 0)
-			break;
+		num_txed += num_to_send;
+		nb_jobs -= num_to_send;
 	}
-
-	return i;
+	qdma_vq->num_enqueues += num_txed;
+	return num_txed;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_enqueue(uint16_t vq_id,
 		    struct rte_qdma_job *job)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -EINVAL;
-	}
-
-	ret = dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job);
+	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	qdma_vq->num_enqueues++;
-
 	return 1;
 }
 
 /* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
+dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
 		   uint16_t *vq_id,
-		   struct rte_qdma_job **job)
+		   struct rte_qdma_job **job,
+		   uint16_t nb_jobs)
 {
 	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
@@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
-
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
 	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
@@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	qbman_pull_desc_set_fq(&pulldesc, fqid);
 	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
 		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	qbman_pull_desc_set_numframes(&pulldesc, 1);
+	if (nb_jobs > dpaa2_dqrr_size)
+		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
+	else
+		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
 
 	while (1) {
 		if (qbman_swp_pull(swp, &pulldesc)) {
@@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		break;
 	}
 
-	/* Check if previous issued command is completed. */
+	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+	/* Check if the previous issued command is completed. */
 	while (!qbman_check_command_complete(dq_storage))
 		;
-	/* Loop until dq_storage is updated with new token by QBMAN */
-	while (!qbman_check_new_result(dq_storage))
-		;
 
-	/* Check for valid frame. */
-	status = qbman_result_DQ_flags(dq_storage);
-	if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) {
-		DPAA2_QDMA_DP_DEBUG("No frame is delivered");
-		return 0;
-	}
+	int num_pulled = 0;
+	int pending = 1;
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
 
-	/* Get the FD */
-	fd = qbman_result_DQ_fd(dq_storage);
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status &
+				QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
 
-	/*
-	 * Fetch metadata from FLE. job and vq_id were set
-	 * in metadata in the enqueue operation.
-	 */
-	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-	io_meta = (struct qdma_io_meta *)(fle) - 1;
-	if (vq_id)
-		*vq_id = io_meta->id;
+		/*
+		 * Fetch metadata from FLE. job and vq_id were set
+		 * in metadata in the enqueue operation.
+		 */
+		fle = (struct qbman_fle *)
+				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+		io_meta = (struct qdma_io_meta *)(fle) - 1;
+		if (vq_id)
+			vq_id[num_pulled] = io_meta->id;
 
-	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-	(*job)->status = DPAA2_GET_FD_ERR(fd);
+		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
 
-	/* Free FLE to the pool */
-	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+		/* Free FLE to the pool */
+		rte_mempool_put(qdma_dev.fle_pool, io_meta);
 
-	DPAA2_QDMA_DP_DEBUG("packet received");
+		dq_storage++;
+		num_pulled++;
+	} while (pending && (num_pulled <= dpaa2_dqrr_size));
 
-	return 1;
+	return num_pulled;
 }
 
-int __rte_experimental
+int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 			  struct rte_qdma_job **job,
 			  uint16_t nb_jobs)
-{
-	int i;
-
-	DPAA2_QDMA_FUNC_TRACE();
-
-	for (i = 0; i < nb_jobs; i++) {
-		job[i] = rte_qdma_vq_dequeue(vq_id);
-		if (!job[i])
-			break;
-	}
-
-	return i;
-}
-
-struct rte_qdma_job * __rte_experimental
-rte_qdma_vq_dequeue(uint16_t vq_id)
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
-	struct rte_qdma_job *job = NULL;
 	struct qdma_virt_queue *temp_qdma_vq;
-	int dequeue_budget = QDMA_DEQUEUE_BUDGET;
-	int ring_count, ret, i;
-	uint16_t temp_vq_id;
-
-	DPAA2_QDMA_FUNC_TRACE();
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
+	int ring_count, ret = 0, i;
 
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != (unsigned int)(qdma_vq->lcore_id)) {
-		DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core",
+		DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core",
 				vq_id);
-		return NULL;
+		return -1;
 	}
 
 	/* Only dequeue when there are pending jobs on VQ */
 	if (qdma_vq->num_enqueues == qdma_vq->num_dequeues)
-		return NULL;
+		return 0;
+
+	if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs))
+		nb_jobs = (qdma_vq->num_enqueues -  qdma_vq->num_dequeues);
 
 	if (qdma_vq->exclusive_hw_queue) {
 		/* In case of exclusive queue directly fetch from HW queue */
-		ret = dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id,
-					 NULL, &job);
+		ret = dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id,
+					 NULL, job, nb_jobs);
 		if (ret < 0) {
 			DPAA2_QDMA_ERR(
 				"Dequeue from DPDMAI device failed: %d", ret);
-			return NULL;
+			return ret;
 		}
+		qdma_vq->num_dequeues += ret;
 	} else {
+		uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX];
 		/*
 		 * Get the QDMA completed jobs from the software ring.
 		 * In case they are not available on the ring poke the HW
 		 * to fetch completed jobs from corresponding HW queues
 		 */
 		ring_count = rte_ring_count(qdma_vq->status_ring);
-		if (ring_count == 0) {
+		if (ring_count < nb_jobs) {
 			/* TODO - How to have right budget */
-			for (i = 0; i < dequeue_budget; i++) {
-				ret = dpdmai_dev_dequeue(dpdmai_dev,
-					qdma_pq->queue_id, &temp_vq_id, &job);
-				if (ret == 0)
-					break;
-				temp_qdma_vq = &qdma_vqs[temp_vq_id];
+			ret = dpdmai_dev_dequeue_multijob(dpdmai_dev,
+					qdma_pq->queue_id,
+					temp_vq_id, job, nb_jobs);
+			for (i = 0; i < ret; i++) {
+				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
-					(void *)(job));
+					(void *)(job[i]));
 				ring_count = rte_ring_count(
 					qdma_vq->status_ring);
-				if (ring_count)
-					break;
 			}
 		}
 
-		/* Dequeue job from the software ring to provide to the user */
-		rte_ring_dequeue(qdma_vq->status_ring, (void **)&job);
-		if (job)
-			qdma_vq->num_dequeues++;
+		if (ring_count) {
+			/* Dequeue job from the software ring
+			 * to provide to the user
+			 */
+			ret = rte_ring_dequeue_bulk(qdma_vq->status_ring,
+					(void **)job, ring_count, NULL);
+			if (ret)
+				qdma_vq->num_dequeues += ret;
+		}
 	}
 
+	return ret;
+}
+
+struct rte_qdma_job *
+rte_qdma_vq_dequeue(uint16_t vq_id)
+{
+	int ret;
+	struct rte_qdma_job *job = NULL;
+
+	ret = rte_qdma_vq_dequeue_multi(vq_id, &job, 1);
+	if (ret < 0)
+		DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret);
+
 	return job;
 }
 
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index c9697b4d7..e1ccc19e8 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -12,6 +12,9 @@
  *
  */
 
+/** Maximum qdma burst size */
+#define RTE_QDMA_BURST_NB_MAX 32
+
 /** Determines the mode of operation */
 enum {
 	/**
@@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id,
  *   Number of QDMA jobs requested for dequeue by the user.
  *
  * @returns
- *   Number of jobs actually dequeued.
+ *   - >=0: Number of jobs successfully received
+ *   - <0: Error code.
  */
 int
 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp mode support
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
                       ` (3 preceding siblings ...)
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
                       ` (2 subsequent siblings)
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI address
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..ee95662f1 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -26,7 +26,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a1351e648..cf1a1aaa6 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -19,13 +19,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -345,14 +348,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -368,10 +386,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -396,31 +440,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -431,7 +501,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -439,6 +509,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -446,73 +518,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -520,16 +619,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -539,77 +640,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -664,9 +763,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -743,6 +842,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -939,6 +1067,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp mode support
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, M.h. Lian, Sachin Saxena

Add support for route by port mode. The route by port
feature in HW helps in translating the PCI address
of connected device.

Signed-off-by: Minghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile             |   2 +-
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 403 +++++++++++++-------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.h         |  65 +++-
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h |  60 ++-
 4 files changed, 383 insertions(+), 147 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 5c75f5fa0..ee95662f1 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -26,7 +26,7 @@ LDLIBS += -lrte_common_dpaax
 
 EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
 
-LIBABIVER := 2
+LIBABIVER := 3
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index a1351e648..cf1a1aaa6 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -19,13 +19,16 @@
 #include <portal/dpaa2_hw_pvt.h>
 #include <portal/dpaa2_hw_dpio.h>
 
+#include "rte_pmd_dpaa2_qdma.h"
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
-#include "rte_pmd_dpaa2_qdma.h"
 
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
+uint32_t dpaa2_coherent_no_alloc_cache;
+uint32_t dpaa2_coherent_alloc_cache;
+
 /* QDMA device */
 static struct qdma_device qdma_dev;
 
@@ -345,14 +348,29 @@ rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags)
 
 	qdma_vqs[i].in_use = 1;
 	qdma_vqs[i].lcore_id = lcore_id;
-
+	memset(&qdma_vqs[i].rbp, 0, sizeof(struct rte_qdma_rbp));
 	rte_spinlock_unlock(&qdma_dev.lock);
 
 	return i;
 }
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp)
+{
+	int i;
+
+	i = rte_qdma_vq_create(lcore_id, flags);
+
+	memcpy(&qdma_vqs[i].rbp, rbp, sizeof(struct rte_qdma_rbp));
+
+	return i;
+}
+
 static void
 dpaa2_qdma_populate_fle(struct qbman_fle *fle,
+			struct rte_qdma_rbp *rbp,
 			uint64_t src, uint64_t dest,
 			size_t len, uint32_t flags)
 {
@@ -368,10 +386,36 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_LEN(fle, (2 * (sizeof(struct qdma_sdd))));
 
 	/* source and destination descriptor */
-	DPAA2_SET_SDD_RD_COHERENT(sdd); /* source descriptor CMD */
-	sdd++;
-	DPAA2_SET_SDD_WR_COHERENT(sdd); /* dest descriptor CMD */
+	if (rbp && rbp->enable) {
+		/* source */
+		sdd->read_cmd.portid = rbp->sportid;
+		sdd->rbpcmd_simple.pfid = rbp->spfid;
+		sdd->rbpcmd_simple.vfid = rbp->svfid;
+
+		if (rbp->srbp) {
+			sdd->read_cmd.rbp = rbp->srbp;
+			sdd->read_cmd.rdtype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		}
+		sdd++;
+		/* destination */
+		sdd->write_cmd.portid = rbp->dportid;
+		sdd->rbpcmd_simple.pfid = rbp->dpfid;
+		sdd->rbpcmd_simple.vfid = rbp->dvfid;
+
+		if (rbp->drbp) {
+			sdd->write_cmd.rbp = rbp->drbp;
+			sdd->write_cmd.wrttype = DPAA2_RBP_MEM_RW;
+		} else {
+			sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+		}
 
+	} else {
+		sdd->read_cmd.rdtype = dpaa2_coherent_no_alloc_cache;
+		sdd++;
+		sdd->write_cmd.wrttype = dpaa2_coherent_alloc_cache;
+	}
 	fle++;
 	/* source frame list to source buffer */
 	if (flags & RTE_QDMA_JOB_SRC_PHY) {
@@ -396,31 +440,57 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 	DPAA2_SET_FLE_FIN(fle);
 }
 
-int
-rte_qdma_vq_enqueue_multi(uint16_t vq_id,
-			  struct rte_qdma_job **job,
-			  uint16_t nb_jobs)
+static inline uint16_t dpdmai_dev_set_fd(struct qbman_fd *fd,
+					struct rte_qdma_job *job,
+					struct rte_qdma_rbp *rbp,
+					uint16_t vq_id)
 {
-	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
-	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
-	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	struct qdma_io_meta *io_meta;
-	struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
-	struct dpaa2_queue *txq;
 	struct qbman_fle *fle;
+	int ret = 0;
+	/*
+	 * Get an FLE/SDD from FLE pool.
+	 * Note: IO metadata is before the FLE and SDD memory.
+	 */
+	ret = rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta));
+	if (ret) {
+		DPAA2_QDMA_DP_DEBUG("Memory alloc failed for FLE");
+		return ret;
+	}
+
+	/* Set the metadata */
+	io_meta->cnxt = (size_t)job;
+	io_meta->id = vq_id;
+
+	fle = (struct qbman_fle *)(io_meta + 1);
+
+	DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+	DPAA2_SET_FD_COMPOUND_FMT(fd);
+	DPAA2_SET_FD_FRC(fd, QDMA_SER_CTX);
+
+	/* Populate FLE */
+	memset(fle, 0, QDMA_FLE_POOL_SIZE);
+	dpaa2_qdma_populate_fle(fle, rbp, job->src, job->dest,
+				job->len, job->flags);
+
+	return 0;
+}
+
+static int
+dpdmai_dev_enqueue_multi(struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t txq_id,
+			uint16_t vq_id,
+			struct rte_qdma_rbp *rbp,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct qbman_fd fd[RTE_QDMA_BURST_NB_MAX];
+	struct dpaa2_queue *txq;
 	struct qbman_eq_desc eqdesc;
 	struct qbman_swp *swp;
 	int ret;
 	uint32_t num_to_send = 0;
 	uint16_t num_tx = 0;
-	uint16_t num_txed = 0;
-
-	/* Return error in case of wrong lcore_id */
-	if (rte_lcore_id() != qdma_vq->lcore_id) {
-		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
-				vq_id);
-		return -1;
-	}
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -431,7 +501,7 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
 
-	txq = &(dpdmai_dev->tx_queue[qdma_pq->queue_id]);
+	txq = &(dpdmai_dev->tx_queue[txq_id]);
 
 	/* Prepare enqueue descriptor */
 	qbman_eq_desc_clear(&eqdesc);
@@ -439,6 +509,8 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	qbman_eq_desc_set_no_orp(&eqdesc, 0);
 	qbman_eq_desc_set_response(&eqdesc, 0, 0);
 
+	memset(fd, 0, RTE_QDMA_BURST_NB_MAX * sizeof(struct qbman_fd));
+
 	while (nb_jobs > 0) {
 		uint32_t loop;
 
@@ -446,73 +518,100 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 			dpaa2_eqcr_size : nb_jobs;
 
 		for (loop = 0; loop < num_to_send; loop++) {
-			/*
-			 * Get an FLE/SDD from FLE pool.
-			 * Note: IO metadata is before the FLE and SDD memory.
-			 */
-			ret = rte_mempool_get(qdma_dev.fle_pool,
-					(void **)(&io_meta));
-			if (ret) {
-				DPAA2_QDMA_DP_WARN("Me alloc failed for FLE");
-				return ret;
+			ret = dpdmai_dev_set_fd(&fd[loop],
+						job[num_tx], rbp, vq_id);
+			if (ret < 0) {
+				/* Set nb_jobs to loop, so outer while loop
+				 * breaks out.
+				 */
+				nb_jobs = loop;
+				break;
 			}
 
-			/* Set the metadata */
-			io_meta->cnxt = (size_t)job[num_tx];
-			io_meta->id = vq_id;
-
-			fle = (struct qbman_fle *)(io_meta + 1);
-
-			/* populate Frame descriptor */
-			memset(&fd_arr[loop], 0, sizeof(struct qbman_fd));
-			DPAA2_SET_FD_ADDR(&fd_arr[loop],
-					DPAA2_VADDR_TO_IOVA(fle));
-			DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]);
-			DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX);
-
-			/* Populate FLE */
-			memset(fle, 0, QDMA_FLE_POOL_SIZE);
-			dpaa2_qdma_populate_fle(fle, job[num_tx]->src,
-						job[num_tx]->dest,
-						job[num_tx]->len,
-						job[num_tx]->flags);
-
 			num_tx++;
 		}
 
 		/* Enqueue the packet to the QBMAN */
 		uint32_t enqueue_loop = 0;
-		while (enqueue_loop < num_to_send) {
+		while (enqueue_loop < loop) {
 			enqueue_loop += qbman_swp_enqueue_multiple(swp,
 						&eqdesc,
-						&fd_arr[enqueue_loop],
+						&fd[enqueue_loop],
 						NULL,
-						num_to_send - enqueue_loop);
+						loop - enqueue_loop);
 		}
-
-		num_txed += num_to_send;
-		nb_jobs -= num_to_send;
+		nb_jobs -= loop;
 	}
-	qdma_vq->num_enqueues += num_txed;
-	return num_txed;
+	return num_tx;
 }
 
 int
-rte_qdma_vq_enqueue(uint16_t vq_id,
-		    struct rte_qdma_job *job)
+rte_qdma_vq_enqueue_multi(uint16_t vq_id,
+			  struct rte_qdma_job **job,
+			  uint16_t nb_jobs)
 {
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+	struct qdma_hw_queue *qdma_pq = qdma_vq->hw_queue;
+	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	ret = rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* Return error in case of wrong lcore_id */
+	if (rte_lcore_id() != qdma_vq->lcore_id) {
+		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
+				vq_id);
+		return -EINVAL;
+	}
+
+	ret = dpdmai_dev_enqueue_multi(dpdmai_dev,
+				 qdma_pq->queue_id,
+				 vq_id,
+				 &qdma_vq->rbp,
+				 job,
+				 nb_jobs);
 	if (ret < 0) {
 		DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret);
 		return ret;
 	}
 
-	return 1;
+	qdma_vq->num_enqueues += ret;
+
+	return ret;
+}
+
+int
+rte_qdma_vq_enqueue(uint16_t vq_id,
+		    struct rte_qdma_job *job)
+{
+	return rte_qdma_vq_enqueue_multi(vq_id, &job, 1);
+}
+
+static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
+					struct rte_qdma_job **job)
+{
+	struct qbman_fle *fle;
+	struct qdma_io_meta *io_meta;
+	uint16_t vqid;
+	/*
+	 * Fetch metadata from FLE. job and vq_id were set
+	 * in metadata in the enqueue operation.
+	 */
+	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
+	io_meta = (struct qdma_io_meta *)(fle) - 1;
+
+	*job = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
+	(*job)->status = (DPAA2_GET_FD_ERR(fd) << 8) |
+			 (DPAA2_GET_FD_FRC(fd) & 0xFF);
+
+	vqid = io_meta->id;
+
+	/* Free FLE to the pool */
+	rte_mempool_put(qdma_dev.fle_pool, io_meta);
+
+	return vqid;
 }
 
-/* Function to receive a QDMA job for a given device and queue*/
 static int
 dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   uint16_t rxq_id,
@@ -520,16 +619,18 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		   struct rte_qdma_job **job,
 		   uint16_t nb_jobs)
 {
-	struct qdma_io_meta *io_meta;
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
 	struct qbman_pull_desc pulldesc;
-	const struct qbman_fd *fd;
 	struct qbman_swp *swp;
-	struct qbman_fle *fle;
 	uint32_t fqid;
-	uint8_t status;
-	int ret;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, next_pull = nb_jobs, num_pulled = 0;
+
+	DPAA2_QDMA_FUNC_TRACE();
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
@@ -539,77 +640,75 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 		}
 	}
 	swp = DPAA2_PER_LCORE_PORTAL;
+
 	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
-	dq_storage = rxq->q_storage->dq_storage[0];
 	fqid = rxq->fqid;
 
-	/* Prepare dequeue descriptor */
-	qbman_pull_desc_clear(&pulldesc);
-	qbman_pull_desc_set_fq(&pulldesc, fqid);
-	qbman_pull_desc_set_storage(&pulldesc, dq_storage,
-		(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
-	if (nb_jobs > dpaa2_dqrr_size)
-		qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size);
-	else
-		qbman_pull_desc_set_numframes(&pulldesc, nb_jobs);
-
-	while (1) {
-		if (qbman_swp_pull(swp, &pulldesc)) {
-			DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
-			continue;
+	do {
+		dq_storage = rxq->q_storage->dq_storage[0];
+		/* Prepare dequeue descriptor */
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+			(uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+
+		if (next_pull > dpaa2_dqrr_size) {
+			qbman_pull_desc_set_numframes(&pulldesc,
+					dpaa2_dqrr_size);
+			next_pull -= dpaa2_dqrr_size;
+		} else {
+			qbman_pull_desc_set_numframes(&pulldesc, next_pull);
+			next_pull = 0;
 		}
-		break;
-	}
 
-	rte_prefetch0((void *)((size_t)(dq_storage + 1)));
-	/* Check if the previous issued command is completed. */
-	while (!qbman_check_command_complete(dq_storage))
-		;
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN("VDQ command not issued. QBMAN busy");
+				/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
 
-	int num_pulled = 0;
-	int pending = 1;
-	do {
-		/* Loop until the dq_storage is updated with
-		 * new token by QBMAN
-		 */
-		while (!qbman_check_new_result(dq_storage))
+		rte_prefetch0((void *)((size_t)(dq_storage + 1)));
+		/* Check if the previous issued command is completed. */
+		while (!qbman_check_command_complete(dq_storage))
 			;
 
-		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
-		/* Check whether Last Pull command is Expired and
-		 * setting Condition for Loop termination
-		 */
-		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
-			pending = 0;
-			/* Check for valid frame. */
-			status = qbman_result_DQ_flags(dq_storage);
-			if (unlikely((status &
-				QBMAN_DQ_STAT_VALIDFRAME) == 0))
-				continue;
-		}
-		fd = qbman_result_DQ_fd(dq_storage);
+		num_pulled = 0;
+		pending = 1;
 
-		/*
-		 * Fetch metadata from FLE. job and vq_id were set
-		 * in metadata in the enqueue operation.
-		 */
-		fle = (struct qbman_fle *)
-				DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
-		io_meta = (struct qdma_io_meta *)(fle) - 1;
-		if (vq_id)
-			vq_id[num_pulled] = io_meta->id;
+		do {
+			/* Loop until dq_storage is updated
+			 * with new token by QBMAN
+			 */
+			while (!qbman_check_new_result(dq_storage))
+				;
+			rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+
+			if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+				pending = 0;
+				/* Check for valid frame. */
+				status = qbman_result_DQ_flags(dq_storage);
+				if (unlikely((status &
+					QBMAN_DQ_STAT_VALIDFRAME) == 0))
+					continue;
+			}
+			fd = qbman_result_DQ_fd(dq_storage);
 
-		job[num_pulled] = (struct rte_qdma_job *)(size_t)io_meta->cnxt;
-		job[num_pulled]->status = DPAA2_GET_FD_ERR(fd);
+			vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+			if (vq_id)
+				vq_id[num_rx] = vqid;
 
-		/* Free FLE to the pool */
-		rte_mempool_put(qdma_dev.fle_pool, io_meta);
+			dq_storage++;
+			num_rx++;
+			num_pulled++;
 
-		dq_storage++;
-		num_pulled++;
-	} while (pending && (num_pulled <= dpaa2_dqrr_size));
+		} while (pending);
+	/* Last VDQ provided all packets and more packets are requested */
+	} while (next_pull && num_pulled == dpaa2_dqrr_size);
 
-	return num_pulled;
+	return num_rx;
 }
 
 int
@@ -664,9 +763,9 @@ rte_qdma_vq_dequeue_multi(uint16_t vq_id,
 				temp_qdma_vq = &qdma_vqs[temp_vq_id[i]];
 				rte_ring_enqueue(temp_qdma_vq->status_ring,
 					(void *)(job[i]));
-				ring_count = rte_ring_count(
-					qdma_vq->status_ring);
 			}
+			ring_count = rte_ring_count(
+					qdma_vq->status_ring);
 		}
 
 		if (ring_count) {
@@ -743,6 +842,35 @@ rte_qdma_vq_destroy(uint16_t vq_id)
 	return 0;
 }
 
+int
+rte_qdma_vq_destroy_rbp(uint16_t vq_id)
+{
+	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
+
+	DPAA2_QDMA_FUNC_TRACE();
+
+	/* In case there are pending jobs on any VQ, return -EBUSY */
+	if (qdma_vq->num_enqueues != qdma_vq->num_dequeues)
+		return -EBUSY;
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	if (qdma_vq->exclusive_hw_queue) {
+		free_hw_queue(qdma_vq->hw_queue);
+	} else {
+		if (qdma_vqs->status_ring)
+			rte_ring_free(qdma_vqs->status_ring);
+
+		put_hw_queue(qdma_vq->hw_queue);
+	}
+
+	memset(qdma_vq, 0, sizeof(struct qdma_virt_queue));
+
+	rte_spinlock_lock(&qdma_dev.lock);
+
+	return 0;
+}
+
 void
 rte_qdma_stop(void)
 {
@@ -939,6 +1067,21 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		DPAA2_QDMA_ERR("Adding H/W queue to list failed");
 		goto init_err;
 	}
+
+	if (!dpaa2_coherent_no_alloc_cache) {
+		if (dpaa2_svr_family == SVR_LX2160A) {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_LX2_COHERENT_ALLOCATE_CACHE;
+		} else {
+			dpaa2_coherent_no_alloc_cache =
+				DPAA2_COHERENT_NO_ALLOCATE_CACHE;
+			dpaa2_coherent_alloc_cache =
+				DPAA2_COHERENT_ALLOCATE_CACHE;
+		}
+	}
+
 	DPAA2_QDMA_DEBUG("Initialized dpdmai object successfully");
 
 	return 0;
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
index 0cbe90255..f15dda694 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h
@@ -22,28 +22,24 @@ struct qdma_io_meta;
 
 /** Notification by FQD_CTX[fqid] */
 #define QDMA_SER_CTX (1 << 8)
-
+#define DPAA2_RBP_MEM_RW            0x0
 /**
  * Source descriptor command read transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_RD_COHERENT(sdd) ((sdd)->cmd = (0xb << 28))
+#define DPAA2_COHERENT_NO_ALLOCATE_CACHE	0xb
+#define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE	0x7
 /**
  * Destination descriptor command write transaction type for RBP=0:
  * coherent copy of cacheable memory
  */
-#define DPAA2_SET_SDD_WR_COHERENT(sdd) ((sdd)->cmd = (0x6 << 28))
+#define DPAA2_COHERENT_ALLOCATE_CACHE		0x6
+#define DPAA2_LX2_COHERENT_ALLOCATE_CACHE	0xb
 
 /** Maximum possible H/W Queues on each core */
 #define MAX_HW_QUEUE_PER_CORE		64
 
-/**
- * In case of Virtual Queue mode, this specifies the number of
- * dequeue the 'qdma_vq_dequeue/multi' API does from the H/W Queue
- * in case there is no job present on the Virtual Queue ring.
- */
-#define QDMA_DEQUEUE_BUDGET		64
-
+#define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
 /**
  * Represents a QDMA device.
  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
@@ -90,6 +86,8 @@ struct qdma_virt_queue {
 	struct rte_ring *status_ring;
 	/** Associated hw queue */
 	struct qdma_hw_queue *hw_queue;
+	/** Route by port */
+	struct rte_qdma_rbp rbp;
 	/** Associated lcore id */
 	uint32_t lcore_id;
 	/** States if this vq is in use or not */
@@ -118,7 +116,7 @@ struct qdma_io_meta {
 	 */
 	uint64_t cnxt;
 	/** VQ ID is stored as a part of metadata of the enqueue command */
-	 uint64_t id;
+	uint64_t id;
 };
 
 /** Source/Destination Descriptor */
@@ -127,9 +125,48 @@ struct qdma_sdd {
 	/** Stride configuration */
 	uint32_t stride;
 	/** Route-by-port command */
-	uint32_t rbpcmd;
-	uint32_t cmd;
-} __attribute__((__packed__));
+	union {
+		uint32_t rbpcmd;
+		struct rbpcmd_st {
+			uint32_t vfid:6;
+			uint32_t rsv4:2;
+			uint32_t pfid:1;
+			uint32_t rsv3:7;
+			uint32_t attr:3;
+			uint32_t rsv2:1;
+			uint32_t at:2;
+			uint32_t vfa:1;
+			uint32_t ca:1;
+			uint32_t tc:3;
+			uint32_t rsv1:5;
+		} rbpcmd_simple;
+	};
+	union {
+		uint32_t cmd;
+		struct rcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv1:14;
+			uint32_t rbp:1;
+			uint32_t ssen:1;
+			uint32_t rthrotl:4;
+			uint32_t sqos:3;
+			uint32_t ns:1;
+			uint32_t rdtype:4;
+		} read_cmd;
+		struct wcmd_simple {
+			uint32_t portid:4;
+			uint32_t rsv3:10;
+			uint32_t rsv2:2;
+			uint32_t lwc:2;
+			uint32_t rbp:1;
+			uint32_t dsen:1;
+			uint32_t rsv1:4;
+			uint32_t dqos:3;
+			uint32_t ns:1;
+			uint32_t wrttype:4;
+		} write_cmd;
+	};
+} __attribute__ ((__packed__));
 
 /** Represents a DPDMAI raw device */
 struct dpaa2_dpdmai_dev {
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index e1ccc19e8..bbc66a286 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -13,7 +13,7 @@
  */
 
 /** Maximum qdma burst size */
-#define RTE_QDMA_BURST_NB_MAX 32
+#define RTE_QDMA_BURST_NB_MAX 256
 
 /** Determines the mode of operation */
 enum {
@@ -73,6 +73,40 @@ struct rte_qdma_config {
 	int fle_pool_count;
 };
 
+struct rte_qdma_rbp {
+	uint32_t use_ultrashort:1;
+	uint32_t enable:1;
+	/**
+	 * dportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t dportid:4;
+	uint32_t dpfid:2;
+	uint32_t dvfid:6;
+	/*using route by port for destination */
+	uint32_t drbp:1;
+	/**
+	 * sportid:
+	 * 0000 PCI-Express 1
+	 * 0001 PCI-Express 2
+	 * 0010 PCI-Express 3
+	 * 0011 PCI-Express 4
+	 * 0100 PCI-Express 5
+	 * 0101 PCI-Express 6
+	 */
+	uint32_t sportid:4;
+	uint32_t spfid:2;
+	uint32_t svfid:6;
+	/* using route by port for source */
+	uint32_t srbp:1;
+	uint32_t rsv:4;
+};
+
 /** Provides QDMA device statistics */
 struct rte_qdma_vq_stats {
 	/** States if this vq has exclusively associated hw queue */
@@ -105,8 +139,10 @@ struct rte_qdma_job {
 	/**
 	 * Status of the transaction.
 	 * This is filled in the dequeue operation by the driver.
+	 * upper 8bits acc_err for route by port.
+	 * lower 8bits fd error
 	 */
-	uint8_t status;
+	uint16_t status;
 };
 
 /**
@@ -177,6 +213,11 @@ rte_qdma_start(void);
 int
 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
 
+/*create vq for route-by-port*/
+int
+rte_qdma_vq_create_rbp(uint32_t lcore_id, uint32_t flags,
+			struct rte_qdma_rbp *rbp);
+
 /**
  * Enqueue multiple jobs to a Virtual Queue.
  * If the enqueue is successful, the H/W will perform DMA operations
@@ -275,6 +316,21 @@ rte_qdma_vq_stats(uint16_t vq_id,
 int
 rte_qdma_vq_destroy(uint16_t vq_id);
 
+/**
+ * Destroy the RBP specific Virtual Queue specified by vq_id.
+ * This API can be called from any thread/core. User can create/destroy
+ * VQ's at runtime.
+ *
+ * @param vq_id
+ *   RBP based Virtual Queue ID which needs to be deinialized.
+ *
+ * @returns
+ *   - 0: Success.
+ *   - <0: Error code.
+ */
+
+int __rte_experimental
+rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
  */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
                       ` (4 preceding siblings ...)
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
  2019-04-04 13:04     ` [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64 Bruce Richardson
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index cf1a1aaa6..38f329a50 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -376,8 +376,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -555,8 +553,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -630,8 +626,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -801,8 +795,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

The runtime traces shall not be present in datapath

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c       | 4 ----
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c         | 8 --------
 drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 469960a3e..7d311b2ee 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -67,8 +67,6 @@ dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev,
 	struct qbman_swp *swp;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -128,8 +126,6 @@ dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev,
 	uint8_t status;
 	int ret;
 
-	DPAA2_CMDIF_FUNC_TRACE();
-
 	RTE_SET_USED(count);
 
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index cf1a1aaa6..38f329a50 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -376,8 +376,6 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle,
 {
 	struct qdma_sdd *sdd;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	sdd = (struct qdma_sdd *)((uint8_t *)(fle) +
 		(DPAA2_QDMA_MAX_FLE * sizeof(struct qbman_fle)));
 
@@ -555,8 +553,6 @@ rte_qdma_vq_enqueue_multi(uint16_t vq_id,
 	struct dpaa2_dpdmai_dev *dpdmai_dev = qdma_pq->dpdmai_dev;
 	int ret;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	/* Return error in case of wrong lcore_id */
 	if (rte_lcore_id() != qdma_vq->lcore_id) {
 		DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core",
@@ -630,8 +626,6 @@ dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
 	uint16_t vqid;
 	int ret, next_pull = nb_jobs, num_pulled = 0;
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
@@ -801,8 +795,6 @@ rte_qdma_vq_stats(uint16_t vq_id,
 {
 	struct qdma_virt_queue *qdma_vq = &qdma_vqs[vq_id];
 
-	DPAA2_QDMA_FUNC_TRACE();
-
 	if (qdma_vq->in_use) {
 		vq_status->exclusive_hw_queue = qdma_vq->exclusive_hw_queue;
 		vq_status->lcore_id = qdma_vq->lcore_id;
diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
index bbc66a286..ce491d5d4 100644
--- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
+++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h
@@ -329,7 +329,7 @@ rte_qdma_vq_destroy(uint16_t vq_id);
  *   - <0: Error code.
  */
 
-int __rte_experimental
+int
 rte_qdma_vq_destroy_rbp(uint16_t vq_id);
 /**
  * Stop QDMA device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
                       ` (5 preceding siblings ...)
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
@ 2019-04-04 11:50     ` Hemant Agrawal
  2019-04-04 11:50       ` Hemant Agrawal
  2019-04-04 13:04     ` [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64 Bruce Richardson
  7 siblings, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

This patch add support for non prefetch mode in Rx functions.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile     |   1 +
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 215 +++++++++++++++++++++++++++-
 drivers/raw/dpaa2_qdma/meson.build  |   2 +-
 3 files changed, 212 insertions(+), 6 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index ee95662f1..450c76e76 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -21,6 +21,7 @@ LDLIBS += -lrte_eal
 LDLIBS += -lrte_mempool
 LDLIBS += -lrte_mempool_dpaa2
 LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_kvargs
 LDLIBS += -lrte_ring
 LDLIBS += -lrte_common_dpaax
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 38f329a50..a41c1e385 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -14,6 +14,7 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
+#include <rte_kvargs.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -23,6 +24,8 @@
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
 
+#define DPAA2_QDMA_NO_PREFETCH "no_prefetch"
+
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
@@ -43,6 +46,14 @@ static struct qdma_virt_queue *qdma_vqs;
 /* QDMA per core data */
 static struct qdma_per_core_info qdma_core_info[RTE_MAX_LCORE];
 
+typedef int (dpdmai_dev_dequeue_multijob_t)(struct dpaa2_dpdmai_dev *dpdmai_dev,
+					    uint16_t rxq_id,
+					    uint16_t *vq_id,
+					    struct rte_qdma_job **job,
+					    uint16_t nb_jobs);
+
+dpdmai_dev_dequeue_multijob_t *dpdmai_dev_dequeue_multijob;
+
 static struct qdma_hw_queue *
 alloc_hw_queue(uint32_t lcore_id)
 {
@@ -608,12 +619,156 @@ static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
 	return vqid;
 }
 
+/* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t rxq_id,
-		   uint16_t *vq_id,
-		   struct rte_qdma_job **job,
-		   uint16_t nb_jobs)
+dpdmai_dev_dequeue_multijob_prefetch(
+			struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t rxq_id,
+			uint16_t *vq_id,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct dpaa2_queue *rxq;
+	struct qbman_result *dq_storage, *dq_storage1 = NULL;
+	struct qbman_pull_desc pulldesc;
+	struct qbman_swp *swp;
+	struct queue_storage_info_t *q_storage;
+	uint32_t fqid;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, pull_size;
+
+	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_QDMA_ERR("Failure in affining portal");
+			return 0;
+		}
+	}
+	swp = DPAA2_PER_LCORE_PORTAL;
+
+	pull_size = (nb_jobs > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_jobs;
+	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
+	fqid = rxq->fqid;
+	q_storage = rxq->q_storage;
+
+	if (unlikely(!q_storage->active_dqs)) {
+		q_storage->toggle = 0;
+		dq_storage = q_storage->dq_storage[q_storage->toggle];
+		q_storage->last_num_pkts = pull_size;
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_numframes(&pulldesc,
+					      q_storage->last_num_pkts);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+				(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+		if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+			while (!qbman_check_command_complete(
+			       get_swp_active_dqs(
+			       DPAA2_PER_LCORE_DPIO->index)))
+				;
+			clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+		}
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN(
+					"VDQ command not issued.QBMAN busy\n");
+					/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
+		q_storage->active_dqs = dq_storage;
+		q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+		set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index,
+				   dq_storage);
+	}
+
+	dq_storage = q_storage->active_dqs;
+	rte_prefetch0((void *)(size_t)(dq_storage));
+	rte_prefetch0((void *)(size_t)(dq_storage + 1));
+
+	/* Prepare next pull descriptor. This will give space for the
+	 * prefething done on DQRR entries
+	 */
+	q_storage->toggle ^= 1;
+	dq_storage1 = q_storage->dq_storage[q_storage->toggle];
+	qbman_pull_desc_clear(&pulldesc);
+	qbman_pull_desc_set_numframes(&pulldesc, pull_size);
+	qbman_pull_desc_set_fq(&pulldesc, fqid);
+	qbman_pull_desc_set_storage(&pulldesc, dq_storage1,
+		(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1);
+
+	/* Check if the previous issued command is completed.
+	 * Also seems like the SWP is shared between the Ethernet Driver
+	 * and the SEC driver.
+	 */
+	while (!qbman_check_command_complete(dq_storage))
+		;
+	if (dq_storage == get_swp_active_dqs(q_storage->active_dpio_id))
+		clear_swp_active_dqs(q_storage->active_dpio_id);
+
+	pending = 1;
+
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
+
+		vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+		if (vq_id)
+			vq_id[num_rx] = vqid;
+
+		dq_storage++;
+		num_rx++;
+	} while (pending);
+
+	if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+		while (!qbman_check_command_complete(
+		       get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)))
+			;
+		clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+	}
+	/* issue a volatile dequeue command for next pull */
+	while (1) {
+		if (qbman_swp_pull(swp, &pulldesc)) {
+			DPAA2_QDMA_DP_WARN("VDQ command is not issued."
+					  "QBMAN is busy (2)\n");
+			continue;
+		}
+		break;
+	}
+
+	q_storage->active_dqs = dq_storage1;
+	q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+	set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1);
+
+	return num_rx;
+}
+
+static int
+dpdmai_dev_dequeue_multijob_no_prefetch(
+		struct dpaa2_dpdmai_dev *dpdmai_dev,
+		uint16_t rxq_id,
+		uint16_t *vq_id,
+		struct rte_qdma_job **job,
+		uint16_t nb_jobs)
 {
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
@@ -958,6 +1113,43 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 	return 0;
 }
 
+static int
+check_devargs_handler(__rte_unused const char *key, const char *value,
+		      __rte_unused void *opaque)
+{
+	if (strcmp(value, "1"))
+		return -1;
+
+	return 0;
+}
+
+static int
+dpaa2_get_devargs(struct rte_devargs *devargs, const char *key)
+{
+	struct rte_kvargs *kvlist;
+
+	if (!devargs)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (!kvlist)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, key)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	if (rte_kvargs_process(kvlist, key,
+			       check_devargs_handler, NULL) < 0) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	rte_kvargs_free(kvlist);
+
+	return 1;
+}
+
 static int
 dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 {
@@ -1060,6 +1252,17 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		goto init_err;
 	}
 
+	if (dpaa2_get_devargs(rawdev->device->devargs,
+		DPAA2_QDMA_NO_PREFETCH)) {
+		/* If no prefetch is configured. */
+		dpdmai_dev_dequeue_multijob =
+				dpdmai_dev_dequeue_multijob_no_prefetch;
+		DPAA2_QDMA_INFO("No Prefetch RX Mode enabled");
+	} else {
+		dpdmai_dev_dequeue_multijob =
+			dpdmai_dev_dequeue_multijob_prefetch;
+	}
+
 	if (!dpaa2_coherent_no_alloc_cache) {
 		if (dpaa2_svr_family == SVR_LX2160A) {
 			dpaa2_coherent_no_alloc_cache =
@@ -1139,6 +1342,8 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 };
 
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
+	"no_prefetch=<int> ");
 
 RTE_INIT(dpaa2_qdma_init_log)
 {
diff --git a/drivers/raw/dpaa2_qdma/meson.build b/drivers/raw/dpaa2_qdma/meson.build
index 2a4b69c16..1577946fa 100644
--- a/drivers/raw/dpaa2_qdma/meson.build
+++ b/drivers/raw/dpaa2_qdma/meson.build
@@ -4,7 +4,7 @@
 version = 2
 
 build = dpdk_conf.has('RTE_LIBRTE_DPAA2_MEMPOOL')
-deps += ['rawdev', 'mempool_dpaa2', 'ring']
+deps += ['rawdev', 'mempool_dpaa2', 'ring', 'kvargs']
 sources = files('dpaa2_qdma.c')
 
 allow_experimental_apis = true
-- 
2.17.1

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
@ 2019-04-04 11:50       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

This patch add support for non prefetch mode in Rx functions.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/dpaa2_qdma/Makefile     |   1 +
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 215 +++++++++++++++++++++++++++-
 drivers/raw/dpaa2_qdma/meson.build  |   2 +-
 3 files changed, 212 insertions(+), 6 deletions(-)

diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index ee95662f1..450c76e76 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -21,6 +21,7 @@ LDLIBS += -lrte_eal
 LDLIBS += -lrte_mempool
 LDLIBS += -lrte_mempool_dpaa2
 LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_kvargs
 LDLIBS += -lrte_ring
 LDLIBS += -lrte_common_dpaax
 
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 38f329a50..a41c1e385 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -14,6 +14,7 @@
 #include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_prefetch.h>
+#include <rte_kvargs.h>
 
 #include <mc/fsl_dpdmai.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -23,6 +24,8 @@
 #include "dpaa2_qdma.h"
 #include "dpaa2_qdma_logs.h"
 
+#define DPAA2_QDMA_NO_PREFETCH "no_prefetch"
+
 /* Dynamic log type identifier */
 int dpaa2_qdma_logtype;
 
@@ -43,6 +46,14 @@ static struct qdma_virt_queue *qdma_vqs;
 /* QDMA per core data */
 static struct qdma_per_core_info qdma_core_info[RTE_MAX_LCORE];
 
+typedef int (dpdmai_dev_dequeue_multijob_t)(struct dpaa2_dpdmai_dev *dpdmai_dev,
+					    uint16_t rxq_id,
+					    uint16_t *vq_id,
+					    struct rte_qdma_job **job,
+					    uint16_t nb_jobs);
+
+dpdmai_dev_dequeue_multijob_t *dpdmai_dev_dequeue_multijob;
+
 static struct qdma_hw_queue *
 alloc_hw_queue(uint32_t lcore_id)
 {
@@ -608,12 +619,156 @@ static inline uint16_t dpdmai_dev_get_job(const struct qbman_fd *fd,
 	return vqid;
 }
 
+/* Function to receive a QDMA job for a given device and queue*/
 static int
-dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev,
-		   uint16_t rxq_id,
-		   uint16_t *vq_id,
-		   struct rte_qdma_job **job,
-		   uint16_t nb_jobs)
+dpdmai_dev_dequeue_multijob_prefetch(
+			struct dpaa2_dpdmai_dev *dpdmai_dev,
+			uint16_t rxq_id,
+			uint16_t *vq_id,
+			struct rte_qdma_job **job,
+			uint16_t nb_jobs)
+{
+	struct dpaa2_queue *rxq;
+	struct qbman_result *dq_storage, *dq_storage1 = NULL;
+	struct qbman_pull_desc pulldesc;
+	struct qbman_swp *swp;
+	struct queue_storage_info_t *q_storage;
+	uint32_t fqid;
+	uint8_t status, pending;
+	uint8_t num_rx = 0;
+	const struct qbman_fd *fd;
+	uint16_t vqid;
+	int ret, pull_size;
+
+	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_QDMA_ERR("Failure in affining portal");
+			return 0;
+		}
+	}
+	swp = DPAA2_PER_LCORE_PORTAL;
+
+	pull_size = (nb_jobs > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_jobs;
+	rxq = &(dpdmai_dev->rx_queue[rxq_id]);
+	fqid = rxq->fqid;
+	q_storage = rxq->q_storage;
+
+	if (unlikely(!q_storage->active_dqs)) {
+		q_storage->toggle = 0;
+		dq_storage = q_storage->dq_storage[q_storage->toggle];
+		q_storage->last_num_pkts = pull_size;
+		qbman_pull_desc_clear(&pulldesc);
+		qbman_pull_desc_set_numframes(&pulldesc,
+					      q_storage->last_num_pkts);
+		qbman_pull_desc_set_fq(&pulldesc, fqid);
+		qbman_pull_desc_set_storage(&pulldesc, dq_storage,
+				(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1);
+		if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+			while (!qbman_check_command_complete(
+			       get_swp_active_dqs(
+			       DPAA2_PER_LCORE_DPIO->index)))
+				;
+			clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+		}
+		while (1) {
+			if (qbman_swp_pull(swp, &pulldesc)) {
+				DPAA2_QDMA_DP_WARN(
+					"VDQ command not issued.QBMAN busy\n");
+					/* Portal was busy, try again */
+				continue;
+			}
+			break;
+		}
+		q_storage->active_dqs = dq_storage;
+		q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+		set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index,
+				   dq_storage);
+	}
+
+	dq_storage = q_storage->active_dqs;
+	rte_prefetch0((void *)(size_t)(dq_storage));
+	rte_prefetch0((void *)(size_t)(dq_storage + 1));
+
+	/* Prepare next pull descriptor. This will give space for the
+	 * prefething done on DQRR entries
+	 */
+	q_storage->toggle ^= 1;
+	dq_storage1 = q_storage->dq_storage[q_storage->toggle];
+	qbman_pull_desc_clear(&pulldesc);
+	qbman_pull_desc_set_numframes(&pulldesc, pull_size);
+	qbman_pull_desc_set_fq(&pulldesc, fqid);
+	qbman_pull_desc_set_storage(&pulldesc, dq_storage1,
+		(size_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1);
+
+	/* Check if the previous issued command is completed.
+	 * Also seems like the SWP is shared between the Ethernet Driver
+	 * and the SEC driver.
+	 */
+	while (!qbman_check_command_complete(dq_storage))
+		;
+	if (dq_storage == get_swp_active_dqs(q_storage->active_dpio_id))
+		clear_swp_active_dqs(q_storage->active_dpio_id);
+
+	pending = 1;
+
+	do {
+		/* Loop until the dq_storage is updated with
+		 * new token by QBMAN
+		 */
+		while (!qbman_check_new_result(dq_storage))
+			;
+		rte_prefetch0((void *)((size_t)(dq_storage + 2)));
+		/* Check whether Last Pull command is Expired and
+		 * setting Condition for Loop termination
+		 */
+		if (qbman_result_DQ_is_pull_complete(dq_storage)) {
+			pending = 0;
+			/* Check for valid frame. */
+			status = qbman_result_DQ_flags(dq_storage);
+			if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0))
+				continue;
+		}
+		fd = qbman_result_DQ_fd(dq_storage);
+
+		vqid = dpdmai_dev_get_job(fd, &job[num_rx]);
+		if (vq_id)
+			vq_id[num_rx] = vqid;
+
+		dq_storage++;
+		num_rx++;
+	} while (pending);
+
+	if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) {
+		while (!qbman_check_command_complete(
+		       get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)))
+			;
+		clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index);
+	}
+	/* issue a volatile dequeue command for next pull */
+	while (1) {
+		if (qbman_swp_pull(swp, &pulldesc)) {
+			DPAA2_QDMA_DP_WARN("VDQ command is not issued."
+					  "QBMAN is busy (2)\n");
+			continue;
+		}
+		break;
+	}
+
+	q_storage->active_dqs = dq_storage1;
+	q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index;
+	set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1);
+
+	return num_rx;
+}
+
+static int
+dpdmai_dev_dequeue_multijob_no_prefetch(
+		struct dpaa2_dpdmai_dev *dpdmai_dev,
+		uint16_t rxq_id,
+		uint16_t *vq_id,
+		struct rte_qdma_job **job,
+		uint16_t nb_jobs)
 {
 	struct dpaa2_queue *rxq;
 	struct qbman_result *dq_storage;
@@ -958,6 +1113,43 @@ dpaa2_dpdmai_dev_uninit(struct rte_rawdev *rawdev)
 	return 0;
 }
 
+static int
+check_devargs_handler(__rte_unused const char *key, const char *value,
+		      __rte_unused void *opaque)
+{
+	if (strcmp(value, "1"))
+		return -1;
+
+	return 0;
+}
+
+static int
+dpaa2_get_devargs(struct rte_devargs *devargs, const char *key)
+{
+	struct rte_kvargs *kvlist;
+
+	if (!devargs)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
+	if (!kvlist)
+		return 0;
+
+	if (!rte_kvargs_count(kvlist, key)) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+
+	if (rte_kvargs_process(kvlist, key,
+			       check_devargs_handler, NULL) < 0) {
+		rte_kvargs_free(kvlist);
+		return 0;
+	}
+	rte_kvargs_free(kvlist);
+
+	return 1;
+}
+
 static int
 dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 {
@@ -1060,6 +1252,17 @@ dpaa2_dpdmai_dev_init(struct rte_rawdev *rawdev, int dpdmai_id)
 		goto init_err;
 	}
 
+	if (dpaa2_get_devargs(rawdev->device->devargs,
+		DPAA2_QDMA_NO_PREFETCH)) {
+		/* If no prefetch is configured. */
+		dpdmai_dev_dequeue_multijob =
+				dpdmai_dev_dequeue_multijob_no_prefetch;
+		DPAA2_QDMA_INFO("No Prefetch RX Mode enabled");
+	} else {
+		dpdmai_dev_dequeue_multijob =
+			dpdmai_dev_dequeue_multijob_prefetch;
+	}
+
 	if (!dpaa2_coherent_no_alloc_cache) {
 		if (dpaa2_svr_family == SVR_LX2160A) {
 			dpaa2_coherent_no_alloc_cache =
@@ -1139,6 +1342,8 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 };
 
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
+	"no_prefetch=<int> ");
 
 RTE_INIT(dpaa2_qdma_init_log)
 {
diff --git a/drivers/raw/dpaa2_qdma/meson.build b/drivers/raw/dpaa2_qdma/meson.build
index 2a4b69c16..1577946fa 100644
--- a/drivers/raw/dpaa2_qdma/meson.build
+++ b/drivers/raw/dpaa2_qdma/meson.build
@@ -4,7 +4,7 @@
 version = 2
 
 build = dpdk_conf.has('RTE_LIBRTE_DPAA2_MEMPOOL')
-deps += ['rawdev', 'mempool_dpaa2', 'ring']
+deps += ['rawdev', 'mempool_dpaa2', 'ring', 'kvargs']
 sources = files('dpaa2_qdma.c')
 
 allow_experimental_apis = true
-- 
2.17.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:07   ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Richardson, Bruce
  2019-04-04 11:07     ` Richardson, Bruce
@ 2019-04-04 11:52     ` Hemant Agrawal
  2019-04-04 11:52       ` Hemant Agrawal
  1 sibling, 1 reply; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:52 UTC (permalink / raw)
  To: Richardson, Bruce, dev; +Cc: thomas, Shreyansh Jain


On 04-Apr-19 4:37 PM, Richardson, Bruce wrote:
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
>> Sent: Thursday, April 4, 2019 12:04 PM
>> To: dev@dpdk.org
>> Cc: thomas@monjalon.net; Shreyansh Jain <shreyansh.jain@nxp.com>
>> Subject: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to
>> be 64
>>
>> The current value is 10, which is not sufficient for many use-cases.
>> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some use-
>> cases. So, making it to 64 to cover various cases.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>   config/common_base | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
> Need same change in config/rte_config.h for meson build.
Thanks. Just fixed it in v3

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:52     ` Hemant Agrawal
@ 2019-04-04 11:52       ` Hemant Agrawal
  0 siblings, 0 replies; 52+ messages in thread
From: Hemant Agrawal @ 2019-04-04 11:52 UTC (permalink / raw)
  To: Richardson, Bruce, dev; +Cc: thomas, Shreyansh Jain


On 04-Apr-19 4:37 PM, Richardson, Bruce wrote:
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
>> Sent: Thursday, April 4, 2019 12:04 PM
>> To: dev@dpdk.org
>> Cc: thomas@monjalon.net; Shreyansh Jain <shreyansh.jain@nxp.com>
>> Subject: [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to
>> be 64
>>
>> The current value is 10, which is not sufficient for many use-cases.
>> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some use-
>> cases. So, making it to 64 to cover various cases.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>>   config/common_base | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
> Need same change in config/rte_config.h for meson build.
Thanks. Just fixed it in v3

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
                       ` (6 preceding siblings ...)
  2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
@ 2019-04-04 13:04     ` Bruce Richardson
  2019-04-04 13:04       ` Bruce Richardson
  2019-04-04 23:07       ` Thomas Monjalon
  7 siblings, 2 replies; 52+ messages in thread
From: Bruce Richardson @ 2019-04-04 13:04 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, thomas, Shreyansh Jain

On Thu, Apr 04, 2019 at 11:50:18AM +0000, Hemant Agrawal wrote:
> The current value is 10, which is not sufficient for many use-cases.
> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
> use-cases. So, making it to 64 to cover various cases.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 13:04     ` [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64 Bruce Richardson
@ 2019-04-04 13:04       ` Bruce Richardson
  2019-04-04 23:07       ` Thomas Monjalon
  1 sibling, 0 replies; 52+ messages in thread
From: Bruce Richardson @ 2019-04-04 13:04 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, thomas, Shreyansh Jain

On Thu, Apr 04, 2019 at 11:50:18AM +0000, Hemant Agrawal wrote:
> The current value is 10, which is not sufficient for many use-cases.
> e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
> use-cases. So, making it to 64 to cover various cases.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 13:04     ` [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64 Bruce Richardson
  2019-04-04 13:04       ` Bruce Richardson
@ 2019-04-04 23:07       ` Thomas Monjalon
  2019-04-04 23:07         ` Thomas Monjalon
  1 sibling, 1 reply; 52+ messages in thread
From: Thomas Monjalon @ 2019-04-04 23:07 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Bruce Richardson, Shreyansh Jain

04/04/2019 15:04, Bruce Richardson:
> On Thu, Apr 04, 2019 at 11:50:18AM +0000, Hemant Agrawal wrote:
> > The current value is 10, which is not sufficient for many use-cases.
> > e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
> > use-cases. So, making it to 64 to cover various cases.
> > 
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64
  2019-04-04 23:07       ` Thomas Monjalon
@ 2019-04-04 23:07         ` Thomas Monjalon
  0 siblings, 0 replies; 52+ messages in thread
From: Thomas Monjalon @ 2019-04-04 23:07 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, Bruce Richardson, Shreyansh Jain

04/04/2019 15:04, Bruce Richardson:
> On Thu, Apr 04, 2019 at 11:50:18AM +0000, Hemant Agrawal wrote:
> > The current value is 10, which is not sufficient for many use-cases.
> > e.g. NXP LX2 with raw qdma devices can use 32-48 raw devices in some
> > use-cases. So, making it to 64 to cover various cases.
> > 
> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied, thanks




^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2019-04-04 23:08 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 12:18 [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
2019-03-26 12:18 ` Hemant Agrawal
2019-03-26 12:18 ` [dpdk-dev] [PATCH 2/5] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
2019-03-26 12:18   ` Hemant Agrawal
2019-03-26 12:18 ` [dpdk-dev] [PATCH 3/5] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
2019-03-26 12:18   ` Hemant Agrawal
2019-03-26 12:18 ` [dpdk-dev] [PATCH 4/5] raw/dpaa2_qdma: add rbp " Hemant Agrawal
2019-03-26 12:18   ` Hemant Agrawal
2019-03-29 13:53   ` Thomas Monjalon
2019-03-29 13:53     ` Thomas Monjalon
2019-03-26 12:18 ` [dpdk-dev] [PATCH 5/5] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
2019-03-26 12:18   ` Hemant Agrawal
2019-03-29 13:53 ` [dpdk-dev] [PATCH 1/5] raw/dpaa2_qdma: remove experimental tag from APIs Thomas Monjalon
2019-03-29 13:53   ` Thomas Monjalon
2019-04-01 14:14   ` Hemant Agrawal
2019-04-01 14:14     ` Hemant Agrawal
2019-04-04 11:04 ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Hemant Agrawal
2019-04-04 11:04   ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:04   ` [dpdk-dev] [PATCH v2 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
2019-04-04 11:04     ` Hemant Agrawal
2019-04-04 11:07   ` [dpdk-dev] [PATCH v2 1/7] config: increase the num of rawdev to be 64 Richardson, Bruce
2019-04-04 11:07     ` Richardson, Bruce
2019-04-04 11:52     ` Hemant Agrawal
2019-04-04 11:52       ` Hemant Agrawal
2019-04-04 11:50   ` [dpdk-dev] [PATCH v3 " Hemant Agrawal
2019-04-04 11:50     ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 2/7] raw/dpaa2_qdma: remove experimental tag from APIs Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 3/7] raw/dpaa2_qdma: fix to support multiprocess execution Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 4/7] raw/dpaa2_qdma: add burst mode support Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 5/7] raw/dpaa2_qdma: add rbp " Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 6/7] raw/dpaa2x: remove rte logs from data path Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 11:50     ` [dpdk-dev] [PATCH v3 7/7] raw/dpaa2_qdma: add support for non prefetch mode Hemant Agrawal
2019-04-04 11:50       ` Hemant Agrawal
2019-04-04 13:04     ` [dpdk-dev] [PATCH v3 1/7] config: increase the num of rawdev to be 64 Bruce Richardson
2019-04-04 13:04       ` Bruce Richardson
2019-04-04 23:07       ` Thomas Monjalon
2019-04-04 23:07         ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).