Commit Graph

103 Commits (5fc9e4d527f059a996f4725a596698fa76c0370f)

Author SHA1 Message Date
Ben Hutchings 3df95ce948 sfc: Store port number in net_device::dev_id
This exposes the port number to userland through sysfs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-06-03 03:28:26 -07:00
Ben Hutchings d42a8f464b sfc: Get port number from CS_PORT_NUM, not PCI function number
A single shared memory region used to communicate with firmware is
mapped into both PCI PFs of the SFC9020 and SFL9021.  Drivers must be
able to identify which port they are addressing in order to use the
correct sub-region.  Currently we use the PCI function number, but the
PCI address may be virtualised.  Use the CS_PORT_NUM register field
defined for just this purpose.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-06-03 03:27:56 -07:00
Ben Hutchings a4900ac9f7 sfc: Create multiple TX queues
Create a core TX queue and 2 hardware TX queues for each channel.
If separate_tx_channels is set, create equal numbers of RX and TX
channels instead.

Rewrite the channel and queue iteration macros accordingly.
Eliminate efx_channel::used_flags as redundant.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-28 12:44:44 -07:00
Ben Hutchings c28884c574 sfc: Clean up efx_nic::irq_zero_count
There is no need for this to be unsigned long; make it unsigned int.
It does need a line in kernel-doc, so add that.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-28 12:44:41 -07:00
Ben Hutchings 3d07df11c4 sfc: Add necessary parentheses to macro definitions in net_driver.h
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-28 12:44:40 -07:00
Steve Hodgson 6369545945 sfc: Handle serious errors in exactly one interrupt handler
'Fatal' errors set an interrupt flag associated with a specific event
queue; only read the syndrome vector if we see that queue's flag set
(legacy interrupts) or in the interrupt handler for that queue (MSI).

Do not ignore an interrupt if the fatal error flag is set but specific
error flags are all zero.  Even if we don't schedule a reset, we must
respect the queue mask and rearm the appropriate event queues.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-28 12:44:32 -07:00
Ben Hutchings a4b97f2054 sfc: Do not include unneeded headers
Earlier refactoring has made these inclusions unnecessary.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-03 19:12:47 -08:00
Ben Hutchings 754c653a4e sfc: Fix some incorrect or redundant comments
In particular, the comment about EVQ_RPTR_REG is based on inconsistent
preliminary hardware documentation, though the following code was
fixed long before release.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-03 19:12:47 -08:00
Ben Hutchings 4f16c07391 sfc: Replace PHY MDIO test with an 'alive' test
SFC9000-family boards do not all use MDIO PHYs, so we need a different
test for PHY aliveness.

Introduce a PHY operation test_alive().  For PHYs attached to Falcon,
use a common implementation based on the existing PHY MDIO test.
For PHYs managed through MCDI, use the appropriate MCDI request.

Change test name in ethtool from 'core mdio' to 'phy alive'.

Rename test_results::mdio to phy_alive and test_results::phy to phy_ext.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-03 19:12:44 -08:00
Steve Hodgson ff3b00a0fc sfc: Move PHY software state initialisation from init() into probe()
This prevents efx->link_advertising from being blatted during
a reset.

The phy_short_reach sysfs node is now destroyed later in the
port shutdown process, so check for STATE_RUNNING after
acquiring the rtnl_lock (just like in set_phy_flash_cfg).

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-23 19:09:04 -08:00
Ben Hutchings 906bb26c06 sfc: Update version, copyright dates, authors
This driver has been mostly rewritten since Michael Brown's initial
work, so swap the order of the authors.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:58 -08:00
Ben Hutchings 8880f4ec21 sfc: Add support for SFC9000 family (2)
This integrates support for the SFC9000 family of 10G Ethernet
controllers and LAN-on-motherboard chips, starting with the SFL9021
'Siena' and SFC9020 'Bethpage'.

Credit for this code is largely due to my colleagues at Solarflare:

   Guido Barzini
   Steve Hodgson
   Kieran Mansley
   Matthew Slattery
   Neil Turton

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:57 -08:00
Ben Hutchings c383b53729 sfc: Allow for additional checksum offload features
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:54 -08:00
Ben Hutchings 7688483568 sfc: Extend MTD driver for use with new NICs
In new NICs flash is managed by firmware and we will use high-level
operations on partitions rather than direct SPI commands.  Add support
for multiple MTD partitions per flash device and remove the direct
link between MTD and SPI devices.  Maintain a list of MTD partitions
in struct efx_nic.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:54 -08:00
Ben Hutchings c1c4f453b6 sfc: Remove static PHY data and enumerations
New NICs have firmware managing the PHY, and we will discover the PHY
capabilities at run-time.  Replace the static data with probe() and
test_name() operations.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:53 -08:00
Ben Hutchings e58f69f408 sfc: Extend loopback mode enumeration
New NICs and PHYs support a wider variety of loopback modes.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 17:23:53 -08:00
Ben Hutchings 06629f0724 sfc: Add efx_nic_type operation for identity LED control
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:31 -08:00
Ben Hutchings 0aa3fbaa3f sfc: Add efx_nic_type operation for NVRAM self-test
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:31 -08:00
Ben Hutchings 9bfc4bb1f9 sfc: Add efx_nic_type operation for register self-test
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:30 -08:00
Ben Hutchings eb9f6744cb sfc: Implement ethtool reset operation
Refactor efx_reset_down() and efx_reset_up() accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:29 -08:00
Ben Hutchings 89c758fa47 sfc: Add power-management and wake-on-LAN support
Wake-on-LAN is a stub for Falcon, but will be implemented fully for
new NICs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:29 -08:00
Ben Hutchings d3245b28ef sfc: Refactor link configuration
Refactor PHY, MAC and NIC configuration operations so that the
existing link configuration can be re-pushed with:

	efx->phy_op->reconfigure(efx);
	efx->mac_op->reconfigure(efx);

and a new configuration with:

	efx->nic_op->reconfigure_port(efx);

(plus locking and error-checking).

We have not held the link settings in software (aside from flow
control), and have relied on asking the hardware what they are.  This
is a problem because in some cases the hardware may no longer be in a
state to tell us.  In particular, if an entire multi-port board is
reset through one port, the driver bindings to other ports have no
chance to save settings before recovering.

We only actually need to keep track of the autonegotiation settings,
so add an ethtool advertising mask to struct efx_nic, initialise it
in PHY init and update it as necessary.

Remove now-unneeded uses of efx_phy_op::{get,set}_settings() and
struct ethtool_cmd.

Much of this was done by Steve Hodgson <shodgson@solarflare.com>.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:28 -08:00
Ben Hutchings ef2b90ee4d sfc: Move Falcon NIC operations to efx_nic_type
This is preparation for adding differing implementations for new NICs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 16:46:27 -08:00
Ben Hutchings c1ac403bfa sfc: Clean up RX event handling
Add 'likely' hint to test of rx_checksum_enabled.
Don't count IP fragments; the IP stack can do that.
Do count non-matching multicast packets.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-29 00:01:21 -08:00
Ben Hutchings 0228f5cdb0 sfc: Move descriptor cache base addresses to struct efx_nic_type
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:55 -08:00
Ben Hutchings daeda6309e sfc: Decouple NIC revision number from Falcon PCI revision number
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:54 -08:00
Ben Hutchings 299f8d69f3 sfc: Remove some redundant whitespace
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:53 -08:00
Steve Hodgson b895d73e98 sfc: Always start Falcon using the XMAC
The strap bits are only important on Falcon A and all production
boards using it have fixed-speed 10G PHYs.

Replace dummy MAC operations with default MAC operations.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:51 -08:00
Steve Hodgson ab86746175 sfc: Replace MDIO spinlock with mutex
We never use MDIO in atomic context, so we don't need to spin.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:51 -08:00
Steve Hodgson fdaa9aed21 sfc: Simplify PHY polling
Falcon can generate events for LASI interrupts from the PHY, but in
practice we have never implemented this in reference designs.  Instead
we have polled, inserted the appropriate events, and then handled the
events later.  This is a waste of time and code.

Instead, make PHY poll functions update the link state synchronously
and report whether it changed.  We can still make use of the LASI
registers as a shortcut on the SFT9001.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-28 23:58:50 -08:00
Ben Hutchings 8be4f3e6f7 sfc: Change MAC promiscuity and multicast hash at the same time
From: Steve Hodgson <shodgson@solarflare.com>

Currently we can set multicast hash immediately (in atomic context)
but must delay setting MAC promiscuity.  There is not that much
point in deferring one but not the other, and setting the multicast
hash on Siena will involve a firmware request.  So process them
both in efx_mac_work().

Also, set the broadcast bit in the multicast hash in
efx_set_multicast_list(), since this is required for both Falcon and
Siena.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-26 15:59:49 -08:00
Ben Hutchings 9007b9fa36 sfc: Simplify XMAC link polling
From: Steve Hodgson <shodgson@solarflare.com>

Only the XMAC on Falcon needs help from the driver to poll and reset
the MAC-PHY link (XAUI); GMII is a simple parallel bus and on later
NICs firmware takes care of the XAUI link.  Also, an XMAC interrupt
currently schedules a work item which simply clears a flag
(efx_nic::mac_up) to be checked by the regular monitor (or the next
link reconfiguration, if that is sooner).

Rename the flag to xmac_poll_required, changing its sense.  Remove the
needless indirection and just set the flag immediately.  Call
falcon_xmac_poll() directly where required.

Add a new generic operation mac_op::check_fault to check the link
outside of regular monitoring, as required during self-tests.

(Note that this leaves us with an unused work item, but we will
immediately have another use for it.)

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-26 15:59:43 -08:00
Ben Hutchings 55edc6e6ff sfc: Split MAC stats DMA initiation and completion
From: Steve Hodgson <shodgson@solarflare.com>

Currently we initiate MAC stats DMA and busy-wait for completion when
stats are requested.  We can improve on this with a periodic timer to
initiate and poll for stats, and opportunistically poll when stats are
requested.

Since efx_nic::stats_disable_count and efx_stats_{disable,enable}()
are Falcon-specific, rename them and move them accordingly.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-26 15:59:36 -08:00
Ben Hutchings 127e6e10ad sfc: Fix bugs in RX queue flushing
Avoid overrunning the hardware limit of 4 concurrent RX queue flushes.
Expand the queue flush state to support this.  Make similar changes to
TX flushing to keep the code symmetric.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-26 15:59:19 -08:00
Ben Hutchings c459302db6 sfc: Log interrupt and reset type names, not numbers
Define name tables for these enumerations in a similar way as for
loopback.  Move the loopback name table together with them.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:59:04 -08:00
Ben Hutchings eb50c0d67f sfc: Gather link state fields in struct efx_nic into new struct efx_link_state
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:53 -08:00
Ben Hutchings e775fb93a8 sfc: Move all I2C stuff into struct falcon_board
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:52 -08:00
Ben Hutchings 3759433db2 sfc: Move struct falcon_board into struct falcon_nic_data
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:48 -08:00
Ben Hutchings 278c0621fb sfc: Make board information explicitly Falcon-specific
Rename struct efx_board to struct falcon_board.

Introduce and use inline function to look up board info from struct
efx_nic, in preparation for moving it.

Move board init and fini calls into NIC probe and remove functions.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:42 -08:00
Ben Hutchings 981fc1b4b8 sfc: Rename efx_board::init_leds to init_phy and use for SFN4111T
efx_board::init_leds was introduced as a second stage of
initialisation because of the inter-dependency between the board and
PHY.  We want to move board initialisation into NIC probing, which is
too early to use MDIO, so SFN4111T initialisation also needs to be
split.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:40 -08:00
Ben Hutchings 398468ed1b sfc: Use a single blink implementation
Only some PHYs have firmware support for a LED blink mode, so we
currently blink the others in a timer function.  Since all PHYs have
simple on and off modes, we don't gain anything by using multiple
blink implementations.  Also, since we have a process context there
is no need to use a timer.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:39 -08:00
Ben Hutchings 9e0c8a5bab sfc: Remove pointless abstraction of memory BAR number (2)
Finish the job by removing the structure member.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-24 10:58:22 -08:00
Ben Hutchings 18ea024fd6 sfc: Merge efx_fc_resolve() into efx_mdio_get_pause()
efx_fc_resolve() is specific to MDIO and is not used by any other
function.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:25 -07:00
Ben Hutchings 8698a6b642 sfc: Removed kernel-doc for nonexistent member of efx_phy_operations
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:17 -07:00
Ben Hutchings 0d86ebd815 sfc: Maintain interrupt moderation values in ticks, not microseconds
This simplifies the implementation a lot.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:15 -07:00
Ben Hutchings 0484e0db7c sfc: Move shared members of struct falcon_nic_data into struct efx_nic
These will also be used with Siena NICs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:14 -07:00
Ben Hutchings 7d4cdb5af0 sfc: Merge struct efx_blinker into struct efx_board
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:08 -07:00
Ben Hutchings 63f1988419 sfc: Move all TX DMA length limiting into tx.c
Replace the duplicated logic in efx_enqueue_skb() and
efx_tx_queue_insert() with an inline function, efx_max_tx_len().

Remove the failed attempt at abstracting hardware-specifics and put
all the magic numbers in efx_max_tx_len().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:07 -07:00
Ben Hutchings 3ffeabdd2b sfc: Eliminate indirect lookups of queue size constants
Move size and mask definitions into efx.h; calculate page orders in falcon.c.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:05 -07:00
Ben Hutchings 625b451455 sfc: Move RX data FIFO thresholds out of struct efx_nic_type
Since there are now separate blocks of code to set the thresholds for
each NIC type, it is no longer useful to include them in the NIC type
description.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-24 04:27:00 -07:00