On Sun, Feb 28, 2016 at 08:31:34AM +0100, Sven Eckelmann wrote:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+#define ethtool_link_ksettings batadv_ethtool_link_ksettings
+struct batadv_ethtool_link_ksettings {
- struct {
__u32 speed;
__u8 duplex;
- } base;
+};
+#define __ethtool_get_link_ksettings(__dev, __link_settings) \
- batadv_ethtool_get_link_ksettings(__dev, __link_settings)
+static inline int +batadv_ethtool_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *link_ksettings)
+{
- struct ethtool_cmd cmd;
- int ret;
- memset(&cmd, 0, sizeof(cmd));
- ret = __ethtool_get_settings(dev, &cmd);
- if (ret != 0)
return ret;
- link_ksettings->base.duplex = cmd.duplex;
- link_ksettings->base.speed = ethtool_cmd_speed(&cmd);
- return 0;
+}
+#endif /* < KERNEL_VERSION(4, 6, 0) */
Hi Sven,
I really like this approach! thanks a lot! By the way, you should have added your name to the list of contributor of this file though :)
How about re-sending this RFC as PATCH (with your sign-off as well) ?
Cheers,