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 E451E1BBE for ; Tue, 7 Mar 2017 09:28:38 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2017 00:28:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,257,1484035200"; d="scan'208";a="831813263" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.129.167]) by FMSMGA003.fm.intel.com with ESMTP; 07 Mar 2017 00:28:36 -0800 From: Qi Zhang To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, Qi Zhang Date: Tue, 7 Mar 2017 04:19:26 -0500 Message-Id: <20170307091928.57990-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170307091928.57990-1-qi.z.zhang@intel.com> References: <1487801822-30938-1-git-send-email-qi.z.zhang@intel.com> <20170307091928.57990-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 1/3] 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, 07 Mar 2017 08:28:39 -0000 Remove the inappropriate modification on get_max_intr field that keep the intr_source read only. Signed-off-by: Qi Zhang --- 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 92a19cb..b50dad8 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.9.3