summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/nic.h
Commit message (Collapse)AuthorAgeFilesLines
* sfc: Update copyright bannersBen Hutchings2013-08-301-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>
* sfc: Add support for Solarflare SFC9100 familyBen Hutchings2013-08-291-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>
* sfc: Allow event queue initialisation to failJon Cooper2013-08-291-3/+3
| | | | | | | On EF10, event queue initialisation requires an MCDI request which may return failure. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Delegate MAC/NIC statistic description to efx_nic_typeBen Hutchings2013-08-271-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>
* sfc: Remove more left-overs from Falcon GMAC supportBen Hutchings2013-08-271-5/+0Star
| | | | | | We only ever used the XMAC (10G link speed) in production. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Move MTD operations into efx_nic_typeBen Hutchings2013-08-271-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>
* sfc: Rename SPI stuff to show that it is Falcon-specificBen Hutchings2013-08-221-2/+2
| | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Cleanup Falcon-arch simple MAC filter stateBen Hutchings2013-08-221-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>
* sfc: Make most filter operations NIC-type-specificBen Hutchings2013-08-221-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>
* sfc: Move and rename Falcon/Siena common NIC operationsBen Hutchings2013-08-211-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>
* sfc: Refactor queue teardown sequence to allow for EF10 flush behaviourBen Hutchings2013-08-211-3/+1Star
| | | | | | | | | | | | | | 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>
* sfc: Limit scope of a Falcon A1 IRQ workaroundBen Hutchings2013-08-211-1/+0Star
| | | | | | | | | | | 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>
* sfc: Add GFP flags to efx_nic_alloc_buffer() and make most callers allow ↵Ben Hutchings2013-08-211-1/+1
| | | | | | | | | | | 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>
* sfc: Make MCDI independent of SienaBen Hutchings2013-08-211-16/+0Star
| | | | | | | | | 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>
* sfc: Move more Falcon-specific code and definitions into falcon.cBen Hutchings2013-08-211-42/+1Star
| | | | | | | | In particular, fold in the whole of falcon_xmac.c. Drop some entirely unused definitions. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Move details of a Falcon bug workaround out of ethtool.cBen Hutchings2013-08-211-1/+0Star
| | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Report software timestamping capabilitiesBen Hutchings2013-06-241-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>
* sfc: Really disable flow control while flushingBen Hutchings2012-12-011-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>
* ptp: Enable clock drivers along with associated net/PHY driversBen Hutchings2012-11-011-26/+0Star
| | | | | | | | | | | | | | | | 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>
* sfc: Add support for IEEE-1588 PTPStuart Hodgson2012-09-191-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>
* sfc: Fix interface statistics running backwardBen Hutchings2012-07-171-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>
* sfc: Log the part number on probeBen Hutchings2012-03-061-4/+0Star
| | | | | | | | | 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>
* sfc: Run event/IRQ self-test asynchronously when interface is brought upBen Hutchings2012-03-061-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>
* sfc: Encapsulate access to efx_{channel,nic}::last_irq_cpu in self-testBen Hutchings2012-03-061-2/+11
| | | | | | Cleanup in preparation for doing an event test on ifup. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Remove redundant function efx_nic_has_mc()Ben Hutchings2012-03-061-4/+0Star
| | | | | | | This function is now used in only one place, where it always returns true. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Add SR-IOV back-end support for SFC9000 familyBen Hutchings2012-02-161-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>
* sfc: Allocate SRAM between buffer table and descriptor caches at init timeBen Hutchings2012-02-161-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>
* sfc: Generalise event generation to cover VF-owned event queuesBen Hutchings2012-02-161-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>
* sfc: Generate RX fill events based on RX queues, not channelsBen Hutchings2012-02-161-1/+1
| | | | | | | This makes it harder to accidentally send such events to TX-only channels. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZEBen Hutchings2012-02-141-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>
* sfc: Add hwmon driver for boards using SFC9000-family controllersBen Hutchings2012-01-271-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>
* sfc: Correct interrupt timer quantum for Siena (normal and turbo mode)Ben Hutchings2012-01-271-3/+0Star
| | | | | | | | | | | | | | | | 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>
* sfc: Merge efx_mac_operations into efx_nic_typeBen Hutchings2012-01-271-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>
* Merge branch 'master' of github.com:davem330/netDavid S. Miller2011-09-221-2/+0Star
| | | | | | | | | | | | 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
* sfc: Validate IRQ moderation parameters in efx_init_irq_moderation()Ben Hutchings2011-09-161-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>
* sfc: Move the Solarflare driversJeff Kirsher2011-08-111-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>