1. 28 2月, 2018 2 次提交
  2. 19 1月, 2018 1 次提交
  3. 18 10月, 2017 1 次提交
  4. 03 10月, 2017 5 次提交
    • J
      fm10k: prefer %s and __func__ for diagnostic prints · 87be9892
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      87be9892
    • J
      fm10k: introduce a message queue for MAC/VLAN messages · fc917368
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      fc917368
    • J
      fm10k: use generic PM hooks instead of legacy PCIe power hooks · 8249c47c
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      8249c47c
    • J
      fm10k: use spinlock to implement mailbox lock · b4fcd436
      Jacob Keller 提交于
      Lets not re-invent the locking wheel. Remove our bitlock and use
      a proper spinlock instead.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b4fcd436
    • J
      fm10k: prepare_for_reset() when we lose PCIe Link · 0b40f457
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0b40f457
  5. 02 10月, 2017 4 次提交
  6. 03 7月, 2017 1 次提交
  7. 06 4月, 2017 4 次提交
    • N
      fm10k: disable receive queue when configuring ring · 16b1889f
      Ngai-Mint Kwan 提交于
      Write to RXQCTL register to disable the receive queue when configuring
      the RX ring.
      Signed-off-by: NNgai-Mint Kwan <ngai-mint.kwan@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      16b1889f
    • J
      fm10k: allow service task to reschedule itself · b4fd8ffc
      Jacob Keller 提交于
      If some code path executes fm10k_service_event_schedule(), it is
      guaranteed that we only queue the service task once, since we use
      __FM10K_SERVICE_SCHED flag. Unfortunately this has a side effect that if
      a service request occurs while we are currently running the watchdog, it
      is possible that we will fail to notice the request and ignore it until
      the next time the request occurs.
      
      This can cause problems with pf/vf mailbox communication and other
      service event tasks. To avoid this, introduce a FM10K_SERVICE_REQUEST
      bit. When we successfully schedule (and set the _SCHED bit) the service
      task, we will clear this bit. However, if we are unable to currently
      schedule the service event, we just set the new SERVICE_REQUEST bit.
      
      Finally, after the service event completes, we will re-schedule if the
      request bit has been set.
      
      This should ensure that we do not miss any service event schedules,
      since we will re-schedule it once the currently running task finishes.
      This means that for each request, we will always schedule the service
      task to run at least once in full after the request came in.
      
      This will avoid timing issues that can occur with the service event
      scheduling. We do pay a cost in re-running many tasks, but all the
      service event tasks use either flags to avoid duplicate work, or are
      tolerant of being run multiple times.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b4fd8ffc
    • J
      fm10k: future-proof state bitmaps using DECLARE_BITMAP · 46929557
      Jacob Keller 提交于
      This ensures that future programmers do not have to remember to re-size
      the bitmaps due to adding new values. Although this is unlikely for this
      driver, it may happen and it's best to prevent it from ever being an
      issue.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      46929557
    • J
      fm10k: use a BITMAP for flags to avoid race conditions · 3ee7b3a3
      Jacob Keller 提交于
      Replace bitwise operators and #defines with a BITMAP and enumeration
      values. This is similar to how we handle the "state" values as well.
      
      This has two distinct advantages over the old method. First, we ensure
      correctness of operations which are currently problematic due to race
      conditions. Suppose that two kernel threads are running, such as the
      watchdog and an ethtool ioctl, and both modify flags. We'll say that the
      watchdog is CPU A, and the ethtool ioctl is CPU B.
      
      CPU A sets FLAG_1, which can be seen as
        CPU A read FLAGS
        CPU A write FLAGS | FLAG_1
      
      CPU B sets FLAG_2, which can be seen as
        CPU B read FLAGS
        CPU A write FLAGS | FLAG_2
      
      However, "|=" and "&=" operators are not actually atomic. So this could
      be ordered like the following:
      
      CPU A read FLAGS -> variable
      CPU B read FLAGS -> variable
      CPU A write FLAGS (variable | FLAG_1)
      CPU B write FLAGS (variable | FLAG_2)
      
      Notice how the 2nd write from CPU B could actually undo the write from
      CPU A because it isn't guaranteed that the |= operation is atomic.
      
      In practice the race windows for most flag writes is incredibly narrow
      so it is not easy to isolate issues. However, the more flags we have,
      the more likely they will cause problems. Additionally, if such
      a problem were to arise, it would be incredibly difficult to track down.
      
      Second, there is an additional advantage beyond code correctness. We can
      now automatically size the BITMAP if more flags were added, so that we
      do not need to remember that flags is u32 and thus if we added too many
      flags we would over-run the variable. This is not a likely occurrence
      for fm10k driver, but this patch can serve as an example for other
      drivers which have many more flags.
      
      This particular change does have a bit of trouble converting some of the
      idioms previously used with the #defines for flags. Specifically, when
      converting FM10K_FLAG_RSS_FIELD_IPV[46]_UDP flags. This whole operation
      was actually quite problematic, because we actually stored flags
      separately. This could more easily show the problem of the above
      re-ordering issue.
      
      This is really difficult to test whether atomics make a difference in
      practical scenarios, but you can ensure that basic functionality remains
      the same. This patch has a lot of code coverage, but most of it is
      relatively simple.
      
      While we are modifying these files, update their copyright year.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NKrishneil Singh <krishneil.k.singh@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3ee7b3a3
  8. 31 3月, 2017 1 次提交
  9. 08 1月, 2017 1 次提交
  10. 29 8月, 2016 8 次提交
  11. 21 7月, 2016 12 次提交