All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com,
	ferruh.yigit@intel.com
Cc: dev@dpdk.org
Subject: [PATCH v2 1/2] eal/linux: support external Rx interrupt
Date: Tue, 14 Mar 2017 15:03:08 +0200	[thread overview]
Message-ID: <1489496589-26177-2-git-send-email-shahafs@mellanox.com> (raw)
In-Reply-To: <1489496589-26177-1-git-send-email-shahafs@mellanox.com>

Prior to this patch only UIO/VFIO interrupt handlers types were supported.
This patch adds support for the external interrupt handler type, allowing
external drivers to set their own fds with specific interrupt handlers.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c       | 33 ++++++++++++++--------
 .../linuxapp/eal/include/exec-env/rte_interrupts.h |  9 ++++++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map    |  7 +++++
 3 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 92a19cb..c19eb8c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -939,6 +939,8 @@ static __attribute__((noreturn)) void *
 		bytes_read = sizeof(buf.vfio_intr_count);
 		break;
 #endif
+	case RTE_INTR_HANDLE_EXT:
+		return;
 	default:
 		bytes_read = 1;
 		RTE_LOG(INFO, EAL, "unexpected intr type\n");
@@ -1167,6 +1169,24 @@ static __attribute__((noreturn)) void *
 	return rc;
 }
 
+void
+rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle)
+{
+	uint32_t i;
+	struct rte_epoll_event *rev;
+
+	for (i = 0; i < intr_handle->nb_efd; i++) {
+		rev = &intr_handle->elist[i];
+		if (rev->status == RTE_EPOLL_INVALID)
+			continue;
+		if (rte_epoll_ctl(rev->epfd, EPOLL_CTL_DEL, rev->fd, rev)) {
+			/* force free if the entry valid */
+			eal_epoll_data_safe_free(rev);
+			rev->status = RTE_EPOLL_INVALID;
+		}
+	}
+}
+
 int
 rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 {
@@ -1202,19 +1222,8 @@ static __attribute__((noreturn)) void *
 rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
 {
 	uint32_t i;
-	struct rte_epoll_event *rev;
-
-	for (i = 0; i < intr_handle->nb_efd; i++) {
-		rev = &intr_handle->elist[i];
-		if (rev->status == RTE_EPOLL_INVALID)
-			continue;
-		if (rte_epoll_ctl(rev->epfd, EPOLL_CTL_DEL, rev->fd, rev)) {
-			/* force free if the entry valid */
-			eal_epoll_data_safe_free(rev);
-			rev->status = RTE_EPOLL_INVALID;
-		}
-	}
 
+	rte_intr_free_epoll_fd(intr_handle);
 	if (intr_handle->max_intr > intr_handle->nb_efd) {
 		for (i = 0; i < intr_handle->nb_efd; i++)
 			close(intr_handle->efds[i]);
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
index d459bf4..735d307 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
@@ -171,6 +171,15 @@ struct rte_intr_handle {
 		int epfd, int op, unsigned int vec, void *data);
 
 /**
+ * It deletes registered eventfds.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+void
+rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle);
+
+/**
  * It enables the packet I/O interrupt event if it's necessary.
  * It creates event fd for each interrupt vector when MSIX is used,
  * otherwise it multiplexes a single event fd.
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 9c134b4..905d8de 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -186,3 +186,10 @@ DPDK_17.02 {
 	rte_bus_unregister;
 
 } DPDK_16.11;
+
+DPDK_17.05 {
+	global:
+
+	rte_intr_free_epoll_fd;
+
+} DPDK_17.02;
-- 
1.8.3.1

  reply	other threads:[~2017-03-14 13:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 13:57 [PATCH 0/2] net/mlx5 add rxq interrupt support Shahaf Shuler
2017-02-08 13:57 ` [PATCH 1/2] eal_interrupts: support external rxq interrupt handlers Shahaf Shuler
2017-03-09 18:10   ` Thomas Monjalon
2017-03-12  8:30     ` Shahaf Shuler
2017-03-14 12:32       ` Ferruh Yigit
2017-02-08 13:57 ` [PATCH 2/2] net/mlx5: support user space rxq interrupt event Shahaf Shuler
2017-02-09 14:48 ` [PATCH 0/2] net/mlx5 add rxq interrupt support Ferruh Yigit
2017-02-12  7:08   ` Shahaf Shuler
2017-02-21 11:40 ` Shahaf Shuler
2017-02-28  7:29   ` Shahaf Shuler
2017-03-14 13:03 ` [PATCH v2 " Shahaf Shuler
2017-03-14 13:03   ` Shahaf Shuler [this message]
2017-03-14 16:38     ` [PATCH v2 1/2] eal/linux: support external Rx interrupt Yongseok Koh
2017-03-14 18:06       ` Ferruh Yigit
2017-03-14 13:03   ` [PATCH v2 2/2] net/mlx5: support user space rxq interrupt event Shahaf Shuler
2017-03-14 16:39     ` Yongseok Koh

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=1489496589-26177-2-git-send-email-shahafs@mellanox.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=nelio.laranjeiro@6wind.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.