From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 9700D2BAE for ; Thu, 20 Apr 2017 11:01:50 +0200 (CEST) Received: from bretzel.dev.6wind.com (unknown [10.16.0.19]) by proxy.6wind.com (Postfix) with ESMTPS id CBF8423D62; Thu, 20 Apr 2017 11:01:44 +0200 (CEST) Received: from dichtel by bretzel.dev.6wind.com with local (Exim 4.84_2) (envelope-from ) id 1d17yC-0007yN-0r; Thu, 20 Apr 2017 11:01:44 +0200 From: Nicolas Dichtel To: ferruh.yigit@intel.com Cc: dev@dpdk.org, david.marchand@6wind.com, Nicolas Dichtel Date: Thu, 20 Apr 2017 11:01:40 +0200 Message-Id: <20170420090140.30566-1-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2] igb_uio: switch to pci_alloc_irq_vectors() 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: Thu, 20 Apr 2017 09:01:50 -0000 pci_enable_msix() will be removed in kernel 4.12. The new API is available since linux 4.8, thus let's use it. Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aff171641d18 Link: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=4244de1c64de Signed-off-by: Nicolas Dichtel Reviewed-by: David Marchand --- v2: use compat.h and define HAVE_PCI_ENABLE_MSIX limit commit log to 75 columns lib/librte_eal/linuxapp/igb_uio/compat.h | 4 ++++ lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/librte_eal/linuxapp/igb_uio/compat.h b/lib/librte_eal/linuxapp/igb_uio/compat.h index 0d781e482562..c396faea87d3 100644 --- a/lib/librte_eal/linuxapp/igb_uio/compat.h +++ b/lib/librte_eal/linuxapp/igb_uio/compat.h @@ -33,6 +33,10 @@ #define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) +#define HAVE_PCI_ENABLE_MSIX +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \ (!(defined(RHEL_RELEASE_CODE) && \ RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9))) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index 192bd4a96b68..b9d427c51c57 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -325,7 +325,9 @@ static int igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct rte_uio_pci_dev *udev; +#ifdef HAVE_PCI_ENABLE_MSIX struct msix_entry msix_entry; +#endif dma_addr_t map_dma_addr; void *map_addr; int err; @@ -381,6 +383,7 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) switch (igbuio_intr_mode_preferred) { case RTE_INTR_MODE_MSIX: /* Only 1 msi-x vector needed */ +#ifdef HAVE_PCI_ENABLE_MSIX msix_entry.entry = 0; if (pci_enable_msix(dev, &msix_entry, 1) == 0) { dev_dbg(&dev->dev, "using MSI-X"); @@ -389,6 +392,14 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) udev->mode = RTE_INTR_MODE_MSIX; break; } +#else + if (pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSIX) == 1) { + dev_dbg(&dev->dev, "using MSI-X"); + udev->info.irq = pci_irq_vector(dev, 0); + udev->mode = RTE_INTR_MODE_MSIX; + break; + } +#endif /* fall back to INTX */ case RTE_INTR_MODE_LEGACY: if (pci_intx_mask_supported(dev)) { -- 2.11.0