Skip to content
  1. Oct 04, 2017
  2. Oct 03, 2017
    • Jacob Keller's avatar
      fm10k: prefer %s and __func__ for diagnostic prints · 87be9892
      Jacob Keller authored
      
      
      Don't hard code the function names in the diagnostic output when these
      reset related routines fail. Instead, use %s and __func__ so that future
      refactors don't need to change the print outs.
      
      Additionally, while we are here, add missing function header comments
      for the new reset_prepare and reset_done function handlers.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      87be9892
    • Joe Perches's avatar
      fm10k: Fix misuse of net_ratelimit() · c0ad8ef3
      Joe Perches authored
      
      
      Correct the backward logic using !net_ratelimit()
      
      Miscellanea:
      
      o Add a blank line before the error return label
      
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c0ad8ef3
    • Jacob Keller's avatar
    • Jacob Keller's avatar
      fm10k: use the MAC/VLAN queue for VF<->PF MAC/VLAN requests · 1f5c27e5
      Jacob Keller authored
      
      
      Now that we have a working MAC/VLAN queue for handling MAC/VLAN messages
      from the netdev, replace the default handler for the VF<->PF messages.
      This new handler is very similar to the default code, but uses the
      MAC/VLAN queue instead of sending the message directly. Unfortunately we
      can't easily re-use the default code, so we'll just replace the entire
      function.
      
      This ensures that a VF requesting a large number of VLANs or MAC
      addresses does not start a reset cycle, as explained in the commit which
      introduced the message queue.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarNgai-mint Kwan <ngai-mint.kwan@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1f5c27e5
    • Jacob Keller's avatar
      fm10k: introduce a message queue for MAC/VLAN messages · fc917368
      Jacob Keller authored
      
      
      Under some circumstances, when dealing with a large number of MAC
      address or VLAN updates at once, the fm10k driver, particularly the VFs
      can overload the mailbox with too many messages at once.
      
      This results in a mailbox timeout, which causes the driver to initiate
      a reset. During the reset, we re-send all the same messages that
      originally caused the timeout. This results in a cycle of resets each
      triggering a future reset.
      
      To fix or avoid this, we introduce a workqueue item which monitors
      a queue of MAC and VLAN requests. These requests are queued to the end
      of the list, and we process as a FIFO periodically.
      
      Initially we only handle requests for the netdev, but we do handle
      unicast MAC addresses, multicast MAC addresses, and update VLAN
      requests.
      
      A future patch will add support to use this queue for handling MAC
      update requests from the VF<->PF mailbox.
      
      The MAC/VLAN work item will keep checking to make sure that each request
      does not overflow the mailbox and cause a timeout. If it might, then the
      work item will reschedule itself a short time later. This avoids any
      reset cycle, since we never send the message if the mailbox is not
      ready.
      
      As an alternative, we tried increasing the mailbox message FIFO, but
      this just delays the problem and results in needless memory waste on the
      system. Our new message queue is dynamically allocated so only uses as
      much memory as it needs. Additionally, it need not be contiguous like
      the Tx and Rx FIFOs.
      
      Note that this patch chose to only create a queue for MAC and VLAN
      messages, since these are the only messages sent in a large enough
      volume to cause the reset loop. Other messages are very unlikely to
      overflow the mailbox Tx FIFO so easily.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      fc917368
    • Jacob Keller's avatar
      fm10k: use generic PM hooks instead of legacy PCIe power hooks · 8249c47c
      Jacob Keller authored
      
      
      Replace the PCI specific legacy power management hooks with the new
      generic power management hooks which work properly for both suspend and
      hibernate. The new generic system is better and properly handles the
      lower level PCIe power management rather than forcing the driver to
      handle it.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      8249c47c
    • Jacob Keller's avatar
      fm10k: use spinlock to implement mailbox lock · b4fcd436
      Jacob Keller authored
      
      
      Lets not re-invent the locking wheel. Remove our bitlock and use
      a proper spinlock instead.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b4fcd436
    • Jacob Keller's avatar
      fm10k: prepare_for_reset() when we lose PCIe Link · 0b40f457
      Jacob Keller authored
      
      
      If we lose PCIe link, such as when an unannounced PFLR event occurs, or
      when a device is surprise removed, we currently detach the device and
      close the netdev. This unfortunately leaves a lot of things still
      active, such as the msix_mbx_pf IRQ, and Tx/Rx resources.
      
      This can cause problems because the register reads will return
      potentially invalid values which may result in unknown driver behavior.
      
      Begin the process of resetting using fm10k_prepare_for_reset(), much in
      the same way as the suspend and resume cycle does. This will attempt to
      shutdown as much as possible, in order to prevent possible issues.
      
      A naive implementation for this has issues, because there are now
      multiple flows calling the reset logic and setting a reset bit. This
      would cause problems, because the "re-attach" routine might call
      fm10k_handle_reset() prior to the reset actually finishing. Instead,
      we'll add state bits to indicate which flow actually initiated the
      reset.
      
      For the general reset flow, we'll assume that if someone else is
      resetting that we do not need to handle it at all, so it does not need
      its own state bit. For the suspend case, we will simply issue a warning
      indicating that we are attempting to recover from this case when
      resuming.
      
      For the detached subtask, we'll simply refuse to re-attach until we've
      actually initiated a reset as part of that flow.
      
      Finally, we'll stop attempting to manage the mailbox subtask when we're
      detached, since there's nothing we can do if we don't have a PCIe
      address.
      
      Overall this produces a much cleaner shutdown and recovery cycle for
      a PCIe surprise remove event.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0b40f457
    • David S. Miller's avatar
      Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue · 4efac6ff
      David S. Miller authored
      
      
      Jeff Kirsher says:
      
      ====================
      40GbE Intel Wired LAN Driver Updates 2017-10-02
      
      This series contains updates to i40e and i40evf.
      
      Shannon Nelson fixes an issue where when a machine has more CPUs than
      queue pairs, the counting gets a "little funky" and turns off Flow
      Director.  So to correct it, limit the number of LAN queues initially
      allocated to be sure there are some left for Flow Director and other
      features.
      
      Lihong cleans up dead code by removing a condition check which cannot
      ever be true.
      
      Christophe Jaillet fixes a potential NULL pointer dereference, which
      could happen if kzalloc() fails.
      
      Filip corrects the reporting of supported link modes, which was incorrect
      for some NICs.  Added support for 'ethtool -m' command, which displays
      information about QSFP+ modules.
      
      Mariusz adds functions to read/write the LED registers to control the
      LEDS, instead of accessing the registers directly whenever the LEDs
      need to be controlled.
      
      Jake fixes a regression where we introduced a scheduling while atomic,
      so introduce a separate helper function which will manage its own need
      for the mac_filter_hash_lock.  Also cleaned up the "PF" parameter in
      i40e_vc_disable_vf() since it is never used and is not needed.  Fixed
      a rare case where it is possible that a reset does not occur when
      i40e_vc_disable_vf() is called, so modify i40e_reset_vf() to return a
      bool to indicate whether it reset or not so that i40e_vc_disable_vf()
      can wait until a reset actually occurs.
      
      Alan adds the ability for the VF to request more or less underlying
      allocated queues from the PF.  Fixes the incorrect method for clearing
      the vf_states variable with a NULL assignment, when we should be
      using atomic bitops since we don't actually want to clear all the
      flags.  Fixed a resource leak, where the PF driver fails to inform
      clients of a VF reset because we were incorrectly checking the
      I40E_VF_STATE_PRE_ENABLE bit.
      
      Mitch converts i40evf_map_rings_to_vectors() to a void function since
      it cannot fail and allows us to clean up the checks for the function
      return value.
      
      Scott enables the driver(s) to pass traffic with VLAN tags using the
      802.1ad Ethernet protocol.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4efac6ff
    • Scott Peterson's avatar
      i40e: Stop dropping 802.1ad tags - eth proto 0x88a8 · ab243ec9
      Scott Peterson authored
      
      
      Enable i40e to pass traffic with VLAN tags using the 802.1ad ethernet
      protocol ID (0x88a8).
      
      This requires NIC firmware providing version 1.7 of the API. With
      older NIC firmware 802.1ad tagged packets will continue to be dropped.
      
      No VLAN offloads nor RSS are supported for 802.1ad VLANs.
      
      Signed-off-by: default avatarScott Peterson <scott.d.peterson@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      ab243ec9
    • Alan Brady's avatar
      i40e: fix client notify of VF reset · c53d11f6
      Alan Brady authored
      
      
      Currently there is a bug in which the PF driver fails to inform clients
      of a VF reset which then causes clients to leak resources.  The bug
      exists because we were incorrectly checking the I40E_VF_STATE_PRE_ENABLE
      bit.
      
      When a VF is first init we go through a reset to initialize variables
      and allocate resources but we don't want to inform clients of this first
      reset since the client isn't fully enabled yet so we set a state bit
      signifying we're in a "pre-enabled" client state.  During the first
      reset we should be clearing the bit, allowing all following resets to
      notify the client of the reset when the bit is not set.  This patch
      fixes the issue by negating the 'test_and_clear_bit' check to accurately
      reflect the behavior we want.
      
      Signed-off-by: default avatarAlan Brady <alan.brady@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c53d11f6
    • Alan Brady's avatar
      i40e: fix handling of vf_states variable · 41d0a4d0
      Alan Brady authored
      
      
      Currently we inappropriately clear the vf_states variable with a null
      assignment.  This is problematic because we should be using atomic
      bitops on this variable and we don't actually want to clear all the
      flags.  We should just clear the ones we know we want to clear.
      Additionally remove the I40E_VF_STATE_FCOEENA bit because it is no
      longer being used.
      
      Signed-off-by: default avatarAlan Brady <alan.brady@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      41d0a4d0
    • Mitch Williams's avatar
      i40e: make i40evf_map_rings_to_vectors void · 1b7b7596
      Mitch Williams authored
      
      
      This function cannot fail, so why is it returning a value? And why are
      we checking it? Why shouldn't we just make it void? Why is this commit
      message made up of only questions?
      
      Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      1b7b7596