aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/nic.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-12-06Merge branch 'sfc-3.13' into masterBen Hutchings1-0/+2
Merge sfc fixes destined for 3.13, as development for 3.14+ depends on some of them.
2013-12-06sfc: Stop/re-start PTP when stopping/starting the datapath.Alexandre Rames1-0/+2
This disables PTP when we bring the interface down to avoid getting unmatched RX timestamp events, and tries to re-enable it when bringing the interface up. [bwh: Make efx_ptp_stop() safe on Falcon. Introduce efx_ptp_{start,stop}_datapath() functions; we'll expand them later.] Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-11-19sfc: Implement the SIOCGHWTSTAMP ioctlBen Hutchings1-1/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-10-08Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-0/+12
Conflicts: include/linux/netdevice.h net/core/sock.c Trivial merge issues. Removal of "extern" for functions declaration in netdevice.h at the same time "const" was added to an argument. Two parallel line additions in net/core/sock.c Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-04sfc: Add PM and RXDP drop counters to ethtool statsEdward Cree1-0/+12
Recognise the new Packet Memory and RX Data Path counters. The following counters are added: rx_pm_{trunc,discard}_bb_overflow - burst buffer overflowed. This should not occur if BB correctly configured. rx_pm_{trunc,discard}_vfifo_full - not enough space in packet memory. May indicate RX performance problems. rx_pm_{trunc,discard}_qbb - dropped by 802.1Qbb early discard mechanism. Since Qbb is not supported at present, this should not occur. rx_pm_discard_mapping - 802.1p priority configured to be dropped. This should not occur in normal operation. rx_dp_q_disabled_packets - packet was to be delivered to a queue but queue is disabled. May indicate misconfiguration by the driver. rx_dp_di_dropped_packets - parser-dispatcher indicated that a packet should be dropped. rx_dp_streaming_packets - packet was sent to the RXDP streaming bus, ie. a filter directed the packet to the MCPU. rx_dp_emerg_{fetch,wait} - RX datapath had to wait for descriptors to be loaded. Indicates performance problems but not drops. These are only provided if the MC firmware has the PM_AND_RXDP_COUNTERS capability. Otherwise, mask them out. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-24sfc: Remove extern from function prototypesJoe Perches1-107/+103
There are a mix of function prototypes with and without extern in the kernel sources. Standardize on not using extern for function prototypes. Function prototypes don't need to be written with extern. extern is assumed by the compiler. Its use is as unnecessary as using auto to declare automatic/local variables in a block. Signed-off-by: Joe Perches <joe@perches.com>
2013-09-20sfc: Separate out queue-empty check from efx_nic_may_push_tx_desc()Ben Hutchings1-6/+22
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-20sfc: Allocate and link PIO buffers; map them with write-combiningBen Hutchings1-0/+18
Try to allocate a segment of PIO buffer to each TX channel. If allocation fails, log an error but continue. PIO buffers must be mapped separately from the NIC registers, with write-combining enabled. Where the host page size is 4K, we could potentially map each VI's registers and PIO buffer separately. However, this would add significant complexity, and we also need to support architectures such as POWER which have a greater page size. So make a single contiguous write-combining mapping after the uncacheable mapping, aligned to the host page size, and link PIO buffers there. Where necessary, allocate additional VIs within the write-combining mapping purely for access to PIO buffers. Link all TX buffers to TX queues and the additional VIs in efx_ef10_dimension_resources() and in efx_ef10_init_nic() after an MC reboot. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-09-11sfc: Reinitialise and re-validate datapath caps after MC rebootBen Hutchings1-0/+3
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-08-29sfc: Update copyright bannersBen Hutchings1-2/+2
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-29sfc: Add support for Solarflare SFC9100 familyBen Hutchings1-4/+75
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-29sfc: Allow event queue initialisation to failJon Cooper1-3/+3
On EF10, event queue initialisation requires an MCDI request which may return failure. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27sfc: Delegate MAC/NIC statistic description to efx_nic_typeBen Hutchings1-0/+124
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-27sfc: Remove more left-overs from Falcon GMAC supportBen Hutchings1-5/+0
We only ever used the XMAC (10G link speed) in production. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27sfc: Move MTD operations into efx_nic_typeBen Hutchings1-1/+32
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-22sfc: Rename SPI stuff to show that it is Falcon-specificBen Hutchings1-2/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-22sfc: Cleanup Falcon-arch simple MAC filter stateBen Hutchings1-0/+1
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-22sfc: Make most filter operations NIC-type-specificBen Hutchings1-0/+28
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-21sfc: Move and rename Falcon/Siena common NIC operationsBen Hutchings1-33/+167
Add efx_nic_type operations for the many efx_nic functions that need to be implemented different on EF10. For now, change most of the existing efx_nic_*() functions into inline wrappers. As a later step, we may be able to improve branch prediction for operations used on the fast path by copying the pointers into each queue/channel structure. Move the Falcon/Siena implementations to new file farch.c and rename the functions and static data to use a prefix of 'efx_farch_'. Move efx_may_push_tx_desc() to nic.h, as the EF10 TX code will also use it. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Refactor queue teardown sequence to allow for EF10 flush behaviourBen Hutchings1-3/+1
Currently efx_stop_datapath() will try to flush our DMA queues (if DMA is enabled), then finalise software and hardware state for each queue. However, for EF10 we must ask the MC to finalise each queue, which implicitly starts flushing it, and then wait for the flush events. We therefore need to delegate more of this to the NIC type. Combine all the hardware operations into a new NIC-type operation efx_nic_type::fini_dmaq, and call this before tearing down the software state and buffers for all the DMA queues. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Limit scope of a Falcon A1 IRQ workaroundBen Hutchings1-1/+0
We unconditionally acknowledge legacy interrupts just before disabling them. This workaround is needed on Falcon A1 but probably not on later chips where the legacy interrupt mechanism is different. It was also originally done after the IRQ handler was removed, not before. Restore the original behaviour for Falcon A1 only by doing this acknowledgement in the efx_nic_type::fini operation. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow blockingBen Hutchings1-1/+1
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-21sfc: Make MCDI independent of SienaBen Hutchings1-16/+0
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-21sfc: Move more Falcon-specific code and definitions into falcon.cBen Hutchings1-42/+1
In particular, fold in the whole of falcon_xmac.c. Drop some entirely unused definitions. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Move details of a Falcon bug workaround out of ethtool.cBen Hutchings1-1/+0
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-06-24sfc: Report software timestamping capabilitiesBen Hutchings1-2/+2
The kernel can generate software receive timestamps and we should report those for all ports regardless of hardware capabilities. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Really disable flow control while flushingBen Hutchings1-0/+2
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-11-01ptp: Enable clock drivers along with associated net/PHY driversBen Hutchings1-26/+0
Where a PTP clock driver is associated with a net or PHY driver, it should be enabled automatically whenever that driver is enabled. Therefore: - Make PTP clock drivers select rather than depending on PTP_1588_CLOCK - Remove separate boolean options for PTP clock drivers that are built as part of net driver modules. (This also fixes cases where the PTP subsystem is wrongly forced to be built-in.) - Set 'default y' for PTP clock drivers that depend on specific net drivers but are built separately Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-09-19sfc: Add support for IEEE-1588 PTPStuart Hodgson1-0/+36
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-07-17sfc: Fix interface statistics running backwardBen Hutchings1-0/+18
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-03-06sfc: Log the part number on probeBen Hutchings1-4/+0
During probe of each port, read and log the part number from VPD. Remove the Falcon-specific board name lookup. Initial version by Stuart Hodgson <smhodgson@solarflare.com>. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-03-06sfc: Run event/IRQ self-test asynchronously when interface is brought upBen Hutchings1-1/+1
Generate a test event on each event queue whenever the interface is brought up, then after 1 second check that we have either handled a test event or handled another IRQ for each event queue. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-03-06sfc: Encapsulate access to efx_{channel,nic}::last_irq_cpu in self-testBen Hutchings1-2/+11
Cleanup in preparation for doing an event test on ifup. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-03-06sfc: Remove redundant function efx_nic_has_mc()Ben Hutchings1-4/+0
This function is now used in only one place, where it always returns true. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16sfc: Add SR-IOV back-end support for SFC9000 familyBen Hutchings1-0/+89
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-16sfc: Allocate SRAM between buffer table and descriptor caches at init timeBen Hutchings1-0/+2
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-16sfc: Generalise event generation to cover VF-owned event queuesBen Hutchings1-2/+2
For SR-IOV we will need to send events to event queues that belong to VFs serviced by other drivers. Change the parameters of efx_generate_event() to allow this and declare it extern. While we're at it, remove the existing declaration under the wrong name efx_nic_generate_event(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16sfc: Generate RX fill events based on RX queues, not channelsBen Hutchings1-1/+1
This makes it harder to accidentally send such events to TX-only channels. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-13sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZEBen Hutchings1-0/+5
The 'page size' for PCIe DMA, i.e. the alignment of boundaries at which DMA must be broken, is 4KB. Name this value as EFX_PAGE_SIZE and use it in efx_max_tx_len(). Redefine EFX_BUF_SIZE as EFX_PAGE_SIZE since its value is also a result of that requirement, and use it in efx_init_special_buffer(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Add hwmon driver for boards using SFC9000-family controllersBen Hutchings1-0/+14
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-27sfc: Correct interrupt timer quantum for Siena (normal and turbo mode)Ben Hutchings1-3/+0
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-27sfc: Merge efx_mac_operations into efx_nic_typeBen Hutchings1-0/+3
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>
2011-09-22Merge branch 'master' of github.com:davem330/netDavid S. Miller1-2/+0
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-16sfc: Validate IRQ moderation parameters in efx_init_irq_moderation()Ben Hutchings1-1/+2
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-08-11sfc: Move the Solarflare driversJeff Kirsher1-0/+273
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>