From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 31C15326C for ; Tue, 4 Apr 2017 15:27:21 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 04 Apr 2017 06:27:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,275,1486454400"; d="scan'208";a="84133873" Received: from qzhan15-z170x-ud5.sh.intel.com ([10.239.66.54]) by fmsmga005.fm.intel.com with ESMTP; 04 Apr 2017 06:27:20 -0700 From: Qi Zhang To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, Qi Zhang Date: Wed, 5 Apr 2017 05:21:24 +0800 Message-Id: <20170404212125.32114-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404212125.32114-1-qi.z.zhang@intel.com> References: <20170331020913.19004-1-qi.z.zhang@intel.com> <20170404212125.32114-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 1/2] vfio: keep interrupt source read only 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: Tue, 04 Apr 2017 13:27:22 -0000 Remove the inappropriate modification on get_max_intr field that keep the intr_source read only. Signed-off-by: Qi Zhang --- v4: - Add back this patch to make patch set complete though it already be applied. v2: - Seperate patch 1 of v1 into 2 patches.(part 1) lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 ++++------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 029a147..1716d68 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -278,29 +278,6 @@ vfio_disable_msi(const struct rte_intr_handle *intr_handle) { return ret; } -static int -get_max_intr(const struct rte_intr_handle *intr_handle) -{ - struct rte_intr_source *src; - - TAILQ_FOREACH(src, &intr_sources, next) { - if (src->intr_handle.fd != intr_handle->fd) - continue; - - if (src->intr_handle.max_intr < intr_handle->max_intr) - src->intr_handle.max_intr = intr_handle->max_intr; - if (!src->intr_handle.max_intr) - src->intr_handle.max_intr = 1; - else if (src->intr_handle.max_intr > RTE_MAX_RXTX_INTR_VEC_ID) - src->intr_handle.max_intr - = RTE_MAX_RXTX_INTR_VEC_ID + 1; - - return src->intr_handle.max_intr; - } - - return -1; -} - /* enable MSI-X interrupts */ static int vfio_enable_msix(const struct rte_intr_handle *intr_handle) { @@ -313,15 +290,10 @@ vfio_enable_msix(const struct rte_intr_handle *intr_handle) { irq_set = (struct vfio_irq_set *) irq_set_buf; irq_set->argsz = len; - - ret = get_max_intr(intr_handle); - if (ret < 0) { - RTE_LOG(ERR, EAL, "Invalid number of MSI-X irqs for fd %d\n", - intr_handle->fd); - return -1; - } - - irq_set->count = ret; + /* 0 < irq_set->count < RTE_MAX_RXTX_INTR_VEC_ID + 1 */ + irq_set->count = intr_handle->max_intr ? + (intr_handle->max_intr > RTE_MAX_RXTX_INTR_VEC_ID + 1 ? + RTE_MAX_RXTX_INTR_VEC_ID + 1 : intr_handle->max_intr) : 1; irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX; irq_set->start = 0; -- 2.7.4