1. 06 5月, 2022 2 次提交
  2. 30 12月, 2021 1 次提交
  3. 16 12月, 2021 4 次提交
    • J
      ice: support immediate firmware activation via devlink reload · 399e27db
      Jacob Keller 提交于
      The ice hardware contains an embedded chip with firmware which can be
      updated using devlink flash. The firmware which runs on this chip is
      referred to as the Embedded Management Processor firmware (EMP
      firmware).
      
      Activating the new firmware image currently requires that the system be
      rebooted. This is not ideal as rebooting the system can cause unwanted
      downtime.
      
      In practical terms, activating the firmware does not always require a
      full system reboot. In many cases it is possible to activate the EMP
      firmware immediately. There are a couple of different scenarios to
      cover.
      
       * The EMP firmware itself can be reloaded by issuing a special update
         to the device called an Embedded Management Processor reset (EMP
         reset). This reset causes the device to reset and reload the EMP
         firmware.
      
       * PCI configuration changes are only reloaded after a cold PCIe reset.
         Unfortunately there is no generic way to trigger this for a PCIe
         device without a system reboot.
      
      When performing a flash update, firmware is capable of responding with
      some information about the specific update requirements.
      
      The driver updates the flash by programming a secondary inactive bank
      with the contents of the new image, and then issuing a command to
      request to switch the active bank starting from the next load.
      
      The response to the final command for updating the inactive NVM flash
      bank includes an indication of the minimum reset required to fully
      update the device. This can be one of the following:
      
       * A full power on is required
       * A cold PCIe reset is required
       * An EMP reset is required
      
      The response to the command to switch flash banks includes an indication
      of whether or not the firmware will allow an EMP reset request.
      
      For most updates, an EMP reset is sufficient to load the new EMP
      firmware without issues. In some cases, this reset is not sufficient
      because the PCI configuration space has changed. When this could cause
      incompatibility with the new EMP image, the firmware is capable of
      rejecting the EMP reset request.
      
      Add logic to ice_fw_update.c to handle the response data flash update
      AdminQ commands.
      
      For the reset level, issue a devlink status notification informing the
      user of how to complete the update with a simple suggestion like
      "Activate new firmware by rebooting the system".
      
      Cache the status of whether or not firmware will restrict the EMP reset
      for use in implementing devlink reload.
      
      Implement support for devlink reload with the "fw_activate" flag. This
      allows user space to request the firmware be activated immediately.
      
      For the .reload_down handler, we will issue a request for the EMP reset
      using the appropriate firmware AdminQ command. If we know that the
      firmware will not allow an EMP reset, simply exit with a suitable
      netlink extended ACK message indicating that the EMP reset is not
      available.
      
      For the .reload_up handler, simply wait until the driver has finished
      resetting. Logic to handle processing of an EMP reset already exists in
      the driver as part of its reset and rebuild flows.
      
      Implement support for the devlink reload interface with the
      "fw_activate" action. This allows userspace to request activation of
      firmware without a reboot.
      
      Note that support for indicating the required reset and EMP reset
      restriction is not supported on old versions of firmware. The driver can
      determine if the two features are supported by checking the device
      capabilities report. I confirmed support has existed since at least
      version 5.5.2 as reported by the 'fw.mgmt' version. Support to issue the
      EMP reset request has existed in all version of the EMP firmware for the
      ice hardware.
      
      Check the device capabilities report to determine whether or not the
      indications are reported by the running firmware. If the reset
      requirement indication is not supported, always assume a full power on
      is necessary. If the reset restriction capability is not supported,
      always assume the EMP reset is available.
      
      Users can verify if the EMP reset has activated the firmware by using
      the devlink info report to check that the 'running' firmware version has
      updated. For example a user might do the following:
      
       # Check current version
       $ devlink dev info
      
       # Update the device
       $ devlink dev flash pci/0000:af:00.0 file firmware.bin
      
       # Confirm stored version updated
       $ devlink dev info
      
       # Reload to activate new firmware
       $ devlink dev reload pci/0000:af:00.0 action fw_activate
      
       # Confirm running version updated
       $ devlink dev info
      
      Finally, this change does *not* implement basic driver-only reload
      support. I did look into trying to do this. However, it requires
      significant refactor of how the ice driver probes and loads everything.
      The ice driver probe and allocation flows were not designed with such
      a reload in mind. Refactoring the flow to support this is beyond the
      scope of this change.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      399e27db
    • J
      ice: move ice_devlink_flash_update and merge with ice_flash_pldm_image · c9f7a483
      Jacob Keller 提交于
      The ice_devlink_flash_update function performs a few upfront checks and
      then calls ice_flash_pldm_image.
      
      Most if these checks make more sense in the context of code within
      ice_flash_pldm_image. Merge ice_devlink_flash_update and
      ice_flash_pldm_image into one function, placing it in ice_fw_update.c
      
      Since this is still the entry point for devlink, call the function
      ice_devlink_flash_update instead of ice_flash_pldm_image. This leaves a
      single function which handles the devlink parameters and then initiates
      a PLDM update.
      
      With this change, the ice_devlink_flash_update function in
      ice_fw_update.c becomes the main entry point for flash update. It
      elimintes some unnecessary boiler plate code between the two previous
      functions. The ultimate motivation for this is that it eases supporting
      a dry run with the PLDM library in a future change.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      c9f7a483
    • J
      ice: move and rename ice_check_for_pending_update · c356eaa8
      Jacob Keller 提交于
      The ice_devlink_flash_update function performs a few checks and then
      calls ice_flash_pldm_image. One of these checks is to call
      ice_check_for_pending_update. This function checks if the device has
      a pending update, and cancels it if so. This is necessary to allow
      a new flash update to proceed.
      
      We want to refactor the ice code to eliminate ice_devlink_flash_update,
      moving its checks into ice_flash_pldm_image.
      
      To do this, ice_check_for_pending_update will become static, and only
      called by ice_flash_pldm_image. To make this change easier to review,
      first just move the function up within the ice_fw_update.c file.
      
      While at it, note that the function has a misleading name. Its primary
      action is to cancel a pending update. Using the verb "check" does not
      imply this. Rename it to ice_cancel_pending_update.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      c356eaa8
    • J
      ice: devlink: add shadow-ram region to snapshot Shadow RAM · 78ad87da
      Jacob Keller 提交于
      We have a region for reading the contents of the NVM flash as
      a snapshot. This region does not allow reading the Shadow RAM, as it
      always passes the FLASH_ONLY bit to the low level firmware interface.
      
      Add a separate shadow-ram region which will allow snapshot of the
      current contents of the Shadow RAM. This data is built from the NVM
      contents but is distinct as the device builds up the Shadow RAM during
      initialization, so being able to snapshot its contents can be useful
      when attempting to debug flash related issues.
      
      Fix the comment description of the nvm-flash region which incorrectly
      stated that it filled the shadow-ram region, and add a comment
      explaining that the nvm-flash region does not actually read the Shadow
      RAM.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      78ad87da
  4. 15 12月, 2021 5 次提交
  5. 01 12月, 2021 1 次提交
  6. 23 11月, 2021 1 次提交
  7. 22 10月, 2021 1 次提交
  8. 20 10月, 2021 1 次提交
  9. 15 10月, 2021 1 次提交
    • B
      ice: Print the api_patch as part of the fw.mgmt.api · b726ddf9
      Brett Creeley 提交于
      Currently when a user uses "devlink dev info", the fw.mgmt.api will be
      the major.minor numbers as shown below:
      
      devlink dev info pci/0000:3b:00.0
      pci/0000:3b:00.0:
        driver ice
        serial_number 00-01-00-ff-ff-00-00-00
        versions:
            fixed:
              board.id K91258-000
            running:
              fw.mgmt 6.1.2
              fw.mgmt.api 1.7 <--- No patch number included
              fw.mgmt.build 0xd75e7d06
              fw.mgmt.srev 5
              fw.undi 1.2992.0
              fw.undi.srev 5
              fw.psid.api 3.10
              fw.bundle_id 0x800085cc
              fw.app.name ICE OS Default Package
              fw.app 1.3.27.0
              fw.app.bundle_id 0xc0000001
              fw.netlist 3.10.2000-3.1e.0
              fw.netlist.build 0x2a76e110
            stored:
              fw.mgmt.srev 5
              fw.undi 1.2992.0
              fw.undi.srev 5
              fw.psid.api 3.10
              fw.bundle_id 0x800085cc
              fw.netlist 3.10.2000-3.1e.0
              fw.netlist.build 0x2a76e110
      
      There are many features in the driver that depend on the major, minor,
      and patch version of the FW. Without the patch number in the output for
      fw.mgmt.api debugging issues related to the FW API version is difficult.
      Also, using major.minor.patch aligns with the existing firmware version
      which uses a 3 digit value.
      
      Fix this by making the fw.mgmt.api print the major.minor.patch
      versions. Shown below is the result:
      
      devlink dev info pci/0000:3b:00.0
      pci/0000:3b:00.0:
        driver ice
        serial_number 00-01-00-ff-ff-00-00-00
        versions:
            fixed:
              board.id K91258-000
            running:
              fw.mgmt 6.1.2
              fw.mgmt.api 1.7.9 <--- patch number included
              fw.mgmt.build 0xd75e7d06
              fw.mgmt.srev 5
              fw.undi 1.2992.0
              fw.undi.srev 5
              fw.psid.api 3.10
              fw.bundle_id 0x800085cc
              fw.app.name ICE OS Default Package
              fw.app 1.3.27.0
              fw.app.bundle_id 0xc0000001
              fw.netlist 3.10.2000-3.1e.0
              fw.netlist.build 0x2a76e110
            stored:
              fw.mgmt.srev 5
              fw.undi 1.2992.0
              fw.undi.srev 5
              fw.psid.api 3.10
              fw.bundle_id 0x800085cc
              fw.netlist 3.10.2000-3.1e.0
              fw.netlist.build 0x2a76e110
      
      Fixes: ff2e5c70 ("ice: add basic handler for devlink .info_get")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      b726ddf9
  10. 08 10月, 2021 2 次提交
    • W
      ice: Move devlink port to PF/VF struct · 2ae0aa47
      Wojciech Drewek 提交于
      Keeping devlink port inside VSI data structure causes some issues.
      Since VF VSI is released during reset that means that we have to
      unregister devlink port and register it again every time reset is
      triggered. With the new changes in devlink API it
      might cause deadlock issues. After calling
      devlink_port_register/devlink_port_unregister devlink API is going to
      lock rtnl_mutex. It's an issue when VF reset is triggered in netlink
      operation context (like setting VF MAC address or VLAN),
      because rtnl_lock is already taken by netlink. Another call of
      rtnl_lock from devlink API results in dead-lock.
      
      By moving devlink port to PF/VF we avoid creating/destroying it
      during reset. Since this patch, devlink ports are created during
      ice_probe, destroyed during ice_remove for PF and created during
      ice_repr_add, destroyed during ice_repr_rem for VF.
      Signed-off-by: NWojciech Drewek <wojciech.drewek@intel.com>
      Tested-by: NSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      2ae0aa47
    • M
      ice: support basic E-Switch mode control · 3ea9bd5d
      Michal Swiatkowski 提交于
      Write set and get eswitch mode functions used by devlink
      ops. Use new pf struct member eswitch_mode to track current
      eswitch mode in driver.
      
      Changing eswitch mode is only allowed when there are no
      VFs created.
      
      Create new file for eswitch related code.
      
      Add config flag ICE_SWITCHDEV to allow user to choose if
      switchdev support should be enabled or disabled.
      
      Use case examples:
      - show current eswitch mode ('legacy' is the default one)
      [root@localhost]# devlink dev eswitch show pci/0000:03:00.1
      pci/0000:03:00.1: mode legacy
      
      - move to 'switchdev' mode
      [root@localhost]# devlink dev eswitch set pci/0000:03:00.1 mode
      switchdev
      [root@localhost]# devlink dev eswitch show pci/0000:03:00.1
      pci/0000:03:00.1: mode switchdev
      
      - create 2 VFs
      [root@localhost]# echo 2 > /sys/class/net/ens4f1/device/sriov_numvfs
      
      - unsuccessful attempt to change eswitch mode while VFs are created
      [root@localhost]# devlink dev eswitch set pci/0000:03:00.1 mode legacy
      devlink answers: Operation not supported
      
      - destroy VFs
      [root@localhost]# echo 0 > /sys/class/net/ens4f1/device/sriov_numvfs
      
      - restore 'legacy' mode
      [root@localhost]# devlink dev eswitch set pci/0000:03:00.1 mode legacy
      [root@localhost]# devlink dev eswitch show pci/0000:03:00.1
      pci/0000:03:00.1: mode legacy
      Co-developed-by: NGrzegorz Nitka <grzegorz.nitka@intel.com>
      Signed-off-by: NGrzegorz Nitka <grzegorz.nitka@intel.com>
      Signed-off-by: NMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Tested-by: NSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      3ea9bd5d
  11. 29 9月, 2021 1 次提交
  12. 22 9月, 2021 1 次提交
  13. 20 8月, 2021 1 次提交
  14. 09 8月, 2021 1 次提交
    • L
      devlink: Set device as early as possible · 919d13a7
      Leon Romanovsky 提交于
      All kernel devlink implementations call to devlink_alloc() during
      initialization routine for specific device which is used later as
      a parent device for devlink_register().
      
      Such late device assignment causes to the situation which requires us to
      call to device_register() before setting other parameters, but that call
      opens devlink to the world and makes accessible for the netlink users.
      
      Any attempt to move devlink_register() to be the last call generates the
      following error due to access to the devlink->dev pointer.
      
      [    8.758862]  devlink_nl_param_fill+0x2e8/0xe50
      [    8.760305]  devlink_param_notify+0x6d/0x180
      [    8.760435]  __devlink_params_register+0x2f1/0x670
      [    8.760558]  devlink_params_register+0x1e/0x20
      
      The simple change of API to set devlink device in the devlink_alloc()
      instead of devlink_register() fixes all this above and ensures that
      prior to call to devlink_register() everything already set.
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      919d13a7
  15. 07 6月, 2021 2 次提交
    • J
      ice: wait for reset before reporting devlink info · 1c08052e
      Jacob Keller 提交于
      Requesting device firmware information while the device is busy cleaning
      up after a reset can result in an unexpected failure:
      
      This occurs because the command is attempting to access the device
      AdminQ while it is down. Resolve this by having the command wait for
      a while until the reset is complete. To do this, introduce
      a reset_wait_queue and associated helper function "ice_wait_for_reset".
      
      This helper will use the wait queue to sleep until the driver is done
      rebuilding. Use of a wait queue is preferred because the potential sleep
      duration can be several seconds.
      
      To ensure that the thread wakes up properly, a new wake_up call is added
      during all code paths which clear the reset state bits associated with
      the driver rebuild flow.
      
      Using this ensures that tools can request device information without
      worrying about whether the driver is cleaning up from a reset.
      Specifically, it is expected that a flash update could result in
      a device reset, and it is better to delay the response for information
      until the reset is complete rather than exit with an immediate failure.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1c08052e
    • J
      ice: add extack when unable to read device caps · d5f84ae9
      Jacob Keller 提交于
      When filling out information for the DEVLINK_CMD_INFO_GET, the driver
      needs to read some device capabilities. Add an extack message to
      properly inform the caller of the failure, as we do for other failures
      in this function.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      d5f84ae9
  16. 06 2月, 2021 5 次提交
    • J
      ice: display stored UNDI firmware version via devlink info · e67fbcfb
      Jacob Keller 提交于
      Just as we recently added support for other stored firmware flash
      versions, support display of the stored UNDI Option ROM version via
      devlink info.
      
      To do this, we need to introduce a new ice_get_inactive_orom_ver
      function. This is a little trickier than with other flash versions. The
      Option ROM version data was being read from a special "Boot
      Configuration" block of the NVM Preserved Field Area. This block only
      contains the *active* Option ROM version data. It is populated when the
      device firmware finishes updating the Option ROM.
      
      This method is ineffective at reading the stored Option ROM version
      data. Instead of reading from this section of the flash, replace this
      version extraction with one which locates the Combo Version information
      from within the Option ROM binary.
      
      This data is stored within the Option ROM at a 512 byte offset, in
      a simple structured format. The structure uses a simple modulo 256
      checksum for integrity verification. Scan through the Option ROM to
      locate the CIVD data section, and extract the Combo Version.
      
      Refactor ice_get_orom_ver_info so that it takes the bank select
      enumeration parameter. Use this to implement ice_get_inactive_orom_ver.
      
      Although all ice devices have a Boot Configuration block in the NVM PFA,
      not all devices have a valid Option ROM. In this case, the old
      ice_get_orom_ver_info would "succeed" but report a version of all
      zeros. The new implementation would fail to locate the $CIV section in
      the Option ROM and report an error. Thus, we must ensure that
      ice_init_nvm does not fail if ice_get_orom_ver_info fails.
      
      Use the new ice_get_inactive_orom_ver to allow reporting the Option ROM
      versions for a pending update via devlink info.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e67fbcfb
    • J
      ice: display stored netlist versions via devlink info · e120a9ab
      Jacob Keller 提交于
      Add a function to read the inactive netlist bank for version
      information. To support this, refactor how we read the netlist version
      data. Instead of using the firmware AQ interface with a module ID, read
      from the flash as a flat NVM, using ice_read_flash_module.
      
      This change requires a slight adjustment to the offset values used, as
      reading from the flat NVM includes the type field (which was stripped by
      firmware previously). Cleanup the macro names and move them to
      ice_type.h. For clarity in how we calculate the offsets and so that
      programmers can easily map the offset value to the data sheet, use
      a wrapper macro to account for the offset adjustments.
      
      Use the newly added ice_get_inactive_netlist_ver function to extract the
      version data from the pending netlist module update. Add the stored
      variants of "fw.netlist", and "fw.netlist.build" to the info version map
      array.
      
      With this change, we now report the "fw.netlist" and "fw.netlist.build"
      versions into the stored section of the devlink info report. As with the
      main NVM module versions, if there is no pending update, we report the
      currently active values as stored.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e120a9ab
    • J
      ice: display some stored NVM versions via devlink info · 2c4fe41d
      Jacob Keller 提交于
      The devlink info interface supports drivers reporting "stored" versions.
      These versions indicate the version of an update that has been
      downloaded to the device, but is not yet active.
      
      The code for extracting the NVM version recently changed to enable
      support for reading from either the active or the inactive bank. Use
      this to implement ice_get_inactive_nvm_ver, which will read the NVM
      version data from the inactive section of flash.
      
      When reporting the versions via devlink info, first read the device
      capabilities. Determine if there is a pending flash update, and if so,
      extract relevant version information from the inactive flash. Store
      these within the info context structure.
      
      When reporting "stored" firmware versions, devlink documentation
      indicates that we ought to always report a stored value, even if there
      is no pending update. In this common case, the stored version should
      match the running version. This means that each stored version should by
      default fallback to the same value as reported by the running handler.
      
      To support this, modify the version structure to have both a "getter"
      and a "fallback". Modify the control loop so that it will use the
      "fallback" function if the "getter" function does not report a version.
      
      To report versions for which we can read the stored value, use a new
      "stored()" macro. This macro will insert two entries into the version
      list. The first entry is the traditional running version. The second is
      the stored version, implemented with a fallback to the active version.
      This is a little tricky, but reduces the overall duplication of elements
      in the entry list, and ensures that running and stored values remain
      consistent.
      
      To avoid some duplication, add a combined() macro that will insert both
      the running and stored versions into the version entry list.
      
      Using this new support, add pending version reporter functions for
      "fw.psid.api" and "fw.bundle_id". This enables reporting the stored
      values for some of versions in the NVM module of the flash.
      
      Reporting management versions is not implemented by this patch. The
      active management version is reported to the driver via the AdminQ
      mailbox during load. Although the version must be in the firmware binary
      somewhere, accessing this from the inactive firmware is not trivial and
      has not been implemented in this change.
      
      Future changes will introduce support for reading the UNDI Option ROM
      version and the version associated with the Netlist module.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      2c4fe41d
    • J
      ice: introduce context struct for info report · 74789085
      Jacob Keller 提交于
      The ice driver uses an array of structures which link an info name with
      a function that formats the associated version data into a string.
      
      All existing format functions simply format already captured static data
      from the driver hw structure. Future changes will introduce format
      functions for reporting the versions of flash sections stored but not
      yet applied. This type of version data is not stored as a member of the
      hw structure. This is because (a) it might not yet exist in the case
      there is no pending flash update, and (b) even if it does, it might
      change such as if an update is canceled or replaced by a new update
      before finalizing.
      
      We could simply have each format function gather its own data upon being
      called. However, in some cases the raw binary version data is
      a combination of multiple different reported fields. Additionally, the
      current interface doesn't have a way for the function to indicate that
      the version doesn't exist.
      
      Refactor this function interface to take a new ice_info_ctx structure
      instead of the buffer pointer and length. This context structure allows
      for future extensions to pre-gather version data that is stored within
      the context struct instead of the hw struct.
      
      Allocate this context structure initially at the start of
      ice_devlink_info_get. We use dynamic allocation instead of a local stack
      variable in order to avoid using too much kernel stack once we extend it
      with additional data structures.
      
      Modify the main loop that drives the info reporting so that the version
      buffer string is always cleared between each format. Explicitly check
      that the format function actually filled in a version string of non-zero
      length. If the string is not provided, simply skip this version without
      reporting an error. This allows for introducing format functions of
      versions which may or may not be present, such as the version of
      a pending update that has not yet been activated.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      74789085
    • J
      ice: create flash_info structure and separate NVM version · 9af368fa
      Jacob Keller 提交于
      The ice_nvm_info structure has become somewhat of a dumping ground for
      all of the fields related to flash version. It holds the NVM version and
      EETRACK id, the OptionROM info structure, the flash size, the ShadowRAM
      size, and more.
      
      A future change is going to add the ability to read the NVM version and
      EETRACK ID from the inactive NVM bank. To make this simpler, it is
      useful to have these NVM version info fields extracted to their own
      structure.
      
      Rename ice_nvm_info into ice_flash_info, and create a separate
      ice_nvm_info structure that will contain the eetrack and NVM map
      version. Move the netlist_ver structure into ice_flash_info and rename it
      ice_netlist_info for consistency.
      
      Modify the static ice_get_orom_ver_info to take the option rom structure
      as a pointer. This makes it more obvious what portion of the hw struct
      is being modified. Do the same for ice_get_netlist_ver_info.
      
      Introduce a new ice_get_nvm_ver_info function, which will be similar to
      ice_get_orom_ver_info and ice_get_netlist_ver_info, used to keep the NVM
      version extraction code co-located.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      9af368fa
  17. 20 11月, 2020 2 次提交
    • J
      devlink: move flash end and begin to core devlink · 52cc5f3a
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Acked-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      52cc5f3a
    • J
      devlink: move request_firmware out of driver · b44cfd4f
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Acked-by: NShannon Nelson <snelson@pensando.io>
      Acked-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Reviewed-by: NJiri Pirko <jiri@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      b44cfd4f
  18. 10 10月, 2020 5 次提交
  19. 26 9月, 2020 3 次提交
    • J
      ice: add support for flash update overwrite mask · 50db1bca
      Jacob Keller 提交于
      Support the recently added DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK
      parameter in the ice flash update handler. Convert the overwrite mask
      bitfield into the appropriate preservation level used by the firmware
      when updating.
      
      Because there is no equivalent preservation level for overwriting only
      identifiers, this combination is rejected by the driver as not supported
      with an appropriate extended ACK message.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      50db1bca
    • J
      devlink: convert flash_update to use params structure · bc75c054
      Jacob Keller 提交于
      The devlink core recently gained support for checking whether the driver
      supports a flash_update parameter, via `supported_flash_update_params`.
      However, parameters are specified as function arguments. Adding a new
      parameter still requires modifying the signature of the .flash_update
      callback in all drivers.
      
      Convert the .flash_update function to take a new `struct
      devlink_flash_update_params` instead. By using this structure, and the
      `supported_flash_update_params` bit field, a new parameter to
      flash_update can be added without requiring modification to existing
      drivers.
      
      As before, all parameters except file_name will require driver opt-in.
      Because file_name is a necessary field to for the flash_update to make
      sense, no "SUPPORTED" bitflag is provided and it is always considered
      valid. All future additional parameters will require a new bit in the
      supported_flash_update_params bitfield.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Cc: Bin Luo <luobin9@huawei.com>
      Cc: Saeed Mahameed <saeedm@mellanox.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Cc: Ido Schimmel <idosch@mellanox.com>
      Cc: Danielle Ratson <danieller@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bc75c054
    • J
      devlink: check flash_update parameter support in net core · 22ec3d23
      Jacob Keller 提交于
      When implementing .flash_update, drivers which do not support
      per-component update are manually checking the component parameter to
      verify that it is NULL. Without this check, the driver might accept an
      update request with a component specified even though it will not honor
      such a request.
      
      Instead of having each driver check this, move the logic into
      net/core/devlink.c, and use a new `supported_flash_update_params` field
      in the devlink_ops. Drivers which will support per-component update must
      now specify this by setting DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT in
      the supported_flash_update_params in their devlink_ops.
      
      This helps ensure that drivers do not forget to check for a NULL
      component if they do not support per-component update. This also enables
      a slightly better error message by enabling the core stack to set the
      netlink bad attribute message to indicate precisely the unsupported
      attribute in the message.
      
      Going forward, any new additional parameter to flash update will require
      a bit in the supported_flash_update_params bitfield.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Cc: Bin Luo <luobin9@huawei.com>
      Cc: Saeed Mahameed <saeedm@mellanox.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Cc: Ido Schimmel <idosch@mellanox.com>
      Cc: Danielle Ratson <danieller@mellanox.com>
      Cc: Shannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      22ec3d23