]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
10 years agosfc: Prepare for RX scatter on EF10
Jon Cooper [Fri, 8 Mar 2013 10:18:28 +0000 (10:18 +0000)]
sfc: Prepare for RX scatter on EF10

RX DMA scatter is always enabled on EF10.  Adjust the common RX
completion handling to allow for this.

RX completion events on EF10 include the length used from a single
descriptor, not the cumulative length used.  Add a field to struct
efx_rx_queue to hold the cumulative length.

[bwh: Also fix a related comment]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Initialise IRQ moderation for all NIC types from efx_init_eventq()
Ben Hutchings [Wed, 1 May 2013 15:30:17 +0000 (16:30 +0100)]
sfc: Initialise IRQ moderation for all NIC types from efx_init_eventq()

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Allow efx_nic_type::dimension_resources to fail
Ben Hutchings [Wed, 28 Aug 2013 23:45:48 +0000 (00:45 +0100)]
sfc: Allow efx_nic_type::dimension_resources to fail

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Allow event queue initialisation to fail
Jon Cooper [Mon, 15 Apr 2013 17:51:54 +0000 (18:51 +0100)]
sfc: Allow event queue initialisation to fail

On EF10, event queue initialisation requires an MCDI request which
may return failure.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Document conditions for multicast replication vs filter replacement
Ben Hutchings [Tue, 15 Jan 2013 22:00:07 +0000 (22:00 +0000)]
sfc: Document conditions for multicast replication vs filter replacement

Add the efx_filter_is_mc_recip() function to decide whether a filter
is for a multicast recipient and can coexist with other filters with
the same match values.  Update efx_filter_insert_filter() kernel-doc
to explain the conditions for this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Implement asynchronous MCDI requests
Ben Hutchings [Tue, 27 Aug 2013 22:12:31 +0000 (23:12 +0100)]
sfc: Implement asynchronous MCDI requests

This will allow use of MCDI from the data path, in particular for
accelerated RFS.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove unnecessary use of atomic_t
Ben Hutchings [Tue, 27 Aug 2013 22:04:29 +0000 (23:04 +0100)]
sfc: Remove unnecessary use of atomic_t

We can set, get and compare-and-exchange without using atomic_t.
Change efx_mcdi_iface::state to the enum type we really wanted it to
be.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Refactor efx_mcdi_rpc_start() and efx_mcdi_copyin()
Ben Hutchings [Thu, 22 Aug 2013 21:06:09 +0000 (22:06 +0100)]
sfc: Refactor efx_mcdi_rpc_start() and efx_mcdi_copyin()

Preparation for asynchronous MCDI requests.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add support for new board sensors
Ben Hutchings [Wed, 28 Nov 2012 23:11:18 +0000 (23:11 +0000)]
sfc: Add support for new board sensors

Add support for power and current sensors, which need to be named
differently in sysfs.  Power sensors also require values to be scaled
between MCDI and sysfs, and have no minimum value.

Add definitions of the power, current, fan, and additional temperature
and voltage sensors found on SFA6902F, SFN7022F and SFN7122F.

(Includes a bug fix from Andrew Jackson.)

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Use extended MC_CMD_SENSOR_INFO and MC_CMD_READ_SENSORS
Ben Hutchings [Thu, 8 Aug 2013 10:14:20 +0000 (11:14 +0100)]
sfc: Use extended MC_CMD_SENSOR_INFO and MC_CMD_READ_SENSORS

We need to use extended requests to read and get metadata for sensors
numbered > 31.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Return an error code when a sensor is busy.
Alexandre Rames [Wed, 3 Jul 2013 08:47:34 +0000 (09:47 +0100)]
sfc: Return an error code when a sensor is busy.

[bwh: Also name this new state, though we don't expect to see it in an event]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add support for reading packet length from prefix
Ben Hutchings [Sat, 27 Apr 2013 00:55:18 +0000 (01:55 +0100)]
sfc: Add support for reading packet length from prefix

Define a flag for struct efx_rx_buffer and efx_rx_packet() that
indicates packet length must be read from the prefix.  If this
is set, read the length in __efx_rx_packet() (when the prefix
should have arrived in cache).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add TX merged completion counter
Ben Hutchings [Sat, 27 Apr 2013 00:55:21 +0000 (01:55 +0100)]
sfc: Add TX merged completion counter

Add a counter for TX merged completion events.

This is implemented in the common TX path, because the NIC event
handlers only know how many descriptors were completed, not how many
packets.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Generalise packet hash lookup to support EF10 RX prefix
Jon Cooper [Thu, 18 Oct 2012 14:49:54 +0000 (15:49 +0100)]
sfc: Generalise packet hash lookup to support EF10 RX prefix

EF10 uses an entirely different RX prefix format from Falcon-arch.
Extend struct efx_nic_type to describe this.

[bwh: Also replace the magic numbers used for the Falcon-arch RX prefix]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rename EFX_PAGE_BLOCK_SIZE to EFX_VI_PAGE_SIZE and adjust comments
Ben Hutchings [Fri, 28 Jun 2013 19:14:46 +0000 (20:14 +0100)]
sfc: Rename EFX_PAGE_BLOCK_SIZE to EFX_VI_PAGE_SIZE and adjust comments

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove early call to efx_nic_type::reconfigure_mac in efx_reset_up()
Ben Hutchings [Wed, 26 Jun 2013 23:13:07 +0000 (00:13 +0100)]
sfc: Remove early call to efx_nic_type::reconfigure_mac in efx_reset_up()

efx_reset_up() calls efx_nic_type::reconfigure_mac once directly,
then again through efx_start_all() -> efx_start_port() ->
efx->type->reconfigure_mac().

This first call is also made too early to work properly on EF10.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: use MCDI epoch flag to improve MC reboot detection in the driver
Daniel Pieczko [Thu, 20 Jun 2013 10:40:07 +0000 (11:40 +0100)]
sfc: use MCDI epoch flag to improve MC reboot detection in the driver

The Huntington MC will reject all MCDI requests after an MC reboot until it sees
one with the NOT_EPOCH flag clear.  This flag is set by default for all requests,
and then cleared on the first request after we detect that an MC reboot has
occurred.

The old MCDI_STATUS_DELAY_COUNT gave a timeout of 10ms, which was not long enough
for the driver to detect that a reboot had occurred based on the warm boot count
while calling efx_mcdi_poll_reboot() from the loop in efx_mcdi_ev_death().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add EF10 support for TX/RX DMA error events handling.
Alexandre Rames [Thu, 13 Jun 2013 10:36:15 +0000 (11:36 +0100)]
sfc: Add EF10 support for TX/RX DMA error events handling.

Also, since we handle all DMA errors in the same way, merge
RESET_TYPE_(RX|TX)_DESC_FETCH into RESET_TYPE_DMA_ERROR.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add a function pointer to abstract write of host time into NIC shared memory
Laurence Evans [Thu, 7 Mar 2013 11:46:58 +0000 (11:46 +0000)]
sfc: Add a function pointer to abstract write of host time into NIC shared memory

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: PTP MCDI requests need to initialise periph ID field
Laurence Evans [Wed, 6 Mar 2013 15:33:17 +0000 (15:33 +0000)]
sfc: PTP MCDI requests need to initialise periph ID field

This field is ignored by Siena firmware but is significant to EF10 firmware.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Delegate MAC/NIC statistic description to efx_nic_type
Ben Hutchings [Fri, 14 Dec 2012 21:52:56 +0000 (21:52 +0000)]
sfc: Delegate MAC/NIC statistic description to efx_nic_type

Various hardware statistics that are available for Siena are
unavailable or meaningless for Falcon.  Huntington adds further to the
NIC-type-specific statistics, as it has different MAC blocks from
Falcon/Siena.

All NIC types still provide most statistics by DMA, and use
little-endian byte order.

Therefore:
1. Add some general utility functions for reporting hardware statistics,
   efx_nic_describe_stats() and efx_nic_update_stats().
2. Add an efx_nic_type::describe_stats operation to get the number and
   names of statistics, implemented using efx_nic_describe_stats()
3. Change efx_nic_type::update_stats to store the core statistics
   (struct rtnl_link_stats64) or full statistics (array of u64) in a
   caller-provided buffer.  Use efx_nic_update_stats() to aid in the
   implementation.
4. Rename struct efx_ethtool_stat to struct efx_sw_stat_desc and
   EFX_ETHTOOL_NUM_STATS to EFX_ETHTOOL_SW_STAT_COUNT.
5. Remove efx_nic::mac_stats and struct efx_mac_stats.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove driver-local struct ethtool_string
Ben Hutchings [Fri, 14 Dec 2012 22:18:55 +0000 (22:18 +0000)]
sfc: Remove driver-local struct ethtool_string

It's not really helpful to pretend ethtool string arrays are
structured.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove more left-overs from Falcon GMAC support
Ben Hutchings [Fri, 14 Dec 2012 21:52:56 +0000 (21:52 +0000)]
sfc: Remove more left-overs from Falcon GMAC support

We only ever used the XMAC (10G link speed) in production.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move MTD operations into efx_nic_type
Ben Hutchings [Wed, 28 Nov 2012 04:38:14 +0000 (04:38 +0000)]
sfc: Move MTD operations into efx_nic_type

Merge the per-NIC-type MTD probe selection and struct efx_mtd_ops into
struct efx_nic_type.  Move the implementations into the appropriate
source files.

Several NVRAM functions are now only called from MTD operations which
are now implemented in the same file (falcon.c or mcdi.c).  There is no
need for them to be extern, or to be defined at all if CONFIG_SFC_MTD
is not enabled, so move them into the #ifdef CONFIG_SFC_MTD sections
in those files.

Most of the SPI-related definitions are also only used in falcon.c,
so move them there.  Put the remainder of spi.h into nic.h (which
previously included it).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move NIC-type-specific MTD partition date into separate structures
Ben Hutchings [Wed, 28 Nov 2012 04:38:14 +0000 (04:38 +0000)]
sfc: Move NIC-type-specific MTD partition date into separate structures

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Eliminate struct efx_mtd
Ben Hutchings [Wed, 28 Nov 2012 04:38:10 +0000 (04:38 +0000)]
sfc: Eliminate struct efx_mtd

Currently we use struct efx_mtd to represent a physical NVRAM device
and struct efx_mtd_partition to represent a partition on that device.
But this only really makes sense for Falcon, as we don't know or care
whether MC-managed NVRAM partitions are on one or more physical
devices.  It complicates iteration and provides little benefit.
Therefore:

- Replace the pointer to efx_mtd in mtd_info::priv with a pointer to efx_nic
- Move the falcon_spi_device pointer into the union in struct efx_mtd_partition
- Move the device name to efx_mtd_partition::dev_type_name
- Move the efx_mtd_ops pointer to efx_nic::mtd_ops
- Make efx_nic::mtd_list a list of partitions

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rename SPI stuff to show that it is Falcon-specific
Ben Hutchings [Wed, 28 Nov 2012 04:12:41 +0000 (04:12 +0000)]
sfc: Rename SPI stuff to show that it is Falcon-specific

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Cleanup Falcon-arch simple MAC filter state
Ben Hutchings [Mon, 19 Nov 2012 23:08:22 +0000 (23:08 +0000)]
sfc: Cleanup Falcon-arch simple MAC filter state

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Define and use MCDI_POPULATE_DWORD_{1,2,3,4,5,6,7}
Ben Hutchings [Wed, 10 Oct 2012 22:24:51 +0000 (23:24 +0100)]
sfc: Define and use MCDI_POPULATE_DWORD_{1,2,3,4,5,6,7}

There is only one user now, but we're about to add many more.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add flag for stack-owned RX MAC filters
Ben Hutchings [Mon, 19 Nov 2012 23:08:20 +0000 (23:08 +0000)]
sfc: Add flag for stack-owned RX MAC filters

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Refactor Falcon-arch filter removal
Ben Hutchings [Mon, 19 Nov 2012 23:08:19 +0000 (23:08 +0000)]
sfc: Refactor Falcon-arch filter removal

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Make most filter operations NIC-type-specific
Ben Hutchings [Thu, 8 Nov 2012 01:46:53 +0000 (01:46 +0000)]
sfc: Make most filter operations NIC-type-specific

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Refactor Falcon-arch search limit reset
Ben Hutchings [Fri, 26 Oct 2012 23:33:48 +0000 (00:33 +0100)]
sfc: Refactor Falcon-arch search limit reset

Currently every call to efx_farch_filter_table_clear_entry() is
shortly followed by a conditional reset of the table limits.  The new
limits (0) are not pushed to hardware until the next filter insertion.
Move both the reset and the hardware reconfiguration into
efx_farch_filter_table_clear_entry(), and add an explanatory comment.

Also, make consistent use of the term 'search limit' for the maximum
number of probes the NIC must make when searching for a filter of a
particular type.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Split Falcon-arch-specific and common filter state
Ben Hutchings [Fri, 26 Oct 2012 23:33:30 +0000 (00:33 +0100)]
sfc: Split Falcon-arch-specific and common filter state

Move the common state from struct efx_filter_state into struct efx_nic.
Rename struct efx_filter_state to efx_farch_filter_state and change
the type of efx_nic::filter_state to void *.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Extend and abstract efx_filter_spec to cover Huntington/EF10
Ben Hutchings [Fri, 26 Oct 2012 23:33:28 +0000 (00:33 +0100)]
sfc: Extend and abstract efx_filter_spec to cover Huntington/EF10

Replace type field with match_flags.  Add rss_context and match values
covering of most of what is now in the MCDI protocol.

Change some fields into bitfields so that the structure size doesn't grow
beyond 64 bytes.

Ditch the filter decoding functions as it is now easier to pick apart
the abstract structure.

Rewrite ethtool NFC rule functions to set/get filter match flags and
values directly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Name the RX drop queue ID
Ben Hutchings [Tue, 30 Oct 2012 01:01:52 +0000 (01:01 +0000)]
sfc: Name the RX drop queue ID

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rename Falcon-arch filter implementation types and functions
Ben Hutchings [Fri, 26 Oct 2012 22:55:46 +0000 (23:55 +0100)]
sfc: Rename Falcon-arch filter implementation types and functions

The filter table(s) on EF10 are managed by firmware and will need
almost entirely separate code.  Rename the types and functions used
within the existing implementation.  The current definition of struct
efx_filter_spec is really implementation-specific, so we need to keep
it.  For now, define a separate structure for the internal
representation but leave them identical.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove unused filter_flags variables and efx_farch_filter_id_flags()
Ben Hutchings [Mon, 19 Nov 2012 19:05:25 +0000 (19:05 +0000)]
sfc: Remove unused filter_flags variables and efx_farch_filter_id_flags()

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Do not assume efx_nic_type::ev_fini is idempotent
Ben Hutchings [Mon, 8 Oct 2012 17:21:51 +0000 (18:21 +0100)]
sfc: Do not assume efx_nic_type::ev_fini is idempotent

efx_fini_eventq() needs to be idempotent but EF10 firmware is
picky about queue states.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: EFX_WORKAROUND_ALWAYS is really specific to Falcon-architecture
Ben Hutchings [Fri, 5 Oct 2012 18:31:02 +0000 (19:31 +0100)]
sfc: EFX_WORKAROUND_ALWAYS is really specific to Falcon-architecture

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Get rid of per-NIC-type phys_addr_channels and mem_map_size
Ben Hutchings [Tue, 18 Sep 2012 23:56:47 +0000 (00:56 +0100)]
sfc: Get rid of per-NIC-type phys_addr_channels and mem_map_size

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Update and improve kernel-doc for efx_mcdi_state & efx_mcdi_iface
Ben Hutchings [Fri, 26 Oct 2012 16:53:11 +0000 (17:53 +0100)]
sfc: Update and improve kernel-doc for efx_mcdi_state & efx_mcdi_iface

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Fix race in completion handling
Ben Hutchings [Fri, 26 Oct 2012 16:53:12 +0000 (17:53 +0100)]
sfc: Fix race in completion handling

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add support for MCDI v2
Ben Hutchings [Tue, 18 Sep 2012 23:56:18 +0000 (00:56 +0100)]
sfc: Add support for MCDI v2

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Update MCDI protocol definitions for EF10
Ben Hutchings [Tue, 20 Aug 2013 19:35:50 +0000 (20:35 +0100)]
sfc: Update MCDI protocol definitions for EF10

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Translate MCDI error numbers received in events
Ben Hutchings [Mon, 8 Oct 2012 20:43:00 +0000 (21:43 +0100)]
sfc: Translate MCDI error numbers received in events

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move and rename Falcon/Siena common NIC operations
Ben Hutchings [Wed, 21 Aug 2013 18:51:04 +0000 (19:51 +0100)]
sfc: Move and rename Falcon/Siena common NIC operations

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Refactor queue teardown sequence to allow for EF10 flush behaviour
Ben Hutchings [Mon, 27 May 2013 15:52:54 +0000 (16:52 +0100)]
sfc: Refactor queue teardown sequence to allow for EF10 flush behaviour

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove bogus call to efx_release_tx_buffers()
Ben Hutchings [Mon, 27 May 2013 15:52:54 +0000 (16:52 +0100)]
sfc: Remove bogus call to efx_release_tx_buffers()

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Stop RX refill before flushing RX queues
Ben Hutchings [Mon, 27 May 2013 15:52:54 +0000 (16:52 +0100)]
sfc: Stop RX refill before flushing RX queues

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Limit scope of a Falcon A1 IRQ workaround
Ben Hutchings [Thu, 3 Jan 2013 23:36:57 +0000 (23:36 +0000)]
sfc: Limit scope of a Falcon A1 IRQ workaround

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rework IRQ enable/disable
Ben Hutchings [Fri, 5 Oct 2012 22:35:41 +0000 (23:35 +0100)]
sfc: Rework IRQ enable/disable

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Remove efx_process_channel_now()
Ben Hutchings [Fri, 5 Oct 2012 18:30:16 +0000 (19:30 +0100)]
sfc: Remove efx_process_channel_now()

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rename Falcon-architecture register definitions
Ben Hutchings [Tue, 18 Sep 2012 00:57:07 +0000 (01:57 +0100)]
sfc: Rename Falcon-architecture register definitions

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Make struct efx_special_buffer less special
Ben Hutchings [Tue, 18 Sep 2012 23:31:42 +0000 (00:31 +0100)]
sfc: Make struct efx_special_buffer less special

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blocking
Ben Hutchings [Tue, 18 Sep 2012 20:59:52 +0000 (21:59 +0100)]
sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blocking

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Make MCDI independent of Siena
Ben Hutchings [Tue, 18 Sep 2012 01:33:56 +0000 (02:33 +0100)]
sfc: Make MCDI independent of Siena

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion()
Ben Hutchings [Tue, 18 Sep 2012 01:33:55 +0000 (02:33 +0100)]
sfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion()

This should probably be done during MCDI initialisation for any NIC.
Change efx_mcdi_init() to return an error code.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Collect all MCDI port functions into mcdi_port.c
Ben Hutchings [Tue, 18 Sep 2012 01:33:54 +0000 (02:33 +0100)]
sfc: Collect all MCDI port functions into mcdi_port.c

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: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move efx_mcdi_mac_reconfigure() to siena.c and rename
Ben Hutchings [Mon, 8 Oct 2012 15:56:18 +0000 (16:56 +0100)]
sfc: Move efx_mcdi_mac_reconfigure() to siena.c and rename

EF10 does not include a multicast hash filter, so this function is
specific to Siena.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI module
Ben Hutchings [Tue, 18 Sep 2012 01:33:52 +0000 (02:33 +0100)]
sfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI module

These implementations should work for EF10 too.  Rename them
accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Add and use MCDI_SET_QWORD() and MCDI_SET_ARRAY_QWORD()
Ben Hutchings [Wed, 10 Oct 2012 22:20:17 +0000 (23:20 +0100)]
sfc: Add and use MCDI_SET_QWORD() and MCDI_SET_ARRAY_QWORD()

No need to keep open-coding the assignment of high and low dwords.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Ensure MCDI buffers, but not lengths, are dword aligned
Ben Hutchings [Fri, 14 Sep 2012 16:31:41 +0000 (17:31 +0100)]
sfc: Ensure MCDI buffers, but not lengths, are dword aligned

We currently require that MCDI request and response lengths are
multiples of 4 bytes, because we will copy dwords in and out of shared
memory and we want to be sure we won't read or write out of bounds.
But all we really need to know is that there is sufficient padding for
that.  Also, we should ensure that buffers are dword-aligned, as on
some architectures misaligned access will result in data corruption or
a crash.

Change the buffer type to array-of-efx_dword_t and remove the
requirement that the lengths are multiples of 4.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Use proper macros to declare and access MCDI arrays
Ben Hutchings [Fri, 14 Sep 2012 16:31:33 +0000 (17:31 +0100)]
sfc: Use proper macros to declare and access MCDI arrays

A few functions are using heap buffers; change them to use stack
buffers as we really don't need to resort to the heap for a 252
byte buffer in process context.

MC_CMD_MEMCPY is quite weird in that it can use inline data placed in
the request buffer after the array of records.  Thus there are two
variable-length arrays and we can't use the normal accessors for
the second.  So we have to use _MCDI_PTR() in efx_sriov_memcpy().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Introduce and use MCDI_CTL_SDU_LEN_MAX_V1 macro for Siena-specific code
Ben Hutchings [Tue, 20 Aug 2013 14:47:12 +0000 (15:47 +0100)]
sfc: Introduce and use MCDI_CTL_SDU_LEN_MAX_V1 macro for Siena-specific code

The MCDI version 2 protocol supports larger payloads, but will
not be implemented on Siena.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Fill out the set of MCDI accessors
Ben Hutchings [Fri, 14 Sep 2012 16:30:58 +0000 (17:30 +0100)]
sfc: Fill out the set of MCDI accessors

We need to access arrays of 16-bit words and 32-bit dwords in MCDI
buffers based on the MCDI protocol definitions.

We should also be able to read and write fields within structures,
without specifying an array index each time.  So add MCDI_FIELD()
and make MCDI_ARRAY_FIELD() use it.  Also add MCDI_SET_FIELD().

Split MCDI_ARRAY_PTR() into MCDI_ARRAY_STRUCT_PTR() and
_MCDI_ARRAY_PTR(), which are currently identical but will diverge in
later changes.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Rationalise MCDI buffer accessors
Ben Hutchings [Fri, 14 Sep 2012 16:30:44 +0000 (17:30 +0100)]
sfc: Rationalise MCDI buffer accessors

Add _MCDI_DWORD() which yields an lvalue for the given dword field
and change MCDI_DWORD(), MCDI_SET_DWORD() and MCDI_QWORD() to use it.

Fold the rather trivial MCDI_PTR2() into MCDI_PTR() and _MCDI_DWORD().

Remove MCDI_SET_DWORD2() and MCDI_QWORD2().  MCDI_DWORD2() should also
go, but it still has one user which we'll get rid of later.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Introduce and use MCDI_DECLARE_BUF macro
Ben Hutchings [Fri, 14 Sep 2012 16:30:10 +0000 (17:30 +0100)]
sfc: Introduce and use MCDI_DECLARE_BUF macro

MCDI_DECLARE_BUF declares a variable as an MCDI buffer of the
requested length, adding any necessary padding.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move more Falcon-specific code and definitions into falcon.c
Ben Hutchings [Thu, 13 Sep 2012 00:11:31 +0000 (01:11 +0100)]
sfc: Move more Falcon-specific code and definitions into falcon.c

In particular, fold in the whole of falcon_xmac.c.

Drop some entirely unused definitions.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Move details of a Falcon bug workaround out of ethtool.c
Ben Hutchings [Thu, 13 Sep 2012 00:11:25 +0000 (01:11 +0100)]
sfc: Move details of a Falcon bug workaround out of ethtool.c

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: Use efx_mcdi_mon() to find efx_mcdi_mon structure from efx_nic
Ben Hutchings [Thu, 13 Sep 2012 00:11:24 +0000 (01:11 +0100)]
sfc: Use efx_mcdi_mon() to find efx_mcdi_mon structure from efx_nic

This needs to be done before we separate MCDI from siena_nic_data.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agosfc: const-qualify source pointers for MMIO write functions
Ben Hutchings [Thu, 13 Sep 2012 00:11:23 +0000 (01:11 +0100)]
sfc: const-qualify source pointers for MMIO write functions

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agoMerge branch 'sfc-3.11'
Ben Hutchings [Wed, 21 Aug 2013 13:19:36 +0000 (14:19 +0100)]
Merge branch 'sfc-3.11'

Merge sfc fixes destined for 3.11 so we can avoid conflicts with
development for 3.12+.

10 years agosfc: Fix lookup of default RX MAC filters when steered using ethtool
Ben Hutchings [Tue, 9 Jul 2013 16:12:49 +0000 (17:12 +0100)]
sfc: Fix lookup of default RX MAC filters when steered using ethtool

commit 385904f819e3 ('sfc: Don't use
efx_filter_{build,hash,increment}() for default MAC filters') used the
wrong name to find the index of default RX MAC filters at insertion/
update time.  This could result in memory corruption and would in any
case silently fail to update the filter.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
10 years agoMerge branch 'openvswitch_vxlan'
David S. Miller [Tue, 20 Aug 2013 07:16:47 +0000 (00:16 -0700)]
Merge branch 'openvswitch_vxlan'

Pravin B Shelar says:

====================
openvswitch: VXLAN tunneling.

First four vxlan patches extends vxlan so that openvswitch
can share vxlan recv code. Rest of patches refactors vxlan
data plane so that ovs can share that code with vxlan module.
Last patch adds vxlan-vport to openvswitch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoopenvswitch: Add vxlan tunneling support.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:34 +0000 (11:23 -0700)]
openvswitch: Add vxlan tunneling support.

Following patch adds vxlan vport type for openvswitch using
vxlan api. So now there is vxlan dependency for openvswitch.

CC: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Add tx-vlan offload support.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:29 +0000 (11:23 -0700)]
vxlan: Add tx-vlan offload support.

Following patch allows transmit side vlan offload for vxlan
devices.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Improve vxlan headroom calculation.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:22 +0000 (11:23 -0700)]
vxlan: Improve vxlan headroom calculation.

Rather than having static headroom calculation, adjust headroom
according to target device.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Factor out vxlan send api.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:17 +0000 (11:23 -0700)]
vxlan: Factor out vxlan send api.

Following patch allows more code sharing between vxlan and ovs-vxlan.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Extend vxlan handlers for openvswitch.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:07 +0000 (11:23 -0700)]
vxlan: Extend vxlan handlers for openvswitch.

Following patch adds data field to vxlan socket and export
vxlan handler api.
vh->data is required to store private data per vxlan handler.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Add vxlan recv demux.
Pravin B Shelar [Mon, 19 Aug 2013 18:23:02 +0000 (11:23 -0700)]
vxlan: Add vxlan recv demux.

Once we have ovs-vxlan functionality, one UDP port can be assigned
to kernel-vxlan or ovs-vxlan port.  Therefore following patch adds
vxlan demux functionality, so that vxlan or ovs module can
register for particular port.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Restructure vxlan receive.
Pravin B Shelar [Mon, 19 Aug 2013 18:22:54 +0000 (11:22 -0700)]
vxlan: Restructure vxlan receive.

Use iptunnel_pull_header() for better code sharing.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: Restructure vxlan socket apis.
Pravin B Shelar [Mon, 19 Aug 2013 18:22:48 +0000 (11:22 -0700)]
vxlan: Restructure vxlan socket apis.

Restructure vxlan-socket management APIs so that it can be
shared between vxlan and ovs modules.
This patch does not change any functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
v6-v7:
 - get rid of zero refcnt vs from hashtable.
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: add comments
hayeswang [Fri, 16 Aug 2013 08:09:38 +0000 (16:09 +0800)]
r8152: add comments

Add comments.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: adjust tx_bottom function
hayeswang [Fri, 16 Aug 2013 08:09:37 +0000 (16:09 +0800)]
r8152: adjust tx_bottom function

Split some parts of code into another function to simplify
tx_bottom(). Use while loop to replace the goto loop.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: move some declearation of variables
hayeswang [Fri, 16 Aug 2013 08:09:36 +0000 (16:09 +0800)]
r8152: move some declearation of variables

Move some declearation of variables in rx_bottom().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: adjust some duplicated code
hayeswang [Fri, 16 Aug 2013 08:09:35 +0000 (16:09 +0800)]
r8152: adjust some duplicated code

- Use r8152_get_tx_agg for getting tx agg list
- Replace submit rx with goto submit

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: replace lockflags with flags
hayeswang [Fri, 16 Aug 2013 08:09:34 +0000 (16:09 +0800)]
r8152: replace lockflags with flags

Replace lockflags with flags.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: replace void * with struct r8152 *
hayeswang [Fri, 16 Aug 2013 08:09:33 +0000 (16:09 +0800)]
r8152: replace void * with struct r8152 *

Change the type of contex of tx_agg and rx_agg from void * to
staruc r8152 *.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agor8152: remove clearing the memory to zero for netdev priv
hayeswang [Fri, 16 Aug 2013 08:09:32 +0000 (16:09 +0800)]
r8152: remove clearing the memory to zero for netdev priv

Remove memset(tp, 0, sizeof(*tp));

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosis900: don't restart auto-negotiation each time after link resume.
Denis Kirjanov [Fri, 16 Aug 2013 07:20:07 +0000 (11:20 +0400)]
sis900: don't restart auto-negotiation each time after link resume.

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
David S. Miller [Fri, 16 Aug 2013 22:37:26 +0000 (15:37 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

10 years agoMerge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux
Linus Torvalds [Fri, 16 Aug 2013 17:00:18 +0000 (10:00 -0700)]
Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux

Pull clock controller fixes from Michael Turquette:
 "Two small fixes for the Zynq clock controller introduced in 3.11-rc1
  and another Exynos clock patch which fixes a regression that prevents
  the video pipeline from functioning on that platform"

* tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux:
  clk: exynos4: Add CLK_GET_RATE_NOCACHE flag for the Exynos4x12 ISP clocks
  clk/zynq/clkc: Add CLK_SET_RATE_PARENT flag to ethernet muxes
  clk/zynq/clkc: Add dedicated spinlock for the SWDT

10 years agoMerge tag 'pm-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Linus Torvalds [Fri, 16 Aug 2013 16:59:00 +0000 (09:59 -0700)]
Merge tag 'pm-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki:
 "The removal of delayed_work_pending() checks from kernel/power/qos.c
  done in 3.9 introduced a deadlock in pm_qos_work_fn().

  Fix from Stephen Boyd"

* tag 'pm-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / QoS: Fix workqueue deadlock when using pm_qos_update_request_timeout()

10 years agoMerge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Linus Torvalds [Fri, 16 Aug 2013 16:58:21 +0000 (09:58 -0700)]
Merge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This batch contains a few USB audio fixes, a couple of HD-audio
  quirks, various small ASoC driver fixes in addition to an ASoC core
  fix that may lead to memory corruption.

  Unfortunately slightly more volume than the previous pull request, but
  all are reasonable regression fixes"

* tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Add a fixup for Gateway LT27
  ASoC: tegra: fix Tegra30 I2S capture parameter setup
  ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam C525
  ALSA: hda - Fix missing mute controls for CX5051
  ALSA: usb-audio: fix automatic Roland/Yamaha MIDI detection
  ALSA: 6fire: make buffers DMA-able (midi)
  ALSA: 6fire: make buffers DMA-able (pcm)
  ALSA: hda - Add pinfix for LG LW25 laptop
  ASoC: cs42l52: Add new TLV for Beep Volume
  ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume
  ASoC: dapm: Fix empty list check in dapm_new_mux()
  ASoC: sgtl5000: fix buggy 'Capture Attenuate Switch' control
  ASoC: sgtl5000: prevent playback to be muted when terminating concurrent capture

10 years agoMerge tag 'usb-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Fri, 16 Aug 2013 16:57:38 +0000 (09:57 -0700)]
Merge tag 'usb-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some small USB fixes for 3.11-rc6 that have accumulated.

  Nothing huge, a EHCI fix that solves a much-reported audio USB
  problem, some usb-serial driver endian fixes and other minor fixes, a
  wireless USB oops fix, and two new quirks"

* tag 'usb-3.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: keyspan: fix null-deref at disconnect and release
  USB: mos7720: fix broken control requests
  usb: add two quirky touchscreen
  USB: ti_usb_3410_5052: fix big-endian firmware handling
  USB: adutux: fix big-endian device-type reporting
  USB: usbtmc: fix big-endian probe of Rigol devices
  USB: mos7840: fix big-endian probe
  USB-Serial: Fix error handling of usb_wwan
  wusbcore: fix kernel panic when disconnecting a wireless USB->serial device
  USB: EHCI: accept very late isochronous URBs

10 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Fri, 16 Aug 2013 16:35:29 +0000 (09:35 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) Fix SKB leak in 8139cp, from Dave Jones.

 2) Fix use of *_PAGES interfaces with mlx5 firmware, from Moshe Lazar.

 3) RCU conversion of macvtap introduced two races, fixes by Eric
    Dumazet

 4) Synchronize statistic flows in bnx2x driver to prevent corruption,
    from Dmitry Kravkov

 5) Undo optimization in IP tunneling, we were using the inner IP header
    in some cases to inherit the IP ID, but that isn't correct in some
    circumstances.  From Pravin B Shelar

 6) Use correct struct size when parsing netlink attributes in
    rtnl_bridge_getlink().  From Asbjoern Sloth Toennesen

 7) Length verifications in tun_get_user() are bogus, from Weiping Pan
    and Dan Carpenter

 8) Fix bad merge resolution during 3.11 networking development in
    openvswitch, albeit a harmless one which added some unreachable
    code.  From Jesse Gross

 9) Wrong size used in flexible array allocation in openvswitch, from
    Pravin B Shelar

10) Clear out firmware capability flags the be2net driver isn't ready to
    handle yet, from Sarveshwar Bandi

11) Revert DMA mapping error checking addition to cxgb3 driver, it's
    buggy.  From Alexey Kardashevskiy

12) Fix regression in packet scheduler rate limiting when working with a
    link layer of ATM.  From Jesper Dangaard Brouer

13) Fix several errors in TCP Cubic congestion control, in particular
    overflow errors in timestamp calculations.  From Eric Dumazet and
    Van Jacobson

14) In ipv6 routing lookups, we need to backtrack if subtree traversal
    don't result in a match.  From Hannes Frederic Sowa

15) ipgre_header() returns incorrect packet offset.  Fix from Timo Teräs

16) Get "low latency" out of the new MIB counter names.  From Eliezer
    Tamir

17) State check in ndo_dflt_fdb_del() is inverted, from Sridhar
    Samudrala

18) Handle TCP Fast Open properly in netfilter conntrack, from Yuchung
    Cheng

19) Wrong memcpy length in pcan_usb driver, from Stephane Grosjean

20) Fix dealock in TIPC, from Wang Weidong and Ding Tianhong

21) call_rcu() call to destroy SCTP transport is done too early and
    might result in an oops.  From Daniel Borkmann

22) Fix races in genetlink family dumps, from Johannes Berg

23) Flags passed into macvlan by the user need to be validated properly,
    from Michael S Tsirkin

24) Fix skge build on 32-bit, from Stephen Hemminger

25) Handle malformed TCP headers properly in xt_TCPMSS, from Pablo Neira
    Ayuso

26) Fix handling of stacked vlans in vlan_dev_real_dev(), from Nikolay
    Aleksandrov

27) Eliminate MTU calculation overflows in esp{4,6}, from Daniel
    Borkmann

28) neigh_parms need to be setup before calling the ->ndo_neigh_setup()
    method.  From Veaceslav Falico

29) Kill out-of-bounds prefetch in fib_trie, from Eric Dumazet

30) Don't dereference MLD query message if the length isn't value in the
    bridge multicast code, from Linus Lüssing

31) Fix VXLAN IGMP join regression due to an inverted check, from Cong
    Wang

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (70 commits)
  net/mlx5_core: Support MANAGE_PAGES and QUERY_PAGES firmware command changes
  tun: signedness bug in tun_get_user()
  qlcnic: Fix diagnostic interrupt test for 83xx adapters
  qlcnic: Fix beacon state return status handling
  qlcnic: Fix set driver version command
  net: tg3: fix NULL pointer dereference in tg3_io_error_detected and tg3_io_slot_reset
  net_sched: restore "linklayer atm" handling
  drivers/net/ethernet/via/via-velocity.c: update napi implementation
  Revert "cxgb3: Check and handle the dma mapping errors"
  be2net: Clear any capability flags that driver is not interested in.
  openvswitch: Reset tunnel key between input and output.
  openvswitch: Use correct type while allocating flex array.
  openvswitch: Fix bad merge resolution.
  tun: compare with 0 instead of total_len
  rtnetlink: rtnl_bridge_getlink: Call nlmsg_find_attr() with ifinfomsg header
  ethernet/arc/arc_emac - fix NAPI "work > weight" warning
  ip_tunnel: Do not use inner ip-header-id for tunnel ip-header-id.
  bnx2x: prevent crash in shutdown flow with CNIC
  bnx2x: fix PTE write access error
  bnx2x: fix memory leak in VF
  ...

10 years agoFix TLB gather virtual address range invalidation corner cases
Linus Torvalds [Thu, 15 Aug 2013 18:42:25 +0000 (11:42 -0700)]
Fix TLB gather virtual address range invalidation corner cases

Ben Tebulin reported:

 "Since v3.7.2 on two independent machines a very specific Git
  repository fails in 9/10 cases on git-fsck due to an SHA1/memory
  failures.  This only occurs on a very specific repository and can be
  reproduced stably on two independent laptops.  Git mailing list ran
  out of ideas and for me this looks like some very exotic kernel issue"

and bisected the failure to the backport of commit 53a59fc67f97 ("mm:
limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT").

That commit itself is not actually buggy, but what it does is to make it
much more likely to hit the partial TLB invalidation case, since it
introduces a new case in tlb_next_batch() that previously only ever
happened when running out of memory.

The real bug is that the TLB gather virtual memory range setup is subtly
buggered.  It was introduced in commit 597e1c3580b7 ("mm/mmu_gather:
enable tlb flush range in generic mmu_gather"), and the range handling
was already fixed at least once in commit e6c495a96ce0 ("mm: fix the TLB
range flushed when __tlb_remove_page() runs out of slots"), but that fix
was not complete.

The problem with the TLB gather virtual address range is that it isn't
set up by the initial tlb_gather_mmu() initialization (which didn't get
the TLB range information), but it is set up ad-hoc later by the
functions that actually flush the TLB.  And so any such case that forgot
to update the TLB range entries would potentially miss TLB invalidates.

Rather than try to figure out exactly which particular ad-hoc range
setup was missing (I personally suspect it's the hugetlb case in
zap_huge_pmd(), which didn't have the same logic as zap_pte_range()
did), this patch just gets rid of the problem at the source: make the
TLB range information available to tlb_gather_mmu(), and initialize it
when initializing all the other tlb gather fields.

This makes the patch larger, but conceptually much simpler.  And the end
result is much more understandable; even if you want to play games with
partial ranges when invalidating the TLB contents in chunks, now the
range information is always there, and anybody who doesn't want to
bother with it won't introduce subtle bugs.

Ben verified that this fixes his problem.

Reported-bisected-and-tested-by: Ben Tebulin <tebulin@googlemail.com>
Build-testing-by: Stephen Rothwell <sfr@canb.auug.org.au>
Build-testing-by: Richard Weinberger <richard.weinberger@gmail.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoALSA: hda - Add a fixup for Gateway LT27
Takashi Iwai [Fri, 16 Aug 2013 06:17:05 +0000 (08:17 +0200)]
ALSA: hda - Add a fixup for Gateway LT27

Gateway LT27 needs a fixup for the inverted digital mic.

Reported-by: "Nathanael D. Noblet" <nathanael@gnat.ca>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agonetlink: Eliminate kmalloc in netlink dump operation.
Pravin B Shelar [Thu, 15 Aug 2013 22:31:06 +0000 (15:31 -0700)]
netlink: Eliminate kmalloc in netlink dump operation.

Following patch stores struct netlink_callback in netlink_sock
to avoid allocating and freeing it on every netlink dump msg.
Only one dump operation is allowed for a given socket at a time
therefore we can safely convert cb pointer to cb struct inside
netlink_sock.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>