summaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon.c
Commit message (Collapse)AuthorAgeFilesLines
* sfc: Use generic MDIO functions and definitionsBen Hutchings2009-04-301-100/+37Star
| | | | | | | | | | | Make use of the newly-added generic MDIO clause 45 support and remove redundant definitions. Add an 'efx_' prefix to the remaining driver-specific MDIO functions and remove arguments which are redundant with efx->mdio.prtad. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Use correct macro to set event bitfieldBen Hutchings2009-04-151-2/+2
| | | | | | | | | | | falcon_sim_phy_event() used EFX_OWORD_FIELD, which operates on bitfields in 128-bit values, on an event, which is a 64-bit value. This should be harmless - these macros always use little-endian ordering, so it would read and write back the following 8 bytes unchanged - but it is obviously wrong. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2Ingo Molnar2009-03-271-12/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: arch/parisc/kernel/irq.c arch/x86/include/asm/fixmap_64.h arch/x86/include/asm/setup.h kernel/irq/handle.c Semantic merge: arch/x86/include/asm/fixmap.h Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * falcon fix compilation warningsJaswinder Singh Rajput2009-02-111-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | drivers/net/sfc/falcon.c: In function ‘falcon_alloc_special_buffer’: drivers/net/sfc/falcon.c:340: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 10 has type ‘phys_addr_t’ drivers/net/sfc/falcon.c: In function ‘falcon_free_special_buffer’: drivers/net/sfc/falcon.c:355: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 10 has type ‘phys_addr_t’ drivers/net/sfc/falcon.c: In function ‘falcon_probe_port’: drivers/net/sfc/falcon.c:2346: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 7 has type ‘phys_addr_t’ drivers/net/sfc/falcon.c: In function ‘falcon_probe_nic’: drivers/net/sfc/falcon.c:2924: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 7 has type ‘phys_addr_t’ Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* | sfc: Implement adaptive IRQ moderationBen Hutchings2009-03-221-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Calculate a score for each 1000 IRQs: - TX completions are worth 1 point - RX completions are worth 4 if merged using LRO or 2 otherwise Reduce moderation if the score is less than 10000, down to a minimum of 5 us. Increase moderation if the score is more than 20000, up to the specified maximum. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Remove unused private PCI register definitionsBen Hutchings2009-03-221-7/+0Star
| | | | | | | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Work around unreliable legacy interrupt statusBen Hutchings2009-03-221-12/+14
| | | | | | | | | | | | | | | | | | | | | | In rare cases, reading the legacy interrupt status register can acknowledge an event queue whose attention flag has not yet been set in the register. Until we service this event queue it will not generate any more interrupts. Therefore, as a secondary check, poll the next slot in each active event queue whose flag is not set. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Improve NIC internal error recoveryBen Hutchings2009-03-051-4/+19
| | | | | | | | | | | | | | | | | | Make the error count a per-NIC variable. Reset this the count after an hour if it has not reached the critical value. Set the critical value back to 5. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Fix search for flush completion eventsBen Hutchings2009-03-051-12/+9Star
| | | | | | | | | | | | | | | | | | | | | | When flushing queues we disable normal interrupt and event handling and poll event queue 0 looking for flush completions. Unfortunately the flush event polling loop fails to move past any other type of event. This problem has not been observed in production hardware but appears to be a possibility. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Clear I2C adapter structure in falcon_remove_nic()Ben Hutchings2009-03-051-0/+2
| | | | | | | | | | | | | | | | | | i2c_del_adapter() leaves dangling pointers in the structure. If we retry the NIC probe and pass the structure to i2c_add_adapter() again it will lead to an oops unless we clear it first. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | sfc: Add support for QT2025C PHYBen Hutchings2009-03-021-0/+1
|/ | | | | | | | | This is a new PHY supporting SFP+ modules, used in the SFN4112F reference design. It is similar to the QT2022C2 and shares much of its support code. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Replace stats_enabled flag with a disable countBen Hutchings2009-01-301-4/+11
| | | | | | | | | | | Currently we use a spin-lock to serialise statistics fetches and also to inhibit them for short periods of time, plus a flag to enable/disable statistics fetches for longer periods of time, during online reset. This was apparently insufficient to deal with the several reasons for stats being disabled. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Fix post-reset MAC selectionSteve Hodgson2009-01-301-7/+8
| | | | | | | | | Modify falcon_switch_mac() to always set NIC_STAT_REG, even if the the MAC is the same as it was before. This ensures that the value is correct after an online reset. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: SFX7101: Remove workaround for bad link trainingSteve Hodgson2009-01-301-4/+0Star
| | | | | | | | | | | | Early versions of the SFX7101 firmware could complete link training in a state where it would not adequately cancel noise (Solarflare bug 10750). We previously worked around this by resetting the PHY after seeing many Ethernet CRC errors. This workaround is unsafe since it takes no account of the interval between errors; it also appears to be unnecessary with production firmware. Therefore remove it. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: sfc: Use pci_clear_master() to disable bus masteringBen Hutchings2009-01-071-2/+2
| | | | | | | | | | pci_disable_device() disables many features, like MSI-X, which we never reenable in efx_reset(). Further, calls to pci_enable_device() and pci_disable_device() must be matched since the nesting count was introduced, so switch to using pci_clear_master() instead. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
* sfc: Use kzalloc() to ensure struct efx_spi_device is fully initialisedBen Hutchings2008-12-131-1/+1
| | | | | | | Currently the mtd field is not initialised early enough. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Use model numbers for PHY type namesBen Hutchings2008-12-131-1/+1
| | | | | | | | | | Some of the PHY type names are overly generic. Change them to include the model numbers of the PHYs they represent. Correct the model number reference at the top of xfp_phy.c. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Remove leading spacesBen Hutchings2008-12-131-2/+2
| | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Add support for SFN4111TBen Hutchings2008-12-131-0/+7
| | | | | | | | Add support code for the SFN4111T 100/1000/10GBASE-T reference design, based in part on the existing code for the SFE4001. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Add support for Solarflare 10Xpress SFT9001Ben Hutchings2008-12-131-3/+7
| | | | | | | | | | | | Add type codes for the new PHY and rename the SFX7101 type code. Add definition of clause 22 extension MMD. Adapt the 10Xpress SFX7101 code to support the SFT9001 as well. Clean up register definitions. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Rework MAC, PHY and board event handlingBen Hutchings2008-12-131-11/+9Star
| | | | | | | | | | | From: Steve Hodgson <shodgson@solarflare.com> MAC, PHY and board events may be separately enabled and signalled. Our current arrangement of chaining the polling functions can result in events being missed. Change them to be more independent. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Implement auto-negotiationBen Hutchings2008-12-131-3/+3
| | | | | | | | | | | | Add infrastructure for auto-negotiation of speed, duplex and flow control. When using 10Xpress, auto-negotiate flow control. While we're at it, clean up the code to warn when partner is not 10GBASE-T capable. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Add support for sub-10G speedsBen Hutchings2008-12-131-38/+141
| | | | | | | | | | | | | The SFC4000 has a separate MAC for use at sub-10G speeds. Introduce an efx_mac_operations structure with implementations for the two MACs. Switch between the MACs as necessary. PHY settings are independent of the MAC, so add get_settings() and set_settings() to efx_phy_operations. Also add macs field to indicate which MACs the PHY is connected to. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Remove MII extension cruftBen Hutchings2008-12-131-9/+7Star
| | | | | | | | | | Replace efx_nic::link_options bitfield with link_speed (speed in Mbit/s) and link_fd (full duplex flag). Remove broken auto-negotiation functions. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Don't count RX checksum errors during loopback self-testBen Hutchings2008-12-131-5/+8
| | | | | | | | | The loopback self-test checks that IP packets with incorrect checksums are not altered when sent on a queue with checksum generation off. These should not contribute to RX error statistics. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Provide hints to irqbalance daemonBen Hutchings2008-12-131-1/+1
| | | | | | | | Allocate IRQs with the name format <device>[-<type>]-<number> so that future versions of irqbalanced understand what we're doing. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Work around unreliable strap pinsBen Hutchings2008-12-131-70/+44Star
| | | | | | | | | | | The SFC4000 has strap pins indicating the presence of SPI flash and/or EEPROM. These pins are also used for GPIO, and in some cases they may be read wrongly at reset. However, on production boards it must boot from one or the other device, so we can assume the boot device is present and read the board config from there. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Clean up waits for flash/EEPROM operationsBen Hutchings2008-12-131-21/+37
| | | | | | | | | | | | | | | | | | | | Make falcon_spi_wait() ignore the write timer - it is only relevant to write commands, it only works for the device that contains VPD, and it might not be initialised properly at all. Rename falcon_spi_fast_wait() to falcon_spi_wait_write(), reflecting its use, and make it wait up to 10 ms (not 1 ms) since buffered writes to EEPROM may take this long to complete. Make both wait functions sleep instead of busy-waiting. Replace wait for command completion at top of falcon_spi_cmd() with a single poll; no command should be running when the function starts. Correct some comments. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Remove unneeded register writeBen Hutchings2008-12-131-9/+0Star
| | | | | | | This was only ever needed for an FPGA version of Falcon. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Change SPI lengths to type size_tBen Hutchings2008-12-131-9/+10
| | | | | | | Based on a patch by Andrew Morton. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* sfc: Expose flash region storing boot code as MTDBen Hutchings2008-11-061-5/+12
| | | | | | | | | The boot code that appears as a PCI expansion ROM on the SFC4000 is stored in flash. Expose this as a standard MTD device to allow for in-place upgrades. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Clean up non-volatile memory partitioningBen Hutchings2008-11-061-3/+3
| | | | | | | | | | Move flash and EEPROM partition boundary constants into spi.h and rename them to be consistent. Add a comment on the partitioning. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Fix type of FALCON_SPI_MAX_LENBen Hutchings2008-09-251-1/+1
| | | | | | | | | | FALCON_SPI_MAX_LEN has type size_t while other SPI lengths have type unsigned int. This results in warnings from min() on 64-bit architectures where they are different. Add a cast to make it match. From: Steve Hodgson <shodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Disable interrupts after a fatal interrupt occurs until resetBen Hutchings2008-09-251-1/+2
| | | | | | | | This should avoid an interrupt storm, which has been observed in the field with one faulty board. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Insert read memory barrier after checking MAC statistics flagBen Hutchings2008-09-251-1/+3
| | | | | | | | | This prevents speculative reading of the statistics before the completion flag. From: Neil Turton <nturton@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Make queue flushes more reliableBen Hutchings2008-09-251-118/+129
| | | | | | | | | | | | | | Increase the potential retry count for RX flushes from 5 to 100. Stop polling the RX_DESC_PTR_TBL to infer that a flush might have happened. Instead absolutely rely on the flush events, unless bug 7803 applies (Falcon rev A only). To keep things quick, request flushes for every TX and RX queue up front, and match up the events to requests. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Don't use EFX_OWORD_FIELD on an event (64-bit, quad-word)Steve Hodgson2008-09-251-1/+1
| | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Add check for memory allocation failure in falcon_probe_nic()Ben Hutchings2008-09-251-0/+2
| | | | | Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Extend self-testsBen Hutchings2008-09-031-23/+175
| | | | | | | | | | | | | Include PMA/PMD in loopback self-tests as intended. Add NVRAM checksum validation and include it in self-tests. Add register self-tests. Run PHY self-tests where available. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Remove some unreachable error pathsBen Hutchings2008-09-031-23/+7Star
| | | | | | | | Some functions return an error code which is always 0. Change their return types to void and simplify their callers accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Cleanup RX event processingBen Hutchings2008-09-031-18/+12Star
| | | | | | | | | | | | | Make efx_process_channel() and falcon_process_eventq() return the number of packets received rather than updating the quota, consistent with new NAPI. Since channels and RX queues are mapped one-to-one, remove return value from falcon_handle_rx_event() and add a warning for events with the wrong RX queue number. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Remove efx_channel::evqnum fieldBen Hutchings2008-09-031-7/+7
| | | | | | | It is redundant with efx_channel::channel. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Remove initialisation of RX_FILTER_CTL_REG.NUM_KERBen Hutchings2008-09-031-7/+2Star
| | | | | | | | We have long since given up doing RSS on Falcon A1 and therefore we would always write the default value of 0. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Cleanup RX queue informationBen Hutchings2008-09-031-2/+2
| | | | | | | | | Rename efx_nic::rss_queues to the more obvious n_rx_queues Remove efx_rx_queue::used and other stuff that's redundant with it. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Remove efx_channel::has_interruptBen Hutchings2008-09-031-4/+4
| | | | | | | | | efx_channel::has_interrupt is redundant with efx_channel::used_flags. Remove efx_test_eventq() because it is now obviously unreachable. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Export boot configuration in EEPROM through ethtoolBen Hutchings2008-09-031-48/+310
| | | | | | | Extend the SPI device setup code to support this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Removed forced inlining of long functionsBen Hutchings2008-09-031-4/+4
| | | | | | | | | gcc will automatically inline static functions with only one caller, and may inline other functions depending on the kernel configuration and size of the intermediate code. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Use explicit bool for boolean variables, parameters and return valuesBen Hutchings2008-09-031-24/+26
| | | | | | | | | | | | Replace (cond ? 1 : 0) with cond or !!cond as appropriate, and (cond ? 0 : 1) with !cond. Remove some redundant boolean temporaries. Rename one field that looks like a flag but isn't. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Reverse the XOFF/XON pause frame control fifo thresholdsBen Hutchings2008-09-031-2/+2
| | | | | | | | These were clearly bogus. From: Steve Hodgson <shodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
* sfc: Remove mistaken hardware workaroundBen Hutchings2008-09-031-61/+4Star
| | | | | | | | We believed that some valid SNAP frames were being marked as invalid. In fact this is not the case and no workaround is needed. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>