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 E6C232FDD for ; Tue, 4 Apr 2017 17:15:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491318959; x=1522854959; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=wH6XDBxZ6Z+Wg+PU9SJJtVHGeNE79cMXHk/5T9tPjrI=; b=hQ9uVBIUfZi8QZLrjJyAfJyJhTSMUXsQsdarJ0i5VujyDA4LqnFjoJEu FJtYgkDpVvdoiQLadwxqVTDDqv/PJA==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2017 08:15:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,275,1486454400"; d="scan'208";a="73452283" Received: from qzhan15-z170x-ud5.sh.intel.com ([10.239.66.54]) by orsmga004.jf.intel.com with ESMTP; 04 Apr 2017 08:15:39 -0700 From: Qi Zhang To: thomas.monjalon@6wind.com Cc: dev@dpdk.org, Qi Zhang Date: Wed, 5 Apr 2017 07:09:06 +0800 Message-Id: <20170404230908.15145-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404230908.15145-1-qi.z.zhang@intel.com> References: <20170404230459.15006-1-qi.z.zhang@intel.com> <20170404230908.15145-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v6 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 15:15:59 -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.9.3