From 623cd13b165486afaa2df706d49209392f3764ca Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Wed, 4 Jan 2023 20:05:20 -0800 Subject: devlink: split out netlink code Move out the netlink glue into a separate file. Leave the ops in the old file because we'd have to export a ton of functions. Going forward we should switch to split ops which will let us to put the new ops in the netlink.c file. Pure code move, no functional changes. Reviewed-by: Jacob Keller Reviewed-by: Jiri Pirko Signed-off-by: Jakub Kicinski --- net/devlink/devl_internal.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'net/devlink/devl_internal.h') diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h index 1c74293c6c25..fdf7634b0cd1 100644 --- a/net/devlink/devl_internal.h +++ b/net/devlink/devl_internal.h @@ -97,6 +97,20 @@ devlinks_xa_find_get_next(struct net *net, unsigned long *indexp, xa_mark_t filter); /* Netlink */ +#define DEVLINK_NL_FLAG_NEED_PORT BIT(0) +#define DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT BIT(1) +#define DEVLINK_NL_FLAG_NEED_RATE BIT(2) +#define DEVLINK_NL_FLAG_NEED_RATE_NODE BIT(3) +#define DEVLINK_NL_FLAG_NEED_LINECARD BIT(4) + +enum devlink_multicast_groups { + DEVLINK_MCGRP_CONFIG, +}; + +extern const struct genl_small_ops devlink_nl_ops[56]; + +struct devlink *devlink_get_from_attrs(struct net *net, struct nlattr **attrs); + void devlink_notify_unregister(struct devlink *devlink); void devlink_notify_register(struct devlink *devlink); @@ -104,6 +118,9 @@ void devlink_notify_register(struct devlink *devlink); int devlink_port_netdevice_event(struct notifier_block *nb, unsigned long event, void *ptr); +struct devlink_port * +devlink_port_get_from_info(struct devlink *devlink, struct genl_info *info); + /* Reload */ bool devlink_reload_actions_valid(const struct devlink_ops *ops); int devlink_reload(struct devlink *devlink, struct net *dest_net, @@ -115,3 +132,17 @@ static inline bool devlink_reload_supported(const struct devlink_ops *ops) { return ops->reload_down && ops->reload_up; } + +/* Line cards */ +struct devlink_linecard; + +struct devlink_linecard * +devlink_linecard_get_from_info(struct devlink *devlink, struct genl_info *info); +void devlink_linecard_put(struct devlink_linecard *linecard); + +/* Rates */ +struct devlink_rate * +devlink_rate_get_from_info(struct devlink *devlink, struct genl_info *info); +struct devlink_rate * +devlink_rate_node_get_from_info(struct devlink *devlink, + struct genl_info *info); -- cgit v1.2.3