DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: <jerin.jacob@caviumnetworks.com>
Cc: <dev@dpdk.org>, <hemant.agrawal@nxp.com>,
	Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 4/6 v3] event/dpaa2: have separate structure to hold dqrr entries
Date: Wed, 17 Jan 2018 17:09:12 +0530	[thread overview]
Message-ID: <1516189154-28331-5-git-send-email-nipun.gupta@nxp.com> (raw)
In-Reply-To: <1516189154-28331-1-git-send-email-nipun.gupta@nxp.com>

This patch provides cleaner approach to store the DQRR entries,
which are yet to be consumed in case of atomic queues.

Also, this patch changes the storage of the DQRR entry index
into the mbuf->seqn instead of ev->opaque

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c               |  2 ++
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     |  2 --
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  1 +
 drivers/bus/fslmc/rte_fslmc.h               | 18 ++++++++++++++++++
 drivers/event/dpaa2/dpaa2_eventdev.c        | 25 +++++++++++++------------
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h    |  2 ++
 6 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index acc275a..8fe08f6 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -35,6 +35,8 @@
 	return rte_fslmc_bus.device_count[device_type];
 }
 
+RTE_DEFINE_PER_LCORE(struct dpaa2_portal_dqrr, dpaa2_held_bufs);
+
 static void
 cleanup_fslmc_device_list(void)
 {
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 2e79399..46f1e75 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -79,8 +79,6 @@ struct dpaa2_dpio_dev {
 	struct rte_intr_handle intr_handle; /* Interrupt related info */
 	int32_t	epoll_fd; /**< File descriptor created for interrupt polling */
 	int32_t hw_id; /**< An unique ID of this DPIO device instance */
-	uint64_t dqrr_held;
-	uint8_t dqrr_size;
 };
 
 struct dpaa2_dpbp_dev {
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index b9dd063..09ec05f 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -95,6 +95,7 @@ DPDK_18.02 {
 
 	dpaa2_svr_family;
 	dpaa2_virt_mode;
+	per_lcore_dpaa2_held_bufs;
 	qbman_fq_query_state;
 	qbman_fq_state_frame_count;
 	qbman_swp_dqrr_idx_consume;
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index c447b06..69d0fec 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -129,6 +129,24 @@ struct rte_fslmc_bus {
 				/**< Count of all devices scanned */
 };
 
+#define DPAA2_PORTAL_DEQUEUE_DEPTH	32
+
+/* Create storage for dqrr entries per lcore */
+struct dpaa2_portal_dqrr {
+	struct rte_mbuf *mbuf[DPAA2_PORTAL_DEQUEUE_DEPTH];
+	uint64_t dqrr_held;
+	uint8_t dqrr_size;
+};
+
+RTE_DECLARE_PER_LCORE(struct dpaa2_portal_dqrr, dpaa2_held_bufs);
+
+#define DPAA2_PER_LCORE_DQRR_SIZE \
+	RTE_PER_LCORE(dpaa2_held_bufs).dqrr_size
+#define DPAA2_PER_LCORE_DQRR_HELD \
+	RTE_PER_LCORE(dpaa2_held_bufs).dqrr_held
+#define DPAA2_PER_LCORE_DQRR_MBUF(i) \
+	RTE_PER_LCORE(dpaa2_held_bufs).mbuf[i]
+
 /**
  * Register a DPAA2 driver.
  *
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 65c2c7a..88dd930 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -99,13 +99,13 @@
 			qbman_eq_desc_set_no_orp(&eqdesc[loop], 0);
 			qbman_eq_desc_set_response(&eqdesc[loop], 0, 0);
 
-			if (event->impl_opaque) {
-				uint8_t dqrr_index = event->impl_opaque - 1;
+			if (event->mbuf->seqn) {
+				uint8_t dqrr_index = event->mbuf->seqn - 1;
 
 				qbman_eq_desc_set_dca(&eqdesc[loop], 1,
 						      dqrr_index, 0);
-				DPAA2_PER_LCORE_DPIO->dqrr_size--;
-				DPAA2_PER_LCORE_DPIO->dqrr_held &=
+				DPAA2_PER_LCORE_DQRR_SIZE--;
+				DPAA2_PER_LCORE_DQRR_HELD &=
 					~(1 << dqrr_index);
 			}
 
@@ -207,9 +207,9 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
-	ev->impl_opaque = dqrr_index + 1;
-	DPAA2_PER_LCORE_DPIO->dqrr_size++;
-	DPAA2_PER_LCORE_DPIO->dqrr_held |= 1 << dqrr_index;
+	ev->mbuf->seqn = dqrr_index + 1;
+	DPAA2_PER_LCORE_DQRR_SIZE++;
+	DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
 }
 
 static uint16_t
@@ -231,18 +231,19 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 			return 0;
 		}
 	}
-
 	swp = DPAA2_PER_LCORE_PORTAL;
 
 	/* Check if there are atomic contexts to be released */
-	while (DPAA2_PER_LCORE_DPIO->dqrr_size) {
-		if (DPAA2_PER_LCORE_DPIO->dqrr_held & (1 << i)) {
+	while (DPAA2_PER_LCORE_DQRR_SIZE) {
+		if (DPAA2_PER_LCORE_DQRR_HELD & (1 << i)) {
 			qbman_swp_dqrr_idx_consume(swp, i);
-			DPAA2_PER_LCORE_DPIO->dqrr_size--;
+			DPAA2_PER_LCORE_DQRR_SIZE--;
+			DPAA2_PER_LCORE_DQRR_MBUF(i)->seqn =
+				DPAA2_INVALID_MBUF_SEQN;
 		}
 		i++;
 	}
-	DPAA2_PER_LCORE_DPIO->dqrr_held = 0;
+	DPAA2_PER_LCORE_DQRR_HELD = 0;
 
 	do {
 		dq = qbman_swp_dqrr_next(swp);
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
index 3390d67..4d34687 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
@@ -10,6 +10,8 @@
 
 #define DPAA2_MAX_BUF_POOLS	8
 
+#define DPAA2_INVALID_MBUF_SEQN	0
+
 struct buf_pool_cfg {
 	void *addr;
 	/**< The address from where DPAA2 will carve out the buffers */
-- 
1.9.1

  parent reply	other threads:[~2018-01-17  5:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 21:22 [dpdk-dev] [PATCH 0/6 v2] support atomic queues in dpaa2 ethernet with eventdev Nipun Gupta
2018-01-12 21:22 ` [dpdk-dev] [PATCH 1/6 v2] event/dpaa2: replace static with dynamic logging Nipun Gupta
2018-01-12 15:29   ` Hemant Agrawal
2018-01-17  3:50     ` Nipun Gupta
2018-01-18  6:37     ` Jerin Jacob
2018-01-12 21:22 ` [dpdk-dev] [PATCH 2/6 v2] bus/fslmc: introduce API to consume dqrr using index Nipun Gupta
2018-01-12 21:22 ` [dpdk-dev] [PATCH 3/6 v2] event/dpaa2: use dqrr index to cosume the DQRR entry Nipun Gupta
2018-01-12 21:22 ` [dpdk-dev] [PATCH 4/6 v2] event/dpaa2: have separate structure to hold dqrr entries Nipun Gupta
2018-01-12 21:23 ` [dpdk-dev] [PATCH 5/6 v2] bus/fslmc: add flag to configure DCA in QBMAN multi Tx Nipun Gupta
2018-01-12 21:23 ` [dpdk-dev] [PATCH 6/6 v2] net/dpaa2: support atomic queues Nipun Gupta
2018-01-17 11:39 ` [dpdk-dev] [PATCH 0/6 v3] support atomic queues in dpaa2 ethernet with eventdev Nipun Gupta
2018-01-17 11:39   ` [dpdk-dev] [PATCH 1/6 v3] event/dpaa2: replace static with dynamic logging Nipun Gupta
2018-01-17 11:39   ` [dpdk-dev] [PATCH 2/6 v3] bus/fslmc: introduce API to consume dqrr using index Nipun Gupta
2018-01-17 11:39   ` [dpdk-dev] [PATCH 3/6 v3] event/dpaa2: use dqrr index to cosume the DQRR entry Nipun Gupta
2018-01-17 11:39   ` Nipun Gupta [this message]
2018-01-17 11:39   ` [dpdk-dev] [PATCH 5/6 v3] bus/fslmc: add flag to configure DCA in QBMAN multi Tx Nipun Gupta
2018-01-17 11:39   ` [dpdk-dev] [PATCH 6/6 v3] net/dpaa2: support atomic queues Nipun Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516189154-28331-5-git-send-email-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).