[dpdk-dev] [RFC 7/8] eal: add IPC type for interrupt thread
Jianfeng Tan
jianfeng.tan at intel.com
Thu Apr 19 17:03:35 CEST 2018
We are going to merge IPC into interrupt thread. This patch adds
IPC type for interrupt thread.
Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
---
lib/librte_eal/common/include/rte_eal_interrupts.h | 1 +
lib/librte_eal/linuxapp/eal/eal_interrupts.c | 5 ++++
test/test/test_interrupts.c | 29 +++++++++++++++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/include/rte_eal_interrupts.h b/lib/librte_eal/common/include/rte_eal_interrupts.h
index 6eb4932..344db76 100644
--- a/lib/librte_eal/common/include/rte_eal_interrupts.h
+++ b/lib/librte_eal/common/include/rte_eal_interrupts.h
@@ -35,6 +35,7 @@ enum rte_intr_handle_type {
RTE_INTR_HANDLE_EXT, /**< external handler */
RTE_INTR_HANDLE_VDEV, /**< virtual device */
RTE_INTR_HANDLE_DEV_EVENT, /**< device event handle */
+ RTE_INTR_HANDLE_IPC, /**< IPC event handle */
RTE_INTR_HANDLE_MAX /**< count of elements */
};
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 5245372..b23fd9e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -559,6 +559,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)
/* not used at this moment */
case RTE_INTR_HANDLE_DEV_EVENT:
return -1;
+ case RTE_INTR_HANDLE_IPC:
+ return -1;
/* unknown handle type */
default:
RTE_LOG(ERR, EAL,
@@ -609,6 +611,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)
/* not used at this moment */
case RTE_INTR_HANDLE_DEV_EVENT:
return -1;
+ case RTE_INTR_HANDLE_IPC:
+ return -1;
/* unknown handle type */
default:
RTE_LOG(ERR, EAL,
@@ -678,6 +682,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
call = true;
break;
case RTE_INTR_HANDLE_DEV_EVENT:
+ case RTE_INTR_HANDLE_IPC:
bytes_read = 0;
call = true;
break;
diff --git a/test/test/test_interrupts.c b/test/test/test_interrupts.c
index dc19175..7c42d71 100644
--- a/test/test/test_interrupts.c
+++ b/test/test/test_interrupts.c
@@ -21,6 +21,7 @@ enum test_interrupt_handle_type {
TEST_INTERRUPT_HANDLE_VALID_UIO,
TEST_INTERRUPT_HANDLE_VALID_ALARM,
TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT,
+ TEST_INTERRUPT_HANDLE_VALID_IPC,
TEST_INTERRUPT_HANDLE_CASE1,
TEST_INTERRUPT_HANDLE_MAX
};
@@ -85,6 +86,10 @@ test_interrupt_init(void)
intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT].type =
RTE_INTR_HANDLE_DEV_EVENT;
+ intr_handles[TEST_INTERRUPT_HANDLE_VALID_IPC].fd = pfds.readfd;
+ intr_handles[TEST_INTERRUPT_HANDLE_VALID_IPC].type =
+ RTE_INTR_HANDLE_IPC;
+
intr_handles[TEST_INTERRUPT_HANDLE_CASE1].fd = pfds.writefd;
intr_handles[TEST_INTERRUPT_HANDLE_CASE1].type = RTE_INTR_HANDLE_UIO;
@@ -263,6 +268,14 @@ test_interrupt_enable(void)
return -1;
}
+ /* check with specific valid intr_handle */
+ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_IPC];
+ if (rte_intr_enable(&test_intr_handle) == 0) {
+ printf("unexpectedly enable a specific intr_handle "
+ "successfully\n");
+ return -1;
+ }
+
/* check with valid handler and its type */
test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1];
if (rte_intr_enable(&test_intr_handle) < 0) {
@@ -327,6 +340,14 @@ test_interrupt_disable(void)
return -1;
}
+ /* check with specific valid intr_handle */
+ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_IPC];
+ if (rte_intr_disable(&test_intr_handle) == 0) {
+ printf("unexpectedly disable a specific intr_handle "
+ "successfully\n");
+ return -1;
+ }
+
/* check with valid handler and its type */
test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1];
if (rte_intr_disable(&test_intr_handle) < 0) {
@@ -424,7 +445,7 @@ test_interrupt(void)
printf("Check valid alarm interrupt full path\n");
if (test_interrupt_full_path_check(
- TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT) < 0) {
+ TEST_INTERRUPT_HANDLE_VALID_IPC) < 0) {
printf("failure occurred during checking valid alarm "
"interrupt full path\n");
goto out;
@@ -548,6 +569,12 @@ test_interrupt(void)
rte_intr_callback_unregister(&test_intr_handle,
test_interrupt_callback_1, (void *)-1);
+ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_VFIO];
+ rte_intr_callback_unregister(&test_intr_handle,
+ test_interrupt_callback, (void *)-1);
+ rte_intr_callback_unregister(&test_intr_handle,
+ test_interrupt_callback_1, (void *)-1);
+
rte_delay_ms(2 * TEST_INTERRUPT_CHECK_INTERVAL);
/* deinit */
test_interrupt_deinit();
--
2.7.4
More information about the dev
mailing list