aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/r8169.c
AgeCommit message (Collapse)Author
2009-01-21net: Remove redundant NAPI functionsBen Hutchings
Following the removal of the unused struct net_device * parameter from the NAPI functions named *netif_rx_* in commit 908a7a1, they are exactly equivalent to the corresponding *napi_* functions and are therefore redundant. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-22net: Remove unused netdev arg from some NAPI interfaces.Neil Horman
When the napi api was changed to separate its 1:1 binding to the net_device struct, the netif_rx_[prep|schedule|complete] api failed to remove the now vestigual net_device structure parameter. This patch cleans up that api by properly removing it.. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-20netdev: add more functions to netdevice opsStephen Hemminger
This patch moves neigh_setup and hard_start_xmit into the network device ops structure. For bisection, fix all the previously converted drivers as well. Bonding driver took the biggest hit on this. Added a prefetch of the hard_start_xmit in the fast path to try and reduce any impact this would have. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-19r8169: convert to net_device_opsFrancois Romieu
Based upon a patch by Stephen Hemminger. Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-03drivers/net: Kill now superfluous ->last_rx stores.David S. Miller
The generic packet receive code takes care of setting netdev->last_rx when necessary, for the sake of the bonding ARP monitor. Drivers need not do it any more. Some cases had to be skipped over because the drivers were making use of the ->last_rx value themselves. Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-26r8169: revert "read MAC address from EEPROM on init"Francois Romieu
This reverts commit 7bf6bf4803df1adc927f585168d2135fb019c698. The code has both a short existence and an increasing track of failures despite some work to amend it for -rc1. It is not just a matter of reading the eeprom: sometimes the eeprom is read correctly, then the mac address is not written correctly back into the mac registers. Some chipsets seem to work reliably but it is not clear at this point if the code can simply be made to work on a per-chipset basis and post -rc1 is not the place where I want to experiment these things. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-22r8169: checks against wrong mac addresse initFrancois Romieu
Checking the signature of the eeprom and the validity of the MAC address should be enough to filter out the bad addresses observed so far. Contributed by Ivan Vecera and Martin Capitanio. Tested on 8102el, 8168b and 8169 for a start. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-22r8169: verbose mac address initFrancois Romieu
I prefer the debug information to be displayed until the issue is properly handled. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-12r8169: NULL pointer dereference on r8169 loadPetr Vandrovec
mmio_addr in r8169 needs to be initialized before use Maybe that all tp-> initialization should be moved before rtl_init_mac_address call, but this is enough to get rid of crash in rtl_rar_set due to mmio_addr being uninitialized. Signed-off-by: Petr Vandrovec <petr@vandrovec.name> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-10r8169: add shutdown handlerFrancois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: preliminary 8168d supportFrancois Romieu
Taken from Realtek's 8.007.00 r8168 driver. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Fixed-by: Ivan Vecera <ivecera@redhat.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: support additional 8168cp chipsetFrancois Romieu
Taken from Realtek's 8.007.00 r8168 driver. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Fixed-by: Ivan Vecera <ivecera@redhat.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: change default behavior for mildly identified 8168c chipsetsFrancois Romieu
The addition of a new device has so far implied a specialization of these masks. While they identify 8168c devices, they can be expected to be further refined as they have been by Realtek so far. The change should bring the driver closer to the version 8.006.00 of Realtek's 8168 driver. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: add a new 8168cp flavorFrancois Romieu
Taken from Realtek's 8.006.00 r8168 driver. I have left some bits related to jumbo frame aside for now. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: add a new 8168c flavor (bis)Francois Romieu
Taken from Realtek's 8.006.00 r8168 driver. I have left some bits related to jumbo frame aside for now. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: add a new 8168c flavorFrancois Romieu
Taken from Realtek's 8.006.00 r8168 driver. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: sync existing 8168 device hardware start sequences with vendor driverFrancois Romieu
This part of the driver should be reasonably in line with Realtek's 8.006.00 driver. I have left some bits related to jumbo frame and optional features aside for now. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: 8168b Tx performance tweakFrancois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: make room for more specific 8168 hardware start procedureFrancois Romieu
Broadly speaking the 8168c* share some common code which will be factored in __rtl_hw_start_8168cp. The 8168b* share some code too but it will be a bit different. Any change of behavior should be confined to the currently unidentified 8168 chipsets. They will not be applied the Tx performance tweak and will emit a warning instead. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: shuffle some registers handling around (8168 operation only)Francois Romieu
I can not argue strongly for (or against) a specific ordering on a purely technical ground but the patch avoids to swallow Realtek's changes in one big, hard-to-read gulp. Let aside the way the RxConfig register is written (see rtl_set_rx_tx_config_registers / RxConfig / rtl_set_rx_mode), this change brings the registers write ordering closer with Realtek's driver one (version 8.006.00) for the 8168 chipsets. More 8168 specific code which touches the Configx registers will be added in the section covered by Cfg9346_UnLock / Cfg9346_Lock. This code should not be the cause of regression for 810x and 8110 users. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: new phy init parameters for the 8168bFrancois Romieu
The new parameters are synced with Realtek's driver version 8.006.00. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: update phy init parametersFrancois Romieu
The modified parameters are synced with Realtek's driver version 8.006.00. The change should only be noticeable with some 8168c. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-10-10r8169: wake up the PHY of the 8168Francois Romieu
This is typically needed when some other OS puts the PHY to sleep due to the disabling of WOL options in the BIOS of the system. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Chiaki Ishikawa <chiaki.ishikawa@ubin.jp> Cc: Edward Hsu <edward_hsu@realtek.com.tw> Cc: RyanKao <ryankao@realtek.com.tw>
2008-10-09r8169: fix early spinlock useFrancois Romieu
rtl8169_init_one -> rtl_init_mac_address -> rtl_rar_set -> spin_lock_irq(&tp->lock); [...] -> spin_lock_init(&tp->lock); Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-08r8169: WoL fixes, part 2.Bruno Prémont
Since recent kernel (2.6.26 or 2.6.27) the PCI wakeup functions are influenced by generic device ability and configuration when enabling PCI-device triggered wake-up. This patch causes WoL setting to enable/disable device's wish to be permitted to wake-up the host when changing WoL options and also during device probing. Without this patch one has write 'enabled' to /sys/bus/pci/devices/0000:02:08.0/power/wakeup Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-08r8169: WoL fixes, part 1.Bruno Prémont
When probing the chip and handling it's power management settings also remember wether WoL feature is enabled. Without this patch one has to call ethtool to change WoL settings for this flag to be set and any WoL being enabled on suspend to RAM. Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-08r8169: read MAC address from EEPROM on initIvan Vecera
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-24drivers/net: replace __FUNCTION__ with __func__Harvey Harrison
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-09-24r8169: fix RxMissed register accessFrancois Romieu
- the register is defined for the 8169 chipset only and there is no 8169 beyond RTL_GIGA_MAC_VER_06. - only the lower 3 bytes of the register are valid Fixes: 1. http://bugzilla.kernel.org/show_bug.cgi?id=10180 2. http://bugzilla.kernel.org/show_bug.cgi?id=11062 (bits of) Tested by Hermann Gausterer and Adam Huffman. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-09-03Merge branch 'r8169-fixes' of ↵Jeff Garzik
git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6 into upstream-next
2008-08-27r8169: balance pci_map / pci_unmap pairFrancois Romieu
The leak hurts with swiotlb and jumbo frames. Fix http://bugzilla.kernel.org/show_bug.cgi?id=9468. Heavily hinted by Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Alistair John Strachan <alistair@devzero.co.uk> Tested-by: Timothy J Fontaine <tjfontaine@atxconsulting.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-08-17r8169: additional 8101 and 8102 supportFrancois Romieu
Signed-off-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-08-17r8169: add hw start helpers for the 8168 and the 8101Francois Romieu
This commit triggers three 'defined but not used' warnings but I prefer avoiding to tie these helpers to a specific change in the hw start sequences of the 8168 or of the 8101. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-08-17r8169: add 8168/8101 registers descriptionFrancois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-08-17r8169: use pci_find_capability for the PCI-E featuresFrancois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-08-17r8169: Tx performance tweak helperFrancois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-08-17r8169: get ethtool settings through the generic mii helperFrancois Romieu
It avoids to report unsupported link capabilities with the fast-ethernet only 8101/8102. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Martin Capitanio <martin@capitanio.org> Fixed-by: Ivan Vecera <ivecera@redhat.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-07-20r8169: avoid thrashing PCI conf space above RTL_GIGA_MAC_VER_06Marcus Sundberg
The magic write to register 0x82 will often cause PCI config space on my 8168 (PCI ID 10ec:8168, revision 2. mounted in an LG P300 laptop) to be filled with ones during driver load, and thus breaking NIC operation until reboot. If it does not happen on first driver load it can easily be reproduced by unloading and loading the driver a few times. The magic write was added long ago by this commit: Author: François Romieu <romieu@fr.zoreil.com> Date: Sat Jan 10 06:00:46 2004 -0500 [netdrvr r8169] Merge of changes done by Realtek to rtl8169_init_one(): - phy capability settings allows lower or equal capability as suggested in Realtek's changes; - I/O voodoo; - no need to s/mdio_write/RTL8169_WRITE_GMII_REG/; - s/rtl8169_hw_PHY_config/rtl8169_hw_phy_config/; - rtl8169_hw_phy_config(): ad-hoc struct "phy_magic" to limit duplication of code (yep, the u16 -> int conversions should work as expected); - variable renames and whitepace changes ignored. As the 8168 wasn't supported by that version this patch simply removes the bogus write from mac versions <= RTL_GIGA_MAC_VER_06. [The change above makes sense for the 8101/8102 too -- Ueimor] Signed-off-by: Marcus Sundberg <marcus@ingate.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2008-07-20r8169: multicast register updateFrancois Romieu
The layout of the 8101 series is identical to that of the 8168 one, thus allowing to pack everything not 8169 related above MAC_VER_06. New 810x and 8168 chipsets should automagically behave correctly. It matches code in Realtek's 1.008.00 8101 and 8.007.00 8168 drivers. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2008-06-29r8169: remove non-napi codeFrancois Romieu
It will almost unavoidably cause some breakage but it is long overdue. The driver identification string has been updated, a lost tabulation and some unused code have been removed. Otherwise the code paths should stay the same. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-06-29r8169: multicast register update (sync with Realtek's 8.004.00 8168 driver)Francois Romieu
The layout of the 8168 serie is different from that of the 8110 one. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2008-04-17r8169: fix oops in r8169_get_mac_versionIvan Vecera
r8169_get_mac_version crashes when it meets an unknown MAC due to tp->pci_dev not being set. Initialize it early. Signed-off-by: Ivan Vecera <ivecera@redhat.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2008-04-17r8169: fix past rtl_chip_info array size for unknown chipsetsRoel Kluin
'i' is unsigned. Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2008-01-12r8169: fix missing loop variable incrementFrancois Romieu
Spotted-by: Citizen Lee <citizen_lee@thecus.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-08[NET]: Fix drivers to handle napi_disable() disabling interrupts.David S. Miller
When we add the generic napi_disable_pending() breakout logic to net_rx_action() it means that napi_disable() can cause NAPI poll interrupt events to be disabled. And this is exactly what we want. If a napi_disable() is pending, and we are looping in the ->poll(), we want ->poll() event interrupts to stay disabled and we want to complete the NAPI poll ASAP. When ->poll() break out during device down was being handled on a per-driver basis, often these drivers would turn interrupts back on when '!netif_running()' was detected. And this would just cause a reschedule of the NAPI ->poll() in the interrupt handler before the napi_disable() could get in there and grab the NAPI_STATE_SCHED bit. The vast majority of drivers don't care if napi_disable() might have the side effect of disabling NAPI ->poll() event interrupts. In all such cases, when a napi_disable() is performed, the driver just disabled interrupts or is about to. However there were three exceptions to this in PCNET32, R8169, and SKY2. To fix those cases, at the subsequent napi_enable() points, I added code to ensure that the ->poll() interrupt events are enabled in the hardware. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Don Fry <pcnet32@verizon.net>
2007-12-22r8169 endiannessAl Viro
missing conversions in a couple of places Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-11-10r8169: prevent bit sign expansion error in mdio_writeFrancois Romieu
Oops. The current code does not like being given an u16 with the highest bit set as an argument to mdio_write. Let's enforce a correct range of values for both the register address and value (resp. 5 and 16 bits). The callers are currently left as-is. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2007-11-10r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (bis repetita)Mark Lord
RTL_GIGA_MAC_VER_17 breaks as well. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
2007-11-10r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (partly)Mark Lord
Various symptoms depending on the .config options: - the card stops working after some (short) time - the card does not work at all - the card disappears (nothing in lspci/dmesg) A real power-off is needed to recover the card. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2007-11-10r8169: do not enable the TBI for the 8168 and the 81x0Francois Romieu
The 8168c and the 8100e choke on it. I have not seen an indication nor received a report that the TBI is being actively used on the remaining 8168b and 8110. Let's disable it for now until someone complains. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Matthias Winkler <m.winkler@unicon-ka.de> Cc: Maarten Vanraes <maarten.vanraes@gmail.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>