eal/linux: support external Rx interrupt
authorShahaf Shuler <shahafs@mellanox.com>
Tue, 14 Mar 2017 13:03:08 +0000 (15:03 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 16:59:39 +0000 (18:59 +0200)
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>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
lib/librte_eal/linuxapp/eal/eal_interrupts.c
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
lib/librte_eal/linuxapp/eal/rte_eal_version.map

index 029a147..b25a5f8 100644 (file)
@@ -942,6 +942,8 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
                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");
@@ -1170,6 +1172,24 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,
        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)
 {
@@ -1205,19 +1225,8 @@ 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]);
index d459bf4..735d307 100644 (file)
@@ -170,6 +170,15 @@ int
 rte_intr_rx_ctl(struct rte_intr_handle *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,
index 9c134b4..905d8de 100644 (file)
@@ -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;