diff -drupN a/include/linux/netdevice.h b/include/linux/netdevice.h --- a/include/linux/netdevice.h 2018-08-06 17:23:04.000000000 +0300 +++ b/include/linux/netdevice.h 2022-06-12 05:28:14.000000000 +0300 @@ -66,8 +66,28 @@ struct mpls_dev; struct udp_tunnel_info; struct bpf_prog; + +#ifdef CONFIG_NET_ETHTOOL + +/* When the driver uses this macro ethtool code can be optimized out + * when not needed. We still reference it to avoid unused static + * warnings. + */ + #define SET_ETHTOOL_OPS(netdev, ops) \ + ((void)(ops), (netdev)->ethtool_ops = (ops)) + void netdev_set_default_ethtool_ops(struct net_device *dev, const struct ethtool_ops *ops); +int dev_ethtool(struct net *net, struct ifreq *ifreq); + +#else +#define SET_ETHTOOL_OPS(netdev, ops) do {} while (0) +static inline void +netdev_set_default_ethtool_ops(struct net_device *dev, + const struct ethtool_ops *ops) {} +static inline int +dev_ethtool(struct net *net, struct ifreq *ifr) { return -EINVAL; } +#endif /* Backlog congestion levels */ #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ @@ -258,7 +278,7 @@ struct hh_cache { */ #define LL_RESERVED_SPACE(dev) \ ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) -#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ +#define LL_RESERVED_SPACE_EXTRA(dev, extra) \ ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) struct header_ops { @@ -1494,7 +1514,7 @@ enum netdev_priv_flags { * @ethtool_ops: Management operations * @ndisc_ops: Includes callbacks for different IPv6 neighbour * discovery handling. Necessary for e.g. 6LoWPAN. - * @header_ops: Includes callbacks for creating,parsing,caching,etc + * @header_ops: Includes callbacks for creating, parsing, caching, etc * of Layer 2 headers. * * @flags: Interface flags (a la BSD) @@ -1656,8 +1676,8 @@ struct net_device { atomic_t carrier_changes; /* - * Some hardware also needs these fields (state,dev_list, - * napi_list,unreg_list,close_list) but they are not + * Some hardware also needs these fields (state, dev_list, + * napi_list, unreg_list, close_list) but they are not * part of the usual set specified in Space.c. */ @@ -3337,7 +3357,6 @@ void netdev_rx_handler_unregister(struct bool dev_valid_name(const char *name); int dev_ioctl(struct net *net, unsigned int cmd, void __user *); -int dev_ethtool(struct net *net, struct ifreq *); unsigned int dev_get_flags(const struct net_device *); int __dev_change_flags(struct net_device *, unsigned int flags); int dev_change_flags(struct net_device *, unsigned int);