Commit graph

77 commits

Author SHA1 Message Date
Ben Hutchings
8b8a95a11a 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>
2013-08-21 19:44:20 +01:00
Ben Hutchings
0d19a540be 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>
2013-08-21 19:43:47 +01:00
Ben Hutchings
f3ad500344 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>
2013-08-21 19:43:27 +01:00
Ben Hutchings
f073dde03b 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>
2013-08-21 19:43:09 +01:00
Ben Hutchings
43f775b2fa 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>
2013-08-21 19:43:03 +01:00
Ben Hutchings
319ec6444d 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>
2013-08-21 19:37:52 +01:00
Ben Hutchings
6bff861dc7 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>
2013-08-21 19:35:41 +01:00
Ben Hutchings
6602041b83 sfc: Store port number in private data, not net_device::dev_id
We should not use net_device::dev_id to indicate the port number, as
this affects the way the local part of IPv6 addresses is normally
generated.

This field was intended for use where multiple devices may share a
single assigned MAC address and need to have different IPv6 addresses.
Siena's two ports each have their own MAC addresses.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-06-12 03:15:02 -07:00
Ben Hutchings
85740cdf0b sfc: Enable RX DMA scattering where possible
Enable RX DMA scattering iff an RX buffer large enough for the current
MTU will not fit into a single page and the NIC supports DMA
scattering for kernel-mode RX queues.

On Falcon and Siena, the RX_USR_BUF_SIZE field is used as the DMA
limit for both all RX queues with scatter enabled.  Set it to 1824,
matching what Onload uses now.

Maintain a statistic for frames truncated due to lack of descriptors
(rx_nodesc_trunc).  This is distinct from rx_frm_trunc which may be
incremented when scattering is disabled and implies an over-length
frame.

Whenever an MTU change causes scattering to be turned on or off,
update filters that point to the PF queues, but leave others
unchanged, as VF drivers assume scattering is off.

Add n_frags parameters to various functions, and make them iterate:
- efx_rx_packet()
- efx_recycle_rx_buffers()
- efx_rx_mk_skb()
- efx_rx_deliver()

Make efx_handle_rx_event() responsible for updating
efx_rx_queue::removed_count.

Change the RX pipeline state to a starting ring index and number of
fragments, and make __efx_rx_packet() responsible for clearing it.

Based on earlier versions by David Riddoch and Jon Cooper.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-03-07 20:22:12 +00:00
Alexandre Rames
626950db84 sfc: Add AER and EEH support for Siena
The Linux side of EEH is triggered by MMIO reads, but this
driver's data path does not issue any MMIO reads (except in
legacy interrupt mode).  Therefore add a monitor function
to poll EEH periodically.

When preparing to reset the device based on our own error
detection, also poll EEH and defer to its recovery mechanism
if appropriate.

[bwh: Use a separate condition for the initial link poll; fix some
 style errors]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-03-07 20:22:04 +00:00
Ben Hutchings
ef492f11ef sfc: Correctly initialise reset_method in siena_test_chip()
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01 01:55:27 +00:00
Ben Hutchings
d5e8cc6c94 sfc: Really disable flow control while flushing
Receiving pause frames can block TX queue flushes.  Earlier changes
work around this by reconfiguring the MAC during flushes for VFs, but
during flushes for the PF we would only change the fc_disable counter.
Unless the MAC is reconfigured for some other reason during the flush
(which I would not expect to happen) this had no effect at all.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01 00:26:09 +00:00
Stuart Hodgson
7c236c43b8 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>
2012-09-19 02:54:12 +01:00
Ben Hutchings
b7f514af7d sfc: Fix interface statistics running backward
Some interface statistics are computed in such a way that they can
sometimes decrease (and even underflow).  Since the computed value
will never be greater than the true value, we fix this by only storing
the computed value when it increases.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-07-17 16:12:34 +01:00
Ben Hutchings
d4f2cecce1 sfc: Disable VF queues during register self-test
Currently VF queues and drivers may remain active during this test.
This could cause memory corruption or spurious test failures.
Therefore we reset the port/function before running these tests on
Siena.

On Falcon this doesn't work: we have to do some additional
initialisation before some blocks will work again.  So refactor the
reset/register-test sequence into an efx_nic_type method so
efx_selftest() doesn't have to consider such quirks.

In the process, fix another minor bug: Siena does not have an
'invisible' reset and the self-test currently fails to push the PHY
configuration after resetting.  Passing RESET_TYPE_ALL to
efx_reset_{down,up}() fixes this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-07-17 16:12:33 +01:00
Ben Hutchings
bdca71ede7 sfc: Remove redundant function efx_nic_has_mc()
This function is now used in only one place, where it always returns
true.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-03-06 18:14:13 +00:00
Ben Hutchings
cd2d5b529c 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>
2012-02-16 00:25:13 +00:00
Ben Hutchings
28e47c498a sfc: Allocate SRAM between buffer table and descriptor caches at init time
Each port has a block of 64-bit SRAM that is divided between buffer
table and descriptor cache regions at initialisation time.  Currently
we use a fixed allocation, but it needs to be changed to support
larger numbers of queues.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16 00:25:12 +00:00
Ben Hutchings
55c5e0f85d 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>
2012-01-27 00:10:53 +00:00
Ben Hutchings
cc180b69c0 sfc: Correct interrupt timer quantum for Siena (normal and turbo mode)
We currently assume that the timer quantum for Siena is 5 us, the same
as for Falcon.  This is not correct; timer ticks are generated on a
rota which takes a minimum of 768 cycles (each event delivery or other
timer change will delay it by 3 cycles).  The timer quantum should be
6.144 or 3.072 us depending on whether turbo mode is active.

Replace EFX_IRQ_MOD_RESOLUTION with a timer_quantum_ns field in struct
efx_nic, initialised by the efx_nic_type::probe function.

While we're at it, replace EFX_IRQ_MOD_MAX with a timer_period_max
field in struct efx_nic_type.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27 00:10:50 +00:00
Matthew Slattery
6aa9c7f625 sfc: Support extraction of CAPABILITIES from GET_BOARD_CFG response.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27 00:10:49 +00:00
Ben Hutchings
30b81cda95 sfc: Remove efx_nic_type::push_multicast_hash operation
Both implementations of efx_nic_type::reconfigure_mac operation
push the multicast hash filter to the hardware.  It is therefore
redundant to call efx_nic_type::push_multicast_hash as well.

efx_mcdi_mac_reconfigure() also uses this operation, but the
implementation for Siena just uses MCDI anyway.  Merge that into
efx_mcdi_mac_reconfigure().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27 00:10:48 +00:00
Ben Hutchings
710b208dc2 sfc: Merge efx_mac_operations into efx_nic_type
No NICs need to switch efx_mac_operations at run-time, and the MAC
operations are fairly closely bound to NIC types.

Move efx_mac_operations::reconfigure to efx_nic_type::reconfigure_mac
and efx_mac_operations::check_fault fo efx_nic_type::check_mac_fault.
Change callers to call through efx->type or directly if the NIC type
is known.

Remove efx_mac_operations::update_stats.  The implementations for
Falcon used to fetch MAC statistics synchronously and this was used by
efx_register_netdev() to clear statistics after running self-tests.
However, it now only converts statistics that have already been
fetched (and that only for Falcon), and the call from
efx_register_netdev() has no effect.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27 00:10:46 +00:00
Rusty Russell
3db1cd5c05 net: fix assignment of 0/1 to bool variables.
DaveM said:
   Please, this kind of stuff rots forever and not using bool properly
   drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

	@@
	bool b;
	@@
	-b = 0
	+b = false
	@@
	bool b;
	@@
	-b = 1
	+b = true

I merely installed coccinelle, read the documentation and took credit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-12-19 22:27:29 -05:00
David S. Miller
8decf86879 Merge branch 'master' of github.com:davem330/net
Conflicts:
	MAINTAINERS
	drivers/net/Kconfig
	drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
	drivers/net/ethernet/broadcom/tg3.c
	drivers/net/wireless/iwlwifi/iwl-pci.c
	drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
	drivers/net/wireless/rt2x00/rt2800usb.c
	drivers/net/wireless/wl12xx/main.c
2011-09-22 03:23:13 -04:00
Ben Hutchings
9e393b3060 sfc: Validate IRQ moderation parameters in efx_init_irq_moderation()
Add a range check, and move the check that RX and TX are consistent
from efx_ethtool_set_coalesce().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16 16:50:36 -04:00
Jeff Kirsher
874aeea5d0 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>
2011-08-11 02:33:50 -07:00
Renamed from drivers/net/sfc/siena.c (Browse further)