summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
Commit message (Collapse)AuthorAgeFilesLines
* ptp: use list_move instead of list_del/list_addWei Yongjun2012-10-071-6/+3
| | | | | | | | | | Using list_move() instead of list_del() + list_add(). dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
* drivers/net/ethernet/sfc: use standard __{clear,set}_bit_le() functionsBen Hutchings2012-10-063-16/+4
| | | | | | | | | | | There are now standard functions for dealing with little-endian bit arrays, so use them instead of our own implementations. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'for-davem' of ↵David S. Miller2012-10-017-82/+76
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next Ben Hutchings says: ==================== Some bug fixes that should go into 3.7: 1. Fix oops when removing device with SR-IOV enabled. (This regression was introduced by the last set of changes, so the fix does not need to be applied to any earlier kernel versions.) 2. Fix firmware structure field lookup bug that resulted in missing sensor information. 3. Fix bug that makes self-test do very little in some configurations. 4. Fix the numbering of ethtool RX flow steering filters to reflect the real hardware priorities. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * sfc: Fix the reported priorities of different filter typesBen Hutchings2012-10-021-16/+53
| | | | | | | | | | | | | | | | | | | | | | Each RX filter table contains filters with two different levels of specificity: TCP/IPv4 and UDP/IPv4 filters match the local address and port and optionally the remote address and port; Ethernet filters match the local address and optionally the VID. The more specific filters always override less specific filters within the same table, and should be numbered accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Remove EFX_FILTER_FLAG_RX_OVERRIDE_IPBen Hutchings2012-10-023-58/+10
| | | | | | | | | | | | | | This filter flag cannot yet be set through the ethtool command and will not be supported on future hardware. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Fix loopback self-test with separate_tx_channels=1Ben Hutchings2012-10-022-2/+4
| | | | | | | | | | | | | | The loopback self-test iterates over all the TX queues of channel 0, which is not very interesting when that's an RX-only channel. Signed-off-by: Ben Hutchings <bhutchings@solarflre.com>
| * sfc: Fix MCDI structure field lookupBen Hutchings2012-10-021-2/+4
| | | | | | | | | | | | | | | | | | The least significant bit number (LBN) of a field within an MCDI structure is counted from the start of the structure, not the containing dword. In MCDI_ARRAY_FIELD() we need to mask it rather than using the usual EFX_DWORD_FIELD() macro. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Add parentheses around use of bitfield macro argumentsBen Hutchings2012-10-021-11/+11
| | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Fix null function pointer in efx_sriov_channel_typeBen Hutchings2012-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit c31e5f9 ('sfc: Add channel specific receive_skb handler and post_remove callback') added the function pointer field efx_channel_type::post_remove and an unconditional call through it. This field should have been initialised to efx_channel_dummy_op_void in the existing instances of efx_channel_type, but this was only done in efx_default_channel_type. Consequently, if a device has SR-IOV enabled then removing the driver or device will result in an oops. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | ptp: link the phc device to its parent deviceRichard Cochran2012-09-221-1/+2
|/ | | | | | | | | | | PTP Hardware Clock devices appear as class devices in sysfs. This patch changes the registration API to use the parent device, clarifying the clock's relationship to the underlying device. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Ben Hutchings <bhutchings@solarflare.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES requestBen Hutchings2012-09-192-0/+10
| | | | | | | | | | | | | | MCDI supports requests up to 252 bytes long, which is only enough to pass 63 RX queue IDs to MC_CMD_FLUSH_RX_QUEUES. However a VF may have up to 64 RX queues, and if we try to flush them all we will generate an over-length request and BUG() in efx_mcdi_copyin(). Currently all VF drivers limit themselves to 32 RX queues, so reducing the limit to 63 does no harm. Also add a BUILD_BUG_ON in efx_mcdi_flush_rxqs() so we remember to deal with the same problem there if EFX_MAX_CHANNELS is increased. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Bump version to 3.2Ben Hutchings2012-09-191-1/+1
| | | | | | The key new feature for 3.2 is PTP support. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Expose FPGA bitfile partition through MTDBen Hutchings2012-09-191-1/+3
| | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Support variable-length response to MCDI GET_BOARD_CFGBen Hutchings2012-09-192-3/+6
| | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()Ben Hutchings2012-09-191-7/+11
| | | | | | | | On big-endian systems the MTD partition names currently have mangled subtype numbers and are not recognised by the firmware update tool (sfupdate). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Add support for IEEE-1588 PTPStuart Hodgson2012-09-1911-1/+1562
| | | | | | | | | | | | | 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 maximum array sizes for various MCDI commandsBen Hutchings2012-09-191-14/+14
| | | | | | | | The maximum array sizes have been calculated on the basis of a maximum SDU size of 255 bytes, whereas the actual maximum is 252 bytes. Constructing a larger SDU will result in a BUG_ON in efx_mcdi_copyin. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Allow efx_mcdi_rpc to be called in two partsStuart Hodgson2012-09-072-3/+24
| | | | | | | | For NIC/System time synchonisation efx_mcdi_rpc needs to be split in efx_mcdi_rpc_start and efx_mcdi_rpc_finish operations. Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Add channel specific receive_skb handler and post_remove callbackStuart Hodgson2012-09-074-2/+21
| | | | | | | | | | | Allows an extra channel to override the standard receive_skb handler and also for extra non generic operations to be performed on remove. Also set default rx strategy so only skbs can be delivered to the PTP receive function. Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Add explicit RX queue flag to channelStuart Hodgson2012-09-073-4/+16
| | | | | | | | | | The PTP channel will have its own RX queue even though it's not a regular traffic channel. Original work by Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2012-08-311-2/+2
|\ | | | | | | | | | | | | | | Merge the 'net' tree to get the recent set of netfilter bug fixes in order to assist with some merge hassles Pablo is going to have to deal with for upcoming changes. Signed-off-by: David S. Miller <davem@davemloft.net>
| * sfc: Fix reporting of IPv4 full filters through ethtoolBen Hutchings2012-08-241-2/+2
| | | | | | | | | | | | | | ETHTOOL_GRXCLSRULE returns filters for a TCP/IPv4 or UDP/IPv4 4-tuple with source and destination swapped. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Fix the initial device operstateBen Hutchings2012-08-241-3/+3
| | | | | | | | | | | | | | | | Following commit 8f4cccb ('net: Set device operstate at registration time') it is now correct and preferable to set the carrier off before registering a device. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Assign efx and efx->type as early as possible in efx_pci_probe()Ben Hutchings2012-08-241-9/+6
| | | | | | | | | | | | | | We also stop clearing *efx in efx_init_struct(). This is safe because alloc_etherdev_mq() already clears it for us. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Remove bogus comment about MTU change and RX buffer overrunBen Hutchings2012-08-241-2/+0
| | | | | | | | | | | | | | | | | | RX DMA is limited by the length specified in each descriptor and not by the MAC. Over-length frames may get into the RX FIFO regardless of the MAC settings, due to a hardware bug, but they will be truncated by the packet DMA engine and reported as such in the completion event. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Remove overly paranoid locking assertions from netdev operationsBen Hutchings2012-08-242-10/+0
| | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Fix reset vs probe/remove/PM races involving efx_nic::stateBen Hutchings2012-08-241-41/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We try to defer resets while the device is not READY, but we're not doing this quite correctly. In particular, changes to efx_nic::state are documented as serialised by the RTNL lock, but they aren't. 1. We check whether a reset was requested during probe (suggesting broken hardware) before we allow requested resets to be scheduled. This leaves a window where a requested reset would be deferred indefinitely. 2. Although we cancel the reset work item during device removal, there are still later operations that can cause it to be scheduled again. We need to check the state before scheduling it. 3. Since the state can change between scheduling and running of the work item, we still need to check it there, and we need to do so *after* acquiring the RTNL lock which serialises state changes. 4. We must cancel the reset work item during device removal, if the state could ever have been READY. This wasn't done in some of the failure paths from efx_pci_probe(). Move the cancellation to efx_pci_remove_main(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Improve log messages in case we abort probe due to a pending resetBen Hutchings2012-08-241-4/+3
| | | | | | | | | | | | | | | | The current informational message doesn't properly explain what happens, and could also appear if we defer a reset during suspend/resume. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Never try to stop and start a NIC that is disabledBen Hutchings2012-08-241-21/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | efx_change_mtu() and efx_realloc_channels() each stop and start much of the NIC, even if it has been disabled. Since efx_start_all() is a no-op when the NIC is disabled, this is probably harmless in the case of efx_change_mtu(), but efx_realloc_channels() also reenables interrupts which could be a bad thing to do. Change efx_start_all() and efx_start_interrupts() to assert that the NIC is not disabled, but make efx_stop_interrupts() do nothing if the NIC is disabled (since it is already stopped), consistent with efx_stop_all(). Update comments for efx_start_all() and efx_stop_all() to describe their purpose and preconditions more accurately. Add a common function to check and log if the NIC is disabled, and use it in efx_net_open(), efx_change_mtu() and efx_realloc_channels(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Hold RTNL lock (only) when calling efx_stop_interrupts()Ben Hutchings2012-08-241-3/+3
| | | | | | | | | | | | | | Interrupt state should be consistently guarded by the RTNL lock once the net device is registered. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Keep disabled NICs quiescent during suspend/resumeBen Hutchings2012-08-241-12/+16
| | | | | | | | | | | | Currently we ignore and clear the disabled state. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Hold the RTNL lock for more of the suspend/resume cycleBen Hutchings2012-08-241-0/+8
| | | | | | | | | | | | | | | | I don't think these PM functions can race with userland net device operations, but it's much easier to reason about locking if state is consistently guarded by the same lock. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Change state names to be clearer, and comment themBen Hutchings2012-08-244-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | STATE_INIT and STATE_FINI are equivalent and represent incompletely initialised states; combine them as STATE_UNINIT. Rename STATE_RUNNING to STATE_READY, to avoid confusion with netif_running() and IFF_RUNNING. The comments do not quite match current usage, but this will be corrected in subsequent fixes. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Stash header offsets for TSO in struct tso_stateBen Hutchings2012-08-241-16/+12
| | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Replace tso_state::full_packet_space with ip_base_lenBen Hutchings2012-08-241-9/+11
| | | | | | | | | | | | | | | | | | | | We only use tso_state::full_packet_space to calculate the IPv4 tot_len or IPv6 payload_len, not to set tso_state::packet_space. Replace it with an ip_base_len field holding the value of tot_len or payload_len before including the TCP payload, which is much more useful when constructing the new headers. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Simplify TSO header buffer allocationBen Hutchings2012-08-243-218/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TSO header buffers contain a control structure immediately followed by the packet headers, and are kept on a free list when not in use. This complicates buffer management and tends to result in cache read misses when we recycle such buffers (particularly if DMA-coherent memory requires caches to be disabled). Replace the free list with a simple mapping by descriptor index. We know that there is always a payload descriptor between any two descriptors with TSO header buffers, so we can allocate only one such buffer for each two descriptors. While we're at it, use a standard error code for allocation failure, not -1. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Stop TX queues before they fill upBen Hutchings2012-08-243-115/+112
| | | | | | | | | | | | | | We now have a definite upper bound on the number of descriptors per skb; use that to stop the queue when the next packet might not fit. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* | sfc: Refactor struct efx_tx_buffer to use a flags fieldBen Hutchings2012-08-243-56/+53
|/ | | | | | | | | | | | | | Add a flags field to struct efx_tx_buffer, replacing the continuation and map_single booleans. Since a single descriptor cannot be both a TSO header and the last descriptor for an skb, unionise efx_tx_buffer::{skb,tsoh} and add flags for validity of these fields. Clear all flags in free buffers (whereas previously the continuation flag would be set). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
* sfc: Fix maximum number of TSO segments and minimum TX queue sizeBen Hutchings2012-08-024-9/+46
| | | | | | | | | | | | | | | | | | | | Currently an skb requiring TSO may not fit within a minimum-size TX queue. The TX queue selected for the skb may stall and trigger the TX watchdog repeatedly (since the problem skb will be retried after the TX reset). This issue is designated as CVE-2012-3412. Set the maximum number of TSO segments for our devices to 100. This should make no difference to behaviour unless the actual MSS is less than about 700. Increase the minimum TX queue size accordingly to allow for 2 worst-case skbs, so that there will definitely be space to add an skb after we wake a queue. To avoid invalidating existing configurations, change efx_ethtool_set_ringparam() to fix up values that are too small rather than returning -EINVAL. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: initialize dynamic sysfs attributes for lockdepMichal Schmidt2012-07-191-0/+1
| | | | | | | | | | Dynamically allocated sysfs attributes must be initialized using sysfs_attr_init(), otherwise lockdep complains: BUG: key <address> not in .data! Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Acked-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'for-davem' of ↵David S. Miller2012-07-1814-153/+181
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next Ben Hutchings says: ==================== 1. Fix potential badness when running a self-test with SR-IOV enabled. 2. Fix calculation of some interface statistics that could run backward. 3. Miscellaneous cleanup. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * sfc: Correct some comments on enum reset_typeBen Hutchings2012-07-171-4/+4
| | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Fix interface statistics running backwardBen Hutchings2012-07-173-10/+28
| | | | | | | | | | | | | | | | | | 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: Disable VF queues during register self-testBen Hutchings2012-07-175-60/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently VF queues and drivers may remain active during this test. This could cause memory corruption or spurious test failures. Therefore we reset the port/function before running these tests on Siena. On Falcon this doesn't work: we have to do some additional initialisation before some blocks will work again. So refactor the reset/register-test sequence into an efx_nic_type method so efx_selftest() doesn't have to consider such quirks. In the process, fix another minor bug: Siena does not have an 'invisible' reset and the self-test currently fails to push the PHY configuration after resetting. Passing RESET_TYPE_ALL to efx_reset_{down,up}() fixes this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Explain why efx_mcdi_exit_assertion() ignores result of efx_mcdi_rpc()Ben Hutchings2012-07-171-3/+8
| | | | | | | | | | | | | | | | | | | | Fix CID 113952 in Coverity report on Linux. This is the one instance where we don't, and shouldn't, check the return code from efx_mcdi_rpc(). It wasn't immediately obvious to me why we didn't, so I think an explanation is in order. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Use dev_kfree_skb() in efx_end_loopback()Ben Hutchings2012-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix CID 102619 in the Coverity report on Linux. efx_end_loopback() iterates over an array of skb pointers of which some may be null (if efx_begin_loopback() failed). It should not use dev_kfree_skb_irq(), which requires non-null pointers. In practice this is safe because it does not run in interrupt context and therefore always ends up calling dev_kfree_skb(), which does allow null pointers. But we should make that explicit. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Use strlcpy() to copy ethtool stats namesBen Hutchings2012-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | Fix CID 113703 in the Coverity report on Linux. ethtool stats names are limited to 32 bytes including a null terminator. Use strlcpy() to ensure that we will always include the null terminator even if a source string becomes longer than this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Stop changing header offsets on TXBen Hutchings2012-07-171-9/+0
| | | | | | | | | | | | | | There is nothing in the VLAN driver or core VLAN support that invalidates the TCP and IP header offsets. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Remove dead write to tso_state::packet_spaceBen Hutchings2012-07-171-1/+0
| | | | | | | | | | | | | | tso_state::packet_space is always set in tso_start_packet(); the value set in tso_start() is not used, and is also incorrect. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
| * sfc: Use generic DMA API, not PCI-DMA APIBen Hutchings2012-07-175-63/+62
| | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>