From patchwork Thu Apr 6 12:42:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 23253 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7EC33695D; Thu, 6 Apr 2017 06:48:19 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B927A5592 for ; Thu, 6 Apr 2017 06:48:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491454095; x=1522990095; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0WrVtddkAATcMQZ6klCSxH6iQrU9hFXtooMtdnda8RA=; b=ov/EpjnnbOL4CdNKphGAKWo0Z+Qaz/yq/Dfok75x/2CRdDSVsX3njsnB OFEZojg4S6jBntEL24rLE0/nYINCeQ==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2017 21:48:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.37,282,1488873600"; d="scan'208"; a="1151734671" Received: from qzhan15-z170x-ud5.sh.intel.com ([10.239.66.54]) by fmsmga002.fm.intel.com with ESMTP; 05 Apr 2017 21:48:13 -0700 From: Qi Zhang To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, Qi Zhang Date: Thu, 6 Apr 2017 20:42:21 +0800 Message-Id: <20170406124222.18172-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406124222.18172-1-qi.z.zhang@intel.com> References: <20170404230908.15145-1-qi.z.zhang@intel.com> <20170406124222.18172-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v7 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Remove the inappropriate modification on get_max_intr field that keep the intr_source read only. Signed-off-by: Qi Zhang Acked-by: Anatoly Burakov --- 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 e293728..3069779 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -279,29 +279,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) { @@ -314,15 +291,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;