Skip to contentSkip to conversation

igb_uio: fix unknown symbols

PATCH In review Ferruh Yigit 4 participants 7 messages Oct 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb_uio: fix unknown symbols

This patch partially reverts the commit d196343a258e and adds some functions from Markus' previous version of the patch [1].

igb_uio uses pci_msi_unmask_irq() and pci_msi_mask_irq() kernel APIs when kernel version is >= 3.19 because these APIs are implemented in this Linux kernel version.

But these APIs only exported beginning from Linux kernel 4.5, so before this Linux kernel version igb_uio kernel module is not usable, and giving following warnings:
"igb_uio: Unknown symbol pci_msi_unmask_irq"
"igb_uio: Unknown symbol pci_msi_mask_irq"

The support for these APIs increased to Linux kernel >= 4.5

For older version of Linux kernel unmask_msi_irq() and mask_msi_irq() are used but these functions are not exported at all. Instead of these functions switched back to previous implementation in igb_uio for MSI-X, and for MSI used igbuio_msi_mask_irq() from [1].

Fixes d196343a258e ("igb_uio: use kernel functions for masking MSI-X")

[1]
http://dpdk.org/dev/patchwork/patch/28144/

---
 lib/librte_eal/linuxapp/igb_uio/compat.h  | 25 ++++++++--
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 77 ++++++++++++++++++++++++++++---
 2 files changed, 91 insertions(+), 11 deletions(-)
lib/librte_eal/linuxapp/igb_uio/compat.h +21 -4
index 67a7ab3af..30508f35c 100644
@@ -15,6 +15,21 @@
 #define HAVE_PTE_MASK_PAGE_IOMAP
 #endif
 
+#ifndef PCI_MSIX_ENTRY_SIZE
+#define PCI_MSIX_ENTRY_SIZE            16
+#define PCI_MSIX_ENTRY_VECTOR_CTRL     12
+#define PCI_MSIX_ENTRY_CTRL_MASKBIT    1
+#endif
+
+/*
+ * for kernels < 2.6.38 and backported patch that moves MSI-X entry definition
+ * to pci_regs.h Those kernels has PCI_MSIX_ENTRY_SIZE defined but not
+ * PCI_MSIX_ENTRY_CTRL_MASKBIT
+ */
+#ifndef PCI_MSIX_ENTRY_CTRL_MASKBIT
+#define PCI_MSIX_ENTRY_CTRL_MASKBIT    1
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \
 	(!(defined(RHEL_RELEASE_CODE) && \
 	 RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9)))
@@ -110,10 +125,12 @@ static bool pci_check_and_mask_intx(struct pci_dev *pdev)
 #define HAVE_ALLOC_IRQ_VECTORS 1
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
-#define HAVE_PCI_MSI_MASK_IRQ 1
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
+#define HAVE_MSI_LIST_IN_GENERIC_DEVICE 1
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
-#define HAVE_IRQ_DATA 1
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#define HAVE_PCI_MSI_MASK_IRQ 1
 #endif
+
+
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +70 -7

96 lines not on this page · raw message

Signature · 1 line
2.13.6
#1 lore raw
Quoted 20 lines · Ferruh Yigit

This patch partially reverts the commit d196343a258e and adds some functions from Markus' previous version of the patch [1].

igb_uio uses pci_msi_unmask_irq() and pci_msi_mask_irq() kernel APIs when kernel version is >= 3.19 because these APIs are implemented in this Linux kernel version.

But these APIs only exported beginning from Linux kernel 4.5, so before this Linux kernel version igb_uio kernel module is not usable, and giving following warnings:
"igb_uio: Unknown symbol pci_msi_unmask_irq"
"igb_uio: Unknown symbol pci_msi_mask_irq"

The support for these APIs increased to Linux kernel >= 4.5

For older version of Linux kernel unmask_msi_irq() and mask_msi_irq() are used but these functions are not exported at all. Instead of these functions switched back to previous implementation in igb_uio for MSI-X, and for MSI used igbuio_msi_mask_irq() from [1].

Quoted 7 lines
Fixes d196343a258e ("igb_uio: use kernel functions for masking MSI-X")

[1]
http://dpdk.org/dev/patchwork/patch/28144/

Hi Markus,

Can you please test MSI interrupts, I used you function but not tested?

Thanks,
ferruh

#2 lore raw

PATCH 1/1 igb_uio: fix legacy msi masking

MSI masks contain a 1 if interrupt is masked, 0 if unmasked. I got that wrong with the !!state calculation. For better readability, the mask is now changed like in igbuio_msi_mask_irq.

Fixes a8ea1e5fb647 ("igb_uio: fix unknown MSI symbols")
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +4 -3
index 0dda26c..b67d775 100644
@@ -122,13 +122,14 @@ igbuio_msi_mask_irq(struct pci_dev *pdev, struct msi_desc *desc, int32_t state)
 	u32 mask_bits = desc->masked;
 	u32 offset = desc->irq - pdev->irq;
 	u32 mask = 1 << offset;
-	u32 flag = !!state << offset;
 
 	if (!desc->msi_attrib.maskbit)
 		return;
 
-	mask_bits &= ~mask;
-	mask_bits |= flag;
+	if (state != 0)
+		mask_bits &= ~mask;
+	else
+		mask_bits |= mask;
 
 	if (mask_bits != desc->masked) {
 		pci_write_config_dword(pdev, desc->mask_pos, mask_bits);
Signature · 1 line
2.7.4
author Acked-by on v1 1/1
#3 lore raw

Re: [PATCH] igb_uio: fix legacy msi masking

Quoted 8 lines · Markus Theil

MSI masks contain a 1 if interrupt is masked, 0 if unmasked. I got that wrong with the !!state calculation. For better readability, the mask is now changed like in igbuio_msi_mask_irq.

Fixes a8ea1e5fb647 ("igb_uio: fix unknown MSI symbols")
author Applied
#4 lore raw

Re: [PATCH] igb_uio: fix legacy msi masking

Quoted 11 lines · Ferruh Yigit
Quoted 8 lines · Markus Theil

MSI masks contain a 1 if interrupt is masked, 0 if unmasked. I got that wrong with the !!state calculation. For better readability, the mask is now changed like in igbuio_msi_mask_irq.

Fixes a8ea1e5fb647 ("igb_uio: fix unknown MSI symbols")

Applied to dpdk/master, thanks.

#5 lore raw
In reply to Ferruh Yigit
Quoted 20 lines · Ferruh Yigit

This patch partially reverts the commit d196343a258e and adds some functions from Markus' previous version of the patch [1].

igb_uio uses pci_msi_unmask_irq() and pci_msi_mask_irq() kernel APIs when kernel version is >= 3.19 because these APIs are implemented in this Linux kernel version.

But these APIs only exported beginning from Linux kernel 4.5, so before this Linux kernel version igb_uio kernel module is not usable, and giving following warnings:
"igb_uio: Unknown symbol pci_msi_unmask_irq"
"igb_uio: Unknown symbol pci_msi_mask_irq"

The support for these APIs increased to Linux kernel >= 4.5

For older version of Linux kernel unmask_msi_irq() and mask_msi_irq() are used but these functions are not exported at all. Instead of these functions switched back to previous implementation in igb_uio for MSI-X, and for MSI used igbuio_msi_mask_irq() from [1].

Quoted 7 lines
Fixes d196343a258e ("igb_uio: use kernel functions for masking MSI-X")

[1]
http://dpdk.org/dev/patchwork/patch/28144/

I can confirm that with this patch applied I am able to build and load the igb_uio module on CentOS 7.4. I have not tested the actual MSI-X interrupt mask/unmask functionality.

#6 lore raw

13/10/2017 05:21, Patrick MacArthur:

Quoted 24 lines · Ferruh Yigit
Quoted 23 lines

This patch partially reverts the commit d196343a258e and adds some functions from Markus' previous version of the patch [1].

igb_uio uses pci_msi_unmask_irq() and pci_msi_mask_irq() kernel APIs when kernel version is >= 3.19 because these APIs are implemented in this Linux kernel version.

But these APIs only exported beginning from Linux kernel 4.5, so before this Linux kernel version igb_uio kernel module is not usable, and giving following warnings:
"igb_uio: Unknown symbol pci_msi_unmask_irq"
"igb_uio: Unknown symbol pci_msi_mask_irq"

The support for these APIs increased to Linux kernel >= 4.5

For older version of Linux kernel unmask_msi_irq() and mask_msi_irq() are used but these functions are not exported at all. Instead of these functions switched back to previous implementation in igb_uio for MSI-X, and for MSI used igbuio_msi_mask_irq() from [1].

Fixes d196343a258e ("igb_uio: use kernel functions for masking MSI-X")
Quoted 8 lines
Quoted 4 lines

[1]
http://dpdk.org/dev/patchwork/patch/28144/

I can confirm that with this patch applied I am able to build and load the igb_uio module on CentOS 7.4. I have not tested the actual MSI-X interrupt mask/unmask functionality.

Applied shortly without more tests to make it part of RC1, thanks