From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A0C5F9198 for ; Wed, 4 Nov 2015 09:45:59 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 04 Nov 2015 00:45:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,242,1444719600"; d="scan'208";a="593752310" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 04 Nov 2015 00:45:59 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tA48jt2R005112; Wed, 4 Nov 2015 16:45:55 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tA48jpZm028903; Wed, 4 Nov 2015 16:45:53 +0800 Received: (from cliang18@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tA48jppn028899; Wed, 4 Nov 2015 16:45:51 +0800 From: Cunming Liang To: dev@dpdk.org Date: Wed, 4 Nov 2015 16:45:31 +0800 Message-Id: <1446626740-28824-5-git-send-email-cunming.liang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446626740-28824-1-git-send-email-cunming.liang@intel.com> References: <1446617263-7448-1-git-send-email-cunming.liang@intel.com> <1446626740-28824-1-git-send-email-cunming.liang@intel.com> Subject: [dpdk-dev] [PATCH v4 04/13] eal/linux: not allow to enable zero intr efd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2015 08:46:00 -0000 The patch adds condition check to avoid enable nothing. In disable state, both max_intr and nb_efd are zero. Signed-off-by: Cunming Liang --- lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 8 +++++++- lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h index 05bb484..3d138bf 100644 --- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h @@ -85,8 +85,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, * * @param intr_handle * Pointer to the interrupt handle. - * @param nb_vec + * @param nb_efd * Number of interrupt vector trying to enable. + * The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value. diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 8758239..8938067 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -1148,6 +1149,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd) int fd; uint32_t n = RTE_MIN(nb_efd, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); + assert(nb_efd != 0); + if (intr_handle->type == RTE_INTR_HANDLE_VFIO_MSIX) { for (i = 0; i < n; i++) { fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); @@ -1204,5 +1207,8 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle) int rte_intr_allow_others(struct rte_intr_handle *intr_handle) { - return !!(intr_handle->max_intr - intr_handle->nb_efd); + if (!rte_intr_dp_is_en(intr_handle)) + return 1; + else + return !!(intr_handle->max_intr - intr_handle->nb_efd); } diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h index 8da81e7..b44e69c 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h @@ -176,8 +176,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, * * @param intr_handle * Pointer to the interrupt handle. - * @param nb_vec + * @param nb_efd * Number of interrupt vector trying to enable. + * The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value. -- 2.4.3