diff -drupN a/include/linux/ethtool.h b/include/linux/ethtool.h --- a/include/linux/ethtool.h 2018-08-06 17:23:04.000000000 +0300 +++ b/include/linux/ethtool.h 2022-06-12 05:28:14.000000000 +0300 @@ -79,9 +79,17 @@ enum { struct net_device; +#ifdef CONFIG_NET_ETHTOOL /* Some generic methods drivers may use in their ethtool_ops */ u32 ethtool_op_get_link(struct net_device *dev); int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti); +#else +/* Some generic methods drivers may use in their ethtool_ops */ +static inline u32 ethtool_op_get_link(struct net_device *dev) { return 0; } +static inline int +ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti) +{ return -EINVAL; } +#endif /** * ethtool_rxfh_indir_default - get default value for RX flow hash indirection @@ -146,6 +154,7 @@ struct ethtool_link_ksettings { #define ethtool_link_ksettings_test_link_mode(ptr, name, mode) \ test_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name) +#ifdef CONFIG_NET_ETHTOOL extern int __ethtool_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *link_ksettings); @@ -156,6 +165,17 @@ void ethtool_convert_legacy_u32_to_link_ /* return false if src had higher bits set. lower bits always updated. */ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, const unsigned long *src); +#else +static inline u32 __ethtool_get_link_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *link_ksettings) +{ + return -EOPNOTSUPP; +} +static inline void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, + u32 legacy_u32){ } +static inline bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, + const unsigned long *src) { return false; } +#endif /** * struct ethtool_ops - optional netdev operations