* [dpdk-dev] [PATCH] igb_uio: switch to pci_alloc_irq_vectors()
@ 2017-04-13 14:56 Nicolas Dichtel
2017-04-19 18:33 ` Ferruh Yigit
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Dichtel @ 2017-04-13 14:56 UTC (permalink / raw)
To: dev, ferruh.yigit; +Cc: david.marchand, Nicolas Dichtel
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] igb_uio: switch to pci_alloc_irq_vectors()
2017-04-13 14:56 [dpdk-dev] [PATCH] igb_uio: switch to pci_alloc_irq_vectors() Nicolas Dichtel
@ 2017-04-19 18:33 ` Ferruh Yigit
2017-04-20 9:01 ` [dpdk-dev] [PATCH v2] " Nicolas Dichtel
0 siblings, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2017-04-19 18:33 UTC (permalink / raw)
To: Nicolas Dichtel, dev; +Cc: david.marchand
On 4/13/2017 3:56 PM, Nicolas Dichtel wrote:
> 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)
Hi Nicolas,
Overall patch looks good, thanks.
Only can you please use compat.h for version check, instead of doing in
c file?
Thanks,
ferruh
> 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)) {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] igb_uio: switch to pci_alloc_irq_vectors()
2017-04-19 18:33 ` Ferruh Yigit
@ 2017-04-20 9:01 ` Nicolas Dichtel
2017-04-20 11:59 ` Ferruh Yigit
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Dichtel @ 2017-04-20 9:01 UTC (permalink / raw)
To: ferruh.yigit; +Cc: dev, david.marchand, Nicolas Dichtel
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>
---
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] igb_uio: switch to pci_alloc_irq_vectors()
2017-04-20 9:01 ` [dpdk-dev] [PATCH v2] " Nicolas Dichtel
@ 2017-04-20 11:59 ` Ferruh Yigit
2017-04-20 13:07 ` Nicolas Dichtel
2017-04-20 13:11 ` [dpdk-dev] [PATCH v3] " Nicolas Dichtel
0 siblings, 2 replies; 7+ messages in thread
From: Ferruh Yigit @ 2017-04-20 11:59 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: dev, david.marchand
On 4/20/2017 10:01 AM, Nicolas Dichtel wrote:
> 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>
<...>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
> +#define HAVE_PCI_ENABLE_MSIX
> +#endif
Would you mind moving this check to the end of the file, to preserve
version check in increasing order (although I aware some doesn't fit this)?
When above done:
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] igb_uio: switch to pci_alloc_irq_vectors()
2017-04-20 11:59 ` Ferruh Yigit
@ 2017-04-20 13:07 ` Nicolas Dichtel
2017-04-20 13:11 ` [dpdk-dev] [PATCH v3] " Nicolas Dichtel
1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Dichtel @ 2017-04-20 13:07 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, david.marchand
Le 20/04/2017 à 13:59, Ferruh Yigit a écrit :
> On 4/20/2017 10:01 AM, Nicolas Dichtel wrote:
>> 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>
>
> <...>
>
>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
>> +#define HAVE_PCI_ENABLE_MSIX
>> +#endif
>
> Would you mind moving this check to the end of the file, to preserve
> version check in increasing order (although I aware some doesn't fit this)?
No problem. I put this stuff here to keep pci_msix stuff together.
Regards,
Nicolas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v3] igb_uio: switch to pci_alloc_irq_vectors()
2017-04-20 11:59 ` Ferruh Yigit
2017-04-20 13:07 ` Nicolas Dichtel
@ 2017-04-20 13:11 ` Nicolas Dichtel
2017-04-20 13:32 ` Thomas Monjalon
1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Dichtel @ 2017-04-20 13:11 UTC (permalink / raw)
To: ferruh.yigit; +Cc: dev, david.marchand, Nicolas Dichtel
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>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v3: move code in compat.h at the end of the file
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..b800a53cd30b 100644
--- a/lib/librte_eal/linuxapp/igb_uio/compat.h
+++ b/lib/librte_eal/linuxapp/igb_uio/compat.h
@@ -123,3 +123,7 @@ static bool pci_check_and_mask_intx(struct pci_dev *pdev)
}
#endif /* < 3.3.0 */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
+#define HAVE_PCI_ENABLE_MSIX
+#endif
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-04-20 13:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 14:56 [dpdk-dev] [PATCH] igb_uio: switch to pci_alloc_irq_vectors() Nicolas Dichtel
2017-04-19 18:33 ` Ferruh Yigit
2017-04-20 9:01 ` [dpdk-dev] [PATCH v2] " Nicolas Dichtel
2017-04-20 11:59 ` Ferruh Yigit
2017-04-20 13:07 ` Nicolas Dichtel
2017-04-20 13:11 ` [dpdk-dev] [PATCH v3] " Nicolas Dichtel
2017-04-20 13:32 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).