mbox series

[net-next,v2,0/4] net: devlink: sync flash and dev info commands

Message ID 20220822170247.974743-1-jiri@resnulli.us (mailing list archive)
Headers show
Series net: devlink: sync flash and dev info commands | expand

Message

Jiri Pirko Aug. 22, 2022, 5:02 p.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

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(-)

Comments

Jacob Keller Aug. 22, 2022, 7:23 p.m. UTC | #1
> -----Original Message-----
> From: Jiri Pirko <jiri@resnulli.us>
> Sent: Monday, August 22, 2022 10:03 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; kuba@kernel.org; idosch@nvidia.com;
> pabeni@redhat.com; edumazet@google.com; saeedm@nvidia.com; Keller, Jacob
> E <jacob.e.keller@intel.com>; vikas.gupta@broadcom.com;
> gospo@broadcom.com
> Subject: [patch net-next v2 0/4] net: devlink: sync flash and dev info commands
> 
> From: Jiri Pirko <jiri@nvidia.com>
> 
> 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"
> 

Thanks for splitting this. It was much easier to read and process the changes. This version looks great to me.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> 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(-)
> 
> --
> 2.37.1