eal/linux: only call iopl on x86
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_interrupts.c
index 8758239..a9af396 100644 (file)
@@ -45,6 +45,7 @@
 #include <sys/signalfd.h>
 #include <sys/ioctl.h>
 #include <sys/eventfd.h>
+#include <assert.h>
 
 #include <rte_common.h>
 #include <rte_interrupts.h>
 #include <rte_lcore.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
-#include <rte_ring.h>
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_mempool.h>
 #include <rte_pci.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
@@ -886,7 +885,7 @@ rte_eal_intr_init(void)
                /* Set thread_name for aid in debugging. */
                snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
                        "eal-intr-thread");
-               ret_1 = pthread_setname_np(intr_thread, thread_name);
+               ret_1 = rte_thread_setname(intr_thread, thread_name);
                if (ret_1 != 0)
                        RTE_LOG(ERR, EAL,
                        "Failed to set thread name for interrupt handling\n");
@@ -900,6 +899,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 {
        union rte_intr_read_buffer buf;
        int bytes_read = 1;
+       int nbytes;
 
        switch (intr_handle->type) {
        case RTE_INTR_HANDLE_UIO:
@@ -924,15 +924,15 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
         * for epoll_wait.
         */
        do {
-               bytes_read = read(fd, &buf, bytes_read);
-               if (bytes_read < 0) {
+               nbytes = read(fd, &buf, bytes_read);
+               if (nbytes < 0) {
                        if (errno == EINTR || errno == EWOULDBLOCK ||
                            errno == EAGAIN)
                                continue;
                        RTE_LOG(ERR, EAL,
                                "Error reading from fd %d: %s\n",
                                fd, strerror(errno));
-               } else if (bytes_read == 0)
+               } else if (nbytes == 0)
                        RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd);
                return;
        } while (1);
@@ -1148,6 +1148,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
        int fd;
        uint32_t n = RTE_MIN(nb_efd, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID);
 
+       assert(nb_efd != 0);
+
        if (intr_handle->type == RTE_INTR_HANDLE_VFIO_MSIX) {
                for (i = 0; i < n; i++) {
                        fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
@@ -1204,5 +1206,17 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
 int
 rte_intr_allow_others(struct rte_intr_handle *intr_handle)
 {
-       return !!(intr_handle->max_intr - intr_handle->nb_efd);
+       if (!rte_intr_dp_is_en(intr_handle))
+               return 1;
+       else
+               return !!(intr_handle->max_intr - intr_handle->nb_efd);
+}
+
+int
+rte_intr_cap_multiple(struct rte_intr_handle *intr_handle)
+{
+       if (intr_handle->type == RTE_INTR_HANDLE_VFIO_MSIX)
+               return 1;
+
+       return 0;
 }