Skip to contentSkip to conversation

pci: don't use kernel version to determine MSIX defines

PATCH Applied Stephen Hemminger 2 participants 2 messages Dec 27, 2017 – Jan 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: don't use kernel version to determine MSIX defines

In real life, kernel version is only weakly corolated with presence or absence of defines in header files. Instead, check directly if the needed value is defined.

---
 drivers/bus/pci/linux/pci_init.h | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/bus/pci/linux/pci_init.h +13 -7
index f342c47deef6..1ddfc6bc7692 100644
@@ -34,8 +34,6 @@
 #ifndef EAL_PCI_INIT_H_
 #define EAL_PCI_INIT_H_
 
-#include <linux/version.h>
-
 #include <rte_vfio.h>
 
 /** IO resource type: */
@@ -76,14 +74,22 @@ int pci_uio_ioport_unmap(struct rte_pci_ioport *p);
 
 #ifdef VFIO_PRESENT
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
-#define RTE_PCI_MSIX_TABLE_BIR    0x7
-#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8
-#define RTE_PCI_MSIX_FLAGS_QSIZE  0x07ff
-#else
+#ifdef PCI_MSIX_TABLE_BIR
 #define RTE_PCI_MSIX_TABLE_BIR    PCI_MSIX_TABLE_BIR
+#else
+#define RTE_PCI_MSIX_TABLE_BIR    0x7
+#endif
+
+#ifdef PCI_MSIX_TABLE_OFFSET
 #define RTE_PCI_MSIX_TABLE_OFFSET PCI_MSIX_TABLE_OFFSET
+#else
+#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8
+#endif
+
+#ifdef PCI_MSIX_FLAGS_QSIZE
 #define RTE_PCI_MSIX_FLAGS_QSIZE  PCI_MSIX_FLAGS_QSIZE
+#else
+#define RTE_PCI_MSIX_FLAGS_QSIZE  0x07ff
 #endif
 
 /* access config space */
Signature · 1 line
2.11.0
#1 lore raw

27/12/2017 19:25, Stephen Hemminger:

Quoted 5 lines

In real life, kernel version is only weakly corolated with presence or absence of defines in header files. Instead, check directly if the needed value is defined.

Applied, thanks