Commit graph

332 commits

Author SHA1 Message Date
David S. Miller
1ef68ec462 Merge branch 'sfc-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc
Ben Hutchings says:

====================
Some bug fixes and future-proofing for the recently added SFC9120
support:

1. Minimal support for the 40G configuration.
2. Disable the incomplete PTP/hardware timestamping support.
3. Reset MAC stats properly after a firmware upgrade.
4. Re-check the datapath firmware capabilities after the controller is
reset.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-16 21:43:54 -04:00
Ben Hutchings
a915ccc9f2 sfc: Reinitialise and re-validate datapath caps after MC reboot
After an MC reboot, the datapath may be running a different firmware
variant and have different capabilities.  It is critical that we know
the current capabilities so that we can pass valid flags to
MC_CMD_INIT_EVQ.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-11 15:29:53 +01:00
Ben Hutchings
e5a2538a48 sfc: Clean up validation of datapath capabilities
Rename efx_ef10_init_capabilities() to the more specific
efx_ef10_init_datapath_caps().

Stop accepting short responses to MC_CMD_GET_CAPABILITIES; we
don't need to support pre-production firmware.

Move the check for RX prefix support from efx_ef10_probe() into
efx_ef10_init_datapath_caps() and use consistent error messages
for missing TSO support and missing RX prefix support.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-11 15:29:52 +01:00
Ben Hutchings
869070c530 sfc: Reset derived rx_bad_bytes statistic when EF10 MC is rebooted
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.

(This is a re-run of commit 876be083b6 'sfc: Reset driver's
MAC stats after MC reboot seen'.)

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-11 15:29:51 +01:00
Ben Hutchings
8b59f017e4 sfc: Disable PTP on EF10 until we're ready to handle inline RX timestamps
Unlike Siena where timestamping is provided by a peripheral, EF10
delivers RX timestamps in the packet prefix.  However the driver
doesn't yet support this.

We are also creating a PHC device for each EF10 function, even though
the clock is really shared between all of them.

Disable hardware PTP/timestamping support until it's complete.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-11 15:28:27 +01:00
Ben Hutchings
9a12a30627 sfc: Minimal support for 40G link speed
Accept and handle 40G link events.

Accept ethtool link settings of speed == 40000 && duplex, and set the
appropriate MCDI PHY capability.

This does not include reporting of 40G media types, as those have not
yet been assigned numbers in the MCDI protocol.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-05 22:32:57 +01:00
Dan Carpenter
42a5a5c128 sfc: check for allocation failure
It upsets static analyzers when we don't check for allocation failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-04 13:07:47 -04:00
David S. Miller
ae5dbf1ad8 Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next
Ben Hutchings says:

====================
1. A little more refactoring.
2. Remove the unnecessary use of atomic_t that you pointed out.
3. Add support for starting or queueing firmware requests from atomic
context.
4. Add hwmon support for additional sensors found on some new boards.
5. Add support for the EF10 controller architecture, the SFC9100 family
and specifically the SFC9120 controller.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-31 22:24:24 -04:00
Joe Perches
ede23fa816 drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent
__GFP_ZERO is an uncommon flag and perhaps is better
not used.  static inline dma_zalloc_coherent exists
so convert the uses of dma_alloc_coherent with __GFP_ZERO
to the more common kernel style with zalloc.

Remove memset from the static inline dma_zalloc_coherent
and add just one use of __GFP_ZERO instead.

Trivially reduces the size of the existing uses of
dma_zalloc_coherent.

Realign arguments as appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-29 21:55:23 -04:00
Ben Hutchings
f7a6d2c442 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>
2013-08-29 23:34:51 +01:00
Ben Hutchings
8127d661e7 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>
2013-08-29 19:19:29 +01:00
Ben Hutchings
4c75b43a77 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>
2013-08-29 19:06:34 +01:00
Matthew Slattery
bedca866f8 sfc: Allocate NVRAM partition ID range for PHY images
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:17 +01:00
Ben Hutchings
9c51716512 sfc: Add EF10 register and structure definitions
Also update comments and assertions in io.h:
- EF10 does not have a general BIU collector and does not have the
  bug affecting TIMER_COMMAND_REG[0] on Falcon/Siena
- The WPTR field moved within RX_DESC_UPD_REG and TX_DESC_UPD_REG.
  Adjust efx_writed_page() accordingly

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:16 +01:00
Ben Hutchings
ba8977bdb2 sfc: Extend struct efx_tx_buffer to allow pushing option descriptors
The TX path firmware for EF10 supports 'option descriptors' to control
offloads and various other features.  Add a flag and field for these
in struct efx_tx_buffer, and don't treat them as DMA descriptors on
completion.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:14 +01:00
Alexandre Rames
3881d8ab06 sfc: Use a global count of active queues instead of pending drains
On EF10, the firmware will initiate a queue flush in certain
error cases.  We need to accept that flush events might appear
at any time after a queue has been initialised, not just when
we try to flush them.

We can handle Falcon-architecture in just the same way.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:13 +01:00
Jon Cooper
e8c68c0a09 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>
2013-08-29 18:12:12 +01:00
Ben Hutchings
15acb1cea5 sfc: Initialise IRQ moderation for all NIC types from efx_init_eventq()
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:11 +01:00
Ben Hutchings
c15eed220f sfc: Allow efx_nic_type::dimension_resources to fail
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:09 +01:00
Jon Cooper
261e4d96b4 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>
2013-08-29 18:12:08 +01:00
Ben Hutchings
b883d0bd4a 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>
2013-08-29 18:12:07 +01:00
Ben Hutchings
cade715ff1 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>
2013-08-29 18:12:06 +01:00
Ben Hutchings
251111d9a1 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>
2013-08-29 18:12:04 +01:00
Ben Hutchings
2f4bcdcca7 sfc: Refactor efx_mcdi_rpc_start() and efx_mcdi_copyin()
Preparation for asynchronous MCDI requests.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29 18:12:03 +01:00
Ben Hutchings
38589cdcd0 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>
2013-08-29 18:11:58 +01:00
Ben Hutchings
d4fbdcfe93 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>
2013-08-27 22:29:56 +01:00
Alexandre Rames
8c4e720f18 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>
2013-08-27 22:29:48 +01:00
Ben Hutchings
3dced740c2 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>
2013-08-27 22:29:07 +01:00
Ben Hutchings
02e121650b 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>
2013-08-27 22:28:47 +01:00
Jon Cooper
43a3739d55 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>
2013-08-27 22:28:24 +01:00
Ben Hutchings
64a27752dc sfc: Rename EFX_PAGE_BLOCK_SIZE to EFX_VI_PAGE_SIZE and adjust comments
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27 22:28:14 +01:00
Ben Hutchings
ba388fdd08 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>
2013-08-27 22:28:02 +01:00
Daniel Pieczko
d36a08b4ae 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>
2013-08-27 22:27:57 +01:00
Alexandre Rames
3de82b91ea 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>
2013-08-27 22:27:10 +01:00
Laurence Evans
977a5d5d32 sfc: Add a function pointer to abstract write of host time into NIC shared memory
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27 22:27:02 +01:00
Laurence Evans
c1d828bdca 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>
2013-08-27 22:26:15 +01:00
Ben Hutchings
cd0ecc9a6d 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>
2013-08-27 22:25:55 +01:00
Ben Hutchings
b681e57c38 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>
2013-08-27 22:25:42 +01:00
Ben Hutchings
e51361249b 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>
2013-08-27 22:25:29 +01:00
Ben Hutchings
45a3fd55ac 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>
2013-08-27 22:25:21 +01:00
Ben Hutchings
141d748e70 sfc: Move NIC-type-specific MTD partition date into separate structures
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-22 19:26:06 +01:00
Ben Hutchings
b766630b35 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>
2013-08-22 19:26:04 +01:00
Ben Hutchings
ecd0a6f0f2 sfc: Rename SPI stuff to show that it is Falcon-specific
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-22 19:26:03 +01:00
Ben Hutchings
964e61355e 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>
2013-08-22 19:26:02 +01:00
Ben Hutchings
f5253d9256 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>
2013-08-22 19:26:01 +01:00
Ben Hutchings
8803e15042 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>
2013-08-22 19:25:59 +01:00
Ben Hutchings
14990a5d66 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>
2013-08-22 19:25:58 +01:00
Ben Hutchings
add7247718 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>
2013-08-22 19:25:57 +01:00
Ben Hutchings
9a0a943321 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>
2013-08-22 19:25:56 +01:00
Ben Hutchings
6d661cec79 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>
2013-08-22 19:25:54 +01:00