From 9000edb71ab29d184aa33f5a77fa6e52d8812bb9 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Mon, 16 Mar 2020 13:47:12 -0700 Subject: net: ethtool: require drivers to set supported_coalesce_params Now that all in-tree drivers have been updated we can make the supported_coalesce_params mandatory. To save debugging time in case some driver was missed (or is out of tree) add a warning when netdev is registered with set_coalesce but without supported_coalesce_params. Signed-off-by: Jakub Kicinski Reviewed-by: Michal Kubecek Signed-off-by: David S. Miller --- net/ethtool/common.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'net/ethtool/common.c') diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 0b22741b2f8f..dab047eec943 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -289,3 +289,14 @@ out: kfree(indir); return ret; } + +int ethtool_check_ops(const struct ethtool_ops *ops) +{ + if (WARN_ON(ops->set_coalesce && !ops->supported_coalesce_params)) + return -EINVAL; + /* NOTE: sufficiently insane drivers may swap ethtool_ops at runtime, + * the fact that ops are checked at registration time does not + * mean the ops attached to a netdev later on are sane. + */ + return 0; +} -- cgit