[dpdk-stable] [PATCH 1/3] kni: fix kernel 5.4 build - merged pci_aspm.h

Christian Ehrhardt christian.ehrhardt at canonical.com
Mon Oct 21 13:16:32 CEST 2019


Due to kernel change [1] pci-aspm.h no more exists and we need to
include just pci.h instead in kernels >=5.4

The failure due to that is just a not-found include:
/usr/src/dpdk-rte-kni-18.11.2/ethtool/ixgbe/kcompat.h:2225:10:
fatal error: linux/pci-aspm.h: No such file or directory
 2225 | #include <linux/pci-aspm.h>

Fix it by including just pci.h depending on kernel version we build
against.

Not applying to master branch due to kni ethtool being removed in [2]

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7ce2e76a
[2]: https://git.dpdk.org/dpdk/commit/?id=ea6b39b5

Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
---
 kernel/linux/kni/ethtool/igb/kcompat.h   | 8 ++++++--
 kernel/linux/kni/ethtool/ixgbe/kcompat.h | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/kernel/linux/kni/ethtool/igb/kcompat.h b/kernel/linux/kni/ethtool/igb/kcompat.h
index f041a3ebe..74390aa5f 100644
--- a/kernel/linux/kni/ethtool/igb/kcompat.h
+++ b/kernel/linux/kni/ethtool/igb/kcompat.h
@@ -2413,13 +2413,17 @@ static inline int _kc_skb_is_gso_v6(const struct sk_buff *skb)
 
 extern void _kc_pci_disable_link_state(struct pci_dev *dev, int state);
 #define pci_disable_link_state(p, s) _kc_pci_disable_link_state(p, s)
-#else /* < 2.6.26 */
+#else /* < 2.6.26 or > 5.4 */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) )
+#include <linux/pci.h>
+#else
 #include <linux/pci-aspm.h>
+#endif
 #define HAVE_NETDEV_VLAN_FEATURES
 #ifndef PCI_EXP_LNKCAP_ASPMS
 #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
 #endif /* PCI_EXP_LNKCAP_ASPMS */
-#endif /* < 2.6.26 */
+#endif /* < 2.6.26 or > 5.4 */
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
 static inline void _kc_ethtool_cmd_speed_set(struct ethtool_cmd *ep,
diff --git a/kernel/linux/kni/ethtool/ixgbe/kcompat.h b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
index 419fd1f13..64d39a7ae 100644
--- a/kernel/linux/kni/ethtool/ixgbe/kcompat.h
+++ b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
@@ -2221,10 +2221,14 @@ static inline int _kc_skb_is_gso_v6(const struct sk_buff *skb)
 
 extern void _kc_pci_disable_link_state(struct pci_dev *dev, int state);
 #define pci_disable_link_state(p, s) _kc_pci_disable_link_state(p, s)
-#else /* < 2.6.26 */
+#else /* < 2.6.26 or > 5.4 */
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0) )
+#include <linux/pci.h>
+#else
 #include <linux/pci-aspm.h>
+#endif
 #define HAVE_NETDEV_VLAN_FEATURES
-#endif /* < 2.6.26 */
+#endif /* < 2.6.26 or > 5.4 */
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
 static inline void _kc_ethtool_cmd_speed_set(struct ethtool_cmd *ep,
-- 
2.23.0



More information about the stable mailing list