DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 5/7] net/dpaa2: add per thread init PMD API
Date: Mon, 19 Jul 2021 19:29:15 +0530	[thread overview]
Message-ID: <20210719135917.26241-6-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20210719135917.26241-1-hemant.agrawal@nxp.com>

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

DPAA2 hardware require a hardware portal context.
If a thread doing DPAA2 i/o do not have portal, it will
allocate it on run-time. This may cause a delay in the
datapath at run-time. To avoid it, it is better to allocate
a hw context portal at the start of thread expected to do
i/o with DPAA2 hardware.

This patch makes necessary changes for the same and creates
a pmd API to allocate a hw context portal for a thread.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 10 +++++-----
 drivers/net/dpaa2/dpaa2_ethdev.c         | 16 ++++++++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2.h        | 10 ++++++++++
 drivers/net/dpaa2/version.map            |  2 ++
 4 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index c224a883ae..1a1e437ed1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -20,7 +20,8 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <sys/epoll.h>
-#include<sys/eventfd.h>
+#include <sys/eventfd.h>
+#include <sys/syscall.h>
 
 #include <rte_mbuf.h>
 #include <ethdev_driver.h>
@@ -168,7 +169,7 @@ dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int cpu_id)
 	fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
 {
 	struct epoll_event epoll_ev;
 	int eventfd, dpio_epoll_fd, ret;
@@ -205,8 +206,6 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 	dpio_dev->epoll_fd = dpio_epoll_fd;
 
-	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_id);
-
 	return 0;
 }
 
@@ -242,10 +241,11 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 
 #ifdef RTE_EVENT_DPAA2
-	if (dpaa2_dpio_intr_init(dpio_dev, cpu_id)) {
+	if (dpaa2_dpio_intr_init(dpio_dev)) {
 		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
 		return -1;
 	}
+	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_id);
 #endif
 
 	return 0;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8b803b8542..d892819a7e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2382,6 +2382,22 @@ dpaa2_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *ops)
 	return 0;
 }
 
+void
+rte_pmd_dpaa2_thread_init(void)
+{
+	int ret;
+
+	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+		ret = dpaa2_affine_qbman_swp();
+		if (ret) {
+			DPAA2_PMD_ERR(
+				"Failed to allocate IO portal, tid: %d\n",
+				rte_gettid());
+			return;
+		}
+	}
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h
index 7204a8f951..84ac9d38d1 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2.h
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h
@@ -84,4 +84,14 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
 			      uint16_t offset,
 			      uint8_t size);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Do thread specific initialization
+ */
+__rte_experimental
+void
+rte_pmd_dpaa2_thread_init(void);
+
 #endif /* _RTE_PMD_DPAA2_H */
diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map
index b50da13bcb..49f69dacd2 100644
--- a/drivers/net/dpaa2/version.map
+++ b/drivers/net/dpaa2/version.map
@@ -6,6 +6,8 @@ EXPERIMENTAL {
 
 	# added in 21.05
 	rte_pmd_dpaa2_mux_rx_frame_len;
+	# added in 21.08
+	rte_pmd_dpaa2_thread_init;
 };
 
 INTERNAL {
-- 
2.17.1


  parent reply	other threads:[~2021-07-19 14:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 13:59 [dpdk-dev] [PATCH 0/7] NXP DPAAx fixes and improvements Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 1/7] bus/dpaa: fix to use right type of memory free Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 2/7] net/dpaa: fix headroom in VSP case Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 3/7] bus/dpaa: reduce syscall usages Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 4/7] net/dpaa: add check for parsing default Rx queue Hemant Agrawal
2021-07-19 13:59 ` Hemant Agrawal [this message]
2021-09-09  7:09   ` [dpdk-dev] [PATCH 5/7] net/dpaa2: add per thread init PMD API Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 6/7] net/dpaa2: add input validation Hemant Agrawal
2021-07-19 13:59 ` [dpdk-dev] [PATCH 7/7] doc: remove SDK info form individual dev guides Hemant Agrawal
2021-07-23 18:34 ` [dpdk-dev] [PATCH 0/7] NXP DPAAx fixes and improvements 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=20210719135917.26241-6-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=nipun.gupta@nxp.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).