[dpdk-stable] [PATCH 2/3] kni: fix kernel 5.4 build - num_online_cpus
Christian Ehrhardt
christian.ehrhardt at canonical.com
Mon Oct 21 13:16:33 CEST 2019
num_online_cpus was redefined [1] to now be a static inline function.
Due to that the check we had to redefine num_online_cpus as needed
triggers as false-positive and breaks like:
/usr/src/dpdk-rte-kni-18.11.2/ethtool/ixgbe/kcompat.h:239:27:
error: ‘smp_num_cpus’ undeclared (first use in this function)
239 | #define num_online_cpus() smp_num_cpus
That redefine isn't needed for ages, and with >5.4 we can just rely on
it. From the kernel it already is either a working function or defined
as 1UL in case of non SMP.
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=0c09ab96
[2]: https://git.dpdk.org/dpdk/commit/?id=ea6b39b
Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
---
kernel/linux/kni/ethtool/igb/kcompat.h | 2 ++
kernel/linux/kni/ethtool/ixgbe/kcompat.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/kernel/linux/kni/ethtool/igb/kcompat.h b/kernel/linux/kni/ethtool/igb/kcompat.h
index 74390aa5f..964317508 100644
--- a/kernel/linux/kni/ethtool/igb/kcompat.h
+++ b/kernel/linux/kni/ethtool/igb/kcompat.h
@@ -218,9 +218,11 @@ struct msix_entry {
#define node_online(node) ((node) == 0)
#endif
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) )
#ifndef num_online_cpus
#define num_online_cpus() smp_num_cpus
#endif
+#endif
#ifndef cpu_online
#define cpu_online(cpuid) test_bit((cpuid), &cpu_online_map)
diff --git a/kernel/linux/kni/ethtool/ixgbe/kcompat.h b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
index 64d39a7ae..e1671e91a 100644
--- a/kernel/linux/kni/ethtool/ixgbe/kcompat.h
+++ b/kernel/linux/kni/ethtool/ixgbe/kcompat.h
@@ -235,9 +235,11 @@ struct msix_entry {
#define node_online(node) ((node) == 0)
#endif
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) )
#ifndef num_online_cpus
#define num_online_cpus() smp_num_cpus
#endif
+#endif
#ifndef cpu_online
#define cpu_online(cpuid) test_bit((cpuid), &cpu_online_map)
--
2.23.0
More information about the stable
mailing list