aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-12-12sfc: Allow filter removal only with exactly matching priorityBen Hutchings2-2/+2
Currently a higher priority client can remove a lower priority client's filter with equal match-expression. This might happen if (a) the higher priority client has a double-free bug, or (b) another client with sufficient priority replaced and then removed an equal filter, allowing the low priority client to insert an equal filter. In neither case does it actually make sense to carry out the removal; we should say the filter doesn't exist, as the filter currently present is not the one that the high-priority client is referring to. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Don't refer to 'stack' in filter implementationBen Hutchings2-56/+56
Change all the 'stack' naming to 'auto' (or other meaningful term); the device address list is based on more than just what the network stack wants, and the no-match filters aren't really what the stack wants at all. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Change priority and flags for automatic MAC filtersBen Hutchings4-54/+67
MAC filters inserted automatically by the driver, based on the device address list (EF10) or no-match filters (Siena), should be overridable at MANUAL or REQUIRED priority. Currently they themselves have REQUIRED priority and this requires some odd special-casing. We also can't reliably tell whether such a MAC filter has or has not been overridden. We just remember that it is wanted by the stack (RX_STACK flag). Add another priority level, AUTO, between HINT and MANUAL, and use this for the automatic filters while they have not been overridden. Remove the RX_STACK flag. Add an RX_OVER_AUTO flag which is set only when an AUTO filter has been overridden (or was requested to be inserted while a higher-priority filter existed). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Change efx_nic_type::rx_push_indir_table to push hash key as wellAndrew Rybchenko7-39/+57
The EF10 implementation already does this, and it makes more logical sense to group the RSS hash key and indirection table together. Rename the operation to rx_push_rss_config. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Add more information to many warnings using WARN() and netdev_WARN()Ben Hutchings1-10/+20
In case of certain hardware and firmware errors it can be useful to have more context than just the file and line number. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Remove unnecessary condition for processing the TX timestamp queueBen Hutchings1-12/+4
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Don't clear timestamps in efx_ptp_rx()Ben Hutchings1-6/+0
A freshly allocated skb starts with timestamps clear. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Enable PTP clock and timestamping for all functions on EF10Ben Hutchings2-17/+30
The SFC9100 family has only one clock per controller, shared by all functions. Therefore only create a clock device under the primary function, and make all other functions refer to the primary's clock device. Since PTP functionality is limited to port 0 and PF 0 on the earlier SFN[56]322F boards, and we also set the primary flag for that function, we can make the creation of a clock device conditional only on this flag. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Associate primary and secondary functions of controllerBen Hutchings4-0/+93
The primary function of an EF10 controller will share its clock device with other functions in the same domain (which we call secondary functions). To this end, we need to associate functions on the same controller. We do not control probe order, so allow primary and secondary functions to appear in any order. Maintain global lists of all primary functions and of unassociated secondary functions, and a list of secondary functions on each primary function. Use the VPD serial number to tell whether functions are part of the same controller. VPD will not be readable by virtual functions, so this may need to be revisited later. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Store VPD serial number at probe timeBen Hutchings2-7/+34
Original version by Stuart Hodgson. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Add RX packet timestamping for EF10Jon Cooper7-15/+277
The EF10 firmware can optionally insert RX timestamps in the packet prefix. These only include the clock minor value. We must also enable periodic time sync events on each event queue which provide the high bits of the clock value. [bwh: Combined and rebased several changes. Added the above description and some sanity checks for inline vs separate timestamps. Changed efx_rx_skb_attach_timestamp() to read the packet prefix from the skb head area.] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Copy RX prefix into skb head area in efx_rx_mk_skb()Ben Hutchings2-12/+7
We can potentially pull the entire packet contents into the head area and then free the page it was in. In order to read an inline timestamp safely, we need to copy the prefix into the head area as well. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: split setup of hardware timestamping into NIC-type operationDaniel Pieczko4-72/+78
I added efx_ptp_get_mode() to avoid moving the definition for efx_ptp_data, since the current PTP mode is needed for siena.c:siena_set_ptp_hwtstamp. [bwh: Also move the rx_filters mask, and add kernel-doc] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Add support for SFC9100 timestamp formatLaurence Evans1-25/+231
The clock minor tick on the SFC9100 family is 2^-27 s, not 1 ns. There are also various pipeline delays which we need to correct for when interpreting timestamps. We query the firmware for the clock format and corrections at run-time. [bwh: Combined and rebased several changes] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Tidy up PTP synchronization codeLaurence Evans1-20/+24
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: PTP - tidy up unused/useless variablesLaurence Evans1-15/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Remove kernel-doc for efx_ptp_data fields not present in this versionBen Hutchings1-15/+0
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Initialise efx_ptp_data::phc_clock_info from a static templateBen Hutchings1-14/+16
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Do not use MAC address as clock nameBen Hutchings1-3/+2
We'll be sharing clocks between multiple functions with their own MAC addresses. The name field is now documented as 'A short "friendly name" to identify the clock ...' and '... not meant to be a unique id.' So use the name 'sfc'. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Store flags from MC_CMD_DRV_ATTACH for later useBen Hutchings2-2/+18
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Remove dependency of PTP on having a dedicated channelBen Hutchings3-24/+41
We need a dedicated channel on Siena to ensure we can match up the separate RX and timestamp events for each PTP packet. We won't do this for EF10 as timestamps are delivered inline. Pass a channel index of 0 to MC_CMD_PTP_OP_ENABLE when there is no dedicated channel. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Split PTP multicast filter insertion/removal out of efx_ptp_{start,stop}()Ben Hutchings1-17/+39
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Return EBUSY for filter insertion on EF10, matching Falcon/SienaBen Hutchings1-0/+2
The MC firmware will return error MC_CMD_ERR_ENOSPC if filter insertion fails due to lack of resources. The net driver's filter implementation for Falcon-architecture returns EBUSY. They should behave consistently, so for EF10 change ENOSPC to EBUSY. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Expose NVRAM_PARTITION_TYPE_LICENSE on EF10Ben Hutchings1-0/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Fold efx_flush_all() into efx_stop_port() and update commentsBen Hutchings1-18/+12
efx_flush_all() is a really misleading name - it has nothing to do with e.g. flushing DMA queues. Since it's called immediately after efx_stop_port() and is highly dependent on what that does, combine the two functions. Update comments to explain what this is doing a little better. Also update an related and erroneous comment in efx_start_port(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Map MCDI error MC_CMD_ERR_ENOTSUP to Linux EOPNOTSUPPBen Hutchings1-0/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Log all unexpected MCDI errorsEdward Cree5-229/+265
Split each of efx_mcdi_rpc, efx_mcdi_rpc_finish, and efx_mcdi_rpc_async into a normal and a _quiet version; made the former log MCDI errors with netif_err (and include the raw MCDI error code), and the latter never log them at all. Changed various callers; any where some errors are expected (but others are not) call the _quiet version and then if necessary log the MCDI error themselves. Said logging is done by new efx_mcdi_display_error. Callers of efx_mcdi_rpc*_quiet functions which may want to log the error need to ensure that their outbuf is big enough to hold an MCDI error; to this end, they now use MCDI_DECLARE_BUF_OUT_OR_ERR, which always allocates at least 8 bytes. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Add new sensor namesBen Hutchings1-0/+3
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Revise sensor names to be more understandable and consistentEdward Cree1-23/+26
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Report units in sensor warningsEdward Cree1-4/+20
Add units to the "Sensor reports condition X for raw value Y" messages. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Correct RX dropped count for drops while interface is downJon Cooper9-11/+83
We don't directly control RX ingress on Siena or any later controllers, and so we cannot prevent packets from entering the RX datapath while the RX queues are not set up. This results in the hardware incrementing RX_NODESC_DROP_CNT, but it's not an error and we should not include it in error stats. When bringing an interface up or down, pull (or wait for) stats and count the number of packets that were dropped while the interface was down. Subtract this from the reported RX dropped count. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Make initial fill of RX descriptors synchronousJon Cooper5-9/+12
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Tighten the check for RX merged completion eventsBen Hutchings1-4/+9
The addition of RX event merging support means we don't reliably detect dropped RX events now. Currently we will only detect them if the previous event for the RX queue had the CONT bit set. Only accept RX completion events as merged if the GET_CAPABILITIES_OUT_RX_BATCHING bit is set in datapath_caps (which it won't be for the low-latency datapath) and the CONT bit is not set on the event. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Add MC BISTs to ethtool offline self test on EF10Jon Cooper8-2/+152
To run BISTs the MC goes down in to a special mode where it will only respond to MCDI from the testing PF, and TX, RX and event queues are torn down. Other PFs get a message as it goes down to tell them it's going down. When the other PFs get this message, they check the soft status register to tell when the MC has rebooted after BIST mode and they can start recovery. [bwh: Convert the test result to 1 or -1 as for earlier NICs] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-09net: sfc: remove unnecessary pci_set_drvdata()Jingoo Han1-2/+0
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-06sfc: Update MCDI protocol definitionsBen Hutchings1-70/+663
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: Demote "MC Scheduler error" messagesRobert Stonehouse1-2/+2
The MC firmware is cooperatively multitasking and its scheduler will send an event when a task yields after running for more than the expected maximum time. This can be useful for firmware development but does not usually indicate a serious error and does not help to detect a lockup (there is a hardware watchdog that does that). Change the message and reduce log level accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06Merge branch 'sfc-3.13' into masterBen Hutchings6-23/+101
Merge sfc fixes destined for 3.13, as development for 3.14+ depends on some of them.
2013-12-06sfc: Poll for MCDI completion once before timeout occursRobert Stonehouse1-4/+12
There is an as-yet unexplained bug that sometimes prevents (or delays) the driver seeing the completion event for a completed MCDI request on the SFC9120. The requested configuration change will have happened but the driver assumes it to have failed, and this can result in further failures. We can mitigate this by polling for completion after unsuccessfully waiting for an event. Fixes: 8127d661e77f ('sfc: Add support for Solarflare SFC9100 family') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: Refactor efx_mcdi_poll() by introducing efx_mcdi_poll_once()Robert Stonehouse1-6/+17
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: RX buffer allocation takes prefix size into account in IP header alignmentAndrew Rybchenko3-4/+9
rx_prefix_size is 4-bytes aligned on Falcon/Siena (16 bytes), but it is equal to 14 on EF10. So, it should be taken into account if arch requires IP header to be 4-bytes aligned (via NET_IP_ALIGN). Fixes: 8127d661e77f ('sfc: Add support for Solarflare SFC9100 family') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: Maintain current frequency adjustment when applying a time offsetBen Hutchings1-2/+2
There is a single MCDI PTP operation for setting the frequency adjustment and applying a time offset to the hardware clock. When applying a time offset we should not change the frequency adjustment. These two operations can now be requested separately but this requires a flash firmware update. Keep using the single operation, but remember and repeat the previous frequency adjustment. Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: Stop/re-start PTP when stopping/starting the datapath.Alexandre Rames3-3/+33
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-12-06sfc: Rate-limit log message for PTP packets without a matching timestamp eventBen Hutchings1-2/+3
In case of a flood of PTP packets, the timestamp peripheral and MC firmware on the SFN[56]322F boards may not be able to provide timestamp events for all packets. Don't complain too much about this. Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: PTP: Moderate log message on event queue overflowLaurence Evans1-2/+21
Limit syslog flood if a PTP packet storm occurs. Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-06sfc: Add length checks to efx_xmit_with_hwtstamp() and efx_ptp_is_ptp_tx()Ben Hutchings1-0/+4
efx_ptp_is_ptp_tx() must be robust against skbs from raw sockets that have invalid IPv4 and UDP headers. Add checks that: - the transport header has been found - there is enough space between network and transport header offset for an IPv4 header - there is enough space after the transport header offset for a UDP header Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP') Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-05Merge branch 'siocghwtstamp' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-nextDavid S. Miller3-3/+15
Ben Hutchings says: ==================== SIOCGHWTSTAMP ioctl 1. Add the SIOCGHWTSTAMP ioctl and update the timestamping documentation. 2. Implement SIOCGHWTSTAMP in most drivers that support SIOCSHWTSTAMP. 3. Add a test program to exercise SIOC{G,S}HWTSTAMP. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-29sfc: Convert to use hwmon_device_register_with_groupsGuenter Roeck2-48/+32
Simplify the code. Avoid race conditions caused by attributes being created after hwmon device registration. Implicitly (through hwmon API) add mandatory 'name' sysfs attribute. Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-19sfc: Implement the SIOCGHWTSTAMP ioctlBen Hutchings3-3/+15
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-11-14Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-armLinus Torvalds1-11/+1
Pull DMA mask updates from Russell King: "This series cleans up the handling of DMA masks in a lot of drivers, fixing some bugs as we go. Some of the more serious errors include: - drivers which only set their coherent DMA mask if the attempt to set the streaming mask fails. - drivers which test for a NULL dma mask pointer, and then set the dma mask pointer to a location in their module .data section - which will cause problems if the module is reloaded. To counter these, I have introduced two helper functions: - dma_set_mask_and_coherent() takes care of setting both the streaming and coherent masks at the same time, with the correct error handling as specified by the API. - dma_coerce_mask_and_coherent() which resolves the problem of drivers forcefully setting DMA masks. This is more a marker for future work to further clean these locations up - the code which creates the devices really should be initialising these, but to fix that in one go along with this change could potentially be very disruptive. The last thing this series does is prise away some of Linux's addition to "DMA addresses are physical addresses and RAM always starts at zero". We have ARM LPAE systems where all system memory is above 4GB physical, hence having DMA masks interpreted by (eg) the block layers as describing physical addresses in the range 0..DMAMASK fails on these platforms. Santosh Shilimkar addresses this in this series; the patches were copied to the appropriate people multiple times but were ignored. Fixing this also gets rid of some ARM weirdness in the setup of the max*pfn variables, and brings ARM into line with every other Linux architecture as far as those go" * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits) ARM: 7805/1: mm: change max*pfn to include the physical offset of memory ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() ARM: DMA-API: better handing of DMA masks for coherent allocations ARM: 7857/1: dma: imx-sdma: setup dma mask DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks DMA-API: dcdbas: update DMA mask handing DMA-API: dma: edma.c: no need to explicitly initialize DMA masks DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks DMA-API: crypto: remove last references to 'static struct device *dev' DMA-API: crypto: fix ixp4xx crypto platform device support DMA-API: others: use dma_set_coherent_mask() DMA-API: staging: use dma_set_coherent_mask() DMA-API: usb: use new dma_coerce_mask_and_coherent() DMA-API: usb: use dma_set_coherent_mask() DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent() DMA-API: net: octeon: use dma_coerce_mask_and_coherent() DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent() ...