1. 11 2月, 2021 5 次提交
    • P
      i40e: Add flow director support for IPv6 · efca91e8
      Przemyslaw Patynowski 提交于
      Flow director for IPv6 is not supported.
      1) Implementation of support for IPv6 flow director.
      2) Added handlers for addition of TCP6, UDP6, SCTP6, IPv6.
      3) Refactored legacy code to make it more generic.
      4) Added packet templates for TCP6, UDP6, SCTP6, IPv6.
      5) Added handling of IPv6 source and destination address for flow director.
      6) Improved argument passing for source and destination portin TCP6, UDP6
         and SCTP6.
      7) Added handling of ethtool -n for IPv6, TCP6,UDP6, SCTP6.
      8) Used correct bit flag regarding FLEXOFF field of flow director data
         descriptor.
      
      Without this patch, there would be no support for flow director on IPv6,
      TCP6, UDP6, SCTP6.
      Tested based on x710 datasheet by using:
      ethtool -N enp133s0f0 flow-type tcp4 src-port 13 dst-port 37 user-def 0x44142 action 1
      ethtool -N enp133s0f0 flow-type tcp6 src-port 13 dst-port 40 user-def 0x44142 action 2
      ethtool -N enp133s0f0 flow-type udp4 src-port 20 dst-port 40 user-def 0x44142 action 3
      ethtool -N enp133s0f0 flow-type udp6 src-port 25 dst-port 40 user-def 0x44142 action 4
      ethtool -N enp133s0f0 flow-type sctp4 src-port 55 dst-port 65 user-def 0x44142 action 5
      ethtool -N enp133s0f0 flow-type sctp6 src-port 60 dst-port 40 user-def 0x44142 action 6
      ethtool -N enp133s0f0 flow-type ip4 src-ip 1.1.1.1 dst-ip 1.1.1.4 user-def 0x44142 action 7
      ethtool -N enp133s0f0 flow-type ip6 src-ip fe80::3efd:feff:fe6f:bbbb dst-ip fe80::3efd:feff:fe6f:aaaa user-def 0x44142 action 8
      Then send traffic from client which matches the criteria provided to ethtool.
      Observe that packets are redirected to user set queues with ethtool -S <interface>
      Signed-off-by: NPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      efca91e8
    • A
      i40e: Add EEE status getting & setting implementation · 95f352dc
      Aleksandr Loktionov 提交于
      Implement Energy Efficient Ethernet (EEE) status getting & setting.
      The i40e_get_eee() requesting PHY EEE capabilities from firmware.
      The i40e_set_eee() function requests PHY EEE capabilities
      from firmware and sets PHY EEE advertising to full abilities or 0
      depending whether EEE is to be enabled or disabled.
      Signed-off-by: NAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      95f352dc
    • A
      i40e: Add netlink callbacks support for software based DCB · 5effa78e
      Arkadiusz Kubalewski 提交于
      Add callbacks used by software based LLDP agent, which allows to
      configure DCB feature from userspace.
      
      Update copyright dates as appropriate.
      
      If LLDP agent is turned off in BIOS, or after setting private flag
      ("disable-fw-lldp on"). The driver initialized DCB functionality with
      default values, one traffic class with 100% bandwidth allocated.
      
      The new netlink callbacks are required for software LLDP agent, it
      must be able to acquire current DCB configuration of a network port
      and apply DCB configuration changes, if required.
      Signed-off-by: NAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Signed-off-by: NArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      5effa78e
    • A
      i40e: Add init and default config of software based DCB · 4b208eaa
      Arkadiusz Kubalewski 提交于
      Add extra handling on changing the "disable-fw-lldp" private
      flag to properly initialize software based DCB feature.
      
      Add default configuration of DCB functionality when Firmware
      LLDP agent is turned off, in case of driver probe and device
      reset on reconfiguration.
      
      Update copyright dates as appropriate.
      
      Software based DCB is a brand-new feature in i40e driver.
      Before, DCB was implemented by Firmware LLDP agent only. The agent was
      responsible for handling incoming DCB-related LLDP frames and
      applying received DCB configuration to hardware.
      
      Default configuration and new initialization flow for software based
      DCB is required. If LLDP agent is turned off in BIOS, or after
      setting private flag ("disable-fw-lldp on"). The driver initializes
      DCB functionality with default values, one traffic class with 100%
      bandwidth allocated.
      Signed-off-by: NAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Signed-off-by: NArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      4b208eaa
    • A
      i40e: Add hardware configuration for software based DCB · 90bc8e00
      Arkadiusz Kubalewski 提交于
      Add registers and definitions required for applying
      DCB related hardware configuration.
      
      Add functions responsible for calculating and setting proper
      hardware configuration values for software based DCB functionality.
      
      Add function responsible for invoking Admin Queue command, which
      results in applying new DCB configuration to the hardware.
      
      Update copyright dates as appropriate.
      
      Software based DCB is a brand-new feature in i40e driver.
      Before, DCB was implemented by Firmware LLDP agent only. The agent was
      responsible for handling incoming DCB-related LLDP frames and
      applying received DCB configuration to hardware.
      
      New communication channel between software and hardware is required
      for software driver. It must be able to calculate and configure all
      the registers related for DCB feature.
      Signed-off-by: NAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Signed-off-by: NArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      90bc8e00
  2. 09 2月, 2021 16 次提交
  3. 06 2月, 2021 11 次提交
    • B
      ice: remove dead code · 12aae8f1
      Bruce Allan 提交于
      The check for a NULL pf pointer is moot since the earlier declaration and
      assignment of struct device *dev already de-referenced the pointer.  Also,
      the only caller of ice_set_dflt_mib() already ensures pf is not NULL.
      
      Cc: Dave Ertman <david.m.ertman@intel.com>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NBruce Allan <bruce.w.allan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      12aae8f1
    • B
      ice: use flex_array_size where possible · 11404310
      Bruce Allan 提交于
      Use the flex_array_size() helper with the recently added flexible array
      members in structures.
      Signed-off-by: NBruce Allan <bruce.w.allan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      11404310
    • G
      ice: Replace one-element array with flexible-array member · e94c0df9
      Gustavo A. R. Silva 提交于
      There is a regular need in the kernel to provide a way to declare having
      a dynamically sized set of trailing elements in a structure. Kernel code
      should always use “flexible array members”[1] for these cases. The older
      style of one-element or zero-length arrays should no longer be used[2].
      
      Refactor the code according to the use of a flexible-array member in
      struct ice_res_tracker, instead of a one-element array and use the
      struct_size() helper to calculate the size for the allocations.
      
      Also, notice that the code below suggests that, currently, two too many
      bytes are being allocated with devm_kzalloc(), as the total number of
      entries (pf->irq_tracker->num_entries) for pf->irq_tracker->list[] is
      _vectors_ and sizeof(*pf->irq_tracker) also includes the size of the
      one-element array _list_ in struct ice_res_tracker.
      
      drivers/net/ethernet/intel/ice/ice_main.c:3511:
      3511         /* populate SW interrupts pool with number of OS granted IRQs. */
      3512         pf->num_avail_sw_msix = (u16)vectors;
      3513         pf->irq_tracker->num_entries = (u16)vectors;
      3514         pf->irq_tracker->end = pf->irq_tracker->num_entries;
      
      With this change, the right amount of dynamic memory is now allocated
      because, contrary to one-element arrays which occupy at least as much
      space as a single object of the type, flexible-array members don't
      occupy such space in the containing structure.
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arraysBuilt-tested-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e94c0df9
    • 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 function for reading from flash modules · 0ce50c70
      Jacob Keller 提交于
      When reading from the flash memory of the device, the ice driver has two
      interfaces available to it. First, it can use a mediated interface via
      firmware that allows specifying a module ID. This allows reading from
      specific modules of the active flash bank.
      
      The second interface available is to perform flat reads. This allows
      complete access to the entire flash. However, using it requires the
      software to handle calculating module location and interpret pointer
      addresses.
      
      While most data required is accessible through the convenient first
      interface, certain flash contents are not. This includes the CSS header
      information associated with the Option ROM and NVM banks, as well as any
      access to the "inactive" banks used as scratch space for performing
      flash updates.
      
      In order to access all of the relevant flash contents, software must use
      the flat reads. Rather than forcing all flows to perform flat read
      calculations, introduce a new abstraction for reading from the flash:
      ice_read_flash_module. This function provides an abstraction for reading
      from either the active or inactive flash bank at the requested module.
      This interface is very similar to the abstraction provided via firmware,
      but allows access to additional modules, as well as providing
      a mechanism to request access to both flash banks.
      
      At first glance, it might make sense for this abstraction to allow
      specifying precisely which bank (1st or 2nd) the caller wishes to read.
      This is simpler to implement but more difficult to use. In practice,
      most callers only know whether they want the active bank, or the
      inactive bank. Rather than force callers to determine for themselves
      which bank to read from, implement ice_read_flash_module in terms of
      "active" vs "inactive". This significantly simplifies the implementation
      at the caller level and is a more useful abstraction over the flash
      contents.
      
      Make use of this new interface to refactor reading of the main NVM
      version information. Instead of using the firmware's mediated ShadowRAM
      function, use the ice_read_flash_module abstraction.
      
      To do this, notice that most reads of the NVM are going to be in 2-byte
      word chunks. To simplify using ice_read_flash_module for this case,
      ice_read_nvm_module is introduced. This is a simple wrapper around
      ice_read_flash_module which takes the correct pointer address for the
      NVM bank, and forces the 2-byte word format onto the caller.
      
      When reading the NVM versions, some fields are read from the Shadow RAM.
      The Shadow RAM is the first 64KB of flash memory, and is populated
      during device load. Most fields are copied from a section within the
      active NVM bank. In order to read this data from both the active and
      inactive NVM banks, we need to read not from the first 64KB of flash,
      but instead from the correct offset into the NVM bank. Introduce
      ice_read_nvm_sr_copy for this purpose. This function wraps around
      ice_read_nvm_module and has the same interface as the ice_read_sr_word,
      with the exception of allowing the caller to specify whether to read the
      active or inactive flash bank.
      
      With this change, it is now trivial to refactor ice_get_nvm_ver_info to
      read using the software mediated ice_read_flash_module interface instead
      of relying on the firmware mediated interface. This will be used in the
      following change to implement support for stored versions in the devlink
      info report.
      
      Additionally, the overall ice_read_flash_module interface will be used
      and extended to support all three major flash banks, and additionally to
      support reading the flash image security revision information.
      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>
      0ce50c70
    • J
      ice: cache NVM module bank information · 1fa95e01
      Jacob Keller 提交于
      The ice flash contains two copies of each of the NVM, Option ROM, and
      Netlist modules. Each bank has a pointer word and a size word. In order
      to correctly read from the active flash bank, the driver must calculate
      the offset manually.
      
      During NVM initialization, read the Shadow RAM control word and
      determine which bank is active for each NVM module. Additionally, cache
      the size and pointer values for use in calculating the correct offset.
      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>
      1fa95e01
    • 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
    • J
      ice: report timeout length for erasing during devlink flash · 08e1294d
      Jacob Keller 提交于
      When erasing, notify userspace of how long we will potentially take to
      erase a module. Doing so allows userspace to report the timeout, giving
      a clear indication of the upper time bound of the operation.
      
      Since we're re-using the erase timeout value, make it a macro rather
      than a magic number.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NShannon Nelson <snelson@pensando.io>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      08e1294d
  4. 05 2月, 2021 1 次提交
  5. 04 2月, 2021 7 次提交