summaryrefslogtreecommitdiffstats
path: root/net/ethtool/common.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-03-16 21:47:12 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-18 04:56:58 +0100
commit9000edb71ab29d184aa33f5a77fa6e52d8812bb9 (patch)
tree9640630ca6bd67eff03758b3a7dc6930b309b7b7 /net/ethtool/common.c
parentnet: axienet: let core reject the unsupported coalescing parameters (diff)
downloadlinux-9000edb71ab29d184aa33f5a77fa6e52d8812bb9.tar.xz
linux-9000edb71ab29d184aa33f5a77fa6e52d8812bb9.zip
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 <kuba@kernel.org> Reviewed-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool/common.c')
-rw-r--r--net/ethtool/common.c11
1 files changed, 11 insertions, 0 deletions
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;
+}