Commit bb670123 authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

net: devlink: extend info_get() version put to indicate a flash component

Whenever the driver is called by his info_get() op, it may put multiple
version names and values to the netlink message. Extend by additional
helper devlink_info_version_running/stored_put_ext() that allows to
specify a version type that indicates when particular version name
represents a flash component.

This is going to be used in follow-up patch calling info_get() during
flash update command checking if version with this the version type
exists.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 88e500af
...@@ -1714,15 +1714,31 @@ int devlink_info_driver_name_put(struct devlink_info_req *req, ...@@ -1714,15 +1714,31 @@ int devlink_info_driver_name_put(struct devlink_info_req *req,
const char *name); const char *name);
int devlink_info_board_serial_number_put(struct devlink_info_req *req, int devlink_info_board_serial_number_put(struct devlink_info_req *req,
const char *bsn); const char *bsn);
enum devlink_info_version_type {
DEVLINK_INFO_VERSION_TYPE_NONE,
DEVLINK_INFO_VERSION_TYPE_COMPONENT, /* May be used as flash update
* component by name.
*/
};
int devlink_info_version_fixed_put(struct devlink_info_req *req, int devlink_info_version_fixed_put(struct devlink_info_req *req,
const char *version_name, const char *version_name,
const char *version_value); const char *version_value);
int devlink_info_version_stored_put(struct devlink_info_req *req, int devlink_info_version_stored_put(struct devlink_info_req *req,
const char *version_name, const char *version_name,
const char *version_value); const char *version_value);
int devlink_info_version_stored_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type);
int devlink_info_version_running_put(struct devlink_info_req *req, int devlink_info_version_running_put(struct devlink_info_req *req,
const char *version_name, const char *version_name,
const char *version_value); const char *version_value);
int devlink_info_version_running_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type);
int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg); int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg); int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
......
...@@ -6579,7 +6579,8 @@ EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put); ...@@ -6579,7 +6579,8 @@ EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put);
static int devlink_info_version_put(struct devlink_info_req *req, int attr, static int devlink_info_version_put(struct devlink_info_req *req, int attr,
const char *version_name, const char *version_name,
const char *version_value) const char *version_value,
enum devlink_info_version_type version_type)
{ {
struct nlattr *nest; struct nlattr *nest;
int err; int err;
...@@ -6612,7 +6613,8 @@ int devlink_info_version_fixed_put(struct devlink_info_req *req, ...@@ -6612,7 +6613,8 @@ int devlink_info_version_fixed_put(struct devlink_info_req *req,
const char *version_value) const char *version_value)
{ {
return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_FIXED, return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_FIXED,
version_name, version_value); version_name, version_value,
DEVLINK_INFO_VERSION_TYPE_NONE);
} }
EXPORT_SYMBOL_GPL(devlink_info_version_fixed_put); EXPORT_SYMBOL_GPL(devlink_info_version_fixed_put);
...@@ -6621,19 +6623,43 @@ int devlink_info_version_stored_put(struct devlink_info_req *req, ...@@ -6621,19 +6623,43 @@ int devlink_info_version_stored_put(struct devlink_info_req *req,
const char *version_value) const char *version_value)
{ {
return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_STORED, return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_STORED,
version_name, version_value); version_name, version_value,
DEVLINK_INFO_VERSION_TYPE_NONE);
} }
EXPORT_SYMBOL_GPL(devlink_info_version_stored_put); EXPORT_SYMBOL_GPL(devlink_info_version_stored_put);
int devlink_info_version_stored_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type)
{
return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_STORED,
version_name, version_value,
version_type);
}
EXPORT_SYMBOL_GPL(devlink_info_version_stored_put_ext);
int devlink_info_version_running_put(struct devlink_info_req *req, int devlink_info_version_running_put(struct devlink_info_req *req,
const char *version_name, const char *version_name,
const char *version_value) const char *version_value)
{ {
return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_RUNNING, return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_RUNNING,
version_name, version_value); version_name, version_value,
DEVLINK_INFO_VERSION_TYPE_NONE);
} }
EXPORT_SYMBOL_GPL(devlink_info_version_running_put); EXPORT_SYMBOL_GPL(devlink_info_version_running_put);
int devlink_info_version_running_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type)
{
return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_RUNNING,
version_name, version_value,
version_type);
}
EXPORT_SYMBOL_GPL(devlink_info_version_running_put_ext);
static int static int
devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink, devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
enum devlink_command cmd, u32 portid, enum devlink_command cmd, u32 portid,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment