From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 6C660D0B2 for ; Thu, 19 Apr 2018 17:01:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 08:01:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,469,1517904000"; d="scan'208";a="44534170" Received: from dpdk06.sh.intel.com ([10.67.110.196]) by orsmga003.jf.intel.com with ESMTP; 19 Apr 2018 08:01:43 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: thomas@monjalon.net, anatoly.burakov@intel.com, Jianfeng Tan Date: Thu, 19 Apr 2018 15:03:35 +0000 Message-Id: <1524150216-3407-8-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524150216-3407-1-git-send-email-jianfeng.tan@intel.com> References: <1524150216-3407-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [RFC 7/8] eal: add IPC type for interrupt thread X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2018 15:01:47 -0000 We are going to merge IPC into interrupt thread. This patch adds IPC type for interrupt thread. Signed-off-by: Jianfeng Tan --- 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