1. 11 1月, 2018 7 次提交
  2. 22 11月, 2017 1 次提交
    • A
      i40evf: fix client notify of l2 params · 01acc73f
      Alan Brady 提交于
      The current method for notifying clients of l2 parameters is broken
      because we fail to copy the new parameters to the client instance
      struct, we need to do the notification before the client 'open' function
      pointer gets called, and lastly we should set the l2 parameters when
      first adding a client instance.
      
      This patch first introduces the i40evf_client_get_params function to
      prevent code duplication in the i40evf_client_add_instance and the
      i40evf_notify_client_l2_params functions.  We then fix the notify l2
      params function to actually copy the parameters to client instance
      struct and do the same in the *_add_instance' function.  Lastly this
      patch reorganizes the priority in which client tasks fire so that if the
      flag for notifying l2 params is set, it will trigger before the open
      because the client needs these new parameters as part of a client open
      task.
      Signed-off-by: NAlan Brady <alan.brady@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      01acc73f
  3. 18 10月, 2017 1 次提交
  4. 10 10月, 2017 2 次提交
    • J
      i40e/i40evf: fix incorrect default ITR values on driver load · 42702559
      Jacob Keller 提交于
      The ITR register expects to be programmed in units of 2 microseconds.
      Because of this, all of the drivers I40E_ITR_* constants are in terms of
      this 2 microsecond register.
      
      Unfortunately, the rx_itr_default value is expected to be programmed in
      microseconds.
      
      Effectively the driver defaults to an ITR value of half the expected
      value (in terms of minimum microseconds between interrupts).
      
      Fix this by changing the default values to be calculated using
      ITR_REG_TO_USEC macro which indicates that we're converting from the
      register units into microseconds.
      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>
      42702559
    • A
      i40evf: fix mac filter removal timing issue · c766b9af
      Alan Brady 提交于
      Due to the asynchronous nature in which mac filters are added and
      deleted, there exists a bug in which filters are erroneously removed if
      removed then added again quickly.
      
      The events are as such:
          - filter marked for removal
          - same filter is re-added before watchdog that cleans up filters
          - we skip re-adding the filter because we have it already in the
      list
          - watchdog filter cleanup kicks off and filter is removed
      
      So when we were re-adding the same filter, it didn't actually get added
      because it already existed in the list, but was marked for removal and
      had yet to actually be removed.
      
      This patch fixes the issue by making sure that when adding a filter, if
      we find it already existing in our list, make sure it is not marked to
      be removed.
      Signed-off-by: NAlan Brady <alan.brady@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c766b9af
  5. 06 10月, 2017 2 次提交
    • J
      i40evf: enable support for VF VLAN tag stripping control · 0a3b4f70
      Jacob Keller 提交于
      A recent commit 809481484e5d ("i40e/i40evf: support for VF VLAN tag
      stripping control") added support for VFs to negotiate the control of
      VLAN tag stripping. This should have allowed VFs to disable the feature.
      Unfortunately, the flag was set only in netdev->feature flags and not in
      netdev->hw_features.
      
      This ultimately causes the stack to assume that it cannot change the
      flag, so it was unchangeable and marked as [fixed] in the ethtool -k
      output.
      
      Fix this by setting the feature in hw_features first, just as we do for
      the PF code. This enables ethtool -K to disable the feature correctly,
      and fully enables user control of the VLAN tag stripping feature.
      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>
      0a3b4f70
    • J
      i40e/i40evf: spread CPU affinity hints across online CPUs only · be664cbe
      Jacob Keller 提交于
      Currently, when setting up the IRQ for a q_vector, we set an affinity
      hint based on the v_idx of that q_vector. Meaning a loop iterates on
      v_idx, which is an incremental value, and the cpumask is created based
      on this value.
      
      This is a problem in systems with multiple logical CPUs per core (like in
      simultaneous multithreading (SMT) scenarios). If we disable some logical
      CPUs, by turning SMT off for example, we will end up with a sparse
      cpu_online_mask, i.e., only the first CPU in a core is online, and
      incremental filling in q_vector cpumask might lead to multiple offline
      CPUs being assigned to q_vectors.
      
      Example: if we have a system with 8 cores each one containing 8 logical
      CPUs (SMT == 8 in this case), we have 64 CPUs in total. But if SMT is
      disabled, only the 1st CPU in each core remains online, so the
      cpu_online_mask in this case would have only 8 bits set, in a sparse way.
      
      In general case, when SMT is off the cpu_online_mask has only C bits set:
      0, 1*N, 2*N, ..., C*(N-1)  where
      C == # of cores;
      N == # of logical CPUs per core.
      In our example, only bits 0, 8, 16, 24, 32, 40, 48, 56 would be set.
      
      Instead, we should only assign hints for CPUs which are online. Even
      better, the kernel already provides a function, cpumask_local_spread()
      which takes an index and returns a CPU, spreading the interrupts across
      local NUMA nodes first, and then remote ones if necessary.
      
      Since we generally have a 1:1 mapping between vectors and CPUs, there
      is no real advantage to spreading vectors to local CPUs first. In order
      to avoid mismatch of the default XPS hints, we'll pass -1 so that it
      spreads across all CPUs without regard to the node locality.
      
      Note that we don't need to change the q_vector->affinity_mask as this is
      initialized to cpu_possible_mask, until an actual affinity is set and
      then notified back to us.
      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>
      be664cbe
  6. 03 10月, 2017 2 次提交
  7. 30 9月, 2017 2 次提交
    • A
      i40evf: fix ring to vector mapping · c97fc9b6
      Alan Brady 提交于
      The current implementation for mapping queues to vectors is broken
      because it attempts to map each Tx and Rx ring to its own vector,
      however we use combined queues so we should actually be mapping the
      Tx/Rx rings together on one vector.
      
      Also in the current implementation, in the case where we have more
      queues than vectors, we attempt to group the queues together into
      'chunks' and map each 'chunk' of queues to a vector.  Chunking them
      together would be more ideal if, and only if, we only had RSS because of
      the way the hashing algorithm works but in the case of a future patch
      that enables VF ADq, round robin assignment is better and still works
      with RSS.
      
      This patch resolves both those issues and simplifies the code needed to
      accomplish this.  Instead of treating the case where we have more queues
      than vectors as special, if we notice our vector index is greater than
      vectors, reset the vector index to zero and continue mapping.  This
      should ensure that in both cases, whether we have enough vectors for
      each queue or not, the queues get appropriately mapped.
      Signed-off-by: NAlan Brady <alan.brady@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c97fc9b6
    • J
      i40e: shutdown all IRQs and disable MSI-X when suspended · b980c063
      Jacob Keller 提交于
      On some platforms with a large number of CPUs, we will allocate many IRQ
      vectors. When hibernating, the system will attempt to migrate all of the
      vectors back to CPU0 when shutting down all the other CPUs. It is
      possible that we have so many vectors that it cannot re-assign them to
      CPU0. This is even more likely if we have many devices installed in one
      platform.
      
      The end result is failure to hibernate, as it is not possible to
      shutdown the CPUs. We can avoid this by disabling MSI-X and clearing our
      interrupt scheme when the device is suspended. A more ideal solution
      would be some method for the stack to properly handle this for all
      drivers, rather than on a case-by-case basis for each driver to fix
      itself.
      
      However, until this more ideal solution exists, we can do our part and
      shutdown our IRQs during suspend, which should allow systems with
      a large number of CPUs to safely suspend or hibernate.
      
      It may be worth investigating if we should shut down even further when
      we suspend as it may make the path cleaner, but this was the minimum fix
      for the hibernation issue mentioned here.
      
      Testing-hints:
        This affects systems with a large number of CPUs, and with multiple
        devices enabled. Without this change, those platforms are unable to
        hibernate at all.
      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>
      b980c063
  8. 22 9月, 2017 1 次提交
  9. 28 8月, 2017 3 次提交
    • J
      i40e: initialize our affinity_mask based on cpu_possible_mask · 759dc4a7
      Jacob Keller 提交于
      On older kernels a call to irq_set_affinity_hint does not guarantee that
      the IRQ affinity will be set. If nothing else on the system sets the IRQ
      affinity this can result in a bug in the i40e_napi_poll() routine where
      we notice that our interrupt fired on the "wrong" CPU according to our
      internal affinity_mask variable.
      
      This results in a bug where we continuously tell NAPI to stop polling to
      move the interrupt to a new CPU, but the CPU never changes because our
      affinity mask does not match the actual mask setup for the IRQ.
      
      The root problem is a mismatched affinity mask value. So lets initialize
      the value to cpu_possible_mask instead. This ensures that prior to the
      first time we get an IRQ affinity notification we'll have the mask set
      to include every possible CPU.
      
      We use cpu_possible_mask instead of cpu_online_mask since the former is
      almost certainly never going to change, while the later might change
      after we've made a copy.
      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>
      759dc4a7
    • M
      i40e/i40evf: support for VF VLAN tag stripping control · 8774370d
      Mariusz Stachura 提交于
      This patch gives VF capability to control VLAN tag stripping via
      ethtool. As rx-vlan-offload was fixed before, now the VF is able to
      change it using "ethtool --offload <IF> rxvlan on/off" settings.
      Signed-off-by: NMariusz Stachura <mariusz.stachura@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      8774370d
    • J
      i40evf: fix possible snprintf truncation of q_vector->name · 696ac80a
      Jacob Keller 提交于
      The q_vector names are based on the interface name with a driver prefix,
      the type of q_vector setup, and the queue number. We previously set the
      size of this variable to IFNAMSIZ + 9, which is incorrect, because we
      actually include a minimum of 14 characters extra beyond the interface
      name size.
      
      New versions of GCC since 7 include a new warning that detects this
      possible truncation and complains. We can fix this by increasing the
      size in case our interface name is too large to avoid truncation. We
      don't need to go beyond 14 because the compiler is smart enough to
      realize our values can never exceed size of 1. We do go up to 15 here
      because possible future changes may increase the number of queues beyond
      one digit.
      
      While we are here, also change some variables to be unsigned (since they
      are never negative) and stop using an extra unnecessary %s format
      specifier.
      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>
      696ac80a
  10. 26 8月, 2017 6 次提交
  11. 26 7月, 2017 1 次提交
  12. 21 6月, 2017 1 次提交
    • J
      i40evf: assign num_active_queues inside i40evf_alloc_queues · 65c7006f
      Jacob Keller 提交于
      The variable num_active_queues represents the number of active queues we
      have for the device. We assign this pretty early in i40evf_init_subtask.
      
      Several code locations are written with loops over the tx_rings and
      rx_rings structures, which don't get allocated until
      i40evf_alloc_queues, and which get freed by i40evf_free_queues.
      
      These call sites were written under the assumption that tx_rings and
      rx_rings would always be allocated at least when num_active_queues is
      non-zero.
      
      Lets fix this by moving the assignment into the function where we
      allocate queues. We'll use a temporary variable for storage so that we
      don't assign the value in the adapter structure until after the rings
      have been set up.
      
      Finally, when we free the queues, we'll clear the value to ensure that
      we do not loop over the rings memory that no longer exists.
      
      This resolves a possible NULL pointer dereference in
      i40evf_get_ethtool_stats which could occur if the VF fails to recover
      from a reset, and then a user requests statistics.
      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>
      65c7006f
  13. 02 6月, 2017 3 次提交
    • P
      i40evf: Add support for Adaptive Virtual Function · abf709a1
      Preethi Banala 提交于
      Add device ID define and mac_type assignment needed for
      Adaptive Virtual Function (VF Base Mode Support).
      
      Also, update version to v3.0.0 in order to indicate
      clearly that this is the first driver supporting the AVF
      device ID.
      Signed-off-by: NPreethi Banala <preethi.banala@intel.com>
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      abf709a1
    • J
      virtchnl: finish conversion to virtchnl interface · ff3f4cc2
      Jesse Brandeburg 提交于
      This patch implements the complete version of the virtchnl.h file
      with final renames, and fixes the related code in i40e and i40evf.
      
      It also expands comments, and adds details on the usage of
      certain fields.
      
      In addition, due to the changes a couple of casts are needed
      to prevent errors found by sparse after renaming some fields.
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      ff3f4cc2
    • J
      virtchnl: rename i40e to generic virtchnl · 310a2ad9
      Jesse Brandeburg 提交于
      This morphs all the i40e and i40evf references to/in virtchnl.h
      to be generic, using only automated methods. Updates all the
      callers to use the new names.  A followup patch provides separate
      clean ups for messy line conversions from these "automatic"
      changes, to make them more reviewable.
      
      Was executed with the following sed script:
      sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_client.c
      sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_prototype.h
      sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
      sed -i -f transform_script drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40e_common.c
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40e_prototype.h
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf.h
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_client.c
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_main.c
      sed -i -f transform_script drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
      sed -i -f transform_script include/linux/avf/virtchnl.h
      
      transform_script:
      ----8<----
      s/I40E_VIRTCHNL_SUPPORTED_QTYPES/SAVE_ME_SUPPORTED_QTYPES/g
      s/I40E_VIRTCHNL_VF_CAP/SAVE_ME_VF_CAP/g
      
      s/I40E_VIRTCHNL_/VIRTCHNL_/g
      s/i40e_virtchnl_/virtchnl_/g
      s/i40e_vfr_/virtchnl_vfr_/g
      s/I40E_VFR_/VIRTCHNL_VFR_/g
      
      s/VIRTCHNL_OP_ADD_ETHER_ADDRESS/VIRTCHNL_OP_ADD_ETH_ADDR/g
      s/VIRTCHNL_OP_DEL_ETHER_ADDRESS/VIRTCHNL_OP_DEL_ETH_ADDR/g
      s/VIRTCHNL_OP_FCOE/VIRTCHNL_OP_RSVD/g
      
      s/SAVE_ME_SUPPORTED_QTYPES/I40E_VIRTCHNL_SUPPORTED_QTYPES/g
      s/SAVE_ME_VF_CAP/I40E_VIRTCHNL_VF_CAP/g
      ----8<----
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      310a2ad9
  14. 30 4月, 2017 6 次提交
  15. 20 4月, 2017 2 次提交
    • S
      i40e/i40evf: Add tracepoints · ed0980c4
      Scott Peterson 提交于
      This patch adds tracepoints to the i40e and i40evf drivers to which
      BPF programs can be attached for feature testing and verification.
      It's expected that an attached BPF program will identify and count or
      log some interesting subset of traffic. The bcc-tools package is
      helpful there for containing all the BPF arcana in a handy Python
      wrapper. Though you can make these tracepoints log trace messages, the
      messages themselves probably won't be very useful (other to verify the
      tracepoint is being called while you're debugging your BPF program).
      
      The idea here is that tracepoints have such low performance cost when
      disabled that we can leave these in the upstream drivers. This may
      eventually enable the instrumentation of unmodified customer systems
      should the need arise to verify a NIC feature is working as expected.
      In general this enables one set of feature verification tools to be
      used on these drivers whether they're built with the kernel or
      separately.
      
      Users are advised against using these tracepoints for anything other
      than a diagnostic tool. They have a performance impact when enabled,
      and their exact placement and form may change as we see how well they
      work in practice for the purposes above.
      
      Change-ID: Id6014a7322c0e6d08068114dd20bd156f2f6435e
      Signed-off-by: NScott Peterson <scott.d.peterson@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      ed0980c4
    • T
      i40evf: Use net_device_stats from struct net_device · 4a0a3abf
      Tobias Klauser 提交于
      Instead of using a private copy of struct net_device_stats in
      struct i40evf_adapter, use stats from struct net_device. Also remove the
      now unnecessary .ndo_get_stats function.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4a0a3abf