aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-01-21drivers/net/ethernet/sfc/ptp.c: adjust duplicate testJulia Lawall1-1/+1
Delete successive tests to the same location. rc was previously tested and not subsequently updated. efx_phc_adjtime can return an error code, so the call is updated so that is tested instead. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @s exists@ local idexpression y; expression x,e; @@ *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-12-07drivers/net: fix up function prototypes after __dev* removalsGreg Kroah-Hartman1-1/+1
The __dev* removal patches for the network drivers ended up messing up the function prototypes for a bunch of drivers. This patch fixes all of them back up to be properly aligned. Bonus is that this almost removes 100 lines of code, always a nice surprise. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-12-03sfc: remove __dev* attributesBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Solarflare linux maintainers <linux-net-drivers@solarflare.com> Cc: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-01sfc: Make module parameters really booleanBen Hutchings1-4/+4
Most of the module parameters treated as boolean are currently exposed as type int or uint. Defining them with the proper type is useful documentation for both users and developers. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Fix timekeeping in efx_mcdi_poll()Ben Hutchings1-6/+6
efx_mcdi_poll() uses get_seconds() to read the current time and to implement a polling timeout. The use of this function was chosen partly because it could easily be replaced in a co-sim environment with a macro that read the simulated time. Unfortunately the real get_seconds() returns the system time (real time) which is subject to adjustment by e.g. ntpd. If the system time is adjusted forward during a polled MCDI operation, the effective timeout can be shorter than the intended 10 seconds, resulting in a spurious failure. It is also possible for a backward adjustment to delay detection of a areal failure. Use jiffies instead, and change MCDI_RPC_TIMEOUT to be denominated in jiffies. Also correct rounding of the timeout: check time > finish (or rather time_after(time, finish)) and not time >= finish. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: lock TX queues when calling netif_device_detach()Daniel Pieczko3-3/+16
The assertion of netif_device_present() at the top of efx_hard_start_xmit() may fail if we don't do this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Work-around flush timeout when flushes have completedDaniel Pieczko2-4/+53
We sometimes hit a "failed to flush" timeout on some TX queues, but the flushes have completed and the flush completion events seem to go missing. In this case, we can check the TX_DESC_PTR_TBL register and drain the queues if the flushes had finished. [bwh: Minor fixes to coding style] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Reset driver's MAC stats after MC reboot seenBen Hutchings1-1/+8
If the MC reboots then the stats it reports to us will have been reset. We need to reset ours to get efx_update_diff_stat() working properly. (Ideally we would maintain stats across the reboot, but as this should only happen immediately after a firmware upgrade it's not really worth the trouble.) Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Do not initialise buffer in efx_alloc_special_buffer()Ben Hutchings1-3/+0
Currently we initialise the newly allocated buffer to all-1s, which is important for event queues but not for descriptor queues. And since we also do that in efx_nic_init_eventq(), it is completely pointless to do it here. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Correctly initialise reset_method in siena_test_chip()Ben Hutchings1-1/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Remove confusing MMIO functionsBen Hutchings3-36/+28
efx_writed_table() uses a step of 16 bytes but efx_readd_table() uses a step of 4 bytes. Why are they different? Firstly, register access is asymmetric: - The EVQ_RPTR table and RX_INDIRECTION_TBL can (or must?) be written as dwords even though they have a step size of 16 bytes, unlike most other CSRs. - In general, a read of any width is valid for registers, so long as it does not cross register boundaries. There is also no latching behaviour in the BIU, contrary to rumour. We write to the EVQ_RPTR table with efx_writed_table() but never read it back as it's write-only. We write to the RX_INDIRECTION_TBL with efx_writed_table(), but only read it back for the register dump, where we use efx_reado_table() as for any other table with step size of 16. We read MC_TREG_SMEM with efx_readd_table() for the register dump, but normally read and write it with efx_readd() and efx_writed() using offsets calculated in bytes. Since these functions are trivial and have few callers, it's clearer to open-code them at the call sites. While we're at it, update the comments on the BIU behaviour again. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Fix check for failure of MC_CMD_FLUSH_RX_QUEUESBen Hutchings1-1/+1
efx_mcdi_rpc_start() returns a negative value on error or zero on success. However one caller that can't properly handle failure then does WARN_ON(rc > 0). Change it to WARN_ON(rc < 0). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Delete redundant page_addr variable from efx_init_rx_buffers_page()Ben Hutchings1-5/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Really disable flow control while flushingBen Hutchings6-7/+23
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-12-01sfc: Fix byte order warning in self-testBen Hutchings1-1/+1
Add necessary cast when setting a bogus checksum. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-12-01sfc: Fix byte order warnings for ethtool RX filter interfaceBen Hutchings1-11/+14
sparse has got a bit more picky since I last ran it over this. Add forced casts for use of ~0 as a big-endian value. Undo the pointless optimisation of parameter validation with '|'; using '||' avoids these warnings. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-11-19net: Remove bogus dependencies on INETBen Hutchings1-1/+1
Various drivers depend on INET because they used to select INET_LRO, but they have all been converted to use GRO which has no such dependency. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-11-02sfc: Select PTP_1588_CLOCKBen Hutchings1-0/+1
This was missed in commit a24006ed12616bde1bbdb26868495906a212d8dc ('ptp: Enable clock drivers along with associated net/PHY drivers') which enabled sfc's clock driver unconditionally. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-11-01ptp: Enable clock drivers along with associated net/PHY driversBen Hutchings4-37/+1
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-10-07ptp: use list_move instead of list_del/list_addWei Yongjun1-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>
2012-10-06drivers/net/ethernet/sfc: use standard __{clear,set}_bit_le() functionsBen Hutchings3-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>
2012-10-01Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-nextDavid S. Miller7-82/+76
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>
2012-10-02sfc: Fix the reported priorities of different filter typesBen Hutchings1-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>
2012-10-02sfc: Remove EFX_FILTER_FLAG_RX_OVERRIDE_IPBen Hutchings3-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>
2012-10-02sfc: Fix loopback self-test with separate_tx_channels=1Ben Hutchings2-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>
2012-10-02sfc: Fix MCDI structure field lookupBen Hutchings1-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>
2012-10-02sfc: Add parentheses around use of bitfield macro argumentsBen Hutchings1-11/+11
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-10-02sfc: Fix null function pointer in efx_sriov_channel_typeBen Hutchings1-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>
2012-09-22ptp: link the phc device to its parent deviceRichard Cochran1-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>
2012-09-19sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES requestBen Hutchings2-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>
2012-09-19sfc: Bump version to 3.2Ben Hutchings1-1/+1
The key new feature for 3.2 is PTP support. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-09-19sfc: Expose FPGA bitfile partition through MTDBen Hutchings1-1/+3
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-09-19sfc: Support variable-length response to MCDI GET_BOARD_CFGBen Hutchings2-3/+6
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-09-19sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()Ben Hutchings1-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>
2012-09-19sfc: Add support for IEEE-1588 PTPStuart Hodgson11-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>
2012-09-19sfc: Fix maximum array sizes for various MCDI commandsBen Hutchings1-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>
2012-09-07sfc: Allow efx_mcdi_rpc to be called in two partsStuart Hodgson2-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>
2012-09-07sfc: Add channel specific receive_skb handler and post_remove callbackStuart Hodgson4-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>
2012-09-07sfc: Add explicit RX queue flag to channelStuart Hodgson3-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>
2012-08-31Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-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>
2012-08-24sfc: Fix the initial device operstateBen Hutchings1-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>
2012-08-24sfc: Assign efx and efx->type as early as possible in efx_pci_probe()Ben Hutchings1-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>
2012-08-24sfc: Remove bogus comment about MTU change and RX buffer overrunBen Hutchings1-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>
2012-08-24sfc: Remove overly paranoid locking assertions from netdev operationsBen Hutchings2-10/+0
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-08-24sfc: Fix reset vs probe/remove/PM races involving efx_nic::stateBen Hutchings1-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>
2012-08-24sfc: Improve log messages in case we abort probe due to a pending resetBen Hutchings1-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>
2012-08-24sfc: Never try to stop and start a NIC that is disabledBen Hutchings1-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>
2012-08-24sfc: Hold RTNL lock (only) when calling efx_stop_interrupts()Ben Hutchings1-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>
2012-08-24sfc: Keep disabled NICs quiescent during suspend/resumeBen Hutchings1-12/+16
Currently we ignore and clear the disabled state. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-08-24sfc: Hold the RTNL lock for more of the suspend/resume cycleBen Hutchings1-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>