DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: shreyansh.jain@nxp.com, thomas@monjalon.net, hemant.agrawal@nxp.com
Cc: dev@dpdk.org, Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 3/7 v3] bus/fslmc: keep Tx queues information for DPCI devices too
Date: Thu, 26 Apr 2018 15:44:52 +0530	[thread overview]
Message-ID: <1524737696-3145-4-git-send-email-nipun.gupta@nxp.com> (raw)
In-Reply-To: <1524737696-3145-1-git-send-email-nipun.gupta@nxp.com>

The DPCI devices have oth Tx and Rx queues. Event devices use
DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues.
This patch enables Tx queues configuration too.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 +++++++++++++++++++++++---------
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  3 +-
 drivers/event/dpaa2/dpaa2_eventdev.c     | 10 ++--
 3 files changed, 70 insertions(+), 29 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
index aee870a..5ad0374 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c
@@ -39,13 +39,14 @@
 	struct dpci_attr attr;
 	struct dpci_rx_queue_cfg rx_queue_cfg;
 	struct dpci_rx_queue_attr rx_attr;
+	struct dpci_tx_queue_attr tx_attr;
 	int ret, i;
 
 	/* Allocate DPAA2 dpci handle */
 	dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0);
 	if (!dpci_node) {
 		DPAA2_BUS_ERR("Memory allocation failed for DPCI Device");
-		return -1;
+		return -ENOMEM;
 	}
 
 	/* Open the dpci object */
@@ -54,8 +55,7 @@
 			CMD_PRI_LOW, dpci_id, &dpci_node->token);
 	if (ret) {
 		DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret);
-		rte_free(dpci_node);
-		return -1;
+		goto err;
 	}
 
 	/* Get the device attributes */
@@ -63,21 +63,40 @@
 				  CMD_PRI_LOW, dpci_node->token, &attr);
 	if (ret != 0) {
 		DPAA2_BUS_ERR("Reading device failed with err code: %d", ret);
-		rte_free(dpci_node);
-		return -1;
+		goto err;
 	}
 
-	/* Set up the Rx Queue */
-	memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg));
-	ret = dpci_set_rx_queue(&dpci_node->dpci,
-				CMD_PRI_LOW,
-				dpci_node->token,
-				0, &rx_queue_cfg);
-	if (ret) {
-		DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d",
-			      ret);
-		rte_free(dpci_node);
-		return -1;
+	for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
+		struct dpaa2_queue *rxq;
+
+		memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg));
+		ret = dpci_set_rx_queue(&dpci_node->dpci,
+					CMD_PRI_LOW,
+					dpci_node->token,
+					i, &rx_queue_cfg);
+		if (ret) {
+			DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d",
+				      ret);
+			goto err;
+		}
+
+		/* Allocate DQ storage for the DPCI Rx queues */
+		rxq = &(dpci_node->rx_queue[i]);
+		rxq->q_storage = rte_malloc("dq_storage",
+					sizeof(struct queue_storage_info_t),
+					RTE_CACHE_LINE_SIZE);
+		if (!rxq->q_storage) {
+			DPAA2_BUS_ERR("q_storage allocation failed\n");
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t));
+		ret = dpaa2_alloc_dq_storage(rxq->q_storage);
+		if (ret) {
+			DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n");
+			goto err;
+		}
 	}
 
 	/* Enable the device */
@@ -85,8 +104,7 @@
 			  CMD_PRI_LOW, dpci_node->token);
 	if (ret != 0) {
 		DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret);
-		rte_free(dpci_node);
-		return -1;
+		goto err;
 	}
 
 	for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
@@ -96,13 +114,22 @@
 					dpci_node->token, i,
 					&rx_attr);
 		if (ret != 0) {
-			DPAA2_BUS_ERR("Rx queue fetch failed with err code:"
-				      " %d", ret);
-			rte_free(dpci_node);
-			return -1;
+			DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d",
+				      ret);
+			goto err;
 		}
+		dpci_node->rx_queue[i].fqid = rx_attr.fqid;
 
-		dpci_node->queue[i].fqid = rx_attr.fqid;
+		ret = dpci_get_tx_queue(&dpci_node->dpci,
+					CMD_PRI_LOW,
+					dpci_node->token, i,
+					&tx_attr);
+		if (ret != 0) {
+			DPAA2_BUS_ERR("Reading device failed with err code: %d",
+				      ret);
+			goto err;
+		}
+		dpci_node->tx_queue[i].fqid = tx_attr.fqid;
 	}
 
 	dpci_node->dpci_id = dpci_id;
@@ -111,6 +138,19 @@
 	TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next);
 
 	return 0;
+
+err:
+	for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) {
+		struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]);
+
+		if (rxq->q_storage) {
+			dpaa2_free_dq_storage(rxq->q_storage);
+			rte_free(rxq->q_storage);
+		}
+	}
+	rte_free(dpci_node);
+
+	return ret;
 }
 
 struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void)
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 8fd4ef9..fba8f54 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -142,7 +142,8 @@ struct dpaa2_dpci_dev {
 	uint16_t token;
 	rte_atomic16_t in_use;
 	uint32_t dpci_id; /*HW ID for DPCI object */
-	struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES];
+	struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES];
+	struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
 };
 
 /*! Global MCP list */
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index f50bb8d..0199d66 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -87,10 +87,10 @@
 			const struct rte_event *event = &ev[num_tx + loop];
 
 			if (event->sched_type != RTE_SCHED_TYPE_ATOMIC)
-				fqid = evq_info->dpci->queue[
+				fqid = evq_info->dpci->rx_queue[
 					DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid;
 			else
-				fqid = evq_info->dpci->queue[
+				fqid = evq_info->dpci->rx_queue[
 					DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid;
 
 			/* Prepare enqueue descriptor */
@@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id;
 	rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO;
 
-	dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb =
+	dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb =
 		dpaa2_eventdev_process_parallel;
-	dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb =
+	dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb =
 		dpaa2_eventdev_process_atomic;
 
 	for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
-		rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]);
+		rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]);
 		ret = dpci_set_rx_queue(&dpci_dev->dpci,
 					CMD_PRI_LOW,
 					dpci_dev->token, i,
-- 
1.9.1

  parent reply	other threads:[~2018-04-26 10:15 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22  9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-02-22 13:12   ` Shreyansh Jain
2018-02-23  6:35     ` Nipun Gupta
2018-02-22 14:31   ` Jerin Jacob
2018-02-23  6:35     ` Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-02-22  9:34 ` [dpdk-dev] [PATCH 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta
2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta
2018-04-07 14:33   ` [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-04-07 14:33   ` [dpdk-dev] [PATCH v2 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-04-07 14:33   ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta
2018-04-25  1:47     ` Shreyansh Jain
2018-04-25  3:53     ` Shreyansh Jain
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-04-25  4:18     ` Shreyansh Jain
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-04-16 12:40     ` Hemant Agrawal
2018-04-07 14:34   ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta
2018-04-23 12:23     ` Kovacevic, Marko
2018-04-25  1:50     ` Shreyansh Jain
2018-04-07 14:43   ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta
2018-04-26 10:14   ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta
2018-04-26 10:14     ` [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-04-26 10:14     ` [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-05-01  9:45       ` Shreyansh Jain
2018-04-26 10:14     ` Nipun Gupta [this message]
2018-04-26 10:14     ` [dpdk-dev] [PATCH 4/7 v3] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-04-26 10:14     ` [dpdk-dev] [PATCH 5/7 v3] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-04-26 10:14     ` [dpdk-dev] [PATCH 6/7 v3] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-04-26 10:14     ` [dpdk-dev] [PATCH 7/7 v3] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-05-01  9:45     ` [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver Shreyansh Jain
2018-05-02 17:15     ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-05-03 13:49         ` Shreyansh Jain
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-05-03 14:10         ` Shreyansh Jain
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-05-02 17:15       ` [dpdk-dev] [PATCH v4 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-05-03 16:33       ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-05-03 16:33         ` [dpdk-dev] [PATCH v5 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-05-04  7:15         ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta
2018-05-04 10:11         ` [dpdk-dev] [PATCH v6 " Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta
2018-05-04 10:11           ` [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta
2018-05-08 12:08             ` Thomas Monjalon
2018-05-05 18:44           ` [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver Shreyansh Jain
2018-05-08 12:27             ` Thomas Monjalon

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=1524737696-3145-4-git-send-email-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=shreyansh.jain@nxp.com \
    --cc=thomas@monjalon.net \
    /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).