1. 16 2月, 2012 6 次提交
  2. 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
  3. 10 1月, 2012 1 次提交
  4. 17 11月, 2011 1 次提交
  5. 11 8月, 2011 1 次提交
  6. 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
  7. 24 6月, 2011 1 次提交
  8. 18 5月, 2011 1 次提交
  9. 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
  10. 15 4月, 2011 1 次提交
  11. 12 4月, 2011 1 次提交
    • B
      sfc: Do not use efx_process_channel_now() in online self-test · d4fabcc8
      Ben Hutchings 提交于
      During self-tests we use efx_process_channel_now() to handle
      completion and other events synchronously.  This disables interrupts
      and NAPI processing for the channel in question, but it may still be
      interrupted by another channel.  A single socket may receive packets
      from multiple net devices or even multiple channels of the same net
      device, so this can result in deadlock on a socket lock.
      
      Receiving packets in process context will also result in incorrect
      classification by the network cgroup classifier.
      
      Therefore, we must only use efx_process_channel_now() in the offline
      loopback tests (which never deliver packets up the stack) and not for
      the online interrupt and event tests.
      
      For the interrupt test, there is no reason to process events.  We
      only care that an interrupt is raised.
      
      For the event test, we want to know whether events have been received,
      and there may be many events ahead of the one we inject.  Therefore
      remove efx_channel::magic_count and instead test whether
      efx_channel::eventq_read_ptr advances.  This is currently an event
      queue index and might wrap around to exactly the same value, resulting
      in a false negative.  Therefore move the masking to efx_event() and
      efx_nic_eventq_read_ack() so that it cannot wrap within the time of
      the test.
      
      The event test also tries to diagnose failures by checking whether an
      event was delivered without causing an interrupt.  Add and use a
      helper function that only does this.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      d4fabcc8
  12. 05 4月, 2011 1 次提交
  13. 31 3月, 2011 1 次提交
  14. 01 3月, 2011 4 次提交
  15. 18 2月, 2011 1 次提交
    • B
      sfc: Implement hardware acceleration of RFS · 64d8ad6d
      Ben Hutchings 提交于
      Use the existing filter management functions to insert TCP/IPv4 and
      UDP/IPv4 4-tuple filters for Receive Flow Steering.
      
      For each channel, track how many RFS filters are being added during
      processing of received packets and scan the corresponding number of
      table entries for filters that may be reclaimed.  Do this in batches
      to reduce lock overhead.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      64d8ad6d
  16. 16 2月, 2011 2 次提交
    • B
      sfc: Add TX queues for high-priority traffic · 94b274bf
      Ben Hutchings 提交于
      Implement the ndo_setup_tc() operation with 2 traffic classes.
      
      Current Solarstorm controllers do not implement TX queue priority, but
      they do allow queues to be 'paced' with an enforced delay between
      packets.  Paced and unpaced queues are scheduled in round-robin within
      two separate hardware bins (paced queues with a large delay may be
      placed into a third bin temporarily, but we won't use that).  If there
      are queues in both bins, the TX scheduler will alternate between them.
      
      If we make high-priority queues unpaced and best-effort queues paced,
      and high-priority queues are mostly empty, a single high-priority queue
      can then instantly take 50% of the packet rate regardless of how many
      of the best-effort queues have descriptors outstanding.
      
      We do not actually want an enforced delay between packets on best-
      effort queues, so we set the pace value to a reserved value that
      actually results in a delay of 0.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      94b274bf
    • B
      sfc: Distinguish queue lookup from test for queue existence · 525da907
      Ben Hutchings 提交于
      efx_channel_get_{rx,tx}_queue() currently return NULL if the channel
      isn't used for traffic in that direction.  In most cases this is a
      bug, but some callers rely on it as an existence test.
      
      Add existence test functions efx_channel_has_{rx_queue,tx_queues}()
      and use them as appropriate.
      
      Change efx_channel_get_{rx,tx}_queue() to assert that the requested
      queue exists.
      
      Remove now-redundant initialisation from efx_set_channels().
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      525da907
  17. 25 1月, 2011 1 次提交
  18. 14 1月, 2011 1 次提交
  19. 11 12月, 2010 2 次提交
    • B
      sfc: Remove ancient support for nesting of TX stop · c04bfc6b
      Ben Hutchings 提交于
      Long before this driver went into mainline, it had support for
      multiple TX queues per port, with lockless TX enabled.  Since Linux
      did not know anything of this, filling up any hardware TX queue would
      stop the core TX queue and multiple hardware TX queues could fill up
      before the scheduler reacted.  Thus it was necessary to keep a count
      of how many TX queues were stopped and to wake the core TX queue only
      when all had free space again.
      
      The driver also previously (ab)used the per-hardware-queue stopped
      flag as a counter to deal with various things that can inhibit TX, but
      it no longer does that.
      
      Remove the per-channel tx_stop_count, tx_stop_lock and
      per-hardware-queue stopped count and just use the networking core
      queue state directly.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      c04bfc6b
    • B
  20. 08 12月, 2010 1 次提交
    • B
      sfc: Fix crash in legacy onterrupt handler during ring reallocation · 94dec6a2
      Ben Hutchings 提交于
      If we are using a legacy interrupt, our IRQ may be shared and our
      interrupt handler may be called even though interrupts are disabled on
      the NIC. When we change ring sizes, we reallocate the event queue and
      the interrupt handler may use an invalid pointer when called for
      another device's interrupt.
      
      Maintain a legacy_irq_enabled flag and test that at the top of the
      interrupt handler.  Note that this problem results from the need to
      work around broken INT_ISR0 reads, and does not affect the legacy
      interrupt handler for Falcon A1.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      94dec6a2
  21. 07 12月, 2010 1 次提交
    • B
      sfc: Use TX push whenever adding descriptors to an empty queue · cd38557d
      Ben Hutchings 提交于
      Whenever we add DMA descriptors to a TX ring and update the ring
      pointer, the TX DMA engine must first read the new DMA descriptors and
      then start reading packet data.  However, all released Solarflare 10G
      controllers have a 'TX push' feature that allows us to reduce latency
      by writing the first new DMA descriptor along with the pointer update.
      This is only useful when the queue is empty.  The hardware should
      ignore the pushed descriptor if the queue is not empty, but this check
      is buggy, so we must do it in software.
      
      In order to tell whether a TX queue is empty, we need to compare the
      previous transmission count (write_count) and completion count
      (read_count).  However, if we do that every time we update the ring
      pointer then read_count may ping-pong between the caches of two CPUs
      running the transmission and completion paths for the queue.
      Therefore, we split the check for an empty queue between the
      completion path and the transmission path:
      
      - Add an empty_read_count field representing a point at which the
        completion path saw the TX queue as empty.
      - Add an old_write_count field for use on the completion path.
      - On the completion path, whenever read_count reaches or passes
        old_write_count the TX queue may be empty.  We then read
        write_count, set empty_read_count if read_count == write_count,
        and update old_write_count.
      - On the transmission path, we read empty_read_count.  If it's set, we
        compare it with the value of write_count before the current set of
        descriptors was added.  If they match, the queue really is empty and
        we can use TX push.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      cd38557d