From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 42D032BC8 for ; Thu, 31 May 2018 12:12:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2018 03:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,463,1520924400"; d="scan'208";a="46194148" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga006.jf.intel.com with ESMTP; 31 May 2018 03:12:35 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w4VACY5i025113; Thu, 31 May 2018 11:12:34 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w4VACYng018950; Thu, 31 May 2018 11:12:34 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w4VACYpx018945; Thu, 31 May 2018 11:12:34 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: Jianfeng Tan , thomas@monjalon.net, konstantin.ananyev@intel.com Date: Thu, 31 May 2018 11:12:32 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: <1524150216-3407-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [RFC v2 5/6] 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, 31 May 2018 10:12:38 -0000 From: Jianfeng Tan We are going to merge IPC into interrupt thread. This patch adds IPC type for interrupt thread. Signed-off-by: Jianfeng Tan Signed-off-by: Anatoly Burakov --- Notes: RFC->RFCv2: - Fixed typo in test app .../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 6eb493271..344db768d 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 180c0378a..390672739 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -560,6 +560,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, @@ -610,6 +612,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, @@ -679,6 +683,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 dc19175d3..fa18ddf75 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_IPC]; + 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.17.0