1. 07 Jun, 2021 15 commits
    • Paul M Stillwell Jr's avatar
      ice: fix clang warning regarding deadcode.DeadStores · 7e94090a
      Paul M Stillwell Jr authored
      clang generates deadcode.DeadStores warnings when a variable
      is used to read a value, but then that value isn't used later
      in the code. Fix this warning.
      Signed-off-by: default avatarPaul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      7e94090a
    • Anirudh Venkataramanan's avatar
      ice: downgrade error print to debug print · a69606cd
      Anirudh Venkataramanan authored
      Failing to add or remove LLDP filter doesn't seem to be a fatal
      error, so downgrade the dev_err message to a dev_dbg message.
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      a69606cd
    • Anirudh Venkataramanan's avatar
      ice: Detect and report unsupported module power levels · c77849f5
      Anirudh Venkataramanan authored
      Determine whether an unsupported power configuration is preventing link
      establishment by storing and checking the link_cfg_err_byte. Print error
      messages when module power levels are unsupported. Also add a new flag
      bit to prevent spamming said error messages.
      Co-developed-by: default avatarJeb Cramer <jeb.j.cramer@intel.com>
      Signed-off-by: default avatarJeb Cramer <jeb.j.cramer@intel.com>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      c77849f5
    • Jacob Keller's avatar
      ice: (re)initialize NVM fields when rebuilding · 97a4ec01
      Jacob Keller authored
      After performing a flash update, a device EMP reset may occur. This
      reset will cause the newly downloaded firmware to be initialized. When
      this happens, the driver still reports the previous NVM version
      information.
      
      This is because the NVM versions are cached within the hw structure.
      This can be confusing, as the new firmware is in fact running in this
      case.
      
      Handle this by calling ice_init_nvm when rebuilding the driver state.
      This will update the flash version information and ensures that the
      current values are displayed when reporting the NVM versions to the
      stack.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      97a4ec01
    • Jacob Keller's avatar
      ice: wait for reset before reporting devlink info · 1c08052e
      Jacob Keller authored
      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: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      1c08052e
    • Jacob Keller's avatar
      ice: add error message when pldmfw_flash_image fails · e872b94f
      Jacob Keller authored
      When flashing a new firmware image onto the device, the pldmfw library
      parses the image contents looking for a matching record. If no record
      can be found, the function reports an error of -ENOENT. This can produce
      a very confusing error message and experience for the user:
      
        $devlink dev flash pci/0000:ab:00.0 file image.bin
        devlink answers: No such file or directory
      
      This is because the ENOENT error code is interpreted as a missing file
      or directory. The pldmfw library does not have direct access to the
      extack pointer as it is generic and non-netdevice specific. The only way
      that ENOENT is returned by the pldmfw library is when no record matches.
      
      Catch this specific error and report a suitable extended ack message:
      
        $devlink dev flash pci/0000:ab:00.0 file image.bin
        Error: ice: Firmware image has no record matching this device
        devlink answers: No such file or directory
      
      In addition, ensure that we log an error message to the console whenever
      this function fails. Because our driver specific PLDM operation
      functions potentially set the extended ACK message, avoid overwriting
      this with a generic message.
      
      This change should result in an improved experience when attempting to
      flash an image that does not have a compatible record.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      e872b94f
    • Jacob Keller's avatar
      ice: add extack when unable to read device caps · d5f84ae9
      Jacob Keller authored
      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: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      d5f84ae9
    • Jesse Brandeburg's avatar
      ice: use static inline for dummy functions · 96cf4f68
      Jesse Brandeburg authored
      Trivial:
      The driver had previously attempted to use #define
      macros to make functions that have no use in certain
      configs disappear. Using static inlines instead allows
      for certain static checkers to process the code better,
      and results in no functional change.
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      96cf4f68
    • Salil Mehta's avatar
      ice: Re-organizes reqstd/avail {R, T}XQ check/code for efficiency · b38b7f2b
      Salil Mehta authored
      If user has explicitly requested the number of {R,T}XQs, then it is
      unnecessary to get the count of already available {R,T}XQs from the
      PF avail_{r,t}xqs bitmap. This value will get overridden by user specified
      value in any case.
      
      Re-organize this code for improving the flow, readability and efficiency.
      This scope of improvement was found during the review of the ICE driver
      code.
      
      Fixes: 87324e74 ("ice: Implement ethtool ops for channels")
      Cc: intel-wired-lan@lists.osuosl.org
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      b38b7f2b
    • Liwei Song's avatar
      ice: set the value of global config lock timeout longer · fb361284
      Liwei Song authored
      It may need hold Global Config Lock a longer time when download DDP
      package file, extend the timeout value to 5000ms to ensure that
      download can be finished before other AQ command got time to run,
      this will fix the issue below when probe the device, 5000ms is a test
      value that work with both Backplane and BreakoutCable NVM image:
      
      ice 0000:f4:00.0: VSI 12 failed lan queue config, error ICE_ERR_CFG
      ice 0000:f4:00.0: Failed to delete VSI 12 in FW - error: ICE_ERR_AQ_TIMEOUT
      ice 0000:f4:00.0: probe failed due to setup PF switch: -12
      ice: probe of 0000:f4:00.0 failed with error -12
      Signed-off-by: default avatarLiwei Song <liwei.song@windriver.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      fb361284
    • Brett Creeley's avatar
      ice: Refactor VIRTCHNL_OP_CONFIG_VSI_QUEUES handling · 7ad15440
      Brett Creeley authored
      Currently, when a VF requests queue configuration via
      VIRTCHNL_OP_CONFIG_VSI_QUEUES the PF driver expects that this message
      will only be called once and we always assume the queues being
      configured start from 0. This is incorrect and is causing issues when
      a VF tries to send this message for multiple queue blocks. Fix this by
      using the queue_id specified in the virtchnl message and allowing for
      individual Rx and/or Tx queues to be configured.
      
      Also, reduce the duplicated for loops for configuring the queues by
      moving all the logic into a single for loop.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      7ad15440
    • Krzysztof Kazimierczak's avatar
      ice: Refactor ice_setup_rx_ctx · 43c7f919
      Krzysztof Kazimierczak authored
      Move AF_XDP logic and buffer allocation out of ice_setup_rx_ctx() to a
      new function ice_vsi_cfg_rxq(), so the function actually sets up the Rx
      context.
      Signed-off-by: default avatarKrzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
      Co-developed-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarKiran Bhandare <kiranx.bhandare@intel.com>
      43c7f919
    • Brett Creeley's avatar
      ice: Save VF's MAC across reboot · f28cd5ce
      Brett Creeley authored
      If a VM reboots and/or VF driver is unloaded, its cached hardware MAC
      address (hw_lan_addr.addr) is cleared in some cases. If the VF is
      trusted, then the PF driver allows the VF to clear its old MAC address
      even if this MAC was configured by a host administrator. If the VF is
      untrusted, then the PF driver allows the VF to clear its old MAC
      address only if the host admin did not set it.
      
      For the trusted VF case, this is unexpected and will cause issues
      because the host configured MAC (i.e. via XML) will be cleared on VM
      reboot. For the untrusted VF case, this is done to be consistent and it
      will allow the VF to keep the same MAC across VM reboot.
      
      Fix this by introducing dev_lan_addr to the VF structure. This will be
      the VF's MAC address when it's up and running and in most cases will be
      the same as the hw_lan_addr. However, to address the VM reboot and
      unload/reload problem, the driver will never allow the hw_lan_addr to be
      cleared via VIRTCHNL_OP_DEL_ETH_ADDR. When the VF's MAC is changed, the
      dev_lan_addr and hw_lan_addr will always be updated with the same value.
      The only ways the VF's MAC can change are the following:
      
      - Set the VF's MAC administratively on the host via iproute2.
      - If the VF is trusted and changes/sets its own MAC.
      - If the VF is untrusted and the host has not set the MAC via iproute2.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      f28cd5ce
    • Brett Creeley's avatar
      ice: Manage VF's MAC address for both legacy and new cases · 51efbbdf
      Brett Creeley authored
      Currently there is no way for a VF driver to specify if it wants to
      change it's hardware address. New bits are being added to virtchnl.h
      in struct virtchnl_ether_addr that allow for the VF to correctly
      communicate this information. However, legacy VF drivers that don't
      support the new virtchnl.h bits still need to be supported. Make a
      best effort attempt at saving the VF's primary/device address in the
      legacy case and depend on the VIRTCHNL_ETHER_ADDR_PRIMARY type for
      the new case.
      
      Legacy case - If a unicast MAC is being added and the
      hw_lan_addr.addr is empty, then populate it. This assumes that the
      address is the VF's hardware address. If a unicast MAC is being
      added and the hw_lan_addr.addr is not empty, then cache it in the
      legacy_last_added_umac.addr. If a unicast MAC is being deleted and it
      matches the hw_lan_addr.addr, then zero the hw_lan_addr.addr.
      Also, if the legacy_last_added_umac.addr has not expired, copy the
      legacy_last_added_umac.addr into the hw_lan_addr.addr. This is done
      because we cannot guarantee the order of VIRTCHNL_OP_ADD_ETH_ADDR and
      VIRTCHNL_OP_DEL_ETH_ADDR.
      
      New case - If a unicast MAC is being added and it's specified as
      VIRTCHNL_ETHER_ADDR_PRIMARY, then replace the current
      hw_lan_addr.addr. If a unicast MAC is being deleted and it's type
      is specified as VIRTCHNL_ETHER_ADDR_PRIMARY, then zero the
      hw_lan_addr.addr.
      
      Untrusted VFs - Only allow above legacy/new changes to their
      hardware address if the PF has not set it administratively via
      iproute2.
      
      Trusted VFs - Always allow above legacy/new changes to their
      hardware address even if the PF has administratively set it via
      iproute2.
      
      Also, change the variable dflt_lan_addr to hw_lan_addr to clearly
      represent the purpose of this variable since it's purpose is to
      act as a hardware programmed MAC address for the VF.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      51efbbdf
    • Brett Creeley's avatar
      virtchnl: Use pad byte in virtchnl_ether_addr to specify MAC type · eb550f53
      Brett Creeley authored
      Currently, there is no way for a VF driver to specify that it wants to
      change its device/primary unicast MAC address. This makes it
      difficult/impossible for the PF driver to track the VF's device/primary
      unicast MAC address, which is used for VM/VF reboot and displaying on
      the host. Fix this by using 2 bits of a pad byte in the
      virtchnl_ether_addr structure so the VF can specify what type of MAC
      it's adding/deleting.
      
      Below are the values that should be used by all VF drivers going
      forward.
      
      VIRTCHNL_ETHER_ADDR_LEGACY(0):
      	- The type should only ever be 0 for legacy AVF drivers (i.e.
      	  drivers that don't support the new type bits). The PF drivers
      	  will track VF's device/primary unicast MAC, but this will only
      	  be a best effort.
      
      VIRTCHNL_ETHER_ADDR_PRIMARY(1):
      	- This type should only be used when the VF is changing their
      	  device/primary unicast MAC. It should be used for both delete
      	  and add cases related to the device/primary unicast MAC.
      
      VIRTCHNL_ETHER_ADDR_EXTRA(2):
      	- This type should be used when the VF is adding and/or deleting
      	  MAC addresses that are not the device/primary unicast MAC. For
      	  example, extra unicast addresses and multicast addresses
      	  assuming the PF supports "extra" addresses at all.
      
      If a PF is parsing the type field of the virtchnl_ether_addr, then it
      should use the VIRTCHNL_ETHER_ADDR_TYPE_MASK to mask the first two bits
      of the type field since 0, 1, and 2 are the only valid values.
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      eb550f53
  2. 04 Jun, 2021 25 commits