eal: allow external interrupt handler

Add RTE_INTR_HANDLE_EXT handler type for PMDs that do not support VFIO or
UIO.  Those are expected to manage the file descriptor themselves.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
Nelio Laranjeiro 2015-10-30 19:57:21 +01:00 committed by Thomas Monjalon
parent 1ca601d160
commit 67624fc054
2 changed files with 19 additions and 14 deletions

View File

@ -691,26 +691,30 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
bytes_read = sizeof(buf.vfio_intr_count);
break;
#endif
case RTE_INTR_HANDLE_EXT:
default:
bytes_read = 1;
break;
}
/**
* read out to clear the ready-to-be-read flag
* for epoll_wait.
*/
bytes_read = read(events[n].data.fd, &buf, bytes_read);
if (bytes_read < 0) {
if (errno == EINTR || errno == EWOULDBLOCK)
continue;
if (src->intr_handle.type != RTE_INTR_HANDLE_EXT) {
/**
* read out to clear the ready-to-be-read flag
* for epoll_wait.
*/
bytes_read = read(events[n].data.fd, &buf, bytes_read);
if (bytes_read < 0) {
if (errno == EINTR || errno == EWOULDBLOCK)
continue;
RTE_LOG(ERR, EAL, "Error reading from file "
"descriptor %d: %s\n", events[n].data.fd,
strerror(errno));
} else if (bytes_read == 0)
RTE_LOG(ERR, EAL, "Read nothing from file "
"descriptor %d\n", events[n].data.fd);
RTE_LOG(ERR, EAL, "Error reading from file "
"descriptor %d: %s\n",
events[n].data.fd,
strerror(errno));
} else if (bytes_read == 0)
RTE_LOG(ERR, EAL, "Read nothing from file "
"descriptor %d\n", events[n].data.fd);
}
/* grab a lock, again to call callbacks and update status. */
rte_spinlock_lock(&intr_lock);

View File

@ -48,6 +48,7 @@ enum rte_intr_handle_type {
RTE_INTR_HANDLE_VFIO_MSI, /**< vfio device handle (MSI) */
RTE_INTR_HANDLE_VFIO_MSIX, /**< vfio device handle (MSIX) */
RTE_INTR_HANDLE_ALARM, /**< alarm handle */
RTE_INTR_HANDLE_EXT, /**< external handler */
RTE_INTR_HANDLE_MAX
};