net: devlink: extend info_get() version put to indicate a flash component
Subsystems (4)
Jiri Pirko
maintainerRFC PATCH 1/1 net: devlink: extend info_get() version put to indicate a flash component
From: Jiri Pirko <[email protected]>
Limit the acceptance of component name passed to cmd_flash_update() to match one of the versions returned by info_get(), marked by new flag.
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_put_ext() that allows to specify a flag that indicates a particular version name represents a flash component.
Use this indication during cmd_flash_update() execution by calling info_get() with different "req" context. That causes info_get() to lookup the component name instead of filling-up the netlink message.
Fix the only component user which is netdevsim. It uses component named "fw.mgmt" in selftests.
Remove now outdated "UPDATE_COMPONENT" flag.
--- drivers/net/netdevsim/dev.c | 11 +++++-- include/net/devlink.h | 7 +++-- net/core/devlink.c | 62 ++++++++++++++++++++++++++++++------- 3 files changed, 63 insertions(+), 17 deletions(-)
drivers/net/netdevsim/dev.c +8 -3
@@ -995,7 +995,13 @@ static int nsim_dev_info_get(struct devlink *devlink,struct devlink_info_req *req, struct netlink_ext_ack *extack) { - return devlink_info_driver_name_put(req, DRV_NAME); + int err; + + err =devlink_info_driver_name_put (req,DRV_NAME ); +if (err) +return err; + +return devlink_info_version_running_put_ext (req,"fw.mgmt" ,"10.20.30" , true); }#define NSIM_DEV_FLASH_SIZE 500000
@@ -1323,8 +1329,7 @@ nsim_dev_devlink_trap_drop_counter_get(struct devlink *devlink,static const struct devlink_ops nsim_dev_devlink_ops = { .eswitch_mode_set = nsim_devlink_eswitch_mode_set, .eswitch_mode_get = nsim_devlink_eswitch_mode_get, - .supported_flash_update_params =DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT | -DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK , + .supported_flash_update_params =DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK , .reload_actions =BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ), .reload_down = nsim_dev_reload_down, .reload_up = nsim_dev_reload_up,
include/net/devlink.h +5 -2
@@ -624,8 +624,7 @@ struct devlink_flash_update_params {u32 overwrite_mask; }; -#define DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT BIT(0) -#define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK BIT(1) +#define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK BIT(0)struct devlink_region ;struct devlink_info_req ;
@@ -1677,6 +1676,10 @@ int devlink_info_version_stored_put(struct devlink_info_req *req,int devlink_info_version_running_put (struct devlink_info_req *req,const char *version_name,const char *version_value); +int devlink_info_version_running_put_ext (struct devlink_info_req *req, +const char *version_name, +const char *version_value, +bool is_flash_component);int devlink_fmsg_obj_nest_start (struct devlink_fmsg *fmsg);int devlink_fmsg_obj_nest_end (struct devlink_fmsg *fmsg);
net/core/devlink.c +50 -12
141 lines not on this page · raw message
Signature · 1 line
2.35.1