mbox series

[v5,net-next,0/5] ionic: add devlink dev flash support

Message ID 20200918011327.31577-1-snelson@pensando.io
Headers show
Series ionic: add devlink dev flash support | expand

Message

Shannon Nelson Sept. 18, 2020, 1:13 a.m. UTC
Add support for using devlink's dev flash facility to update the
firmware on an ionic device, and add a new timeout parameter to the
devlink flash netlink message.

For long-running flash commands, we add a timeout element to the dev
flash notify message in order for a userland utility to display a timeout
deadline to the user.  This allows the userland utility to display a
count down to the user when a firmware update action is otherwise going
to go for ahile without any updates.  An example use is added to the
netdevsim module.

The ionic driver uses this timeout element in its new flash function.
The driver uses a simple model of pushing the firmware file to the NIC,
asking the NIC to unpack and install the file into the device, and then
selecting it for the next boot.  If any of these steps fail, the whole
transaction is failed.  A couple of the steps can take a long time,
so we use the timeout status message rather than faking it with bogus
done/total messages.

The driver doesn't currently support doing these steps individually.
In the future we want to be able to list the FW that is installed and
selectable but we don't yet have the API to fully support that.

v5: pulled the cmd field back out of the new params struct
    changed netdevsim example message to "Flash select"

v4: Added a new devlink status notify message for showing timeout
    information, and modified the ionic fw update to use it for its long
    running firmware commands.

v3: Changed long dev_cmd timeout on status check calls to a loop around
    calls with a normal timeout, which allows for more intermediate log
    messaging when in a long wait, and for letting other threads run
    dev_cmds if waiting.

v2: Changed "Activate" to "Select" in status messages.

Shannon Nelson (5):
  devlink: add timeout information to status_notify
  devlink: collect flash notify params into a struct
  netdevsim: devlink flash timeout message
  ionic: update the fw update api
  ionic: add devlink firmware update

 drivers/net/ethernet/pensando/ionic/Makefile  |   2 +-
 .../ethernet/pensando/ionic/ionic_devlink.c   |  14 ++
 .../ethernet/pensando/ionic/ionic_devlink.h   |   3 +
 .../net/ethernet/pensando/ionic/ionic_fw.c    | 206 ++++++++++++++++++
 .../net/ethernet/pensando/ionic/ionic_if.h    |  33 ++-
 .../net/ethernet/pensando/ionic/ionic_main.c  |  27 ++-
 drivers/net/netdevsim/dev.c                   |   2 +
 include/net/devlink.h                         |  23 ++
 include/uapi/linux/devlink.h                  |   3 +
 net/core/devlink.c                            |  61 ++++--
 10 files changed, 339 insertions(+), 35 deletions(-)
 create mode 100644 drivers/net/ethernet/pensando/ionic/ionic_fw.c

Comments

David Miller Sept. 18, 2020, 8:54 p.m. UTC | #1
From: Shannon Nelson <snelson@pensando.io>
Date: Thu, 17 Sep 2020 18:13:22 -0700

> Add support for using devlink's dev flash facility to update the
> firmware on an ionic device, and add a new timeout parameter to the
> devlink flash netlink message.
> 
> For long-running flash commands, we add a timeout element to the dev
> flash notify message in order for a userland utility to display a timeout
> deadline to the user.  This allows the userland utility to display a
> count down to the user when a firmware update action is otherwise going
> to go for ahile without any updates.  An example use is added to the
> netdevsim module.
> 
> The ionic driver uses this timeout element in its new flash function.
> The driver uses a simple model of pushing the firmware file to the NIC,
> asking the NIC to unpack and install the file into the device, and then
> selecting it for the next boot.  If any of these steps fail, the whole
> transaction is failed.  A couple of the steps can take a long time,
> so we use the timeout status message rather than faking it with bogus
> done/total messages.
> 
> The driver doesn't currently support doing these steps individually.
> In the future we want to be able to list the FW that is installed and
> selectable but we don't yet have the API to fully support that.
 ...

Series applied to net-next.