diff options
Diffstat (limited to 'net/devlink/devl_internal.h')
-rw-r--r-- | net/devlink/devl_internal.h | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h index d0d889038138..941174e157d4 100644 --- a/net/devlink/devl_internal.h +++ b/net/devlink/devl_internal.h @@ -38,7 +38,6 @@ struct devlink { struct list_head trap_policer_list; struct list_head linecard_list; const struct devlink_ops *ops; - u64 features; struct xarray snapshot_ids; struct devlink_dev_stats stats; struct device *dev; @@ -116,7 +115,7 @@ struct devlink_nl_dump_state { }; }; -struct devlink_gen_cmd { +struct devlink_cmd { int (*dump_one)(struct sk_buff *msg, struct devlink *devlink, struct netlink_callback *cb); }; @@ -129,8 +128,8 @@ devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs); void devlink_notify_unregister(struct devlink *devlink); void devlink_notify_register(struct devlink *devlink); -int devlink_nl_instance_iter_dump(struct sk_buff *msg, - struct netlink_callback *cb); +int devlink_nl_instance_iter_dumpit(struct sk_buff *msg, + struct netlink_callback *cb); static inline struct devlink_nl_dump_state * devlink_dump_state(struct netlink_callback *cb) @@ -140,22 +139,36 @@ devlink_dump_state(struct netlink_callback *cb) return (struct devlink_nl_dump_state *)cb->ctx; } -/* gen cmds */ -extern const struct devlink_gen_cmd devl_gen_inst; -extern const struct devlink_gen_cmd devl_gen_port; -extern const struct devlink_gen_cmd devl_gen_sb; -extern const struct devlink_gen_cmd devl_gen_sb_pool; -extern const struct devlink_gen_cmd devl_gen_sb_port_pool; -extern const struct devlink_gen_cmd devl_gen_sb_tc_pool_bind; -extern const struct devlink_gen_cmd devl_gen_selftests; -extern const struct devlink_gen_cmd devl_gen_param; -extern const struct devlink_gen_cmd devl_gen_region; -extern const struct devlink_gen_cmd devl_gen_info; -extern const struct devlink_gen_cmd devl_gen_health_reporter; -extern const struct devlink_gen_cmd devl_gen_trap; -extern const struct devlink_gen_cmd devl_gen_trap_group; -extern const struct devlink_gen_cmd devl_gen_trap_policer; -extern const struct devlink_gen_cmd devl_gen_linecard; +static inline int +devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink) +{ + if (nla_put_string(msg, DEVLINK_ATTR_BUS_NAME, devlink->dev->bus->name)) + return -EMSGSIZE; + if (nla_put_string(msg, DEVLINK_ATTR_DEV_NAME, dev_name(devlink->dev))) + return -EMSGSIZE; + return 0; +} + +/* Commands */ +extern const struct devlink_cmd devl_cmd_get; +extern const struct devlink_cmd devl_cmd_port_get; +extern const struct devlink_cmd devl_cmd_sb_get; +extern const struct devlink_cmd devl_cmd_sb_pool_get; +extern const struct devlink_cmd devl_cmd_sb_port_pool_get; +extern const struct devlink_cmd devl_cmd_sb_tc_pool_bind_get; +extern const struct devlink_cmd devl_cmd_param_get; +extern const struct devlink_cmd devl_cmd_region_get; +extern const struct devlink_cmd devl_cmd_info_get; +extern const struct devlink_cmd devl_cmd_health_reporter_get; +extern const struct devlink_cmd devl_cmd_trap_get; +extern const struct devlink_cmd devl_cmd_trap_group_get; +extern const struct devlink_cmd devl_cmd_trap_policer_get; +extern const struct devlink_cmd devl_cmd_rate_get; +extern const struct devlink_cmd devl_cmd_linecard_get; +extern const struct devlink_cmd devl_cmd_selftests_get; + +/* Notify */ +void devlink_notify(struct devlink *devlink, enum devlink_command cmd); /* Ports */ int devlink_port_netdevice_event(struct notifier_block *nb, @@ -176,6 +189,12 @@ static inline bool devlink_reload_supported(const struct devlink_ops *ops) return ops->reload_down && ops->reload_up; } +/* Resources */ +struct devlink_resource; +int devlink_resources_validate(struct devlink *devlink, + struct devlink_resource *resource, + struct genl_info *info); + /* Line cards */ struct devlink_linecard; @@ -183,10 +202,19 @@ struct devlink_linecard * devlink_linecard_get_from_info(struct devlink *devlink, struct genl_info *info); /* Rates */ -extern const struct devlink_gen_cmd devl_gen_rate_get; - +int devlink_rate_nodes_check(struct devlink *devlink, u16 mode, + struct netlink_ext_ack *extack); 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); +/* Devlink nl cmds */ +int devlink_nl_cmd_get_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_info_get_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_flash_update(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_selftests_get_doit(struct sk_buff *skb, struct genl_info *info); +int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info); |