1. 27 Aug, 2013 6 commits
  2. 22 Aug, 2013 14 commits
  3. 21 Aug, 2013 20 commits
    • Ben Hutchings's avatar
      sfc: Do not assume efx_nic_type::ev_fini is idempotent · be3fc09c
      Ben Hutchings authored
      efx_fini_eventq() needs to be idempotent but EF10 firmware is
      picky about queue states.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      be3fc09c
    • Ben Hutchings's avatar
      sfc: EFX_WORKAROUND_ALWAYS is really specific to Falcon-architecture · ab3b8250
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      ab3b8250
    • Ben Hutchings's avatar
      sfc: Get rid of per-NIC-type phys_addr_channels and mem_map_size · b105798f
      Ben Hutchings authored
      EF10 functions don't have a fixed BAR size, and the minimum is not
      large enough for all the queues we might want to allocate.  We have to
      find out the BAR size at run-time, and therefore phys_addr_channels
      and mem_map_size cannot be defined per-NIC-type.
      
      Change efx_nic_type::mem_map_size to a function pointer which is
      called to find the wanted memory map size (before probe).
      
      Replace efx_nic_type::phys_addr_channels with efx_nic::max_channels,
      to be initialised by the probe function.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      b105798f
    • Ben Hutchings's avatar
    • Ben Hutchings's avatar
      sfc: Fix race in completion handling · 369327fa
      Ben Hutchings authored
      When we poll for MCDI request completion, we don't hold the interface
      lock while setting the response fields in struct efx_mcdi_iface.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      369327fa
    • Ben Hutchings's avatar
      sfc: Add support for MCDI v2 · df2cd8af
      Ben Hutchings authored
      MCDI v2 adds a second header dword with wider command and length
      fields.  It also defines extra error codes.
      
      Change the fallback error number for unknown MCDI error codes from EIO
      to EPROTO.  EIO is treated as indicating the MCDI transport has failed
      and we need to reset the function, which is rather drastic.
      
      v2 error codes and lengths don't fit into completion events, so for a
      v2-capable transport, always read the response header rather then
      using the event fields.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      df2cd8af
    • Ben Hutchings's avatar
      sfc: Update MCDI protocol definitions for EF10 · f2b0befd
      Ben Hutchings authored
      EF10 controllers do not have shared memory for communication with the
      MC; instead it reads requests and writes responses in host memory,
      which allows for longer messages.  It is also responsible for all
      datapath control operations and hardware resource allocation, which
      requires a large number of new commands and adds more possible error
      cases.  MCDI v2 extends the message header to support this.
      
      Update the MCDI protocol definition header to include v2 lengths,
      errors and messages, and a few definitions specific to the
      SFC9100 family (codenames Farmingdale and Huntington) which is
      the first generation of EF10.
      
      Some messages have been extended, so adjust the code accordingly:
      - The request for MC_CMD_DRV_ATTACH now includes a datapath firmware
        ID.  This is ignored by Siena but we should fill it in anyway,
        initially always specifying low-latency datapath.
      - The response for MC_CMD_GET_LOOPBACK_MODES now includes a 40G
        field.  Accept shorter responses that don't include it.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      f2b0befd
    • Ben Hutchings's avatar
      sfc: Translate MCDI error numbers received in events · 5bc283e5
      Ben Hutchings authored
      Currently we only translate error codes in efx_mcdi_poll(), but we
      also need to do so in efx_mcdi_ev_cpl().
      
      The reason we didn't notice before is that the MC firmware error codes
      are mostly taken from Unix/Linux and no translation is necessary on
      most architectures.  Make sure we notice any future failure by
      changing the sign of resprc (matching the kernel convention) and BUG
      if it's ever positive at command completion.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      5bc283e5
    • Ben Hutchings's avatar
      sfc: Move and rename Falcon/Siena common NIC operations · 86094f7f
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      86094f7f
    • Ben Hutchings's avatar
      sfc: Refactor queue teardown sequence to allow for EF10 flush behaviour · e42c3d85
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      e42c3d85
    • Ben Hutchings's avatar
      sfc: Remove bogus call to efx_release_tx_buffers() · 501a248c
      Ben Hutchings authored
      efx_unregister_netdev() should not call efx_release_tx_buffers()
      directly, as it is already done when closing the device:
      efx_net_stop() -> efx_stop_all() -> efx_stop_datapath() ->
      efx_fini_tx_queue() -> efx_release_tx_buffers().
      
      (This was presumably a workaround for a race between efx_stop_all()
      and the data path that has since been properly fixed.)
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      501a248c
    • Ben Hutchings's avatar
      sfc: Stop RX refill before flushing RX queues · d8aec745
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      d8aec745
    • Ben Hutchings's avatar
      sfc: Limit scope of a Falcon A1 IRQ workaround · 1840667a
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      1840667a
    • Ben Hutchings's avatar
      sfc: Rework IRQ enable/disable · d8291187
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      d8291187
    • Ben Hutchings's avatar
      sfc: Remove efx_process_channel_now() · 514bedbc
      Ben Hutchings authored
      efx_process_channel_now() is unneeded since self-tests can rely on
      normal NAPI polling.  Remove it and all calls to it.
      
      efx_channel::work_pending and efx_channel_processed() are also
      unneeded (the latter being the same as efx_nic_eventq_read_ack()).
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      514bedbc
    • Ben Hutchings's avatar
      sfc: Rename Falcon-architecture register definitions · 8b8a95a1
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      8b8a95a1
    • Ben Hutchings's avatar
      sfc: Make struct efx_special_buffer less special · caa75586
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      caa75586
    • Ben Hutchings's avatar
      sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blocking · 0d19a540
      Ben Hutchings authored
      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: default avatarBen Hutchings <bhutchings@solarflare.com>
      0d19a540
    • Ben Hutchings's avatar
      sfc: Make MCDI independent of Siena · f3ad5003
      Ben Hutchings authored
      Move the lowest layer (transport) of the current MCDI code to
      per-NIC-type operations.
      
      Introduce a new structure and efx_nic member for MCDI-specific data.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      f3ad5003
    • Ben Hutchings's avatar
      sfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion() · f073dde0
      Ben Hutchings authored
      This should probably be done during MCDI initialisation for any NIC.
      Change efx_mcdi_init() to return an error code.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      f073dde0