1. 30 3月, 2021 2 次提交
    • D
      ice: remove DCBNL_DEVRESET bit from PF state · 741b7b74
      Dave Ertman 提交于
      The original purpose of the ICE_DCBNL_DEVRESET was to protect
      the driver during DCBNL device resets.  But, the flow for
      DCBNL device resets now consists of only calls up the stack
      such as dev_close() and dev_open() that will result in NDO calls
      to the driver.  These will be handled with state changes from the
      stack.  Also, there is a problem of the dev_close and dev_open
      being blocked by checks for reset in progress also using the
      ICE_DCBNL_DEVRESET bit.
      
      Since the ICE_DCBNL_DEVRESET bit is not necessary for protecting
      the driver from DCBNL device resets and it is actually blocking
      changes coming from the DCBNL interface, remove the bit from the
      PF state and don't block driver function based on DCBNL reset in
      progress.
      
      Fixes: b94b013e ("ice: Implement DCBNL support")
      Signed-off-by: NDave Ertman <david.m.ertman@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      741b7b74
    • K
      ice: prevent ice_open and ice_stop during reset · e95fc857
      Krzysztof Goreczny 提交于
      There is a possibility of race between ice_open or ice_stop calls
      performed by OS and reset handling routine both trying to modify VSI
      resources. Observed scenarios:
      - reset handler deallocates memory in ice_vsi_free_arrays and ice_open
        tries to access it in ice_vsi_cfg_txq leading to driver crash
      - reset handler deallocates memory in ice_vsi_free_arrays and ice_close
        tries to access it in ice_down leading to driver crash
      - reset handler clears port scheduler topology and sets port state to
        ICE_SCHED_PORT_STATE_INIT leading to ice_ena_vsi_txq fail in ice_open
      
      To prevent this additional checks in ice_open and ice_stop are
      introduced to make sure that OS is not allowed to alter VSI config while
      reset is in progress.
      
      Fixes: cdedef59 ("ice: Configure VSIs for Tx/Rx")
      Signed-off-by: NKrzysztof Goreczny <krzysztof.goreczny@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e95fc857
  2. 09 2月, 2021 4 次提交
  3. 27 1月, 2021 1 次提交
    • B
      ice: Fix MSI-X vector fallback logic · f3fe97f6
      Brett Creeley 提交于
      The current MSI-X enablement logic tries to enable best-case MSI-X
      vectors and if that fails we only support a bare-minimum set. This
      includes a single MSI-X for 1 Tx and 1 Rx queue and a single MSI-X
      for the OICR interrupt. Unfortunately, the driver fails to load when we
      don't get as many MSI-X as requested for a couple reasons.
      
      First, the code to allocate MSI-X in the driver tries to allocate
      num_online_cpus() MSI-X for LAN traffic without caring about the number
      of MSI-X actually enabled/requested from the kernel for LAN traffic.
      So, when calling ice_get_res() for the PF VSI, it returns failure
      because the number of available vectors is less than requested. Fix
      this by not allowing the PF VSI to allocation  more than
      pf->num_lan_msix MSI-X vectors and pf->num_lan_msix Rx/Tx queues.
      Limiting the number of queues is done because we don't want more than
      1 Tx/Rx queue per interrupt due to performance conerns.
      
      Second, the driver assigns pf->num_lan_msix = 2, to account for LAN
      traffic and the OICR. However, pf->num_lan_msix is only meant for LAN
      MSI-X. This is causing a failure when the PF VSI tries to
      allocate/reserve the minimum pf->num_lan_msix because the OICR MSI-X has
      already been reserved, so there may not be enough MSI-X vectors left.
      Fix this by setting pf->num_lan_msix = 1 for the failure case. Then the
      ICE_MIN_MSIX accounts for the LAN MSI-X and the OICR MSI-X needed for
      the failure case.
      
      Update the related defines used in ice_ena_msix_range() to align with
      the above behavior and remove the unused RDMA defines because RDMA is
      currently not supported. Also, remove the now incorrect comment.
      
      Fixes: 152b978a ("ice: Rework ice_ena_msix_range")
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      f3fe97f6
  4. 10 10月, 2020 1 次提交
    • J
      ice: refactor devlink_port to be per-VSI · 48d40025
      Jacob Keller 提交于
      Currently, the devlink_port structure is stored within the ice_pf. This
      made sense because we create a single devlink_port for each PF. This
      setup does not mesh with the abstractions in the driver very well, and
      led to a flow where we accidentally call devlink_port_unregister twice
      during error cleanup.
      
      In particular, if devlink_port_register or devlink_port_unregister are
      called twice, this leads to a kernel panic. This appears to occur during
      some possible flows while cleaning up from a failure during driver
      probe.
      
      If register_netdev fails, then we will call devlink_port_unregister in
      ice_cfg_netdev as it cleans up. Later, we again call
      devlink_port_unregister since we assume that we must cleanup the port
      that is associated with the PF structure.
      
      This occurs because we cleanup the devlink_port for the main PF even
      though it was not allocated. We allocated the port within a per-VSI
      function for managing the main netdev, but did not release the port when
      cleaning up that VSI, the allocation and destruction are not aligned.
      
      Instead of attempting to manage the devlink_port as part of the PF
      structure, manage it as part of the PF VSI. Doing this has advantages,
      as we can match the de-allocation of the devlink_port with the
      unregister_netdev associated with the main PF VSI.
      
      Moving the port to the VSI is preferable as it paves the way for
      handling devlink ports allocated for other purposes such as SR-IOV VFs.
      
      Since we're changing up how we allocate the devlink_port, also change
      the indexing. Originally, we indexed the port using the PF id number.
      This came from an old goal of sharing a devlink for each physical
      function. Managing devlink instances across multiple function drivers is
      not workable. Instead, lets set the port number to the logical port
      number returned by firmware and set the index using the VSI index
      (sometimes referred to as VSI handle).
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      48d40025
  5. 25 9月, 2020 2 次提交
    • J
      ice: fix memory leak in ice_vsi_setup · f6a07271
      Jacob Keller 提交于
      During ice_vsi_setup, if ice_cfg_vsi_lan fails, it does not properly
      release memory associated with the VSI rings. If we had used devres
      allocations for the rings, this would be ok. However, we use kzalloc and
      kfree_rcu for these ring structures.
      
      Using the correct label to cleanup the rings during ice_vsi_setup
      highlights an issue in the ice_vsi_clear_rings function: it can leave
      behind stale ring pointers in the q_vectors structure.
      
      When releasing rings, we must also ensure that no q_vector associated
      with the VSI will point to this ring again. To resolve this, loop over
      all q_vectors and release their ring mapping. Because we are about to
      free all rings, no q_vector should remain pointing to any of the rings
      in this VSI.
      
      Fixes: 5513b920 ("ice: Update Tx scheduler tree for VSI multi-Tx queue support")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      f6a07271
    • J
      ice: fix memory leak if register_netdev_fails · 135f4b9e
      Jacob Keller 提交于
      The ice_setup_pf_sw function can cause a memory leak if register_netdev
      fails, due to accidentally failing to free the VSI rings. Fix the memory
      leak by using ice_vsi_release, ensuring we actually go through the full
      teardown process.
      
      This should be safe even if the netdevice is not registered because we
      will have set the netdev pointer to NULL, ensuring ice_vsi_release won't
      call unregister_netdev.
      
      An alternative fix would be moving management of the PF VSI netdev into
      the main VSI setup code. This is complicated and likely requires
      significant refactor in how we manage VSIs
      
      Fixes: 3a858ba3 ("ice: Add support for VSI allocation and deallocation")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      135f4b9e
  6. 01 9月, 2020 1 次提交
  7. 01 8月, 2020 1 次提交
  8. 29 7月, 2020 1 次提交
  9. 24 7月, 2020 1 次提交
  10. 02 7月, 2020 1 次提交
  11. 19 6月, 2020 1 次提交
  12. 31 5月, 2020 2 次提交
  13. 29 5月, 2020 1 次提交
  14. 28 5月, 2020 2 次提交
  15. 23 5月, 2020 3 次提交
    • B
      ice: Implement aRFS · 28bf2672
      Brett Creeley 提交于
      Enable accelerated Receive Flow Steering (aRFS). It is used to steer Rx
      flows to a specific queue. This functionality is triggered by the network
      stack through ndo_rx_flow_steer and requires Flow Director (ntuple on) to
      function.
      
      The fltr_info is used to add/remove/update flow rules in the HW, the
      fltr_state is used to determine what to do with the filter with respect
      to HW and/or SW, and the flow_id is used in co-ordination with the
      network stack.
      
      The work for aRFS is split into two paths: the ndo_rx_flow_steer
      operation and the ice_service_task. The former is where the kernel hands
      us an Rx SKB among other items to setup aRFS and the latter is where
      the driver adds/updates/removes filter rules from HW and updates filter
      state.
      
      In the Rx path the following things can happen:
              1. New aRFS entries are added to the hash table and the state is
                 set to ICE_ARFS_INACTIVE so the filter can be updated in HW
                 by the ice_service_task path.
              2. aRFS entries have their Rx Queue updated if we receive a
                 pre-existing flow_id and the filter state is ICE_ARFS_ACTIVE.
                 The state is set to ICE_ARFS_INACTIVE so the filter can be
                 updated in HW by the ice_service_task path.
              3. aRFS entries marked as ICE_ARFS_TODEL are deleted
      
      In the ice_service_task path the following things can happen:
              1. New aRFS entries marked as ICE_ARFS_INACTIVE are added or
                 updated in HW.
                 and their state is updated to ICE_ARFS_ACTIVE.
              2. aRFS entries are deleted from HW and their state is updated
                 to ICE_ARFS_TODEL.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NMadhu Chittim <madhu.chittim@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      28bf2672
    • H
      ice: Restore filters following reset · 83af0039
      Henry Tieman 提交于
      Following a reset, Flow Director filters are cleared from the hardware.
      Rebuild the filters using the software structures containing the filter
      rules.
      Signed-off-by: NHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      83af0039
    • H
      ice: Initialize Flow Director resources · 148beb61
      Henry Tieman 提交于
      Flow Director allows for redirection based on ntuple rules. Rules are
      programmed using the ethtool set-ntuple interface. Supported actions are
      redirect to queue and drop.
      
      Setup the initial framework to process Flow Director filters. Create and
      allocate resources to manage and program filters to the hardware. Filters
      are processed via a sideband interface; a control VSI is created to manage
      communication and process requests through the sideband. Upon allocation of
      resources, update the hardware tables to accept perfect filters.
      Signed-off-by: NHenry Tieman <henry.w.tieman@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      148beb61
  16. 22 5月, 2020 3 次提交
  17. 11 3月, 2020 4 次提交
  18. 16 2月, 2020 4 次提交
    • B
      ice: remove unnecessary fallthrough comments · 752eee06
      Bruce Allan 提交于
      Fallthrough comments are used to explicitly indicate the code is intended
      to flow from one case statement to the next in a switch statement rather
      than break out of the switch statement.  They are only needed when a case
      has one or more statements to execute before falling through to the next
      case, not when there is a list of cases for which the same statement(s)
      should be executed.
      Signed-off-by: NBruce Allan <bruce.w.allan@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      752eee06
    • B
      ice: Fix implicit queue mapping mode in ice_vsi_get_qs · 39066dc5
      Brett Creeley 提交于
      Currently in ice_vsi_get_qs() we set the mapping_mode for Tx and Rx to
      vsi->[tx|rx]_mapping_mode, but the problem is vsi->[tx|rx]_mapping_mode
      have not been set yet. This was working because ICE_VSI_MAP_CONTIG is
      defined to 0. Fix this by being explicit with our mapping mode by
      initializing the Tx and Rx structure's mapping_mode to
      ICE_VSI_MAP_CONTIG and then setting the vsi->[tx|rx]_mapping_mode to the
      [tx|rx]_qs_cfg.mapping_mode values.
      
      Also, only assign the vsi->[tx|rx]_mapping_mode when the queues are
      successfully mapped to the VSI. With this change there was no longer a
      need to initialize the ret variable to 0 so remove that.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      39066dc5
    • B
      ice: Add support to enable/disable all Rx queues before waiting · 13a6233b
      Brett Creeley 提交于
      Currently when we enable/disable all Rx queues we do the following
      sequence for each Rx queue and then move to the next queue.
      
      1. Enable/Disable the Rx queue via register write.
      2. Read the configuration register to determine if the Rx queue was
      enabled/disabled successfully.
      
      In some cases enabling/disabling queue 0 fails because of step 2 above.
      Fix this by doing step 1 for all of the Rx queues and then step 2 for
      all of the Rx queues.
      
      Also, there are cases where we enable/disable a single queue (i.e.
      SR-IOV and XDP) so add a new function that does step 1 and 2 above with
      a read flush in between.
      
      This change also required a single Rx queue to be enabled/disabled with
      and without waiting for the change to propagate through hardware. Fix
      this by adding a boolean wait flag to the necessary functions.
      
      Also, add the keywords "one" and "all" to distinguish between
      enabling/disabling a single Rx queue and all Rx queues respectively.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      13a6233b
    • B
      ice: Add initial support for QinQ · 42f3efef
      Brett Creeley 提交于
      Allow support for S-Tag + C-Tag VLAN traffic by disabling pruning when
      there are no 0x8100 VLAN interfaces currently created on top of the PF.
      When an 0x8100 VLAN interface is configured, enable pruning and only
      support single and double C-Tag VLAN traffic. If all of the 0x8100
      interfaces that were created on top of the PF are removed via
      ethtool -K <iface> rx-vlan-filter off or via ip tools, then disable
      pruning and allow S-Tag + C-Tag traffic again.
      
      Add VLAN 0 filter by default for the PF. This is because a bridge
      sets the default_pvid to 1, sends the request down to
      ice_vlan_rx_add_vid(), and we never get the request to add VLAN 0 via
      the 8021q module which causes all untagged traffic to be dropped.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      42f3efef
  19. 13 2月, 2020 5 次提交