ethtool: introduce ethtool netlink interface
Basic genetlink and init infrastructure for the netlink interface, register genetlink family "ethtool". Add CONFIG_ETHTOOL_NETLINK Kconfig option to make the build optional. Add initial overall interface description into Documentation/networking/ethtool-netlink.rst, further patches will add more detailed information. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
356b23c073
commit
2b4a8990b7
33
net/ethtool/netlink.c
Normal file
33
net/ethtool/netlink.c
Normal file
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/ethtool_netlink.h>
|
||||
#include "netlink.h"
|
||||
|
||||
/* genetlink setup */
|
||||
|
||||
static const struct genl_ops ethtool_genl_ops[] = {
|
||||
};
|
||||
|
||||
static struct genl_family ethtool_genl_family = {
|
||||
.name = ETHTOOL_GENL_NAME,
|
||||
.version = ETHTOOL_GENL_VERSION,
|
||||
.netnsok = true,
|
||||
.parallel_ops = true,
|
||||
.ops = ethtool_genl_ops,
|
||||
.n_ops = ARRAY_SIZE(ethtool_genl_ops),
|
||||
};
|
||||
|
||||
/* module setup */
|
||||
|
||||
static int __init ethnl_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = genl_register_family(ðtool_genl_family);
|
||||
if (WARN(ret < 0, "ethtool: genetlink family registration failed"))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
subsys_initcall(ethnl_init);
|
Reference in New Issue
Block a user