[dpdk-dev,1/2] eal_interrupts: support external rxq interrupt handlers

Message ID 1486562252-15307-2-git-send-email-shahafs@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Shahaf Shuler Feb. 8, 2017, 1:57 p.m. UTC
  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 ++++++
 2 files changed, 30 insertions(+), 12 deletions(-)
  

Comments

Thomas Monjalon March 9, 2017, 6:10 p.m. UTC | #1
2017-02-08 15:57, Shahaf Shuler:
>  /**
> + * It deletes registered eventfds.
> + *
> + * @param intr_handle
> + *   Pointer to the interrupt handle.
> + */
> +void
> +rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle);

This patch looks OK except a miss in the EAL map files for this new function.
The title should be "eal/linux: support external Rx interrupt"

I think this patch should target next-net.
Please Ferruh, take care of this patchset. Thanks
  
Shahaf Shuler March 12, 2017, 8:30 a.m. UTC | #2
Thursday, March 9, 2017 8:10 PM, Thomas Monjalon:
> 2017-02-08 15:57, Shahaf Shuler:
> >  /**
> > + * It deletes registered eventfds.
> > + *
> > + * @param intr_handle
> > + *   Pointer to the interrupt handle.
> > + */
> > +void
> > +rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle);
> 
> This patch looks OK except a miss in the EAL map files for this new function.
> The title should be "eal/linux: support external Rx interrupt"
> 
> I think this patch should target next-net.
> Please Ferruh, take care of this patchset. Thanks

Ferruh, any more comments before submitting a v2?
  
Ferruh Yigit March 14, 2017, 12:32 p.m. UTC | #3
On 3/12/2017 8:30 AM, Shahaf Shuler wrote:
> Thursday, March 9, 2017 8:10 PM, Thomas Monjalon:
>> 2017-02-08 15:57, Shahaf Shuler:
>>>  /**
>>> + * It deletes registered eventfds.
>>> + *
>>> + * @param intr_handle
>>> + *   Pointer to the interrupt handle.
>>> + */
>>> +void
>>> +rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle);
>>
>> This patch looks OK except a miss in the EAL map files for this new function.
>> The title should be "eal/linux: support external Rx interrupt"
>>
>> I think this patch should target next-net.
>> Please Ferruh, take care of this patchset. Thanks
> 
> Ferruh, any more comments before submitting a v2? 

Hi Shahaf,

No extra comments, only second patch does not cleanly apply to next-net,
please rebase it to before sending.

Thanks,
ferruh
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index b5b3f2b..c4465f9 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -937,6 +937,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");
@@ -1165,6 +1167,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)
 {
@@ -1200,19 +1220,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.