All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: david.marchand@6wind.com, Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH] igb_uio: switch to pci_alloc_irq_vectors()
Date: Thu, 13 Apr 2017 16:56:32 +0200	[thread overview]
Message-ID: <20170413145632.4214-1-nicolas.dichtel@6wind.com> (raw)

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 <nicolas.dichtel@6wind.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index 192bd4a96b68..b50e0f8b0457 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;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
 	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 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
 		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

             reply	other threads:[~2017-04-13 14:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 14:56 Nicolas Dichtel [this message]
2017-04-19 18:33 ` [PATCH] igb_uio: switch to pci_alloc_irq_vectors() Ferruh Yigit
2017-04-20  9:01   ` [PATCH v2] " Nicolas Dichtel
2017-04-20 11:59     ` Ferruh Yigit
2017-04-20 13:07       ` Nicolas Dichtel
2017-04-20 13:11       ` [PATCH v3] " Nicolas Dichtel
2017-04-20 13:32         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170413145632.4214-1-nicolas.dichtel@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.