This patch makes sfc invoke the GRO hooks instead of LRO. As
GRO has a compatible external interface to LRO this is a very
straightforward replacement.
Everything should appear identical to the user except that the
offload is now controlled by the GRO ethtool option instead of
LRO. I've kept the lro module parameter as is since that's for
compatibility only.
I have eliminated efx_rx_mk_skb as the GRO layer can take care
of all packets regardless of whether GRO is enabled or not.
So the only case where we don't call GRO is if the packet checksum
is absent. This is to keep the behaviour changes of the patch to
a minimum.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Following the removal of the unused struct net_device * parameter from
the NAPI functions named *netif_rx_* in commit 908a7a1, they are
exactly equivalent to the corresponding *napi_* functions and are
therefore redundant.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Only the SFX7101 requires software power control. This was
incorrectly being applied to the SFT9001 rev A as well.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
pci_disable_device() disables many features, like MSI-X, which we
never reenable in efx_reset(). Further, calls to pci_enable_device()
and pci_disable_device() must be matched since the nesting count was
introduced, so switch to using pci_clear_master() instead.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
When we removed the network device argument from several
NAPI interfaces in 908a7a16b8
("net: Remove unused netdev arg from some NAPI interfaces.")
several drivers now started getting unused variable warnings.
This fixes those up.
Signed-off-by: David S. Miller <davem@davemloft.net>
When AN is enabled and the link is down the speed/duplex control bits
will not be meaningful. Use the advertising bits instead, and mask
them with the LPA bits if and only if AN is complete (as before).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This should reduce user confusion and may also aid recovery (ioctls
will still be available).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The SFT9001 firmware implements cable diagnostics; run those and
include their results in a self-test. In case of a cable fault, do
not fail the self-test as a whole; only faults in the NIC should cause
that.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pass in ethtool test flags to determine which tests to run.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
When the napi api was changed to separate its 1:1 binding to the net_device
struct, the netif_rx_[prep|schedule|complete] api failed to remove the now
vestigual net_device structure parameter. This patch cleans up that api by
properly removing it..
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Currently efx_mtd_rename() can race with the probe() and remove()
functions.
Move probe() before device registration and remove() after
unregistration. Move initialisation/update of all names based on the
netdev name into a new function and call it under the RTNL immediately
after registration.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Currently the mtd field is not initialised early enough.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
From: Steve Hodgson <shodgson@solarflare.com>
efx_pci_probe_main() can return success despite a reset being scheduled.
Catch this and retry or abort probe depending on the reset type.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Some of the PHY type names are overly generic. Change them to include
the model numbers of the PHYs they represent.
Correct the model number reference at the top of xfp_phy.c.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ethtool must contend with the MTD driver for the SPI bus lock, which
may carry out long operations such as flash erase. Allow it to be
interrupted while waiting.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Our ethtool self-test result names each begin with a component name. For
some results this is "port0", which is not very meaningful. Change that
to "rx" or "phy" as appropriate.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Add support code for the SFN4111T 100/1000/10GBASE-T reference design,
based in part on the existing code for the SFE4001.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Add type codes for the new PHY and rename the SFX7101 type code.
Add definition of clause 22 extension MMD.
Adapt the 10Xpress SFX7101 code to support the SFT9001 as well.
Clean up register definitions.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
From: Steve Hodgson <shodgson@solarflare.com>
MAC, PHY and board events may be separately enabled and signalled.
Our current arrangement of chaining the polling functions can result
in events being missed. Change them to be more independent.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Add infrastructure for auto-negotiation of speed, duplex and flow
control.
When using 10Xpress, auto-negotiate flow control. While we're
at it, clean up the code to warn when partner is not 10GBASE-T
capable.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The SFC4000 has a separate MAC for use at sub-10G speeds. Introduce
an efx_mac_operations structure with implementations for the two MACs.
Switch between the MACs as necessary.
PHY settings are independent of the MAC, so add get_settings() and
set_settings() to efx_phy_operations. Also add macs field to indicate
which MACs the PHY is connected to.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
We often want to set or clear a flag in an MDIO register, but avoid
writing if no change is required since this can have side-effects.
Encapsulate this in a function, mdio_clause45_set_flag().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Remove kluge for development boards with unspecified board type.
Remove assumption of contiguous board type code assignments.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Combine DEVS0 and DEVS1 registers into a 32-bit mask instead of
reading just DEVS0.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Replace efx_nic::link_options bitfield with link_speed (speed in
Mbit/s) and link_fd (full duplex flag).
Remove broken auto-negotiation functions.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The loopback self-test checks that IP packets with incorrect checksums
are not altered when sent on a queue with checksum generation off.
These should not contribute to RX error statistics.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Change "channel" to "chan".
Shorten PHY loopback names.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Allocate IRQs with the name format <device>[-<type>]-<number> so that
future versions of irqbalanced understand what we're doing.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
In a bidirectional forwarding test, we find that the best performance
is achieved by sending the TX completion interrupts from one NIC to a
CPU which shares an L2 cache with RX completion interrupts from the
other NIC. To facilitate this, add an option (through a module
parameter) to create separate channels for RX and TX completion with
separate IRQs when MSI-X is available.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This is needed for recovery in case a PHY firmware upgrade is aborted.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The SFC4000 has strap pins indicating the presence of SPI flash and/or
EEPROM. These pins are also used for GPIO, and in some cases they may
be read wrongly at reset. However, on production boards it must boot
from one or the other device, so we can assume the boot device is
present and read the board config from there.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Make falcon_spi_wait() ignore the write timer - it is only relevant to
write commands, it only works for the device that contains VPD, and it
might not be initialised properly at all.
Rename falcon_spi_fast_wait() to falcon_spi_wait_write(), reflecting
its use, and make it wait up to 10 ms (not 1 ms) since buffered writes
to EEPROM may take this long to complete.
Make both wait functions sleep instead of busy-waiting.
Replace wait for command completion at top of falcon_spi_cmd() with a
single poll; no command should be running when the function starts.
Correct some comments.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Each reset is serialised by the rtnl_lock anyway, so there's no win
per-NIC.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
A value of 0 means indefinite repetition (until interrupted).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This was only ever needed for an FPGA version of Falcon.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Set dummy monitor method for unrecognised boards.
Clean up board resources if efx_pci_probe_main() fails after board has
been initialised.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Convert driver to new net_device_ops. Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Randy Dunlap found that SFC_MTD was selected when sfc was built-in and
the MTD core was a module. Don't allow that combination.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
In order for the network device ops get_stats call to be immutable, the handling
of the default internal network device stats block has to be changed. Add a new
helper function which replaces the old use of internal_get_stats.
Note: change return code to make it clear that the caller should not
go changing the returned statistics.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The TX watchdog should trigger a reset, but a temperature/power alarm
should not as this is unlikely to solve the problem.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Add board monitoring to periodic work whenever link is down.
For SFE4001, report when a fault has caused the PHY to turn off.
For SFE4002, switch XFP PHY into low-power state in case of a fault.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
The boot code that appears as a PCI expansion ROM on the SFC4000 is
stored in flash. Expose this as a standard MTD device to allow for
in-place upgrades.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>