Skip to contentSkip to conversation

batman-adv: Disable __ethtool_get_link_ksettings compat on < 3.2

PATCH In review Sven Eckelmann 2 participants 4 messages Mar 1, 2016 – Mar 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 batman-adv: Disable __ethtool_get_link_ksettings compat on < 3.2

The __ethtool_get_link_ksettings is currently used only for kernels >= 3.15. But the compat code is read by the compiler for each kernel. But kernels up to 3.1 never had the function __ethtool_get_settings which is used to emulate this function for kernels < 4.6. Therefore, kernels < 3.2 will fail to compile when this compatibility layer is enabled.

Fixes 3515604d82d5 ("batman-adv: ELP - use new ethtool_link_get_ksettings API")

---
v2:
- correct version number of the supported kernel

 compat-include/linux/ethtool.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
compat-include/linux/ethtool.h +3 -1
index 87f7577..2e6270e 100644
@@ -24,7 +24,9 @@
 #include <linux/version.h>
 #include_next <linux/ethtool.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+/* WARNING only enabled on kernels with __ethtool_get_settings support */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && \
+    LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 
 #define ethtool_link_ksettings batadv_ethtool_link_ksettings
 
Signature · 1 line
2.7.0
#1 lore raw
Quoted 20 lines · Sven Eckelmann

The __ethtool_get_link_ksettings is currently used only for kernels >= 3.15. But the compat code is read by the compiler for each kernel. But kernels up to 3.1 never had the function __ethtool_get_settings which is used to emulate this function for kernels < 4.6. Therefore, kernels < 3.2 will fail to compile when this compatibility layer is enabled.

Fixes 3515604d82d5 ("batman-adv: ELP - use new ethtool_link_get_ksettings API")

---
v2:
- correct version number of the supported kernel

 compat-include/linux/ethtool.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
compat-include/linux/ethtool.h +0 -0
index 87f7577..2e6270e 100644

compat-include/linux/ethtool.h line 29

Quoted 7 lines
compat-include/linux/ethtool.h +3 -1
@@ -24,7 +24,9 @@
 #include <linux/version.h>
 #include_next <linux/ethtool.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+/* WARNING only enabled on kernels with __ethtool_get_settings support */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && \
+    LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)

Sven,

does it mean that on <3.2 batman v won't compile at all ?

Cheers,

Signature · 1 line
Antonio Quartulli
#2 lore raw

On Tuesday 01 March 2016 16:07:08 Antonio Quartulli wrote:
[...]

Quoted 1 line

does it mean that on <3.2 batman v won't compile at all ?

Ehrm, it doesn't even work on < 3.15. And afaik it never compiled on < 3.2

Kind regards,
Sven

#3 lore raw
In reply to Sven Eckelmann
Quoted 11 lines · On Tuesday 01 March 2016 08:33:37 Sven Eckelmann wrote:

The __ethtool_get_link_ksettings is currently used only for kernels >= 3.15. But the compat code is read by the compiler for each kernel. But kernels up to 3.1 never had the function __ethtool_get_settings which is used to emulate this function for kernels < 4.6. Therefore, kernels < 3.2 will fail to compile when this compatibility layer is enabled.

Fixes 3515604d82d5 ("batman-adv: ELP - use new ethtool_link_get_ksettings

API") Signed-off-by: Sven Eckelmann <[email protected]>
---
v2:
- correct version number of the supported kernel

This patch rejected in favor of the compat(-include) cleanup [1].

Kind regards,
Sven

[1] https://patchwork.open-mesh.org/patch/15942/