net: devlink: sync flash and dev info commands
Subsystems (4)
Jiri Pirko
maintainerv2 cover net: devlink: sync flash and dev info commands
From: Jiri Pirko <[email protected]>
Purpose of this patchset is to introduce consistency between two devlink commands:
devlink dev info
Shows versions of running default flash target and components.
devlink dev flash
Flashes default flash target or component name (if specified on cmdline).
Currently it is up to the driver what versions to expose and what flash update component names to accept. This is inconsistent. Thankfully, only netdevsim currently using components so it is still time
to sanitize this.
This patchset makes sure, that devlink.c calls into driver for component flash update only in case the driver exposes the same version name.
Also there a new flag exposed to the use over netlink for versions. If driver considers the version represents flashable component, DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT is set. This provides a list of component names for the user.
Example:
$ devlink dev info
netdevsim/netdevsim10:
driver netdevsim
versions:
running:
fw.mgmt 10.20.30
fw 11.22.33
flash_components:
fw.mgmt
$ devlink dev flash netdevsim/netdevsim10 file somefile.bin
[fw.mgmt] Preparing to flash
[fw.mgmt] Flashing 100%
[fw.mgmt] Flash select
[fw.mgmt] Flashing done
$ devlink dev flash netdevsim/netdevsim10 file somefile.bin component fw.mgmt
[fw.mgmt] Preparing to flash
[fw.mgmt] Flashing 100%
[fw.mgmt] Flash select
[fw.mgmt] Flashing done
$ devlink dev flash netdevsim/netdevsim10 file somefile.bin component dummy
Error: selected component is not supported by this device.---v1->v2:
- see changelog of individual patches, no code changes, just split patch
- removed patches that exposed "default flash target"
Jiri Pirko (4):
net: devlink: extend info_get() version put to indicate a flash
component
netdevsim: add version fw.mgmt info info_get() and mark as a component
net: devlink: limit flash component name to match version returned by
info_get()
net: devlink: expose the info about version representing a component
drivers/net/netdevsim/dev.c | 12 +++- include/net/devlink.h | 15 +++- include/uapi/linux/devlink.h | 2 + net/core/devlink.c | 133 +++++++++++++++++++++++++++++------ 4 files changed, 136 insertions(+), 26 deletions(-)
Signature · 1 line
2.37.1
Jiri Pirko
maintainerPATCH v2 1/4 net: devlink: extend info_get() version put to indicate a flash component
From: Jiri Pirko <[email protected]>
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 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.
---v1->v2:
- split from v1 patch "net: devlink: extend info_get() version put to indicate a flash component", no code changes
--- include/net/devlink.h | 12 ++++++++++++ net/core/devlink.c | 23 +++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-)
include/net/devlink.h +12 -0
@@ -1714,6 +1714,14 @@ int devlink_info_driver_name_put(struct devlink_info_req *req, const char *name);int devlink_info_board_serial_number_put (struct devlink_info_req *req,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,const char *version_name,const char *version_value);
@@ -1723,6 +1731,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, +enum devlink_info_version_type version_type);int devlink_fmsg_obj_nest_start (struct devlink_fmsg *fmsg);int devlink_fmsg_obj_nest_end (struct devlink_fmsg *fmsg);
net/core/devlink.c +19 -4
@@ -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,const char *version_name, -const char *version_value) +const char *version_value, +enum devlink_info_version_type version_type) {struct nlattr *nest;int err;
@@ -6612,7 +6613,8 @@ int devlink_info_version_fixed_put(struct devlink_info_req *req, const char *version_value) {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);
@@ -6621,7 +6623,8 @@ int devlink_info_version_stored_put(struct devlink_info_req *req, const char *version_value) {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);
@@ -6630,10 +6633,22 @@ int devlink_info_version_running_put(struct devlink_info_req *req, const char *version_value) {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); +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 devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink, enum devlink_command cmd, u32 portid,
Signature · 1 line
2.37.1
Jakub Kicinski
maintainerRe: [patch net-next v2 1/4] net: devlink: extend info_get() version put to indicate a flash component
include/net/devlink.h int devlink_info_version_stored_put(struct devlink_info_req *req, · line 1737
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
include/net/devlink.h +4
-0+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);
Why are we hooking into running, wouldn't stored make more sense?
Jiri Pirko
maintainerRe: [patch net-next v2 1/4] net: devlink: extend info_get() version put to indicate a flash component
Quoted 7 lines · Tue, Aug 23, 2022 at 05:00:26AM CEST, [email protected] wrote:
include/net/devlink.h int devlink_info_version_stored_put(struct devlink_info_req *req, · line 1737
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
include/net/devlink.h +4
-0+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);Why are we hooking into running, wouldn't stored make more sense?
I think eventually this should be in both. Netdevsim and mlxsw (which I did this originally for) does not have "stored".
Jakub Kicinski
maintainerRe: [patch net-next v2 1/4] net: devlink: extend info_get() version put to indicate a flash component
Quoted 11 lines · On Tue, 23 Aug 2022 08:35:04 +0200 Jiri Pirko wrote:
Quoted 7 lines · Tue, Aug 23, 2022 at 05:00:26AM CEST, [email protected] wrote:
include/net/devlink.h int devlink_info_version_stored_put(struct devlink_info_req *req, · line 1737
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
include/net/devlink.h +4
-0+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);Why are we hooking into running, wouldn't stored make more sense?
I think eventually this should be in both. Netdevsim and mlxsw (which I did this originally for) does not have "stored".
Well, netdevsim is just API dust, and mlxsw is incorrect :/
Jiri Pirko
maintainerRe: [patch net-next v2 1/4] net: devlink: extend info_get() version put to indicate a flash component
Quoted 10 lines · Tue, Aug 23, 2022 at 09:32:08PM CEST, [email protected] wrote:
Quoted 9 lines · On Tue, 23 Aug 2022 08:35:04 +0200 Jiri Pirko wrote:
Quoted 7 lines · Tue, Aug 23, 2022 at 05:00:26AM CEST, [email protected] wrote:
include/net/devlink.h int devlink_info_version_stored_put(struct devlink_info_req *req, · line 1737
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
include/net/devlink.h +4
-0+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);Why are we hooking into running, wouldn't stored make more sense?
Quoted 4 lines
Quoted 2 lines
I think eventually this should be in both. Netdevsim and mlxsw (which I did this originally for) does not have "stored".
Well, netdevsim is just API dust, and mlxsw is incorrect :/
Okay, will add "stored".
Jiri Pirko
maintainerPATCH v2 2/4 netdevsim: add version fw.mgmt info info_get() and mark as a component
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Fix the only component user which is netdevsim. It uses component named "fw.mgmt" in selftests. So add this version to info_get() output with version type component.
---v1->v2:
- split from v1 patch "net: devlink: extend info_get() version put to indicate a flash component", no code changes
--- drivers/net/netdevsim/dev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/netdevsim/dev.c +8 -1
@@ -984,7 +984,14 @@ 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" , +DEVLINK_INFO_VERSION_TYPE_COMPONENT ); }#define NSIM_DEV_FLASH_SIZE 500000
Signature · 1 line
2.37.1
Jiri Pirko
maintainerPATCH v2 3/4 net: devlink: limit flash component name to match version returned by info_get()
In reply to Jiri PirkoFrom: 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 version type. This makes things clearer and enforces 1:1 mapping between exposed version and accepted flash component.
Check VERSION_TYPE_COMPONENT version type 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.
Remove "UPDATE_COMPONENT" flag which becomes used.
---v1->v2:
- split from v1 patch "net: devlink: extend info_get() version put to indicate a flash component", no code changes
--- drivers/net/netdevsim/dev.c | 3 +- include/net/devlink.h | 3 +- net/core/devlink.c | 105 ++++++++++++++++++++++++++++++------ 3 files changed, 90 insertions(+), 21 deletions(-)
drivers/net/netdevsim/dev.c +1 -2
@@ -1319,8 +1319,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 +1 -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 ;
net/core/devlink.c +88 -17
160 lines not on this page · raw message
Signature · 1 line
2.37.1
Jiri Pirko
maintainerPATCH v2 4/4 net: devlink: expose the info about version representing a component
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
If certain version exposed by a driver is marked to be representing a component, expose this info to the user.
Example:
$ devlink dev info
netdevsim/netdevsim10:
driver netdevsim
versions:
running:
fw.mgmt 10.20.30
flash_components:
fw.mgmt--- include/uapi/linux/devlink.h | 2 ++ net/core/devlink.c | 5 +++++ 2 files changed, 7 insertions(+)
include/uapi/linux/devlink.h +2 -0
@@ -607,6 +607,8 @@ enum devlink_attr {DEVLINK_ATTR_SELFTESTS ,/* nested */ +DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT ,/* u8 0 or 1 */ +/* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX,
net/core/devlink.c +5 -0
@@ -6670,6 +6670,11 @@ static int devlink_info_version_put(struct devlink_info_req *req, int attr,if (err) goto nla_put_failure; + err =nla_put_u8 (req->msg,DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT , + version_type ==DEVLINK_INFO_VERSION_TYPE_COMPONENT ); +if (err) + goto nla_put_failure; +nla_nest_end (req->msg, nest);return 0 ;
Signature · 1 line
2.37.1
Jakub Kicinski
maintainerRe: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:47 +0200 Jiri Pirko wrote:
If certain version exposed by a driver is marked to be representing a component, expose this info to the user.
Example:
Quoted 8 lines
$ devlink dev info
netdevsim/netdevsim10:
driver netdevsim
versions:
running:
fw.mgmt 10.20.30
flash_components:
fw.mgmtI don't think we should add API without a clear use, let's drop this as well.
Jiri Pirko
maintainerRe: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 14 lines · Tue, Aug 23, 2022 at 05:01:16AM CEST, [email protected] wrote:
Quoted 4 lines · On Mon, 22 Aug 2022 19:02:47 +0200 Jiri Pirko wrote:
If certain version exposed by a driver is marked to be representing a component, expose this info to the user.
Example:
Quoted 8 lines
$ devlink dev info netdevsim/netdevsim10: driver netdevsim versions: running: fw.mgmt 10.20.30 flash_components: fw.mgmt
Quoted 2 lines
I don't think we should add API without a clear use, let's drop this as well.
What do you mean? This just simply lists components that are possible to use with devlink dev flash. What is not clear? I don't follow.
Jakub Kicinski
maintainerRe: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 6 lines · On Tue, 23 Aug 2022 08:36:01 +0200 Jiri Pirko wrote:
Quoted 2 lines · Tue, Aug 23, 2022 at 05:01:16AM CEST, [email protected] wrote:
I don't think we should add API without a clear use, let's drop this as well.
What do you mean? This just simply lists components that are possible to use with devlink dev flash. What is not clear? I don't follow.
Dumping random internal bits of the kernel is not how we create uAPIs.
Again, what is the scenario in which user space needs to know the flashable component today ?
Jiri Pirko
maintainerRe: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 5 lines · Tue, Aug 23, 2022 at 09:31:21PM CEST, [email protected] wrote:
Quoted 4 lines · On Tue, 23 Aug 2022 08:36:01 +0200 Jiri Pirko wrote:
Quoted 2 lines · Tue, Aug 23, 2022 at 05:01:16AM CEST, [email protected] wrote:
I don't think we should add API without a clear use, let's drop this as well.
Quoted 7 lines
Quoted 2 lines
What do you mean? This just simply lists components that are possible to use with devlink dev flash. What is not clear? I don't follow.
Dumping random internal bits of the kernel is not how we create uAPIs.
Again, what is the scenario in which user space needs to know the flashable component today ?
Well, I thought it would be polite to let the user know what component he can pass to the kernel. Now, it is try-fail/success game. But if you think it is okay to let the user in the doubts, no problem. I will drop the patch.
RE: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 24 lines
-----Original Message-----
From: Jiri Pirko <[email protected]>
Sent: Wednesday, August 24, 2022 1:50 AM
To: Jakub Kicinski <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Keller, Jacob E <[email protected]>; [email protected]; [email protected]
Subject: Re: [patch net-next v2 4/4] net: devlink: expose the info about version representing a componentQuoted 10 lines · Tue, Aug 23, 2022 at 09:31:21PM CEST, [email protected] wrote:
Quoted 6 lines · On Tue, 23 Aug 2022 08:36:01 +0200 Jiri Pirko wrote:
Quoted 2 lines · Tue, Aug 23, 2022 at 05:01:16AM CEST, [email protected] wrote:
I don't think we should add API without a clear use, let's drop this as well.
What do you mean? This just simply lists components that are possible to use with devlink dev flash. What is not clear? I don't follow.
Dumping random internal bits of the kernel is not how we create uAPIs.
Quoted 7 lines
Quoted 2 lines
Again, what is the scenario in which user space needs to know the flashable component today ?
Well, I thought it would be polite to let the user know what component he can pass to the kernel. Now, it is try-fail/success game. But if you think it is okay to let the user in the doubts, no problem. I will drop the patch.
I would prefer exposing this as well since it lets the user know which names are valid for flashing.
I do have some patches for ice to support individual component update as well I can post soon.
Thanks,
Jake
Jakub Kicinski
maintainerRe: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 8 lines · Jacob E
Quoted 4 lines
Well, I thought it would be polite to let the user know what component he can pass to the kernel. Now, it is try-fail/success game. But if you think it is okay to let the user in the doubts, no problem. I will drop the patch.
I would prefer exposing this as well since it lets the user know which names are valid for flashing.
I do have some patches for ice to support individual component update as well I can post soon.
Gentlemen, I had multiple false starts myself adding information to device info, flashing and health reporters. Adding APIs which will actually be _useful_ in production is not trivial. I have the advantage of being able to talk to Meta's production team first so none of my patches made it to the list.
To be clear I'm not saying (nor believe) that Meta's needs or processes are in any way "the right way to go" or otherwise should dictate the APIs. It's just an example I have direct access to.
I don't think I'm out of line asking you for a clear use case. Just knowing something is flashable is not sufficient information, the user needs to know what the component actually describes and what binary to use to update it.
Since we have no use of component flashing now it's all cart before the horse.
Coincidentally I doubt anyone is making serious use of the health infrastructure.
RE: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 30 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Wednesday, August 24, 2022 11:12 AM
To: Keller, Jacob E <[email protected]>
Cc: Jiri Pirko <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [patch net-next v2 4/4] net: devlink: expose the info about version representing a componentQuoted 6 lines · Jacob E
Quoted 4 lines
Well, I thought it would be polite to let the user know what component he can pass to the kernel. Now, it is try-fail/success game. But if you think it is okay to let the user in the doubts, no problem. I will drop the patch.
I would prefer exposing this as well since it lets the user know which names are
valid for flashing.
Quoted 2 lines
I do have some patches for ice to support individual component update as well
I can post soon.
Gentlemen, I had multiple false starts myself adding information to device info, flashing and health reporters. Adding APIs which will actually be _useful_ in production is not trivial. I have the advantage of being able to talk to Meta's production team first so none of my patches made it to the list.
Quoted 9 lines
To be clear I'm not saying (nor believe) that Meta's needs or processes are in any way "the right way to go" or otherwise should dictate the APIs. It's just an example I have direct access to.
I don't think I'm out of line asking you for a clear use case. Just knowing something is flashable is not sufficient information, the user needs to know what the component actually describes and what binary to use to update it.
At least for ice, the same binary would be used for individual component update. the PLDM firmware binary header describes where each component is within it, and is decoded by lib/pldmfw, we just need to translate the PLDM header codes to the userspace names.
The old tools which Intel supports do have support for such an individual component update, but the demand wasn't very high, so I never got around to posting the patches to support this. There are some corner cases where it might be helpful to flash (or reflash) a single component, but it seems somewhat less useful for most end-users and mostly would be useful for internal engineering and debugging.
Users would still need to know what each component is, and there isn't much the kernel API itself can do here. We do document a short description, but that is going to be limited in usefulness since it likely depends on a lot of related knowledge.
Thanks,
Jake
Quoted 5 lines
Since we have no use of component flashing now it's all cart before the horse.
Coincidentally I doubt anyone is making serious use of the health infrastructure.
There haven't been a lot of implementations here, which makes it hard to develop tooling, and then without tooling no one wants to write the implementation....
Re: [patch net-next v2 4/4] net: devlink: expose the info about version representing a component
Quoted 40 lines · Jacob E
Quoted 30 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Wednesday, August 24, 2022 11:12 AM
To: Keller, Jacob E <[email protected]>
Cc: Jiri Pirko <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [patch net-next v2 4/4] net: devlink: expose the info about version representing a componentQuoted 6 lines · Jacob E
Quoted 4 lines
Well, I thought it would be polite to let the user know what component he can pass to the kernel. Now, it is try-fail/success game. But if you think it is okay to let the user in the doubts, no problem. I will drop the patch.
I would prefer exposing this as well since it lets the user know which names are
valid for flashing.
Quoted 2 lines
I do have some patches for ice to support individual component update as well
I can post soon.
Gentlemen, I had multiple false starts myself adding information to device info, flashing and health reporters. Adding APIs which will actually be _useful_ in production is not trivial. I have the advantage of being able to talk to Meta's production team first so none of my patches made it to the list.
Quoted 9 lines
To be clear I'm not saying (nor believe) that Meta's needs or processes are in any way "the right way to go" or otherwise should dictate the APIs. It's just an example I have direct access to.
I don't think I'm out of line asking you for a clear use case. Just knowing something is flashable is not sufficient information, the user needs to know what the component actually describes and what binary to use to update it.
Quoted 6 lines
At least for ice, the same binary would be used for individual component update. the PLDM firmware binary header describes where each component is within it, and is decoded by lib/pldmfw, we just need to translate the PLDM header codes to the userspace names.
The old tools which Intel supports do have support for such an individual component update, but the demand wasn't very high, so I never got around to posting the patches to support this. There are some corner cases where it might be helpful to flash (or reflash) a single component, but it seems somewhat less useful for most end-users and mostly would be useful for internal engineering and debugging.
Users would still need to know what each component is, and there isn't much the kernel API itself can do here. We do document a short description, but that is going to be limited in usefulness since it likely depends on a lot of related knowledge.
I agree with this. Individual component updates are most useful in a dev/debug environment rather than in production. I'm not sure there is value in exporting this all the way out to kernel APIs.
Quoted 59 lines
-----Original Message-----
From: Jiri Pirko <[email protected]>
Sent: Monday, August 22, 2022 10:03 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Keller, Jacob E <[email protected]>; [email protected]; [email protected]
Subject: [patch net-next v2 0/4] net: devlink: sync flash and dev info commandsFrom: Jiri Pirko <[email protected]>
Purpose of this patchset is to introduce consistency between two devlink commands:
devlink dev info
Shows versions of running default flash target and components.
devlink dev flash
Flashes default flash target or component name (if specified on cmdline).Currently it is up to the driver what versions to expose and what flash update component names to accept. This is inconsistent. Thankfully, only netdevsim currently using components so it is still time
to sanitize this.This patchset makes sure, that
devlink.ccalls into driver for component flash update only in case the driver exposes the same version name.Also there a new flag exposed to the use over netlink for versions. If driver considers the version represents flashable component,
DEVLINK_ATTR_INFO_VERSION_IS_COMPONENTis set. This provides a list of component names for the user.Example:
$ devlink dev info netdevsim/netdevsim10: driver netdevsim versions: running: fw.mgmt 10.20.30 fw 11.22.33 flash_components: fw.mgmt $ devlink dev flash netdevsim/netdevsim10 file somefile.bin [fw.mgmt] Preparing to flash [fw.mgmt] Flashing 100% [fw.mgmt] Flash select [fw.mgmt] Flashing done $ devlink dev flash netdevsim/netdevsim10 file somefile.bin component fw.mgmt [fw.mgmt] Preparing to flash [fw.mgmt] Flashing 100% [fw.mgmt] Flash select [fw.mgmt] Flashing done $ devlink dev flash netdevsim/netdevsim10 file somefile.bin component dummy Error: selected component is not supported by this device.
Quoted 5 lines
---
v1->v2:
- see changelog of individual patches, no code changes, just split patch
- removed patches that exposed "default flash target"
Thanks for splitting this. It was much easier to read and process the changes. This version looks great to me.
Quoted 16 lines
Jiri Pirko (4):
net: devlink: extendinfo_get()version put to indicate a flash
component
netdevsim: add version fw.mgmt infoinfo_get()and mark as a component
net: devlink: limit flash component name to match version returned byinfo_get()net: devlink: expose the info about version representing a component
drivers/net/netdevsim/dev.c | 12 +++- include/net/devlink.h | 15 +++- include/uapi/linux/devlink.h | 2 + net/core/devlink.c | 133 +++++++++++++++++++++++++++++------ 4 files changed, 136 insertions(+), 26 deletions(-)--
2.37.1