1. 19 9月, 2012 1 次提交
  2. 08 9月, 2012 2 次提交
  3. 25 8月, 2012 4 次提交
    • B
      sfc: Change state names to be clearer, and comment them · f16aeea0
      Ben Hutchings 提交于
      STATE_INIT and STATE_FINI are equivalent and represent incompletely
      initialised states; combine them as STATE_UNINIT.
      
      Rename STATE_RUNNING to STATE_READY, to avoid confusion with
      netif_running() and IFF_RUNNING.
      
      The comments do not quite match current usage, but this will be
      corrected in subsequent fixes.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      f16aeea0
    • B
      sfc: Simplify TSO header buffer allocation · f7251a9c
      Ben Hutchings 提交于
      TSO header buffers contain a control structure immediately followed by
      the packet headers, and are kept on a free list when not in use.  This
      complicates buffer management and tends to result in cache read misses
      when we recycle such buffers (particularly if DMA-coherent memory
      requires caches to be disabled).
      
      Replace the free list with a simple mapping by descriptor index.  We
      know that there is always a payload descriptor between any two
      descriptors with TSO header buffers, so we can allocate only one
      such buffer for each two descriptors.
      
      While we're at it, use a standard error code for allocation failure,
      not -1.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      f7251a9c
    • B
      sfc: Stop TX queues before they fill up · 14bf718f
      Ben Hutchings 提交于
      We now have a definite upper bound on the number of descriptors per
      skb; use that to stop the queue when the next packet might not fit.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      14bf718f
    • B
      sfc: Refactor struct efx_tx_buffer to use a flags field · 7668ff9c
      Ben Hutchings 提交于
      Add a flags field to struct efx_tx_buffer, replacing the
      continuation and map_single booleans.
      
      Since a single descriptor cannot be both a TSO header and the last
      descriptor for an skb, unionise efx_tx_buffer::{skb,tsoh} and add
      flags for validity of these fields.
      
      Clear all flags in free buffers (whereas previously the continuation
      flag would be set).
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      7668ff9c
  4. 17 7月, 2012 2 次提交
    • B
      sfc: Disable VF queues during register self-test · d4f2cecc
      Ben Hutchings 提交于
      Currently VF queues and drivers may remain active during this test.
      This could cause memory corruption or spurious test failures.
      Therefore we reset the port/function before running these tests on
      Siena.
      
      On Falcon this doesn't work: we have to do some additional
      initialisation before some blocks will work again.  So refactor the
      reset/register-test sequence into an efx_nic_type method so
      efx_selftest() doesn't have to consider such quirks.
      
      In the process, fix another minor bug: Siena does not have an
      'invisible' reset and the self-test currently fails to push the PHY
      configuration after resetting.  Passing RESET_TYPE_ALL to
      efx_reset_{down,up}() fixes this.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      d4f2cecc
    • B
      sfc: Use generic DMA API, not PCI-DMA API · 0e33d870
      Ben Hutchings 提交于
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      0e33d870
  5. 11 7月, 2012 1 次提交
  6. 10 5月, 2012 2 次提交
  7. 07 3月, 2012 2 次提交
  8. 23 2月, 2012 1 次提交
  9. 16 2月, 2012 7 次提交
    • B
      sfc: Add SR-IOV back-end support for SFC9000 family · cd2d5b52
      Ben Hutchings 提交于
      On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs),
      each with an RX queue, a TX queue, an event queue and a mailbox
      register.  These may be assigned to up to 127 SR-IOV virtual functions
      per port, with up to 64 VIs per VF.
      
      We allocate an extra channel (IRQ and event queue only) to receive
      requests from VF drivers.
      
      There is a per-port limit of 4 concurrent RX queue flushes, and queue
      flushes may be initiated by the MC in response to a Function Level
      Reset (FLR) of a VF.  Therefore, when SR-IOV is in use, we submit all
      flush requests via the MC.
      
      The RSS indirection table is shared with VFs, so the number of RX
      queues used in the PF is limited to the number of VIs per VF.
      
      This is almost entirely the work of Steve Hodgson, formerly
      shodgson@solarflare.com.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      cd2d5b52
    • B
      sfc: Allocate SRAM between buffer table and descriptor caches at init time · 28e47c49
      Ben Hutchings 提交于
      Each port has a block of 64-bit SRAM that is divided between buffer
      table and descriptor cache regions at initialisation time.  Currently
      we use a fixed allocation, but it needs to be changed to support
      larger numbers of queues.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      28e47c49
    • B
      sfc: Add support for 'extra' channel types · 7f967c01
      Ben Hutchings 提交于
      Abstract some of the channel operations to allow for 'extra'
      channels that do not have RX or TX queues.
      
      - Try to assign a channel to each extra channel type that is enabled
        for the NIC, but gracefully degrade if we can't allocate sufficient
        MSI-X vectors
      - Allow each extra channel type to generate its own channel name
      - Allow channel types to disable reallocation and reinitialisation
        of their channels
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      7f967c01
    • B
      a16e5b24
    • B
    • S
      sfc: Disable flow control during flushes · a606f432
      Steve Hodgson 提交于
      The TX DMA engine issues upstream read requests when there is room in
      the TX FIFO for the completion. However, the fetches for the rest of
      the packet might be delayed by any back pressure.  Since a flush must
      wait for an EOP, the entire flush may be delayed by back pressure.
      
      Mitigate this by disabling flow control before the flushes are
      started.  Since PF and VF flushes run in parallel introduce
      fc_disable, a reference count of the number of flushes outstanding.
      
      The same principle could be applied to Falcon, but that
      would bring with it its own testing.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      a606f432
    • B
      sfc: Leave interrupts and event queues enabled whenever we can · 9f2cb71c
      Ben Hutchings 提交于
      When SR-IOV is enabled we may receive FLR (Function-Level Reset)
      events, associated queue flush events and requests from VF drivers at
      any time.  Therefore we need to keep event queues and interrupts
      enabled whenever possible.
      
      Currently we stop interrupt-driven event processing before flushing RX
      and TX queues; efx_nic_flush_queues() then polls event queues for
      flush events and discards any others it finds.  Change it to work with
      the regular event handling functions.
      
      Currently efx_start_channel() fills RX queues synchronously when a
      device is brought up.  This could now race with NAPI, so change it to
      send fill events.
      
      This was almost entirely written by Steve Hodgson, formerly
      shodgson@solarflare.com.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      9f2cb71c
  10. 27 1月, 2012 9 次提交
    • B
      sfc: Replace efx_rx_buffer::is_page and other booleans with a flags field · db339569
      Ben Hutchings 提交于
      Replace checksummed and discard booleans from efx_handle_rx_event()
      with a bitmask, added to the flags field.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      db339569
    • B
      sfc: Make all MAC statistics consistently 64 bits wide · f9c76250
      Ben Hutchings 提交于
      Currently we use type u64 for byte counts, which can very quickly
      exceed 2^32, and unsigned long for packet counts, which do not.  But
      it can still take only 20-something minutes to send or receive 2^32
      packets, and not all tools properly handle overflow even if they
      sample more often than this.
      
      The MAC statistics are all updated synchronously, so it costs very
      little to make them all 64-bit regardless of native word size.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      f9c76250
    • B
      b249513e
    • B
      sfc: Clean up test interrupt handling · 1646a6f3
      Ben Hutchings 提交于
      Interrupts are normally generated by the event queues, moderated by
      timers.  However, they may also be triggered by detection of a 'fatal'
      error condition (e.g. memory parity error) or by the host writing to
      certain CSR fields as part of a self-test.
      
      The IRQ level/index used for these on Falcon rev B0 and Siena is set
      by the KER_INT_LEVE_SEL field and cached by the driver in
      efx_nic::fatal_irq_level.  Since this value is also relevant to
      self-tests rename the field to just 'irq_level'.
      
      Avoid unnecessary cache traffic by using a per-channel 'last_irq_cpu'
      field and only writing to the per-controller field when the interrupt
      matches efx_nic::irq_level.  Remove the volatile qualifier and use
      ACCESS_ONCE in the places we read these fields.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      1646a6f3
    • B
      sfc: Correct interrupt timer quantum for Siena (normal and turbo mode) · cc180b69
      Ben Hutchings 提交于
      We currently assume that the timer quantum for Siena is 5 us, the same
      as for Falcon.  This is not correct; timer ticks are generated on a
      rota which takes a minimum of 768 cycles (each event delivery or other
      timer change will delay it by 3 cycles).  The timer quantum should be
      6.144 or 3.072 us depending on whether turbo mode is active.
      
      Replace EFX_IRQ_MOD_RESOLUTION with a timer_quantum_ns field in struct
      efx_nic, initialised by the efx_nic_type::probe function.
      
      While we're at it, replace EFX_IRQ_MOD_MAX with a timer_period_max
      field in struct efx_nic_type.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      cc180b69
    • B
      sfc: Consistently test DEBUG macro, not EFX_ENABLE_DEBUG · 5f3f9d6c
      Ben Hutchings 提交于
      The netif_dbg() macro is defined in <linux/netdevice.h>.  If the DEBUG
      macro is defined, it logs a message at 'debug' level, otherwise it
      does nothing.
      
      In net_driver.h we define DEBUG if EFX_ENABLE_DEBUG is defined, but
      this is too late for those source files that already got a
      definition of netif_dbg() by including <linux/netdevice.h>
      
      Get rid of EFX_ENABLE_DEBUG, and only define and test DEBUG.
      
      In mtd.c, we do not use DEBUG as a condition flag but are forced to
      use the DEBUG macro-function from <linux/mtd/mtd.h>.  Undefine DEBUG
      before including it.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      5f3f9d6c
    • B
      sfc: Remove efx_nic_type::push_multicast_hash operation · 30b81cda
      Ben Hutchings 提交于
      Both implementations of efx_nic_type::reconfigure_mac operation
      push the multicast hash filter to the hardware.  It is therefore
      redundant to call efx_nic_type::push_multicast_hash as well.
      
      efx_mcdi_mac_reconfigure() also uses this operation, but the
      implementation for Siena just uses MCDI anyway.  Merge that into
      efx_mcdi_mac_reconfigure().
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      30b81cda
    • B
      sfc: Merge efx_mac_operations into efx_nic_type · 710b208d
      Ben Hutchings 提交于
      No NICs need to switch efx_mac_operations at run-time, and the MAC
      operations are fairly closely bound to NIC types.
      
      Move efx_mac_operations::reconfigure to efx_nic_type::reconfigure_mac
      and efx_mac_operations::check_fault fo efx_nic_type::check_mac_fault.
      Change callers to call through efx->type or directly if the NIC type
      is known.
      
      Remove efx_mac_operations::update_stats.  The implementations for
      Falcon used to fetch MAC statistics synchronously and this was used by
      efx_register_netdev() to clear statistics after running self-tests.
      However, it now only converts statistics that have already been
      fetched (and that only for Falcon), and the call from
      efx_register_netdev() has no effect.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      710b208d
    • B
      sfc: Hold efx_nic::stats_lock while reading efx_nic::mac_stats · 1cb34522
      Ben Hutchings 提交于
      efx_nic::stats_lock is used to serialise stats updates, but each
      reader was dropping it before it finished reading efx_nic::mac_stats.
      
      If there were concurrent stats reads using procfs, or one using procfs
      and one using ethtool, an update could race with a read.  On a 32-bit
      system, the reader could see word-tearing of 64-bit stats (32 bits of
      the old value and 32 bits of the new).
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      1cb34522
  11. 10 1月, 2012 1 次提交
  12. 17 11月, 2011 1 次提交
  13. 11 8月, 2011 1 次提交
  14. 25 6月, 2011 2 次提交
    • B
      sfc: Fix mapping of reset reasons and flags to methods · 0e2a9c7c
      Ben Hutchings 提交于
      There are certain hardware bugs that may occur on Falcon during normal
      operation, that require a reset to recover from.  We try to minimise
      disruption by keeping the PHY running, following a reset sequence
      labelled as 'invisible'.
      
      Siena does not suffer from these hardware bugs, so we have not
      implemented an 'invisible' reset sequence.  However, if a similar
      error does occur (due to a hardware fault or software bug) then the
      code shared with Falcon will wrongly assume that the PHY is not being
      reset.
      
      Since the mapping of reset reasons (internal) and flags (ethtool) to
      methods must differ significantly between NIC types, move it into
      per-NIC-type functions (replacing the insufficient reset_world_flags
      field).
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      0e2a9c7c
    • B
      sfc: Allow resets to be upgraded; use atomic ops for safety · a7d529ae
      Ben Hutchings 提交于
      Currently an attempt to schedule any reset is ignored if a reset
      is already pending.  This ignores the relative scopes - if the
      requested reset is greater in scope then the scheduled reset should
      be upgraded accordingly.
      
      There are also some race conditions which could lead to a reset
      request being lost.  Deal with them by using atomic operations on a
      bitmask.  This also makes tests on reset_pending easier to get right.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      a7d529ae
  15. 24 6月, 2011 1 次提交
  16. 18 5月, 2011 1 次提交
  17. 17 5月, 2011 1 次提交
    • B
      sfc: Use netif_device_{detach,attach}() around reset and self-test · e4abce85
      Ben Hutchings 提交于
      We need to keep the TX queues stopped throughout a reset, without
      triggering the TX watchdog and regardless of the link state.  The
      proper way to do this is to use netif_device_{detach,attach}() just as
      we do around suspend/resume, rather than the current bodge of faking
      link-down.
      
      Since we also need to do this during an offline self-test and we
      perform a reset during that, add these function calls outside of
      efx_reset_down() and efx_reset_up().
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      e4abce85
  18. 15 4月, 2011 1 次提交