DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Leroy <maxime@leroys.fr>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, sachin.saxena@nxp.com,
	david.marchand@redhat.com, Maxime Leroy <maxime@leroys.fr>
Subject: [PATCH v3 3/6] bus/fslmc/dpio: make the portal DQRI epoll optional
Date: Tue, 30 Jun 2026 16:43:26 +0200	[thread overview]
Message-ID: <20260630144329.457643-4-maxime@leroys.fr> (raw)
In-Reply-To: <20260630144329.457643-1-maxime@leroys.fr>

dpaa2_dpio_intr_init() builds a private epoll instance the event PMD
sleeps on. The upcoming net rx-queue-interrupt path waits on the
application's own epoll instead, so that instance would be built but
never used.

Add a build_epoll parameter: pass true to build it (event PMD), false
to skip the epoll_create/epoll_ctl. epoll_fd is set to -1 when none is
built and closed in intr_deinit only when valid. The sole caller passes
true: no functional change.

Signed-off-by: Maxime Leroy <maxime@leroys.fr>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 40 +++++++++++++++++-------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 2a9e519668..f0b843e3a3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -205,13 +205,12 @@ 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)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, bool build_epoll)
 {
 	struct epoll_event epoll_ev;
 	int eventfd, dpio_epoll_fd, ret;
 	int threshold = 0x3, timeout = 0xFF;
 
-	dpio_epoll_fd = epoll_create(1);
 	ret = rte_dpaa2_intr_enable(dpio_dev->intr_handle, 0);
 	if (ret) {
 		DPAA2_BUS_ERR("Interrupt registration failed");
@@ -231,16 +230,30 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
 	qbman_swp_dqrr_thrshld_write(dpio_dev->sw_portal, threshold);
 	qbman_swp_intr_timeout_write(dpio_dev->sw_portal, timeout);
 
-	eventfd = rte_intr_fd_get(dpio_dev->intr_handle);
-	epoll_ev.events = EPOLLIN | EPOLLPRI | EPOLLET;
-	epoll_ev.data.fd = eventfd;
+	dpio_dev->epoll_fd = -1;
 
-	ret = epoll_ctl(dpio_epoll_fd, EPOLL_CTL_ADD, eventfd, &epoll_ev);
-	if (ret < 0) {
-		DPAA2_BUS_ERR("epoll_ctl failed");
-		return -1;
+	/* private epoll for the event PMD; the net rx-intr path uses the app's */
+	if (build_epoll) {
+		dpio_epoll_fd = epoll_create1(EPOLL_CLOEXEC);
+		if (dpio_epoll_fd < 0) {
+			DPAA2_BUS_ERR("epoll_create failed");
+			rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
+			return -1;
+		}
+
+		eventfd = rte_intr_fd_get(dpio_dev->intr_handle);
+		epoll_ev.events = EPOLLIN | EPOLLPRI | EPOLLET;
+		epoll_ev.data.fd = eventfd;
+
+		ret = epoll_ctl(dpio_epoll_fd, EPOLL_CTL_ADD, eventfd, &epoll_ev);
+		if (ret < 0) {
+			DPAA2_BUS_ERR("epoll_ctl failed");
+			rte_dpaa2_intr_disable(dpio_dev->intr_handle, 0);
+			close(dpio_epoll_fd);
+			return -1;
+		}
+		dpio_dev->epoll_fd = dpio_epoll_fd;
 	}
-	dpio_dev->epoll_fd = dpio_epoll_fd;
 
 	return 0;
 }
@@ -253,7 +266,10 @@ static void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev)
 	if (ret)
 		DPAA2_BUS_ERR("DPIO interrupt disable failed");
 
-	close(dpio_dev->epoll_fd);
+	if (dpio_dev->epoll_fd >= 0) {
+		close(dpio_dev->epoll_fd);
+		dpio_dev->epoll_fd = -1;
+	}
 }
 #endif
 
@@ -277,7 +293,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 
 #ifdef RTE_EVENT_DPAA2
-	if (dpaa2_dpio_intr_init(dpio_dev)) {
+	if (dpaa2_dpio_intr_init(dpio_dev, true)) {
 		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
 		return -1;
 	}
-- 
2.43.0


  parent reply	other threads:[~2026-06-30 14:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 15:49 [PATCH 0/9] net/dpaa2: NAPI-style Rx queue interrupts Maxime Leroy
2026-06-11 15:49 ` [PATCH 1/9] net/dpaa2: implement RSS RETA query and update Maxime Leroy
2026-06-11 15:49 ` [PATCH 2/9] eal/interrupts: keep real errno on epoll error Maxime Leroy
2026-06-16  8:02   ` David Marchand
2026-06-16  9:29     ` David Marchand
2026-06-11 15:49 ` [PATCH 3/9] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-11 15:49 ` [PATCH 4/9] bus/fslmc/dpio: make the portal DQRI epoll optional Maxime Leroy
2026-06-11 15:49 ` [PATCH 5/9] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-06-16  8:05   ` David Marchand
2026-06-11 15:49 ` [PATCH 6/9] bus/fslmc/dpio: tune DQRI interrupt coalescing holdoff Maxime Leroy
2026-06-11 15:49 ` [PATCH 7/9] net/dpaa2: fix Rx queue count for primary process Maxime Leroy
2026-06-11 15:49 ` [PATCH 8/9] ethdev: keep fast-path ops valid after port stop Maxime Leroy
2026-06-11 16:01   ` Morten Brørup
2026-06-11 18:39     ` Maxime Leroy
2026-06-12 15:00       ` Thomas Monjalon
2026-06-14 19:30   ` Stephen Hemminger
2026-06-15  9:26   ` David Marchand
2026-06-16  9:23     ` Maxime Leroy
2026-06-16  9:33       ` David Marchand
2026-06-11 15:49 ` [PATCH 9/9] net/dpaa2: drop the fake software VLAN strip offload Maxime Leroy
2026-06-11 15:56   ` Morten Brørup
2026-06-11 16:13     ` Morten Brørup
2026-06-11 16:58     ` Maxime Leroy
2026-06-11 17:30   ` Stephen Hemminger
2026-06-12  5:42     ` Maxime Leroy
2026-06-16 10:27 ` [PATCH v2 0/6] net/dpaa2: NAPI-style Rx queue interrupts Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 1/6] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 2/6] bus/fslmc/dpio: make the portal DQRI epoll optional Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 3/6] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-06-18  8:46     ` David Marchand
2026-06-16 10:27   ` [PATCH v2 4/6] bus/fslmc/dpio: tune DQRI interrupt coalescing holdoff Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 5/6] net/dpaa2: fix Rx queue count for primary process Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 6/6] net/dpaa2: drop the fake software VLAN strip offload Maxime Leroy
2026-06-16 14:11     ` Stephen Hemminger
2026-06-16 15:40       ` Hemant Agrawal
2026-06-21  4:33   ` [PATCH v2 0/6] net/dpaa2: NAPI-style Rx queue interrupts Hemant Agrawal
2026-06-29 13:13     ` Maxime Leroy
2026-06-30 14:43   ` [PATCH v3 " Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 1/6] event/dpaa2: disable channel before closing it Maxime Leroy
2026-07-03 17:21       ` Hemant Agrawal
2026-07-06  9:11         ` Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 2/6] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-30 14:43     ` Maxime Leroy [this message]
2026-06-30 14:43     ` [PATCH v3 4/6] bus/fslmc/mc: implement dpcon_set_notification Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 5/6] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-07-03 17:21       ` Hemant Agrawal
2026-07-06 10:36         ` Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 6/6] net/dpaa2: pin Rx queue interrupt to the polling core Maxime Leroy
2026-07-03 16:03     ` [PATCH v3 0/6] net/dpaa2: NAPI-style Rx queue interrupts Stephen Hemminger
2026-07-03 18:56       ` Maxime Leroy
2026-07-03 20:26         ` Stephen Hemminger

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=20260630144329.457643-4-maxime@leroys.fr \
    --to=maxime@leroys.fr \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@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