1. 22 8月, 2013 21 次提交
    • B
      sfc: Get rid of per-NIC-type phys_addr_channels and mem_map_size · b105798f
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      b105798f
    • B
    • B
      sfc: Fix race in completion handling · 369327fa
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      369327fa
    • B
      sfc: Add support for MCDI v2 · df2cd8af
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      df2cd8af
    • B
      sfc: Update MCDI protocol definitions for EF10 · f2b0befd
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      f2b0befd
    • B
      sfc: Translate MCDI error numbers received in events · 5bc283e5
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      5bc283e5
    • 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: Remove bogus call to efx_release_tx_buffers() · 501a248c
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      501a248c
    • 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: Remove efx_process_channel_now() · 514bedbc
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      514bedbc
    • 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
    • B
      sfc: Make MCDI independent of Siena · f3ad5003
      Ben Hutchings 提交于
      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: NBen Hutchings <bhutchings@solarflare.com>
      f3ad5003
    • B
      sfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion() · f073dde0
      Ben Hutchings 提交于
      This should probably be done during MCDI initialisation for any NIC.
      Change efx_mcdi_init() to return an error code.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      f073dde0
    • B
      sfc: Collect all MCDI port functions into mcdi_port.c · 43f775b2
      Ben Hutchings 提交于
      Collect together MCDI port functions from mcdi.c, mcdi_mac.c,
      mcdi_phy.c and siena.c.  Rename the 'siena' functions accordingly.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      43f775b2
    • B
      sfc: Move efx_mcdi_mac_reconfigure() to siena.c and rename · 319ec644
      Ben Hutchings 提交于
      EF10 does not include a multicast hash filter, so this function is
      specific to Siena.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      319ec644
    • B
      sfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI module · 6bff861d
      Ben Hutchings 提交于
      These implementations should work for EF10 too.  Rename them
      accordingly.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      6bff861d
  2. 21 8月, 2013 13 次提交
  3. 20 8月, 2013 6 次提交