From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id AD81BF977 for ; Mon, 27 Feb 2017 17:19:13 +0100 (CET) Received: by mail-wm0-f67.google.com with SMTP id v77so14193636wmv.0 for ; Mon, 27 Feb 2017 08:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Ew9yYs3ubwx7sy3ZhT9YiYRI/SZEGOaKdZKFAmDVL+o=; b=lfeYuZInrMMF8oDWLMFm1N1slAyLEdJlSdF3tVDRPWS0M37O8X/1ist0+c/C27f2Dk ja3pAowOsmqfBHGLLrrQhsg3uh24iCXpRL7M4yt3l5KSUQxizir3lAWoCTaGFO3ZLXY6 zplGbuaeMDSrIi+88x5nu5wamkcsJfreAN+L8wm+7PwXb01mfr0unOJvrx9bpdh54y5I 32IOTTJUokIi+1h67/qm583RzISnpMb3lpvVSHE5UjEB2AGn5zxE4AtYPjVYm9XIVz50 eamoleb78g8FrMtUsoM2l+EomyCpnDxix1E1sd0XHIqCqeikhNIyIH4xbBpa59nZhfq2 ThkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Ew9yYs3ubwx7sy3ZhT9YiYRI/SZEGOaKdZKFAmDVL+o=; b=eDdyMZscgad3pForX697aAFW2wxz4IQFbTsgD7QImM9MDC0q1dnEkeWKE+ekI7ZSwz +DYKJBwaJk3GEGGed6SuhIgXW5ayRxnvpO/Ty2gv2L8WDIS3j2GNXucDn2HiDr7WwECd V9Rld1ZY6I4KSEbDdmL5+GoLUgOw2IjrGWLj5d29wikopyGwX4pIutDAllwIj1Sdua1o 1y3gmu+sddrGf+6zyjqRMcDBs8MheZcvnAO+vD2E7DE0XX100iAIeHBCwH1sbxhc/LFn T1CrRNFMWKcYxTJuljTN7DpPmios96BIUvJt9/sUiyLIkIUxYIGKu3B38BjRjkgz4XQ0 qVXg== X-Gm-Message-State: AMke39n6NOpyPJ6VaKwTjdl8KiBH5A47kJZMu7hOlwlwMi4Om0m1X6x9/NoaAwkB+n1+x0YMrPOzm0rLs3itBA== X-Received: by 10.28.140.135 with SMTP id o129mr2201435wmd.101.1488212353189; Mon, 27 Feb 2017 08:19:13 -0800 (PST) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.211.20 with HTTP; Mon, 27 Feb 2017 08:19:12 -0800 (PST) In-Reply-To: <1487801822-30938-2-git-send-email-qi.z.zhang@intel.com> References: <1487801822-30938-1-git-send-email-qi.z.zhang@intel.com> <1487801822-30938-2-git-send-email-qi.z.zhang@intel.com> From: Jan Blunck Date: Mon, 27 Feb 2017 17:19:12 +0100 X-Google-Sender-Auth: 1gp3BJ_9jmVTS8pZTCYfxmkiApA Message-ID: To: Qi Zhang Cc: Thomas Monjalon , dev Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH 1/2] eal: clean up interrupt handle 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: Mon, 27 Feb 2017 16:19:14 -0000 On Wed, Feb 22, 2017 at 11:17 PM, Qi Zhang wrote: > --- 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; The changes (to not change the interrupt handle in intr_sources) seems to be unrelated to the API changes. Can you split this into two commits, please? Also I'm not 100% convinced that the low-level drivers should make extensive use of the ethdev's const intr_handle. I believe that the ethdev ops might be incomplete in that sense that it would be better to add an rx_intr_ctl() operation to the ethdev ops structure and pass control the the low-level device.