Skip to contentSkip to conversation

igb_uio: fix compability on old kernel

PATCH In review Stephen Hemminger 5 participants 12 messages Jul 25, 2014 – Sep 3, 2014 7 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 igb_uio: fix compability on old kernel

Add more compatibility wrappers, and split out all the wrapper code to a separate file. Builds on Debian Squeeze (2.6.32) which is oldest version of kernel current DPDK supports.

---
 lib/librte_eal/linuxapp/igb_uio/compat.h  |  103 ++++++++++++++++++++++++++++++
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c |   81 -----------------------
 2 files changed, 104 insertions(+), 80 deletions(-)
lib/librte_eal/linuxapp/igb_uio/compat.h new file +103 -0
@@ -0,0 +1,103 @@
+/*
+ * Minimal wrappers to allow compiling igb_uio on older kernels.
+ */
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+#define pci_cfg_access_lock   pci_block_user_cfg_access
+#define pci_cfg_access_unlock pci_unblock_user_cfg_access
+#endif
+
+#ifndef PCI_MSIX_ENTRY_SIZE
+#define PCI_MSIX_ENTRY_SIZE             16
+#define  PCI_MSIX_ENTRY_LOWER_ADDR      0
+#define  PCI_MSIX_ENTRY_UPPER_ADDR      4
+#define  PCI_MSIX_ENTRY_DATA            8
+#define  PCI_MSIX_ENTRY_VECTOR_CTRL     12
+#define   PCI_MSIX_ENTRY_CTRL_MASKBIT   1
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+static int pci_num_vf(struct pci_dev *dev)
+{
+	struct iov {
+		int pos;
+		int nres;
+		u32 cap;
+		u16 ctrl;
+		u16 total;
+		u16 initial;
+		u16 nr_virtfn;
+	} *iov = (struct iov *)dev->sriov;
+
+	if (!dev->is_physfn)
+		return 0;
+
+	return iov->nr_virtfn;
+}
+#endif
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+
+/* Check if INTX works to control irq's.
+ * Set's INTX_DISABLE flag and reads it back
+ */
+static bool pci_intx_mask_supported(struct pci_dev *pdev)
+{
+	bool mask_supported = false;
+	uint16_t orig, new;
+
+	pci_block_user_cfg_access(pdev);
+	pci_read_config_word(pdev, PCI_COMMAND, &orig);
+	pci_write_config_word(pdev, PCI_COMMAND,
+			      orig ^ PCI_COMMAND_INTX_DISABLE);
+	pci_read_config_word(pdev, PCI_COMMAND, &new);
+
+	if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
+		dev_err(&pdev->dev, "Command register changed from "
+			"0x%x to 0x%x: driver or hardware bug?\n", orig, new);
+	} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
+		mask_supported = true;
+		pci_write_config_word(pdev, PCI_COMMAND, orig);
+	}
+	pci_unblock_user_cfg_access(pdev);
+
+	return mask_supported;
+}
+
+static bool pci_check_and_mask_intx(struct pci_dev *pdev)
+{
+	bool pending;
+	uint32_t status;
+
+	pci_block_user_cfg_access(pdev);
+	pci_read_config_dword(pdev, PCI_COMMAND, &status);
+
+	/* interrupt is not ours, goes to out */
+	pending = (((status >> 16) & PCI_STATUS_INTERRUPT) != 0);
+	if (pending) {
+		uint16_t old, new;
+
+		old = status;
+		if (status != 0)
+			new = old & (~PCI_COMMAND_INTX_DISABLE);
+		else
+			new = old | PCI_COMMAND_INTX_DISABLE;
+
+		if (old != new)
+			pci_write_config_word(pdev, PCI_COMMAND, new);
+	}
+	pci_unblock_user_cfg_access(pdev);
+
+	return pending;
+}
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+/* Compatability wrapper for new kernel API for IRQ */
+#define irq_data	irq_desc
+#define irq_get_irq_data(irq)	irq_to_desc(irq)
+#define irq_data_get_msi(data)	get_irq_desc_msi(data)
+#endif
+
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +1 -80

99 lines not on this page · raw message

#2 lore raw

PATCH 2/2 igb_uio: handle no IRQ fallback

In reply to a message not in the archive

Fix a couple of issues with my earlier igb_uio stuff:
1. With MSI (like MSI-X) actual IRQ number is not known until after the pci_enable_msi() is done.
2. If INTX fails, fall back to running without IRQ. This allows usermode PCI to recover and run without out IRQ for cases where PCI INTX support is broken (aka VMWare).

lib/librte_eal/linuxapp/igb_uio/igb_uio.c +9 -8
@@ -506,7 +506,6 @@ igbuio_pci_probe(struct pci_dev *dev, co
 	udev->info.version = "0.1";
 	udev->info.handler = igbuio_pci_irqhandler;
 	udev->info.irqcontrol = igbuio_pci_irqcontrol;
-	udev->info.irq = dev->irq;
 #ifdef CONFIG_XEN_DOM0
 	/* check if the driver run on Xen Dom0 */
 	if (xen_initial_domain())
@@ -516,9 +515,6 @@ igbuio_pci_probe(struct pci_dev *dev, co
 	udev->pdev = dev;
 
 	switch (igbuio_intr_mode_preferred) {
-	case RTE_INTR_MODE_NONE:
-		udev->info.irq = 0;
-		break;
 	case RTE_INTR_MODE_MSIX:
 		/* Only 1 msi-x vector needed */
 		msix_entry.entry = 0;
@@ -532,6 +528,7 @@ igbuio_pci_probe(struct pci_dev *dev, co
 	case RTE_INTR_MODE_MSI:
 		if (pci_enable_msi(dev) == 0) {
 			dev_dbg(&dev->dev, "using MSI");
+			udev->info.irq = dev->irq;
 			udev->mode = RTE_INTR_MODE_MSI;
 			break;
 		}
@@ -540,13 +537,17 @@ igbuio_pci_probe(struct pci_dev *dev, co
 		if (pci_intx_mask_supported(dev)) {
 			dev_dbg(&dev->dev, "using INTX");
 			udev->info.irq_flags = IRQF_SHARED;
+			udev->info.irq = dev->irq;
 			udev->mode = RTE_INTR_MODE_LEGACY;
-		} else {
-			dev_err(&dev->dev, "PCI INTX mask not supported\n");
-			err = -EIO;
-			goto fail_release_iomem;
+			break;
 		}
+		dev_notice(&dev->dev, "PCI INTX mask not supported\n");
+		/* fall back to no IRQ */
+	case RTE_INTR_MODE_NONE:
+		udev->mode = RTE_INTR_MODE_NONE;
+		udev->info.irq = 0;
 		break;
+
 	default:
 		dev_err(&dev->dev, "invalid IRQ mode %u",
 			igbuio_intr_mode_preferred);
#5 lore raw
In reply to a message not in the archive

2014-07-25 10:36, Stephen Hemminger:

Quoted 5 lines

Add more compatibility wrappers, and split out all the wrapper code to a separate file. Builds on Debian Squeeze (2.6.32) which is oldest version of kernel current DPDK supports.

Applied for version 1.7.1.

There are still some compilation issues with RHEL:
include/linux/pci.h:1572: note: previous declaration of ‘pci_num_vf’ was here include/linux/pci.h:868: note: previous declaration of ‘pci_intx_mask_supported’ was here include/linux/pci.h:869: note: previous declaration of ‘pci_check_and_mask_intx’ was here

Some ifdefs are missing but I don't want to dig into RHEL kernel headers to find what is the first RHEL release to support these functions. By the way, if someone knows an easy method to get all RHEL kernel headers or to know the release where a symbol appeared, it would be very useful.

Signature · 1 line
Thomas
#4 lore raw

Re: [PATCH 2/2] igb_uio: handle no IRQ fallback

In reply to a message not in the archive

2014-07-25 10:37, Stephen Hemminger:

Quoted 8 lines

Fix a couple of issues with my earlier igb_uio stuff:
1. With MSI (like MSI-X) actual IRQ number is not known until after the pci_enable_msi() is done.
2. If INTX fails, fall back to running without IRQ. This allows usermode PCI to recover and run without out IRQ for cases where PCI INTX support is broken (aka VMWare).

Applied for version 1.7.1.

Thanks

Signature · 1 line
Thomas
#6 lore raw
In reply to Thomas Monjalon

Hi Thomas,

Not that I would *like* to fix this, but I *need* to fix it. We are using CentOS 6.5, which I believe is based on RHEL. We have kernel 2.6.32-431.3.1.el6.x86_64.

I realize that we need to add/change ifdefs around pci_num_vf, pci_intx_mask_supported, and pci_check_and_mask_intx in igb_uio/compat.h. Any more specific suggestions on how to (elegantly) fix it for us, but not break it for anyone else?

--
Regards,
Robert

Quoted 27 lines

2014-07-25 10:36, Stephen Hemminger:

Quoted 5 lines

Add more compatibility wrappers, and split out all the wrapper code to a separate file. Builds on Debian Squeeze (2.6.32) which is oldest version of kernel current DPDK supports.

Applied for version 1.7.1.

There are still some compilation issues with RHEL:
include/linux/pci.h:1572: note: previous declaration of Œpci_num_vf¹ was here
include/linux/pci.h:868: note: previous declaration of Œpci_intx_mask_supported¹ was here
include/linux/pci.h:869: note: previous declaration of Œpci_check_and_mask_intx¹ was here

Some ifdefs are missing but I don't want to dig into RHEL kernel headers to
find what is the first RHEL release to support these functions. By the way, if someone knows an easy method to get all RHEL kernel headers or to know the release where a symbol appeared, it would be very useful.

Signature · 1 line
Thomas
#8 lore raw
In reply to a message not in the archive

This is what we came up with. It works for us. In our kernel headers' linux/pci.h, pci_num_vf is enclosed within "#ifdef CONFIG_PCI_IOV/#endif"; pci_intx_mask_supported and pci_check_and_mask_intx are enclosed within "#ifdef HAVE_PCI_SET_MWI/#endif".

What do you think?

--
Thanks,
Robert

---
 lib/librte_eal/linuxapp/igb_uio/compat.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/lib/librte_eal/linuxapp/igb_uio/compat.h
index 2a16540..f7404d8 100644

lib/librte_eal/linuxapp/igb_uio/compat.h +1 -1
@@ -17,7 +17,7 @@
 #define   PCI_MSIX_ENTRY_CTRL_MASKBIT   1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) &&

!defined(CONFIG_PCI_IOV)
static int pci_num_vf(struct pci_dev *dev)

 {
    struct iov {

@@ -38,7 +38,7 @@ static int pci_num_vf(struct pci_dev *dev)
#endif

-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(HAVE_PCI_SET_MWI)

/* Check if INTX works to control irq's.
* Set's INTX_DISABLE flag and reads it back

Signature · 5 lines
1.7.1



On Fri, Aug 22, 2014 at 1:29 PM, Sanford, Robert <[email protected]>
Quoted 16 lines · wrote:

Hi Thomas,

Not that I would *like* to fix this, but I *need* to fix it. We are using CentOS 6.5, which I believe is based on RHEL. We have kernel 2.6.32-431.3.1.el6.x86_64.

I realize that we need to add/change ifdefs around pci_num_vf, pci_intx_mask_supported, and pci_check_and_mask_intx in igb_uio/compat.h. Any more specific suggestions on how to (elegantly) fix it for us, but not break it for anyone else?

--
Regards,
Robert

#10 lore raw
In reply to a message not in the archive
Quoted 6 lines · On Fri, 22 Aug 2014 14:09:35 -0400 Robert Sanford…

This is what we came up with. It works for us. In our kernel headers' linux/pci.h, pci_num_vf is enclosed within "#ifdef CONFIG_PCI_IOV/#endif"; pci_intx_mask_supported and pci_check_and_mask_intx are enclosed within "#ifdef HAVE_PCI_SET_MWI/#endif".

What do you think?

Maybe we can just get rid of kernel version checks all together and just use the HAVE_ checks.

I will test on stock 2.6.32.

#12 lore raw
In reply to a message not in the archive
Quoted 8 lines
Quoted 8 lines

This is what we came up with. It works for us. In our kernel headers' linux/pci.h, pci_num_vf is enclosed within "#ifdef CONFIG_PCI_IOV/#endif";
pci_intx_mask_supported and pci_check_and_mask_intx are enclosed within "#ifdef HAVE_PCI_SET_MWI/#endif".

Quoted 6 lines
Quoted 1 line

What do you think?

Maybe we can just get rid of kernel version checks all together and just use the HAVE_ checks.

I will test on stock 2.6.32.

Sorry, I spoke too soon. Although it builds with the ifdefs, I just found that it does not load.
"kernel: igb_uio: Unknown symbol irq_to_desc"

#14 lore raw
In reply to a message not in the archive

Hi Robert,

2014-08-26 11:08, Sanford, Robert:

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

This is what we came up with. It works for us. In our kernel headers' linux/pci.h, pci_num_vf is enclosed within "#ifdef CONFIG_PCI_IOV/#endif";
pci_intx_mask_supported and pci_check_and_mask_intx are enclosed within "#ifdef HAVE_PCI_SET_MWI/#endif".

What do you think?

Quoted 8 lines
Quoted 4 lines

Maybe we can just get rid of kernel version checks all together and just use the HAVE_ checks.

I will test on stock 2.6.32.

Sorry, I spoke too soon. Although it builds with the ifdefs, I just found that it does not load.
"kernel: igb_uio: Unknown symbol irq_to_desc"

Do you have some progress on this side?
Release 1.7.1 should be closed tomorrow and your help would be greatly appreciated.

Thanks

Signature · 1 line
Thomas
#16 lore raw
In reply to a message not in the archive
Quoted 107 lines · Stephen Hemminger

Add more compatibility wrappers, and split out all the wrapper code to a separate file. Builds on Debian Squeeze (2.6.32) which is oldest version of kernel current DPDK supports.

---
  lib/librte_eal/linuxapp/igb_uio/compat.h  |  103 ++++++++++++++++++++++++++++++
  lib/librte_eal/linuxapp/igb_uio/igb_uio.c |   81 -----------------------
  2 files changed, 104 insertions(+), 80 deletions(-)
lib/librte_eal/linuxapp/igb_uio/compat.h new file +93 -0
@@ -0,0 +1,103 @@
+/*
+ * Minimal wrappers to allow compiling igb_uio on older kernels.
+ */
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+#define pci_cfg_access_lock   pci_block_user_cfg_access
+#define pci_cfg_access_unlock pci_unblock_user_cfg_access
+#endif
+
+#ifndef PCI_MSIX_ENTRY_SIZE
+#define PCI_MSIX_ENTRY_SIZE             16
+#define  PCI_MSIX_ENTRY_LOWER_ADDR      0
+#define  PCI_MSIX_ENTRY_UPPER_ADDR      4
+#define  PCI_MSIX_ENTRY_DATA            8
+#define  PCI_MSIX_ENTRY_VECTOR_CTRL     12
+#define   PCI_MSIX_ENTRY_CTRL_MASKBIT   1
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+static int pci_num_vf(struct pci_dev *dev)
+{
+	struct iov {
+		int pos;
+		int nres;
+		u32 cap;
+		u16 ctrl;
+		u16 total;
+		u16 initial;
+		u16 nr_virtfn;
+	} *iov = (struct iov *)dev->sriov;
+
+	if (!dev->is_physfn)
+		return 0;
+
+	return iov->nr_virtfn;
+}
+#endif
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+
+/* Check if INTX works to control irq's.
+ * Set's INTX_DISABLE flag and reads it back
+ */
+static bool pci_intx_mask_supported(struct pci_dev *pdev)
+{
+	bool mask_supported = false;
+	uint16_t orig, new;
+
+	pci_block_user_cfg_access(pdev);
+	pci_read_config_word(pdev, PCI_COMMAND, &orig);
+	pci_write_config_word(pdev, PCI_COMMAND,
+			      orig ^ PCI_COMMAND_INTX_DISABLE);
+	pci_read_config_word(pdev, PCI_COMMAND, &new);
+
+	if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
+		dev_err(&pdev->dev, "Command register changed from "
+			"0x%x to 0x%x: driver or hardware bug?\n", orig, new);
+	} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
+		mask_supported = true;
+		pci_write_config_word(pdev, PCI_COMMAND, orig);
+	}
+	pci_unblock_user_cfg_access(pdev);
+
+	return mask_supported;
+}
+
+static bool pci_check_and_mask_intx(struct pci_dev *pdev)
+{
+	bool pending;
+	uint32_t status;
+
+	pci_block_user_cfg_access(pdev);
+	pci_read_config_dword(pdev, PCI_COMMAND, &status);
+
+	/* interrupt is not ours, goes to out */
+	pending = (((status >> 16) & PCI_STATUS_INTERRUPT) != 0);
+	if (pending) {
+		uint16_t old, new;
+
+		old = status;
+		if (status != 0)
+			new = old & (~PCI_COMMAND_INTX_DISABLE);
+		else
+			new = old | PCI_COMMAND_INTX_DISABLE;
+
+		if (old != new)
+			pci_write_config_word(pdev, PCI_COMMAND, new);
+	}
+	pci_unblock_user_cfg_access(pdev);
+
+	return pending;

lib/librte_eal/linuxapp/igb_uio/compat.h line 103

Quoted 10 lines
lib/librte_eal/linuxapp/igb_uio/compat.h new file +10 -0
+}
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+/* Compatability wrapper for new kernel API for IRQ */
+#define irq_data	irq_desc
+#define irq_get_irq_data(irq)	irq_to_desc(irq)
+#define irq_data_get_msi(data)	get_irq_desc_msi(data)
+#endif
+

irq_to_desc is not exported to modules before kernel 3.4 and commit 3911ff30. On Red Hat 6.5 the module fails to load due to an unknow symbol error. I've seen another post saying that it also fails to insert on kernel 2.6.34. I guess it should not work either on debian squeeze (kernel 2.6.32), did you compile it in built-in?

For now, I don't see how we could fix it, since it is not exported we are not allowed to use it in a kernel module. Do you have a way to fix this issue?

Thanks,
Guillaume

Quoted 104 lines
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +1 -80
@@ -37,10 +37,7 @@
  #endif
  #include <rte_pci_dev_features.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-#define pci_cfg_access_lock   pci_block_user_cfg_access
-#define pci_cfg_access_unlock pci_unblock_user_cfg_access
-#endif
+#include "compat.h"
 
  #ifdef RTE_PCI_CONFIG
  #define PCI_SYS_FILE_BUF_SIZE      10
@@ -70,26 +67,6 @@ igbuio_get_uio_pci_dev(struct uio_info *
  }
 
  /* sriov sysfs */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
-static int pci_num_vf(struct pci_dev *dev)
-{
-	struct iov {
-		int pos;
-		int nres;
-		u32 cap;
-		u16 ctrl;
-		u16 total;
-		u16 initial;
-		u16 nr_virtfn;
-	} *iov = (struct iov *)dev->sriov;
-
-	if (!dev->is_physfn)
-		return 0;
-
-	return iov->nr_virtfn;
-}
-#endif
-
  static ssize_t
  show_max_vfs(struct device *dev, struct device_attribute *attr,
  	     char *buf)
@@ -228,62 +205,6 @@ static struct attribute *dev_attrs[] = {
  static const struct attribute_group dev_attr_grp = {
  	.attrs = dev_attrs,
  };
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-/* Check if INTX works to control irq's.
- * Set's INTX_DISABLE flag and reads it back
- */
-static bool pci_intx_mask_supported(struct pci_dev *pdev)
-{
-	bool mask_supported = false;
-	uint16_t orig, new;
-
-	pci_block_user_cfg_access(pdev);
-	pci_read_config_word(pdev, PCI_COMMAND, &orig);
-	pci_write_config_word(pdev, PCI_COMMAND,
-			      orig ^ PCI_COMMAND_INTX_DISABLE);
-	pci_read_config_word(pdev, PCI_COMMAND, &new);
-
-	if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
-		dev_err(&pdev->dev, "Command register changed from "
-			"0x%x to 0x%x: driver or hardware bug?\n", orig, new);
-	} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
-		mask_supported = true;
-		pci_write_config_word(pdev, PCI_COMMAND, orig);
-	}
-	pci_unblock_user_cfg_access(pdev);
-
-	return mask_supported;
-}
-
-static bool pci_check_and_mask_intx(struct pci_dev *pdev)
-{
-	bool pending;
-	uint32_t status;
-
-	pci_block_user_cfg_access(pdev);
-	pci_read_config_dword(pdev, PCI_COMMAND, &status);
-
-	/* interrupt is not ours, goes to out */
-	pending = (((status >> 16) & PCI_STATUS_INTERRUPT) != 0);
-	if (pending) {
-		uint16_t old, new;
-
-		old = status;
-		if (status != 0)
-			new = old & (~PCI_COMMAND_INTX_DISABLE);
-		else
-			new = old | PCI_COMMAND_INTX_DISABLE;
-
-		if (old != new)
-			pci_write_config_word(pdev, PCI_COMMAND, new);
-	}
-	pci_unblock_user_cfg_access(pdev);
-
-	return pending;
-}
-#endif
-
  /*
   * It masks the msix on/off of generating MSI-X messages.
   */
#15 lore raw
In reply to a message not in the archive
Quoted 4 lines · Robert Sanford

This is what we came up with. It works for us. In our kernel headers' linux/pci.h, pci_num_vf is enclosed within "#ifdef CONFIG_PCI_IOV/#endif"; pci_intx_mask_supported and pci_check_and_mask_intx are enclosed within "#ifdef HAVE_PCI_SET_MWI/#endif".

Testing on HAVE_PCI_SET_MWI seems not correct. It is defined since linux 2.6.12. There is no define associated with the commit that adds pci_intx_mask_supported and pci_check_and_mask_intx.

So I think we'll have to check the distribution, something like:

-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && \
+ (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE == RHEL_RELEASE_VERSION(6,5)))

What do you think?

--
Best regards,
Guillaume

Quoted 37 lines

What do you think?

--
Thanks,
Robert

---
  lib/librte_eal/linuxapp/igb_uio/compat.h |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/igb_uio/compat.h +1 -1
index 2a16540..f7404d8 100644
@@ -17,7 +17,7 @@
  #define   PCI_MSIX_ENTRY_CTRL_MASKBIT   1
  #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) &&
 !defined(CONFIG_PCI_IOV)
  static int pci_num_vf(struct pci_dev *dev)
  {
     struct iov {
lib/librte_eal/linuxapp/igb_uio/compat.h +1 -1
@@ -38,7 +38,7 @@ static int pci_num_vf(struct pci_dev *dev)
  #endif
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) &&
 !defined(HAVE_PCI_SET_MWI)
 
  /* Check if INTX works to control irq's.

* Set's INTX_DISABLE flag and reads it back

#18 lore raw
In reply to a message not in the archive

Hi Stephen,

There are some reports about build errors with igb_uio. This is critical for the release.
As your patches have introduced this problem, we'd like to have your opinion.

For release 1.7.1, I've reverted MSI support.
We should try to fix it for next release.

2014-09-01 16:55, Guillaume Gaudonville:

Quoted 6 lines · Stephen Hemminger
Quoted 5 lines
lib/librte_eal/linuxapp/igb_uio/compat.h new file +5 -0
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+/* Compatability wrapper for new kernel API for IRQ */
+#define irq_data	irq_desc
+#define irq_get_irq_data(irq)	irq_to_desc(irq)
+#define irq_data_get_msi(data)	get_irq_desc_msi(data)
Quoted 8 lines
Quoted 1 line

+#endif

irq_to_desc is not exported to modules before kernel 3.4 and commit 3911ff30.
On Red Hat 6.5 the module fails to load due to an unknow symbol error. I've seen another post saying that it also fails to insert on kernel 2.6.34. I guess it should not work either on debian squeeze (kernel 2.6.32), did you compile it in built-in?

Generally speaking, I think your patches would need more tests. If you cannot properly test your patches, you could explain how you test it, when submitting patch, so someone else could continue the test campaign.

Quoted 3 lines

For now, I don't see how we could fix it, since it is not exported we are not allowed to use it in a kernel module.
Do you have a way to fix this issue?

Waiting for the fix, MSI support is reverted.

Thanks for your understanding

Signature · 1 line
Thomas