1. 02 6月, 2017 7 次提交
  2. 30 4月, 2017 5 次提交
    • J
      i40e: use DECLARE_BITMAP for state fields · 0da36b97
      Jacob Keller 提交于
      Instead of assuming our flags fit within an unsigned long, use
      DECLARE_BITMAP which will ensure that we always allocate enough space.
      Additionally, use __I40E_STATE_SIZE__ markers as the last element of the
      enumeration so that the size of the BITMAP is compile-time assigned
      rather than programmer-time assigned. This ensures that potential future
      flag additions do not actually overrun the array. This is especially
      important as 32bit systems would only have 32bit longs instead of 64bit
      longs as we generally have assumed in the prior code.
      
      This change also removes a dereference of the state fields throughout
      the code, so it does have a bit of code churn. The conversions were
      automated using sed replacements with an alternation
      
        s/&(vsi->back|vsi|pf)->state/\1->state/
        s/&adapter->vsi.state/adapter->vsi.state/
      
      For debugfs, we modify the printing so that we can display chunks of the
      state value on new lines. This ensures that we can print the entire set
      of state values. Additionally, we now print them as 08lx to ensure that
      they display nicely.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0da36b97
    • J
      i40e: remove unnecessary msleep() delay in i40e_free_vfs · 2318b401
      Jacob Keller 提交于
      The delay was added because of a desire to ensure that the VF driver can
      finish up removing. However, pci_disable_sriov already has its own
      ssleep() call that will sleep for an entire second, so there is no
      reason to add extra delay on top of this by using msleep here. In
      practice, an msleep() won't have a huge impact on timing but there is no
      real value in keeping it, so lets just simplify the code and remove it.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      2318b401
    • J
      i40e: amortize wait time when disabling lots of VFs · 707d088a
      Jacob Keller 提交于
      Just as we do in i40e_reset_all_vfs, save some time when freeing VFs by
      amortizing the wait time for stopping queues. We can use
      i40e_vsi_stop_rings_no_wait() to begin the process of stopping all the
      VF rings at once. Then, once we've started the process on each VF we can
      begin waiting for the VFs to stop. This helps reduce the total wait time
      by a large factor.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      707d088a
    • J
      i40e: make use of i40e_reset_all_vfs when initializing new VFs · 1b484370
      Jacob Keller 提交于
      When allocating a large number of VFs, the driver previously used
      i40e_reset_vf in a sequence. Just as when performing a normal reset,
      this accumulates a large amount of delay for handling all of the VFs in
      sequence. This delay is mainly due to a hardware requirement to wait
      after initiating a reset on the VF.
      
      We recently added a new function, i40e_reset_all_vfs() which can be used
      to amortize the delay time, by first triggering all VF resets, then
      waiting once, and finally cleaning up and allocating the VFs. This is
      almost as good as truly running the resets in parallel.
      
      In order to avoid sending a spurious reset message to a client
      interface, we have a check to see whether we've assigned
      pf->num_alloc_vfs yet. This was originally intended as a way to
      distinguish the "initialization" case from the regular reset case.
      
      Unfortunately, this means that we can't directly use i40e_reset_all_vfs
      yet. Lets avoid this check of pf->num_alloc_vfs by replacing it with
      a proper VSI state bit which we can use instead. This makes the
      intention much clearer and allows us to re-use the i40e_reset_all_vfs
      function directly.
      
      Change-ID: I694279b37eb6b5a91b6670182d0c15d10244fd6e
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NMitch Williams <mitch.a.williams@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1b484370
    • J
      i40e: properly spell I40E_VF_STATE_* flags · 6322e63c
      Jacob Keller 提交于
      These flags represent the state of the VF at various times. Do not
      spell them as _STAT_ which can be confusing to readers who may think
      these refer to statistics.
      
      Change-ID: I6bc092cd472e8276896a1fd7498aced2084312df
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      6322e63c
  3. 20 4月, 2017 2 次提交
    • J
      i40e: reset all VFs in parallel when rebuilding PF · e4b433f4
      Jacob Keller 提交于
      When there are a lot of active VFs, it can take multiple seconds to
      finish resetting all of them during certain flows., which can cause some
      VFs to fail to wait long enough for the reset to occur. The user might
      see messages like "Never saw reset" or "Reset never finished" and the VF
      driver will stop functioning properly.
      
      The naive solution would be to simply increase the wait timer. We can
      get much more clever. Notice that i40e_reset_vf is run in a serialized
      fashion, and includes lots of delays.
      
      There are two prominent delays which take most of the time. First, when
      we begin resetting VFs, we have multiple 10ms delays which accrue
      because we reset each VF in a serial fashion. These delays accumulate to
      almost 4 seconds when handling the maximum number of VFs (128).
      
      Secondly, there is a massive 50ms delay for each time we disable queues
      on a VSI. This delay is necessary to allow HW to finish disabling queues
      before we restore functionality. However, just like with the first case,
      we are paying the cost for each VF, rather than disabling all VFs and
      waiting once.
      
      Both of these can be fixed, but required some previous refactoring to
      handle the special case. First, we will need the
      i40e_vsi_wait_queues_disabled function which was previously DCB
      specific. Second, we will need to implement our own
      i40e_vsi_stop_rings_no_wait function which will handle the stopping of
      rings without the delays.
      
      Finally, implement an i40e_reset_all_vfs function, which will first
      start the reset of all VFs, and pay the wait cost all at once, rather
      than serially waiting for each VF before we start processing then next
      one. After the VF has been reset, we'll disable all the VF queues, and
      then wait for them to disable. Again, we'll organize the flow such that
      we pay the wait cost only once.
      
      Finally, after we've disabled queues we'll go ahead and begin restoring
      VF functionality. The result is reducing the wait time by a large factor
      and ensuring that VFs do not timeout when waiting in the VF driver.
      
      Change-ID: Ia6e8cf8d98131b78aec89db78afb8d905c9b12be
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e4b433f4
    • J
      i40e: split some code in i40e_reset_vf into helpers · 9dc2e417
      Jacob Keller 提交于
      A future patch is going to want to re-use some of the code in
      i40e_reset_vf, so lets break up the beginning and ending parts into
      their own helper functions. The first function will be used to
      initialize the reset on a VF, while the second function will be used to
      finalize the reset and restore functionality.
      
      Change-ID: I48df808b8bf09de3c2ed8c521f57b3f0ab9e5907
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9dc2e417
  4. 07 4月, 2017 1 次提交
  5. 28 3月, 2017 1 次提交
    • R
      i40e: Fixed race conditions in VF reset · beff3e9d
      Robert Konklewski 提交于
      First, this patch eliminates IOMMU DMAR Faults caused by VF hardware.
      This is done by enabling VF hardware only after VSI resources are
      freed. Otherwise, hardware could DMA into memory that is (or just has
      been) being freed.
      
      Then, the VF driver is activated only after VSI resources have been
      reallocated. That's because the VF driver can request resources
      immediately after it's activated. So they need to be ready at that
      point.
      
      The second race condition happens when the OS initiates a VF reset,
      and then before it's finished modifies VF's settings by changing its
      MAC, VLAN ID, bandwidth allocation, anti-spoof checking, etc. These
      functions needed to be blocked while VF is undergoing reset. Otherwise,
      they could operate on data structures that had just been freed or not
      yet fully initialized.
      
      Change-ID: I43ba5a7ae2c9a1cce3911611ffc4598ae33ae3ff
      Signed-off-by: NRobert Konklewski <robertx.konklewski@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      beff3e9d
  6. 15 3月, 2017 3 次提交
  7. 28 2月, 2017 1 次提交
  8. 03 2月, 2017 4 次提交
  9. 07 12月, 2016 2 次提交
    • J
      i40e: use (add|rm)_vlan_all_mac helper functions when changing PVID · 9af52f60
      Jacob Keller 提交于
      The current flow for adding or updating the PVID for a VF uses
      i40e_vsi_add_vlan and i40e_vsi_kill_vlan which each take, then release
      the hash lock. In addition the two functions also must take special care
      that they do not perform VLAN mode changes as this will make the code in
      i40e_ndo_set_vf_port_vlan behave incorrectly.
      
      Fix these issues by using the new helper functions i40e_add_vlan_all_mac
      and i40e_rm_vlan_all_mac which expect the hash lock to already be taken.
      Additionally these functions do not perform any state updates in regards
      to VLAN mode, so they are safe to use in the PVID update flow.
      
      It should be noted that we don't need the VLAN mode update code here,
      because there are only a few flows here.
      
      (a) we're adding a new PVID
        In this case, if we already had VLAN filters the VSI is knocked
        offline so we don't need to worry about pre-existing VLAN filters
      
      (b) we're replacing an existing PVID
        In this case, we can't have any VLAN filters except those with the old
        PVID which we already take care of manually.
      
      (c) we're removing an existing PVID
        Similarly to above, we can't have any existing VLAN filters except
        those with the old PVID which we already take care of correctly.
      
      Because of this, we do not need (or even want) the special accounting
      done in i40e_vsi_add_vlan, so use of the helpers is a saner alternative.
      It also opens the door for a future patch which will refactor the flow
      of i40e_vsi_add_vlan now that it is not needed in this function.
      
      Change-ID: Ia841f63da94e12b106f41cf7d28ce8ce92f2ad99
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9af52f60
    • C
      i40e: Add support for 25G devices · 3123237a
      Carolyn Wyborny 提交于
      Add support for 25G devices - defines and data structures.
      
      One tricky part here is that the firmware support for these
      Devices introduces a mismatch between the PHY type enum and
      the bitfields for the phy types.
      
      This change creates a macro and uses it to increment the 25G
      PHY values when creating 25G bitfields.
      
      Change-ID: I69b24d837d44cf9220bf5cb8dd46c5be89ce490b
      Signed-off-by: NCarolyn Wyborny <carolyn.wyborny@intel.com>
      Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3123237a
  10. 03 12月, 2016 2 次提交
    • J
      i40e: set broadcast promiscuous mode for each active VLAN · 435c084a
      Jacob Keller 提交于
      A previous workaround added to ensure receipt of all broadcast frames
      incorrectly set the broadcast promiscuous mode unconditionally
      regardless of active VLAN status.
      
      Replace this partial workaround with a complete solution that sets the
      broadcast promiscuous filters in i40e_sync_vsi_filters. This new method
      sets the promiscuous mode based on when broadcast filters are added or
      removed.
      
      I40E_VLAN_ANY will request a broadcast filter for all VLANs, (as we're
      in untagged mode) while a broadcast filter on a specific VLAN will only
      request broadcast for that VLAN.
      
      Thus, we restore addition of broadcast filter to the array, but we add
      special handling for these such that they enable the broadcast
      promiscuous mode instead of being sent as regular filters.
      
      The end result is that we will correctly receive all broadcast packets
      (even those with a *source* address equal to the broadcast address) but
      will not receive packets for which we don't have an active VLAN filter.
      
      Change-ID: I7d0585c5cec1a5bf55bf533b42e5e817d5db6a2d
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      435c084a
    • J
      i40e: remove error_param_int label from i40e_vc_config_promiscuous_mode_msg · 7429c0bd
      Jacob Keller 提交于
      This label is unnecessary, as are jumping to a block that checks aq_ret
      and then immediately skipping it and returning. So just jump straight to
      the error_param and remove this unnecessary label.
      
      Also use goto error_param even in the last check for style consistency.
      
      Change-ID: If487c7d10c4048e37c594e5eca167693aaed45f6
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      7429c0bd
  11. 01 11月, 2016 5 次提交
  12. 24 9月, 2016 1 次提交
    • M
      net: Update API for VF vlan protocol 802.1ad support · 79aab093
      Moshe Shemesh 提交于
      Introduce new rtnl UAPI that exposes a list of vlans per VF, giving
      the ability for user-space application to specify it for the VF, as an
      option to support 802.1ad.
      We adjusted IP Link tool to support this option.
      
      For future use cases, the new UAPI supports multiple vlans. For now we
      limit the list size to a single vlan in kernel.
      Add IFLA_VF_VLAN_LIST in addition to IFLA_VF_VLAN to keep backward
      compatibility with older versions of IP Link tool.
      
      Add a vlan protocol parameter to the ndo_set_vf_vlan callback.
      We kept 802.1Q as the drivers' default vlan protocol.
      Suitable ip link tool command examples:
        Set vf vlan protocol 802.1ad:
          ip link set eth0 vf 1 vlan 100 proto 802.1ad
        Set vf to VST (802.1Q) mode:
          ip link set eth0 vf 1 vlan 100 proto 802.1Q
        Or by omitting the new parameter
          ip link set eth0 vf 1 vlan 100
      Signed-off-by: NMoshe Shemesh <moshe@mellanox.com>
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79aab093
  13. 23 9月, 2016 2 次提交
  14. 19 8月, 2016 4 次提交