git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eal: new function to create control threads
[dpdk.git]
/
lib
/
librte_eal
/
linuxapp
/
eal
/
eal_interrupts.c
diff --git
a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index
3e9ac41
..
8fee317
100644
(file)
--- a/
lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/
lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@
-51,7
+51,6
@@
#include <rte_common.h>
#include <rte_interrupts.h>
#include <rte_memory.h>
#include <rte_common.h>
#include <rte_interrupts.h>
#include <rte_memory.h>
-#include <rte_memzone.h>
#include <rte_launch.h>
#include <rte_eal.h>
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_eal.h>
#include <rte_per_lcore.h>
@@
-60,7
+59,6
@@
#include <rte_branch_prediction.h>
#include <rte_debug.h>
#include <rte_log.h>
#include <rte_branch_prediction.h>
#include <rte_debug.h>
#include <rte_log.h>
-#include <rte_pci.h>
#include <rte_malloc.h>
#include <rte_errno.h>
#include <rte_spinlock.h>
#include <rte_malloc.h>
#include <rte_errno.h>
#include <rte_spinlock.h>
@@
-891,10
+889,10
@@
rte_eal_intr_init(void)
}
/* create the host thread to wait/handle the interrupt */
}
/* create the host thread to wait/handle the interrupt */
- ret =
p
thread_create(&intr_thread, NULL,
+ ret =
rte_ctrl_
thread_create(&intr_thread, NULL,
eal_intr_thread_main, NULL);
if (ret != 0) {
eal_intr_thread_main, NULL);
if (ret != 0) {
- rte_errno = ret;
+ rte_errno =
-
ret;
RTE_LOG(ERR, EAL,
"Failed to create thread for interrupt handling\n");
} else {
RTE_LOG(ERR, EAL,
"Failed to create thread for interrupt handling\n");
} else {
@@
-907,14
+905,14
@@
rte_eal_intr_init(void)
"Failed to set thread name for interrupt handling\n");
}
"Failed to set thread name for interrupt handling\n");
}
- return
-
ret;
+ return ret;
}
static void
eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
{
union rte_intr_read_buffer buf;
}
static void
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 bytes_read =
0
;
int nbytes;
switch (intr_handle->type) {
int nbytes;
switch (intr_handle->type) {
@@
-930,11
+928,9
@@
eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
break;
#endif
case RTE_INTR_HANDLE_VDEV:
break;
#endif
case RTE_INTR_HANDLE_VDEV:
- /* for vdev, fd points to:
- * a. eventfd which does not need to read out;
- * b. datapath fd which needs PMD to read out.
- */
- return;
+ bytes_read = intr_handle->efd_counter_size;
+ /* For vdev, number of bytes to read is set by driver */
+ break;
case RTE_INTR_HANDLE_EXT:
return;
default:
case RTE_INTR_HANDLE_EXT:
return;
default:
@@
-947,6
+943,8
@@
eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
* read out to clear the ready-to-be-read flag
* for epoll_wait.
*/
* read out to clear the ready-to-be-read flag
* for epoll_wait.
*/
+ if (bytes_read == 0)
+ return;
do {
nbytes = read(fd, &buf, bytes_read);
if (nbytes < 0) {
do {
nbytes = read(fd, &buf, bytes_read);
if (nbytes < 0) {
@@
-1206,7
+1204,12
@@
rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
intr_handle->nb_efd = n;
intr_handle->max_intr = NB_OTHER_INTR + n;
} else if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
intr_handle->nb_efd = n;
intr_handle->max_intr = NB_OTHER_INTR + n;
} else if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
- /* do nothing, and let vdev driver to initialize this struct */
+ /* only check, initialization would be done in vdev driver.*/
+ if (intr_handle->efd_counter_size >
+ sizeof(union rte_intr_read_buffer)) {
+ RTE_LOG(ERR, EAL, "the efd_counter_size is oversized");
+ return -EINVAL;
+ }
} else {
intr_handle->efds[0] = intr_handle->fd;
intr_handle->nb_efd = RTE_MIN(nb_efd, 1U);
} else {
intr_handle->efds[0] = intr_handle->fd;
intr_handle->nb_efd = RTE_MIN(nb_efd, 1U);