1. 30 8月, 2013 3 次提交
  2. 28 8月, 2013 1 次提交
  3. 23 8月, 2013 4 次提交
    • B
      sfc: Cleanup Falcon-arch simple MAC filter state · 964e6135
      Ben Hutchings 提交于
      On Falcon we implement MAC filtering requested by the stack using the
      MAC wrapper's single unicast filter and multicast hash filter.  Siena
      is very similar, though MAC configuration is mediated by the MC.
      
      Since MCDI operations may sleep, reconfiguration is deferred from
      ndo_set_rx_mode to a work item.  However, it still updates the private
      variables describing the filter state synchronously.  Contrary to
      comments, the later use of these variables is not protected using the
      address lock, resulting in race conditions.
      
      Move the state update to a new function
      efx_farch_filter_sync_rx_mode() and make the Falcon-arch MAC
      configuration functions call that, so that its use is consistently
      serialised by the mac_lock.
      
      Invert and rename the promiscuous flag to the more accurate
      unicast_filter, and comment that both this and multicast_hash are
      not used on EF10.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      964e6135
    • B
      sfc: Add flag for stack-owned RX MAC filters · 8803e150
      Ben Hutchings 提交于
      MAC filters inserted on request from the stack (ndo_set_rx_mode)
      should allow manual steering but not removal.  Currently we have a
      special case for Siena's all-multicast and all-unicast MAC filters,
      but on EF10 we need to allow for steering of precise MAC filters as
      well.
      
      The EFX_FILTER_FLAG_RX_STACK flag changes the behaviour of replacement
      and removal requests:
      
      - Replacement *of* a filter with this flag never clears the flag but
        does change steering and saved priority
      - Replacement *by* a filter with this flag only sets the flag but does
        not change steering
      - Removal with priority < EFX_FILTER_PRI_REQUIRED really resets RX
        steering and saved priority
      
      This could support precise MAC filtering on Siena in future.
      
      As a side-benefit, the default MAC filters are hidden from ethtool
      until they are steered.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      8803e150
    • B
      sfc: Refactor Falcon-arch filter removal · 14990a5d
      Ben Hutchings 提交于
      Move the special case for removal of default filters from
      efx_farch_filter_table_clear_entry() into a wrapper function,
      efx_farch_filter_table_remove().  Move the existence and priority
      checks into the latter and use it where appropriate.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      14990a5d
    • B
      sfc: Make most filter operations NIC-type-specific · add72477
      Ben Hutchings 提交于
      Aside from accelerated RFS, there is almost nothing that can be shared
      between the filter table implementations for the Falcon architecture
      and EF10.
      
      Move the few shared functions into efx.c and rx.c and the rest into
      farch.c.  Introduce efx_nic_type operations for the implementation and
      inline wrapper functions that call these.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      add72477
  4. 22 8月, 2013 9 次提交
    • B
      sfc: EFX_WORKAROUND_ALWAYS is really specific to Falcon-architecture · ab3b8250
      Ben Hutchings 提交于
      The workarounds that currently use EFX_WORKAROUND_ALWAYS are in
      Falcon-specific or Falcon-arch-specific code, so get rid of the
      conditions altogether.  Add/move comments as appropriate.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      ab3b8250
    • B
      sfc: Move and rename Falcon/Siena common NIC operations · 86094f7f
      Ben Hutchings 提交于
      Add efx_nic_type operations for the many efx_nic functions that need
      to be implemented different on EF10.  For now, change most of the
      existing efx_nic_*() functions into inline wrappers.  As a later step,
      we may be able to improve branch prediction for operations used on the
      fast path by copying the pointers into each queue/channel structure.
      
      Move the Falcon/Siena implementations to new file farch.c and rename
      the functions and static data to use a prefix of 'efx_farch_'.
      
      Move efx_may_push_tx_desc() to nic.h, as the EF10 TX code will also
      use it.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      86094f7f
    • B
      sfc: Refactor queue teardown sequence to allow for EF10 flush behaviour · e42c3d85
      Ben Hutchings 提交于
      Currently efx_stop_datapath() will try to flush our DMA queues (if DMA
      is enabled), then finalise software and hardware state for each queue.
      However, for EF10 we must ask the MC to finalise each queue, which
      implicitly starts flushing it, and then wait for the flush events.
      We therefore need to delegate more of this to the NIC type.
      
      Combine all the hardware operations into a new NIC-type operation
      efx_nic_type::fini_dmaq, and call this before tearing down the
      software state and buffers for all the DMA queues.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      e42c3d85
    • B
      sfc: Stop RX refill before flushing RX queues · d8aec745
      Ben Hutchings 提交于
      rx_queue::enabled guards refill, so rename it to reflect that.  Clear
      it at the start of the queue teardown process rather than waiting for
      the RX queue to be flushed.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      d8aec745
    • B
      sfc: Limit scope of a Falcon A1 IRQ workaround · 1840667a
      Ben Hutchings 提交于
      We unconditionally acknowledge legacy interrupts just before disabling
      them.  This workaround is needed on Falcon A1 but probably not on
      later chips where the legacy interrupt mechanism is different.  It was
      also originally done after the IRQ handler was removed, not before.
      Restore the original behaviour for Falcon A1 only by doing this
      acknowledgement in the efx_nic_type::fini operation.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      1840667a
    • B
      sfc: Rework IRQ enable/disable · d8291187
      Ben Hutchings 提交于
      There are many problems with the current efx_stop_interrupts() and
      efx_start_interrupts():
      
      1. On Siena, it is unsafe to disable the master IRQ enable bit
      (DRV_INT_EN_KER) while any IRQ sources are enabled.
      
      2. On EF10 there is no master IRQ enable bit, so we cannot expect to
      defer IRQs without tearing down event queues.  (Though I don't think
      we will need to keep any event queues around while the device is down,
      as we do for VFDI on Siena.)
      
      3. synchronize_irq() only waits for a running IRQ handler to finish,
      not for any propagation through IRQ controllers.  Therefore an IRQ may
      still be received and handled after efx_stop_interrupts() returns.
      IRQ handlers can then race with channel reallocation.
      
      To fix this:
      
      a. Introduce a software IRQ enable flag.  So long as this is clear,
      IRQ handlers will only acknowledge IRQs and not touch the channel
      structures.
      
      b. Define a new struct efx_msi_context as the context for MSIs.  This
      is never reallocated and is sufficient to find the software enable
      flag and the channel structure.  It also includes the channel/IRQ
      name, which was previously separated out as it must also not be
      reallocated.
      
      c. Split efx_{start,stop}_interrupts() into
      efx_{,soft_}_{enable,disable}_interrupts().  The 'soft' functions
      don't touch the hardware master enable flag (if it exists) and don't
      reinitialise or tear down channels with the keep_eventq flag set.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      d8291187
    • B
      sfc: Rename Falcon-architecture register definitions · 8b8a95a1
      Ben Hutchings 提交于
      The EF10 architecture has a very different register layout from
      previous controllers, so we'll use separate files for the two sets of
      register definitions.  Use 'farch' as an abbreviation for
      Falcon-architecture.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      8b8a95a1
    • B
      sfc: Make struct efx_special_buffer less special · caa75586
      Ben Hutchings 提交于
      On EF10, the firmware is in charge of allocating buffer table entries.
      Change struct efx_special_buffer to use a struct efx_buffer member,
      so that it can be used with efx_nic_{alloc,free}_buffer() in that
      case.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      caa75586
    • B
      sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blocking · 0d19a540
      Ben Hutchings 提交于
      Most call sites for efx_nic_alloc_buffer() are part of the probe or
      reconfiguration paths and can allocate with GFP_KERNEL.  A few others
      should use GFP_NOIO (I think).  Only one is in atomic context and
      must use the current GFP_ATOMIC.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      0d19a540
  5. 25 6月, 2013 3 次提交
  6. 18 3月, 2013 1 次提交
  7. 13 3月, 2013 1 次提交
    • B
      sfc: Only use TX push if a single descriptor is to be written · fae8563b
      Ben Hutchings 提交于
      Using TX push when notifying the NIC of multiple new descriptors in
      the ring will very occasionally cause the TX DMA engine to re-use an
      old descriptor.  This can result in a duplicated or partly duplicated
      packet (new headers with old data), or an IOMMU page fault.  This does
      not happen when the pushed descriptor is the only one written.
      
      TX push also provides little latency benefit when a packet requires
      more than one descriptor.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      fae8563b
  8. 08 3月, 2013 1 次提交
    • B
      sfc: Enable RX DMA scattering where possible · 85740cdf
      Ben Hutchings 提交于
      Enable RX DMA scattering iff an RX buffer large enough for the current
      MTU will not fit into a single page and the NIC supports DMA
      scattering for kernel-mode RX queues.
      
      On Falcon and Siena, the RX_USR_BUF_SIZE field is used as the DMA
      limit for both all RX queues with scatter enabled.  Set it to 1824,
      matching what Onload uses now.
      
      Maintain a statistic for frames truncated due to lack of descriptors
      (rx_nodesc_trunc).  This is distinct from rx_frm_trunc which may be
      incremented when scattering is disabled and implies an over-length
      frame.
      
      Whenever an MTU change causes scattering to be turned on or off,
      update filters that point to the PF queues, but leave others
      unchanged, as VF drivers assume scattering is off.
      
      Add n_frags parameters to various functions, and make them iterate:
      - efx_rx_packet()
      - efx_recycle_rx_buffers()
      - efx_rx_mk_skb()
      - efx_rx_deliver()
      
      Make efx_handle_rx_event() responsible for updating
      efx_rx_queue::removed_count.
      
      Change the RX pipeline state to a starting ring index and number of
      fragments, and make __efx_rx_packet() responsible for clearing it.
      
      Based on earlier versions by David Riddoch and Jon Cooper.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      85740cdf
  9. 01 12月, 2012 4 次提交
    • D
      sfc: Work-around flush timeout when flushes have completed · 525d9e82
      Daniel Pieczko 提交于
      We sometimes hit a "failed to flush" timeout on some TX queues, but the
      flushes have completed and the flush completion events seem to go missing.
      In this case, we can check the TX_DESC_PTR_TBL register and drain the
      queues if the flushes had finished.
      
      [bwh: Minor fixes to coding style]
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      525d9e82
    • B
      sfc: Do not initialise buffer in efx_alloc_special_buffer() · c3771a35
      Ben Hutchings 提交于
      Currently we initialise the newly allocated buffer to all-1s, which is
      important for event queues but not for descriptor queues.  And since
      we also do that in efx_nic_init_eventq(), it is completely pointless
      to do it here.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      c3771a35
    • B
      sfc: Remove confusing MMIO functions · 778cdaf6
      Ben Hutchings 提交于
      efx_writed_table() uses a step of 16 bytes but efx_readd_table() uses
      a step of 4 bytes.  Why are they different?
      
      Firstly, register access is asymmetric:
      
      - The EVQ_RPTR table and RX_INDIRECTION_TBL can (or must?) be written
        as dwords even though they have a step size of 16 bytes, unlike
        most other CSRs.
      - In general, a read of any width is valid for registers, so long as
        it does not cross register boundaries.  There is also no latching
        behaviour in the BIU, contrary to rumour.
      
      We write to the EVQ_RPTR table with efx_writed_table() but never read
      it back as it's write-only.  We write to the RX_INDIRECTION_TBL with
      efx_writed_table(), but only read it back for the register dump, where
      we use efx_reado_table() as for any other table with step size of 16.
      
      We read MC_TREG_SMEM with efx_readd_table() for the register dump, but
      normally read and write it with efx_readd() and efx_writed() using
      offsets calculated in bytes.
      
      Since these functions are trivial and have few callers, it's clearer
      to open-code them at the call sites.  While we're at it, update the
      comments on the BIU behaviour again.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      778cdaf6
    • B
      sfc: Really disable flow control while flushing · d5e8cc6c
      Ben Hutchings 提交于
      Receiving pause frames can block TX queue flushes.  Earlier changes
      work around this by reconfiguring the MAC during flushes for VFs, but
      during flushes for the PF we would only change the fc_disable counter.
      Unless the MAC is reconfigured for some other reason during the flush
      (which I would not expect to happen) this had no effect at all.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      d5e8cc6c
  10. 06 10月, 2012 1 次提交
  11. 25 8月, 2012 2 次提交
    • 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: 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
  12. 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
  13. 07 3月, 2012 3 次提交
  14. 16 2月, 2012 5 次提交