diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2020-11-18 22:06:36 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-20 08:41:02 +0300 |
commit | 52cc5f3a166a33012ebca2cdefebf4c689110068 (patch) | |
tree | e00777b69f41c960484292daece12bd69181f8b6 /drivers/net/ethernet/intel/ice/ice_devlink.c | |
parent | b44cfd4f5b912454387a4bf735d42eb4e7078ca8 (diff) | |
download | linux-52cc5f3a166a33012ebca2cdefebf4c689110068.tar.xz |
devlink: move flash end and begin to core devlink
When performing a flash update via devlink, device drivers may inform
user space of status updates via
devlink_flash_update_(begin|end|timeout|status)_notify functions.
It is expected that drivers do not send any status notifications unless
they send a begin and end message. If a driver sends a status
notification without sending the appropriate end notification upon
finishing (regardless of success or failure), the current implementation
of the devlink userspace program can get stuck endlessly waiting for the
end notification that will never come.
The current ice driver implementation may send such a status message
without the appropriate end notification in rare cases.
Fixing the ice driver is relatively simple: we just need to send the
begin_notify at the start of the function and always send an end_notify
no matter how the function exits.
Rather than assuming driver authors will always get this right in the
future, lets just fix the API so that it is not possible to get wrong.
Make devlink_flash_update_begin_notify and
devlink_flash_update_end_notify static, and call them in devlink.c core
code. Always send the begin_notify just before calling the driver's
flash_update routine. Always send the end_notify just after the routine
returns regardless of success or failure.
Doing this makes the status notification easier to use from the driver,
as it no longer needs to worry about catching failures and cleaning up
by calling devlink_flash_update_end_notify. It is now no longer possible
to do the wrong thing in this regard. We also save a couple of lines of
code in each driver.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_devlink.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_devlink.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c index 0036d3e7df0b..29d6192b15f3 100644 --- a/drivers/net/ethernet/intel/ice/ice_devlink.c +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c @@ -275,12 +275,9 @@ ice_devlink_flash_update(struct devlink *devlink, if (err) return err; - devlink_flash_update_begin_notify(devlink); devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0); - err = ice_flash_pldm_image(pf, params->fw, preservation, extack); - devlink_flash_update_end_notify(devlink); - return err; + return ice_flash_pldm_image(pf, params->fw, preservation, extack); } static const struct devlink_ops ice_devlink_ops = { |