From: Kevin Traynor <ktraynor@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com,
dsosnowski@nvidia.com, viacheslavo@nvidia.com,
hkalra@marvell.com, Kevin Traynor <ktraynor@redhat.com>
Subject: [PATCH v4 2/3] eal/interrupt: add interrupt event info
Date: Thu, 19 Feb 2026 14:38:51 +0000 [thread overview]
Message-ID: <20260219143852.200722-3-ktraynor@redhat.com> (raw)
In-Reply-To: <20260219143852.200722-1-ktraynor@redhat.com>
Add RTE_INTR_EVENT_* defines and a new API rte_intr_active_events()
in order to retrieve them.
As the events are in the context of the current interrupt,
rte_intr_active_events() must be called from the context of
an interrupt callback.
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
lib/eal/freebsd/eal_interrupts.c | 7 +++++++
lib/eal/include/rte_interrupts.h | 23 +++++++++++++++++++++++
lib/eal/linux/eal_interrupts.c | 31 ++++++++++++++++++++++++++++++-
lib/eal/windows/eal_interrupts.c | 7 +++++++
4 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 5c3ab6699e..aa0bd50009 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -769,2 +769,9 @@ int rte_thread_is_intr(void)
return rte_thread_equal(intr_thread, rte_thread_self());
}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_intr_active_events, 26.03)
+uint32_t
+rte_intr_active_events(void)
+{
+ return 0;
+}
diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h
index 1b9a0b2a78..bff4f98f85 100644
--- a/lib/eal/include/rte_interrupts.h
+++ b/lib/eal/include/rte_interrupts.h
@@ -40,4 +40,10 @@ struct rte_intr_handle;
#define RTE_INTR_VEC_RXTX_OFFSET 1
+/** Interrupt event flags returned by rte_intr_active_events() */
+#define RTE_INTR_EVENT_IN (1 << 0) /**< Data available to read */
+#define RTE_INTR_EVENT_ERR (1 << 1) /**< Error condition on fd */
+#define RTE_INTR_EVENT_HUP (1 << 2) /**< Hang up / disconnect */
+#define RTE_INTR_EVENT_RDHUP (1 << 3) /**< Read Hang up / disconnect */
+
/**
* The interrupt source type, e.g. UIO, VFIO, ALARM etc.
@@ -197,4 +203,21 @@ int rte_intr_ack(const struct rte_intr_handle *intr_handle);
int rte_thread_is_intr(void);
+/**
+ * Return the event flags for the interrupt currently being processed.
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Must be called from an interrupt callback running on the EAL
+ * interrupt thread. The returned value is a bitmask of
+ * RTE_INTR_EVENT_* flags.
+ *
+ * @return
+ * Active event flags, or 0 if not in interrupt context or
+ * on platforms that do not support this feature.
+ */
+__rte_experimental
+uint32_t rte_intr_active_events(void);
+
/**
* It allocates memory for interrupt instance. API takes flag as an argument
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index f3f6bdd01d..43493aa299 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -41,4 +41,6 @@
static RTE_DEFINE_PER_LCORE(int, _epfd) = -1; /**< epoll fd per thread */
+static uint32_t active_events; /**< events for active interrupt */
+
/**
* union for pipe fds.
@@ -887,4 +889,20 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)
}
+static uint32_t
+epoll_to_intr_events(uint32_t epoll_events)
+{
+ uint32_t ev = 0;
+
+ if (epoll_events & EPOLLIN)
+ ev |= RTE_INTR_EVENT_IN;
+ if (epoll_events & EPOLLERR)
+ ev |= RTE_INTR_EVENT_ERR;
+ if (epoll_events & EPOLLHUP)
+ ev |= RTE_INTR_EVENT_HUP;
+ if (epoll_events & EPOLLRDHUP)
+ ev |= RTE_INTR_EVENT_RDHUP;
+ return ev;
+}
+
static void
eal_intr_source_remove_and_free(struct rte_intr_source *src)
@@ -1014,5 +1032,5 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
if (call) {
-
+ active_events = epoll_to_intr_events(events[n].events);
/* Finally, call all callbacks. */
TAILQ_FOREACH(cb, &src->callbacks, next) {
@@ -1028,4 +1046,5 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
rte_spinlock_lock(&intr_lock);
}
+ active_events = 0;
}
/* we done with that interrupt source, release it. */
@@ -1642,2 +1661,12 @@ int rte_thread_is_intr(void)
return rte_thread_equal(intr_thread, rte_thread_self());
}
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_intr_active_events, 26.03)
+uint32_t
+rte_intr_active_events(void)
+{
+ if (rte_thread_is_intr())
+ return active_events;
+
+ return 0;
+}
diff --git a/lib/eal/windows/eal_interrupts.c b/lib/eal/windows/eal_interrupts.c
index 5ff30c7631..1c7700eca2 100644
--- a/lib/eal/windows/eal_interrupts.c
+++ b/lib/eal/windows/eal_interrupts.c
@@ -117,4 +117,11 @@ rte_thread_is_intr(void)
}
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_intr_active_events, 26.03)
+uint32_t
+rte_intr_active_events(void)
+{
+ return 0;
+}
+
RTE_EXPORT_INTERNAL_SYMBOL(rte_intr_rx_ctl)
int
--
2.53.0
next prev parent reply other threads:[~2026-02-19 14:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 12:20 [PATCH] eal/linux: handle epoll error conditions Kevin Traynor
2026-01-29 12:51 ` Kevin Traynor
2026-02-06 17:20 ` [PATCH v2 0/2] interrupt epoll event handling Kevin Traynor
2026-02-06 17:20 ` [PATCH v2 1/2] net/mlx5: check for no data read in devx interrupt Kevin Traynor
2026-02-07 6:09 ` Stephen Hemminger
2026-02-10 15:05 ` Kevin Traynor
2026-02-10 17:05 ` Slava Ovsiienko
2026-02-10 19:07 ` Kevin Traynor
2026-02-10 20:58 ` Slava Ovsiienko
2026-02-19 14:44 ` Kevin Traynor
2026-02-06 17:20 ` [PATCH v2 2/2] eal/linux: handle interrupt epoll events Kevin Traynor
2026-02-07 6:11 ` Stephen Hemminger
2026-02-10 13:35 ` Kevin Traynor
2026-02-10 9:17 ` David Marchand
2026-02-10 14:47 ` Kevin Traynor
2026-02-10 18:06 ` [PATCH v3 0/2] interrupt epoll event handling Kevin Traynor
2026-02-10 18:06 ` [PATCH v3 1/2] net/mlx5: check for no data read in devx interrupt Kevin Traynor
2026-02-10 18:06 ` [PATCH v3 2/2] eal/linux: handle interrupt epoll events Kevin Traynor
2026-02-19 14:37 ` [PATCH v4 0/3] interrupt disconnect/error event handling Kevin Traynor
2026-02-19 14:38 ` Kevin Traynor
2026-02-19 14:38 ` [PATCH v4 1/3] eal/linux: handle interrupt epoll events Kevin Traynor
2026-02-19 14:38 ` Kevin Traynor [this message]
2026-02-26 15:41 ` [PATCH v4 2/3] eal/interrupt: add interrupt event info David Marchand
2026-03-02 11:47 ` Kevin Traynor
2026-02-19 14:38 ` [PATCH v4 3/3] net/mlx5: check devx disconnect/error interrupt events Kevin Traynor
2026-03-03 16:16 ` Slava Ovsiienko
2026-02-19 18:52 ` [PATCH v4 0/3] interrupt disconnect/error event handling Stephen Hemminger
2026-03-02 11:41 ` Kevin Traynor
2026-03-03 18:58 ` [PATCH v5 " Kevin Traynor
2026-03-03 18:58 ` [PATCH v5 1/3] eal/linux: handle interrupt epoll events Kevin Traynor
2026-03-03 18:58 ` [PATCH v5 2/3] eal/interrupt: add interrupt event info Kevin Traynor
2026-03-03 18:58 ` [PATCH v5 3/3] net/mlx5: check devx disconnect/error interrupt events Kevin Traynor
2026-03-04 11:09 ` [PATCH v5 0/3] interrupt disconnect/error event handling David Marchand
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=20260219143852.200722-3-ktraynor@redhat.com \
--to=ktraynor@redhat.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=hkalra@marvell.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.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