1. 20 Nov, 2020 3 commits
    • Jacob Keller's avatar
      devlink: move flash end and begin to core devlink · 52cc5f3a
      Jacob Keller authored
      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: default avatarJacob Keller <jacob.e.keller@intel.com>
      Acked-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      52cc5f3a
    • Jacob Keller's avatar
      devlink: move request_firmware out of driver · b44cfd4f
      Jacob Keller authored
      All drivers which implement the devlink flash update support, with the
      exception of netdevsim, use either request_firmware or
      request_firmware_direct to locate the firmware file. Rather than having
      each driver do this separately as part of its .flash_update
      implementation, perform the request_firmware within net/core/devlink.c
      
      Replace the file_name parameter in the struct devlink_flash_update_params
      with a pointer to the fw object.
      
      Use request_firmware rather than request_firmware_direct. Although most
      Linux distributions today do not have the fallback mechanism
      implemented, only about half the drivers used the _direct request, as
      compared to the generic request_firmware. In the event that
      a distribution does support the fallback mechanism, the devlink flash
      update ought to be able to use it to provide the firmware contents. For
      distributions which do not support the fallback userspace mechanism,
      there should be essentially no difference between request_firmware and
      request_firmware_direct.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Acked-by: default avatarShannon Nelson <snelson@pensando.io>
      Acked-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b44cfd4f
    • Jakub Kicinski's avatar
  2. 19 Nov, 2020 37 commits