History log of /drivers/net/ethernet/sfc/mcdi.c
Revision Date Author Comments
e283546c0465dd3026bc94f7b1a9de7f6b8969ec 16-Apr-2014 Edward Cree <ecree@solarflare.com> sfc:On MCDI timeout, issue an FLR (and mark MCDI to fail-fast)

When an MCDI command times out (whether or not we find it
completed when we poll), call efx_mcdi_abandon(), which tells
all subsequent MCDI calls to fail-fast, and queues up an FLR.

Because an FLR doesn't lead to receiving any reboot even from
the MC (unlike most other types of reset), we have to call
efx_ef10_reset_mc_allocations.
In efx_start_all(), if a reset (of any kind) is pending, we
bail out.
Without this, attempts to reconfigure (e.g. change mtu) can
cause driver/mc state inconsistency if the first MCDI call
triggers an FLR.

For similar reasons, on EF10, in
efx_reset_down(method=RESET_TYPE_MCDI_TIMEOUT), set the number
of active queues to zero before calling efx_stop_all().
And, on farch, in efx_reset_up(method=RESET_TYPE_MCDI_TIMEOUT),
set active_queues and flushes pending & outstanding to zero.

efx_mcdi_mode_{poll,event}() should not take us out of fail-fast
mode. Instead, this is done by efx_mcdi_reset() after the FLR
completes.

The new FLR reset_type RESET_TYPE_MCDI_TIMEOUT doesn't really
fit into the hierarchy of reset 'scopes' whereby efx_reset()
decides some resets subsume others. Thus, it uses separate logic.

Also, fixed up some inconsistency around RESET_TYPE_MC_BIST,
which was in the wrong place in that hierarchy.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
cd84ff4da1f46cbdc2d73366eabe9a8f818447cd 07-Mar-2014 Edward Cree <ecree@solarflare.com> sfc: Use ether_addr_copy and eth_broadcast_addr

Faster than memcpy/memset on some architectures.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3e336261f88c3fb7a9789b1e3d0259eb0c8036fd 17-Jan-2014 Jon Cooper <jcooper@solarflare.com> sfc: Change efx_mcdi_reset_port to use ENTITY_RESET MC command.

PORT_RESET MC command was NOP in the ef10 firmware hence we are using
ENTITY_RESET to make sure all resource allocations are reset.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0bcf4a645fc027d05d15e79ce48b5893cff28082 18-Oct-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Associate primary and secondary functions of controller

The primary function of an EF10 controller will share its clock
device with other functions in the same domain (which we call
secondary functions). To this end, we need to associate functions
on the same controller.

We do not control probe order, so allow primary and secondary
functions to appear in any order. Maintain global lists of all
primary functions and of unassociated secondary functions,
and a list of secondary functions on each primary function.

Use the VPD serial number to tell whether functions are part of the
same controller. VPD will not be readable by virtual functions, so
this may need to be revisited later.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
bd9a265db26cdbfe74a303111381d90e66f56877 18-Nov-2013 Jon Cooper <jcooper@solarflare.com> sfc: Add RX packet timestamping for EF10

The EF10 firmware can optionally insert RX timestamps in the packet
prefix. These only include the clock minor value. We must also
enable periodic time sync events on each event queue which provide
the high bits of the clock value.

[bwh: Combined and rebased several changes.
Added the above description and some sanity checks for inline vs
separate timestamps.
Changed efx_rx_skb_attach_timestamp() to read the packet prefix
from the skb head area.]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
8349f7f610263a2b469feb0eb07583ad0742e7ba 16-Oct-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Store flags from MC_CMD_DRV_ATTACH for later use

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
ea136ae71f392341475116a371b92cc78183c2b2 08-Oct-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Map MCDI error MC_CMD_ERR_ENOTSUP to Linux EOPNOTSUPP

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
1e0b8120b2aef503f480b0e0182d7a7304acfb3d 31-May-2013 Edward Cree <ecree@solarflare.com> sfc: Log all unexpected MCDI errors

Split each of efx_mcdi_rpc, efx_mcdi_rpc_finish, and efx_mcdi_rpc_async into
a normal and a _quiet version; made the former log MCDI errors with
netif_err (and include the raw MCDI error code), and the latter never log
them at all. Changed various callers; any where some errors are expected
(but others are not) call the _quiet version and then if necessary log the
MCDI error themselves. Said logging is done by new efx_mcdi_display_error.

Callers of efx_mcdi_rpc*_quiet functions which may want to log the error
need to ensure that their outbuf is big enough to hold an MCDI error; to
this end, they now use MCDI_DECLARE_BUF_OUT_OR_ERR, which always allocates
at least 8 bytes.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
74cd60a4d7b4f686146efd7ed211974691f0c2c1 16-Sep-2013 Jon Cooper <jcooper@solarflare.com> sfc: Add MC BISTs to ethtool offline self test on EF10

To run BISTs the MC goes down in to a special mode where it will only
respond to MCDI from the testing PF, and TX, RX and event queues are
torn down. Other PFs get a message as it goes down to tell them it's
going down.

When the other PFs get this message, they check the soft status
register to tell when the MC has rebooted after BIST mode and they can
start recovery.

[bwh: Convert the test result to 1 or -1 as for earlier NICs]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2d9955bedb18a403bde1290607d5c02cd86ae5fe 07-Oct-2013 Robert Stonehouse <rstonehouse@solarflare.com> sfc: Demote "MC Scheduler error" messages

The MC firmware is cooperatively multitasking and its scheduler will
send an event when a task yields after running for more than the
expected maximum time. This can be useful for firmware development
but does not usually indicate a serious error and does not help to
detect a lockup (there is a hardware watchdog that does that).
Change the message and reduce log level accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
6b294b8efedaa7cf7507154148e2c79766ad6f96 09-Oct-2013 Robert Stonehouse <rstonehouse@solarflare.com> sfc: Poll for MCDI completion once before timeout occurs

There is an as-yet unexplained bug that sometimes prevents (or delays)
the driver seeing the completion event for a completed MCDI request on
the SFC9120. The requested configuration change will have happened
but the driver assumes it to have failed, and this can result in
further failures. We can mitigate this by polling for completion
after unsuccessfully waiting for an event.

Fixes: 8127d661e77f ('sfc: Add support for Solarflare SFC9100 family')
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
5731d7b35e5b87157a9b9973cc2eff70c50aec58 09-Oct-2013 Robert Stonehouse <rstonehouse@solarflare.com> sfc: Refactor efx_mcdi_poll() by introducing efx_mcdi_poll_once()

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
ecb1c9cc215cb5a4390b714d8b09de637f54fa3f 07-Oct-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Only bind to EF10 functions with the LinkCtrl and Trusted flags

Although we do not yet enable multiple PFs per port, it is possible
that a board will be reconfigured to enable them while the driver has
not yet been updated to fully support this.

The most obvious problem is that multiple functions may try to set
conflicting link settings. But we will also run into trouble if the
firmware doesn't consider us fully trusted. So, abort probing unless
both the LinkCtrl and Trusted flags are set for this function.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
b2d32f03e67cc9b0ad16fc1fff87edf90f059883 20-Sep-2013 Daniel Pieczko <dpieczko@solarflare.com> sfc: Increase MCDI status timeout to 250ms

The SFC9120 MC firmware often takes longer than 20ms to reboot and
update the warm boot count in BIU_MC_SFT_STATUS_REG. A timeout of
250ms is very generous for an MC reboot.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
dfdaa95c7abc3dc7acf44b0c4aeac4c3c44966d6 18-Sep-2013 Daniel Pieczko <dpieczko@solarflare.com> sfc: Wait for MC reboot to complete before scheduling driver reset

Scheduling a reset following an MC reboot event before waiting for
reboot to complete results in a race that can lead to a state where
must_realloc_vis is false in efx_ef10_fini_dmaq() but the VIs have
been destroyed during the MC reboot.

To avoid MC errors when trying to remove VIs that do not exist, wait
for the MC reboot to complete before scheduling the reset.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
f7a6d2c4427790cc8695401576dc594fcce8fc80 30-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Update copyright banners

Update the dates for files that have been added to in 2012-2013.
Drop the 'Solarstorm' brand name that's still lingering here.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
8127d661e77f5ec410093bce411f540afa34593f 29-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Add support for Solarflare SFC9100 family

This adds support for the EF10 network controller architecture and the
SFC9100 family, starting with SFC9120 'Farmingdale', and bumps the
driver version to 4.0.

New features in the SFC9100 family include:

- Flexible allocation of internal resources to PCIe physical and virtual
functions under firmware control
- RX event merging to reduce DMA writes at high packet rates
- Integrated RX timestamping
- PIO buffers for lower TX latency
- Firmware-driven data path that supports additional offload features
and filter types
- Delivery of packets between functions and to multiple recipients,
allowing firmware to implement a vswitch
- Multiple RX flow hash (RSS) contexts with their own hash keys and
indirection tables
- 40G MAC (single port only)

...not all of which are enabled in this initial driver or the initial
firmware release.

Much of the new code is by Jon Cooper.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
4c75b43a7795671a52a002034d370ea1352f95c8 29-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Make efx_mcdi_{init,fini}() call efx_mcdi_drv_attach()

This should be done during MCDI initialisation for any NIC.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
cade715ff18440dda53e59c10c606586c92be33e 28-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> 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>
251111d9a1bd9a26e25446d876156bf265858cb5 28-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> 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>
2f4bcdcca796ca7d385e3f870e552a2d85f0a7c9 22-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Refactor efx_mcdi_rpc_start() and efx_mcdi_copyin()

Preparation for asynchronous MCDI requests.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
d36a08b4ae08566426ddb7519b869ec0cd040532 20-Jun-2013 Daniel Pieczko <dpieczko@solarflare.com> 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>
3de82b91ea604d7178925ce80ab821c968009c21 13-Jun-2013 Alexandre Rames <arames@solarflare.com> 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>
cd0ecc9a6d279c8c5c5336f576330c45f5c80939 14-Dec-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
45a3fd55acc8989ff93d469e57b123cd3702a948 28-Nov-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
369327fa65f20118571643d673b90d3700166e2d 26-Oct-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
df2cd8af097850bb3440817fdb6b08922ff4b327 19-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
f2b0befd1dd2f0b08feff8e66741d56b239af7b8 20-Aug-2013 Ben Hutchings <bhutchings@solarflare.com> 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>
5bc283e51327e249459caab1aff505000ae2beeb 08-Oct-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
8b8a95a11aa985b7f6f6df8a0ffa597e56ff8310 18-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
f3ad50034425692965a0f2becdd9c45ecb45cd66 18-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
f073dde03b3e8d11050d82f52caaf75fd924e069 18-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
43f775b2fa759a9c126a911f999f35aeb0fbbb84 18-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
6bff861dc798ed36da0cb80f0201da2fe9d9dc69 18-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
9528b9219348e0a013f4b587958a8ba9c96d7e20 14-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
c5bb0e9891ba1f7c871adc09d9ef727e1c0c1c1e 14-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
59cfc479b2c8ba344c8497d5c913b6cba2ce3755 14-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> 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>
89cc80a44b7c320e08599cb86f6aef0ead8986a1 22-Apr-2013 Ben Hutchings <bhutchings@solarflare.com> sfc: Fix naming of MTD partitions for FPGA bitfiles

efx_mcdi_get_board_cfg() uses a buffer for the firmware response that
is only large enough to hold subtypes for the originally defined set
of NVRAM partitions. Longer responses are truncated, and we may read
off the end of the buffer when copying out subtypes for additional
partitions. In particular, this can result in the MTD partition for
an FPGA bitfile being named e.g. 'eth5 sfc_fpga:00' when it should be
'eth5 sfc_fpga:01'. This means the firmware update tool (sfupdate)
can't tell which bitfile should be written to the partition.

Correct the response buffer size.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ebf98e797b4e26ad52ace1511a0b503ee60a6cd4 01-Dec-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Fix timekeeping in efx_mcdi_poll()

efx_mcdi_poll() uses get_seconds() to read the current time and to
implement a polling timeout. The use of this function was chosen
partly because it could easily be replaced in a co-sim environment
with a macro that read the simulated time.

Unfortunately the real get_seconds() returns the system time (real
time) which is subject to adjustment by e.g. ntpd. If the system time
is adjusted forward during a polled MCDI operation, the effective
timeout can be shorter than the intended 10 seconds, resulting in a
spurious failure. It is also possible for a backward adjustment to
delay detection of a areal failure.

Use jiffies instead, and change MCDI_RPC_TIMEOUT to be denominated in
jiffies. Also correct rounding of the timeout: check time > finish
(or rather time_after(time, finish)) and not time >= finish.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
876be083b669c43203c0ee8709d749896e1d8d60 01-Oct-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Reset driver's MAC stats after MC reboot seen

If the MC reboots then the stats it reports to us will have been
reset. We need to reset ours to get efx_update_diff_stat() working
properly.

(Ideally we would maintain stats across the reboot, but as this should
only happen immediately after a firmware upgrade it's not really worth
the trouble.)

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
bbec969b7f57a6ab5683145b99da869f99080e2a 11-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Fix check for failure of MC_CMD_FLUSH_RX_QUEUES

efx_mcdi_rpc_start() returns a negative value on error or zero on
success. However one caller that can't properly handle failure then
does WARN_ON(rc > 0). Change it to WARN_ON(rc < 0).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
450783747f42dfa3883920acfad4acdd93ce69af 19-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request

MCDI supports requests up to 252 bytes long, which is only enough to
pass 63 RX queue IDs to MC_CMD_FLUSH_RX_QUEUES. However a VF may have
up to 64 RX queues, and if we try to flush them all we will generate
an over-length request and BUG() in efx_mcdi_copyin(). Currently
all VF drivers limit themselves to 32 RX queues, so reducing the
limit to 63 does no harm.

Also add a BUILD_BUG_ON in efx_mcdi_flush_rxqs() so we remember to
deal with the same problem there if EFX_MAX_CHANNELS is increased.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
e3f5ec1108ee01b555d5894722884e40dbec058f 05-Jul-2011 Ben Hutchings <bhutchings@solarflare.com> sfc: Support variable-length response to MCDI GET_BOARD_CFG

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
bfeed902946a31692e7a24ed355b6d13ac37d014 07-Sep-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()

On big-endian systems the MTD partition names currently have mangled
subtype numbers and are not recognised by the firmware update tool
(sfupdate).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
7c236c43b838221e17220bcb39e8e8d8c7123713 03-Sep-2012 Stuart Hodgson <smhodgson@solarflare.com> sfc: Add support for IEEE-1588 PTP

Add PTP IEEE-1588 support and make accesible via the PHC subsystem.

This work is based on prior code by Andrew Jackson

Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com>
[bwh:
- Add byte order conversion in efx_ptp_send_times()
- Simplify conversion of PPS event times
- Add the built-in vs module check to CONFIG_SFC_PTP dependencies]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
c3cba721f1b761ca96f6fe437dec738db1069909 16-Jul-2012 Stuart Hodgson <smhodgson@solarflare.com> sfc: Allow efx_mcdi_rpc to be called in two parts

For NIC/System time synchonisation efx_mcdi_rpc needs to be split in
efx_mcdi_rpc_start and efx_mcdi_rpc_finish operations.

Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
0f1e54ae52b950ed79074ae794d027d6c97fd34e 03-Jul-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Explain why efx_mcdi_exit_assertion() ignores result of efx_mcdi_rpc()

Fix CID 113952 in Coverity report on Linux.

This is the one instance where we don't, and shouldn't, check the
return code from efx_mcdi_rpc(). It wasn't immediately obvious to me
why we didn't, so I think an explanation is in order.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
cd2d5b529cdb9bd274f3e4bc68d37d4d63b7f383 14-Feb-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Add SR-IOV back-end support for SFC9000 family

On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs),
each with an RX queue, a TX queue, an event queue and a mailbox
register. These may be assigned to up to 127 SR-IOV virtual functions
per port, with up to 64 VIs per VF.

We allocate an extra channel (IRQ and event queue only) to receive
requests from VF drivers.

There is a per-port limit of 4 concurrent RX queue flushes, and queue
flushes may be initiated by the MC in response to a Function Level
Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all
flush requests via the MC.

The RSS indirection table is shared with VFs, so the number of RX
queues used in the PF is limited to the number of VIs per VF.

This is almost entirely the work of Steve Hodgson, formerly
shodgson@solarflare.com.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
55c5e0f85dc550f03dc8a0b0097da6af3b4865c5 06-Jan-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Add hwmon driver for boards using SFC9000-family controllers

The SFC9000-family controllers have firmware to manage all board
peripherals including temperature, heat sink continuity and voltage
sensors. The firmware reports sensor alarms, which we log, and
will shut down the board if necessary.

Some users may want to monitor their boards more closely, so add an
hwmon driver that exposes all sensors reported by the firmware. Move
efx_mcdi_sensor_event() into the new file so it can share the array of
sensor labels with the hwmon driver.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
6aa9c7f625e8ce07060467051b68fc068118ee64 14-Jul-2010 Matthew Slattery <mslattery@solarflare.com> sfc: Support extraction of CAPABILITIES from GET_BOARD_CFG response.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
788ec41cc843f12e8d0eba5f2b37af18b76654a5 21-Dec-2011 Ben Hutchings <bhutchings@solarflare.com> sfc: Use new names for MC shared memory layout constants

These are defined alongside the firmware protocol in mcdi_pcol.h.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
3f713bf4dd9f7ef2a2c5e9ec124b3d992a2669db 21-Dec-2011 Ben Hutchings <bhutchings@solarflare.com> sfc: Make handling of MC reboot more reliable

When the MC reboots, either as part of a firmware upgrade or due to a
bug, it attempts to complete (with an error) any requests that were
outstanding before the reboot. Since there is an inherent race
condition in checking this, it will also write to a status word in
shared memory.

If we look at each of these separately, we may detect each reboot
twice, resulting in a spurious command failure after a firmware
upgrade or frustrating recovery from a firmware bug. Instead, if a
request completion indicates a reboot, we must poll and clear the
status word.

This bug was previously masked by use of an incorrect address for the
status word. Fix that, using the definition now included in
mcdi_pcol.h.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
05a9320f7e64b69cbf612a69b7358546519ffc30 20-Dec-2011 Ben Hutchings <bhutchings@solarflare.com> sfc: Update MCDI (firmware interface) definitions

Some commands and constants have been renamed; adjust the code
accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
18e83e4cd144e30fb38bf1f714914182c6c8bced 05-Jan-2012 Ben Hutchings <bhutchings@solarflare.com> sfc: Const-qualify static data as appropriate, partly prompted by checkpatch

Fix the following warnings:

WARNING: struct dev_pm_ops should normally be const
WARNING: static const char * array should probably be static const char * const

Similarly const-qualify struct i2c_board_info, struct i2c_algo_bit_data,
struct efx_ethtool_stat, struct efx_mtd_ops and struct siena_nvram_type_info.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
874aeea5d01cac55c160a4e503e3ddb4db030de7 13-May-2011 Jeff Kirsher <jeffrey.t.kirsher@intel.com> sfc: Move the Solarflare drivers

Moves the Solarflare drivers into drivers/net/ethernet/sfc/ and
make the necessary Kconfig and Makefile changes.

CC: Steve Hodgson <shodgson@solarflare.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>