summaryrefslogtreecommitdiff
path: root/drivers/net/r8169.c
AgeCommit message (Collapse)Author
2013-08-06Make firmware loading of R8169 optionalMursalin Akon
According to Realtek, the firmware provides power optimizations. The driver works without the firmware. Plus, there are scenarios where the firmware is not available, which makes the driver wait at request_firmware call (i.e., 60 sec wait). Bug 1236060 Bug 991551 Change-Id: Ifcaa4b2dd48c4111ded33cf2bade7dc1f6422821 Signed-off-by: Mursalin Akon <makon@nvidia.com> Reviewed-on: http://git-master/r/258353 GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2012-01-19Revert "Driver: net: r8169: Work around for cardhu dock (HACK)"Mursalin Akon
As we can program the Ethernet EEPROM, we do not need the NVIDIA hack anymore. This reverts commit a87ed2225d0367835c6ba0ad880f7b1049deaaa2. Bug 923832 Change-Id: I157315f65a9eb2df964dd07431ce52cc08adca6c Signed-off-by: Mursalin Akon <makon@nvidia.com> Reviewed-on: http://git-master/r/74074 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Eric Brower <ebrower@nvidia.com> Reviewed-by: Jong Kim <jongk@nvidia.com> Reviewed-by: Allen Martin <amartin@nvidia.com> Reviewed-on: http://git-master/r/75541 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com>
2012-01-04Driver: net: r8169: Work around for cardhu dock (HACK)Mursalin Akon
A work around for Ethernet adapter with EEPROM that has not been programmed. Change-Id: I24242d404bda951d740dfb5ebfeae8dd692524ab Signed-off-by: Mursalin Akon <makon@nvidia.com> Reviewed-on: http://git-master/r/70633 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Allen Martin <amartin@nvidia.com>
2011-10-19r8169: fix wrong eee setting for rlt8111evlhayeswang
Correct the wrong parameter for setting EEE for RTL8111E-VL. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-10-19r8169: fix driver shutdown WoL regression.françois romieu
Due to commit 92fc43b4159b518f5baae57301f26d770b0834c9 ("r8169: modify the flow of the hw reset."), rtl8169_hw_reset stomps during driver shutdown on RxConfig bits which are needed for WOL on some versions of the hardware. As these bits were formerly set from the r81{0x, 68}_pll_power_down methods, factor them out for use in the driver shutdown (rtl_shutdown) handler. I favored __rtl8169_get_wol() -hardware state indication- over RTL_FEATURE_WOL as the latter has become a good candidate for removal. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes <hayeswang@realtek.com> Tested-by: Marc Ballarin <ballarin.marc@gmx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-17r8169: do not enable the TBI for anything but the original 8169.Francois Romieu
The TBI bit in PHYStatus is reserved on anything but the oldest 8169. Nobody complained after I disabled it for the 8168 and the 810x (see 66ec5d4fb1ce6f0bd9df4bc4b758f0916d9f37ab). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes Wang <hayeswang@realtek.com>
2011-09-17r8169: remove erroneous processing of always set bit.Francois Romieu
When set, RxFOVF (resp. RxBOVF) is always 1 (resp. 0). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes <hayeswang@realtek.com>
2011-09-17r8169: fix WOL setting for 8105 and 8111evlHayes Wang
rtl8105, rtl8111E, and rtl8111evl need enable RxConfig bit 1 ~ 3 for supporting wake on lan. Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2011-09-17r8169: add MODULE_FIRMWARE for the firmware of 8111evlHayes Wang
Add MODULE_FIRMWARE for the firmware of RTL8111E-VL Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2011-09-17r8169: fix the reset setting for 8111evlHayes Wang
rtl8111evl should stop any TLP requirement before resetting by enabling register 0x37 bit 7. Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2011-08-02r8169 : MAC address change fix for the 8168e-vl.françois romieu
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=39252 Hayes suggested that the usual MAC{0, 4} register writes be completed with writes to extended GigaMAC registers : - 0xe0 .. 0xe5 - 0xf2 .. 0xf7 Registers 0xf0 and 0xf1 should be set to 0. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-28r8169: Add support for D-Link 530T rev C1 (Kernel Bug 38862)Lennart Sorensen
The D-Link DGE-530T rev C1 is a re-badged Realtek 8169 named DLG10028C, unlike the previous revisions which were skge based. It is probably the same as the discontinued DGE-528T (0x4300) other than the PCI ID. The PCI ID is 0x1186:0x4302. Adding it to r8169.c where 0x1186:0x4300 is already found makes the card be detected and work. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=38862 Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-25Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits) fs: Merge split strings treewide: fix potentially dangerous trailing ';' in #defined values/expressions uwb: Fix misspelling of neighbourhood in comment net, netfilter: Remove redundant goto in ebt_ulog_packet trivial: don't touch files that are removed in the staging tree lib/vsprintf: replace link to Draft by final RFC number doc: Kconfig: `to be' -> `be' doc: Kconfig: Typo: square -> squared doc: Konfig: Documentation/power/{pm => apm-acpi}.txt drivers/net: static should be at beginning of declaration drivers/media: static should be at beginning of declaration drivers/i2c: static should be at beginning of declaration XTENSA: static should be at beginning of declaration SH: static should be at beginning of declaration MIPS: static should be at beginning of declaration ARM: static should be at beginning of declaration rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check Update my e-mail address PCIe ASPM: forcedly -> forcibly gma500: push through device driver tree ... Fix up trivial conflicts: - arch/arm/mach-ep93xx/dma-m2p.c (deleted) - drivers/gpio/gpio-ep93xx.c (renamed and context nearby) - drivers/net/r8169.c (just context changes)
2011-07-22r8169: use pci_dev->subsystem_{vendor|device}Sergei Shtylyov
The driver reads PCI subsystem IDs from the PCI configuration registers while they are already stored by the PCI subsystem in the 'subsystem_{vendor|device}' fields of 'struct pci_dev'... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-07-21treewide: fix potentially dangerous trailing ';' in #defined values/expressionsPhil Carmody
All these are instances of #define NAME value; or #define NAME(params_opt) value; These of course fail to build when used in contexts like if(foo $OP NAME) while(bar $OP NAME) and may silently generate the wrong code in contexts such as foo = NAME + 1; /* foo = value; + 1; */ bar = NAME - 1; /* bar = value; - 1; */ baz = NAME & quux; /* baz = value; & quux; */ Reported on comp.lang.c, Message-ID: <ab0d55fe-25e5-482b-811e-c475aa6065c3@c29g2000yqd.googlegroups.com> Initial analysis of the dangers provided by Keith Thompson in that thread. There are many more instances of more complicated macros having unnecessary trailing semicolons, but this pile seems to be all of the cases of simple values suffering from the problem. (Thus things that are likely to be found in one of the contexts above, more complicated ones aren't.) Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-07-19r8169: fix sticky accepts packet bits in RxConfig.Francois Romieu
e542a2269f232d61270ceddd42b73a4348dee2bb (r8169: adjust the RxConfig settings) broke the return from promiscuous mode to physical address match mode. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Signed-off-by: Hayes Wang <hayeswang@realtek.com>
2011-07-14r8169: adjust the RxConfig settings.Hayes Wang
Set the init value before reset in probe function. And then just modify the relative bits and keep the init settings. For 8110S, 8110SB, and 8110SC series, the initial value of RxConfig needs to be set after the tx/rx is enabled. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: don't enable rx when shutdown.Hayes Wang
Only 8111b needs to enable rx when shutdowning with WoL. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: fix wake on lan setting for non-8111E.Hayes Wang
Only 8111E needs enable RxConfig bit 0 ~ 3 when suspending or shutdowning for wake on lan. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: support RTL8111E-VL.Hayes Wang
Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: add ERI functions.Hayes Wang
Add the ERI functions which would be used by the new chips. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: modify the flow of the hw reset.Hayes Wang
- Disable tx and rx by resetting hw, so replace rtl8169_asic_down with rtl8169_hw_reset. - RxConfig bits 0 ~ 5 have to be cleared before hw reset to avoid receiving spurious data. - Certain chips need to do some checking before reset. - Remove hw reset which is done before hw_start. It is done in close, down or device probe functions. - Move rtl8169_init_ring_indexes function into rtl_hw_reset function. The indexes of tx and rx only need to be zero when the hw resets. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-14r8169: adjust some registers.Hayes Wang
Define new registers and modify some existing ones. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
2011-07-05Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
2011-06-27r8169: remove unnecessary read of PCI_CAP_ID_EXPJon Mason
The PCIE capability offset is saved during PCI bus walking. Use the value from pci_dev instead of checking in the driver and saving it off the the driver specific structure. Also, it will remove an unnecessary search in the PCI configuration space if this value is referenced instead of reacquiring it. Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-24r8169: fix wrong register use.Francois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-06-20Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/wireless/iwlwifi/iwl-agn-rxon.c drivers/net/wireless/rtlwifi/pci.c net/netfilter/ipvs/ip_vs_core.c
2011-06-18r8169: check firmware content sooner.Francois Romieu
Firmware checking is only performed when the firmware is loaded instead of each time the driver inits the phy. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2011-06-18r8169: support new firmware format.Hayes Wang
The new firmware format adds versioning as firmware for a specific chipset appears to be subject to change. Current "legacy" format is still supported. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2011-06-18r8169: explicit firmware format check.Francois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2011-06-18r8169: move the firmware down into the device private data.Francois Romieu
No functional difference. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2011-06-17r8169: fix static initializers.Francois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
2011-06-06net: remove interrupt.h inclusion from netdevice.hAlexey Dobriyan
* remove interrupt.g inclusion from netdevice.h -- not needed * fixup fallout, add interrupt.h and hardirq.h back where needed. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-22Add appropriate <linux/prefetch.h> include for prefetch usersPaul Gortmaker
After discovering that wide use of prefetch on modern CPUs could be a net loss instead of a win, net drivers which were relying on the implicit inclusion of prefetch.h via the list headers showed up in the resulting cleanup fallout. Give them an explicit include via the following $0.02 script. ========================================= #!/bin/bash MANUAL="" for i in `git grep -l 'prefetch(.*)' .` ; do grep -q '<linux/prefetch.h>' $i if [ $? = 0 ] ; then continue fi ( echo '?^#include <linux/?a' echo '#include <linux/prefetch.h>' echo . echo w echo q ) | ed -s $i > /dev/null 2>&1 if [ $? != 0 ]; then echo $i needs manual fixup MANUAL="$i $MANUAL" fi done echo ------------------- 8\<---------------------- echo vi $MANUAL ========================================= Signed-off-by: Paul <paul.gortmaker@windriver.com> [ Fixed up some incorrect #include placements, and added some non-network drivers and the fib_trie.c case - Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-05-09r8169: avoid late chip identifier initialisation.Francois Romieu
Unknown 8168 chips did not have any PLL power method set as they did not inherit a default family soon enough. Fix it. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: merge firmware information into the chipset description data.Francois Romieu
- RTL_GIGA_MAC_NONE is a fake index so put it at the end of the enumeration and shift everybody. - RTL_GIGA_MAC_VER_17 / RTL_GIGA_MAC_VER_16 ordering fixed. Though not wrong it was confusing enough to wonder if things were right. Renaming rtl_chip_info was not strictly necessary. It allows to check the patch for the correct use of the indexes though. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: provide some firmware information via ethtool.Francois Romieu
There is no real firmware version yet but the manpage of ethtool is rather terse about the driver information. Former output: $ ethtool -i eth1 driver: r8169 version: 2.3LK-NAPI firmware-version: bus-info: 0000:01:00.0 $ ethtool -i eth0 driver: r8169 version: 2.3LK-NAPI firmware-version: bus-info: 0000:03:00.0 Current output: $ ethtool -i eth1 driver: r8169 version: 2.3LK-NAPI firmware-version: N/A bus-info: 0000:01:00.0 $ ethtool -i eth0 driver: r8169 version: 2.3LK-NAPI firmware-version: rtl_nic/rtl8168d-1.fw bus-info: 0000:03:00.0 Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Fixed-by Ciprian Docan <docan@eden.rutgers.edu> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com> Cc: Fejes József <fejes@joco.name> Cc: Borislav Petkov <borislav.petkov@amd.com>
2011-05-09r8169: remove non-NAPI context invocation of rtl8169_rx_interrupt.Francois Romieu
Invocation of rtl8169_rx_interrupt from rtl8169_reset_task was originally intended to retrieve as much packets as possible from the rx ring when a reset was needed. Nowadays rtl8169_reset_task is only scheduled, with some delay a. from the tx timeout watchdog b. when resuming c. from rtl8169_rx_interrupt itself It's dubious that the loss of outdated packets will matter much for a) and b). c) does not need to call itself again. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: link speed selection timer rework.Francois Romieu
The implementation was a bit krusty. The 10s rtl8169_phy_timer timer has been (was ?) required with older 8169 for adequate phy operation when full gigabit is advertised in autonegotiated mode. The timer does nothing if the link is up. Otherwise it keeps resetting the phy until things improve. - the device private data field phy_1000_ctrl_reg was used to schedule the timer. Avoid it and save a few bytes. - rtl8169_set_settings pending timer is disabled before changing the link settings as rtl8169_phy_timer is not always needed (see the removed test in rtl8169_phy_timer). - rtl8169_set_speed the requested link parameters may not match the chipset : bail out early on failure. - rtl8169_open Calling rtl8169_request_timer is redundant with -> rtl8169_open -> rtl8169_init_phy -> rtl8169_set_speed -> mod_timer The latter always enables the phy timer whereas the former did not for RTL_GIGA_MAC_VER_01. It should not make things worse but only time will tell if reality agrees. - rtl8169_request_timer : unused yet. Removed. - rtl8169_delete_timer : useless. Bloat. Removed. Side effect : the timer may kick in if the TBI is enabled. I do not know if the TBI has ever been used in real life. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: rtl8169_set_speed_xmii cleanup.Francois Romieu
Shorten chipset version test. No functional change. Careful readers will notice that the 'supports_gmii' flag is deduced from the device PCI id. Though less specific than the chipset related RTL_GIGA_MAC_VER_XY, it is good enough to detect a GMII deprieved 810x. Some features push for a device specific configuration (improved jumbo frame support for instance). 'supports_gmii' will follow this path if / when the device PCI id test stops working. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: remove some code duplication.Francois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-05-09r8169: style cleanups.Francois Romieu
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-04-29ethtool: cosmetic: Use ethtool ethtool_cmd_speed APIDavid Decotigny
This updates the network drivers so that they don't access the ethtool_cmd::speed field directly, but use ethtool_cmd_speed() instead. For most of the drivers, these changes are purely cosmetic and don't fix any problem, such as for those 1GbE/10GbE drivers that indirectly call their own ethtool get_settings()/mii_ethtool_gset(). The changes are meant to enforce code consistency and provide robustness with future larger throughputs, at the expense of a few CPU cycles for each ethtool operation. All drivers compiled with make allyesconfig ion x86_64 have been updated. Tested: make allyesconfig on x86_64 + e1000e/bnx2x work Signed-off-by: David Decotigny <decot@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-04-29ethtool: Use full 32 bit speed range in ethtool's set_settingsDavid Decotigny
This makes sure the ethtool's set_settings() callback of network drivers don't ignore the 16 most significant bits when ethtool calls their set_settings(). All drivers compiled with make allyesconfig on x86_64 have been updated. Signed-off-by: David Decotigny <decot@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-04-27r8169: fix merge conflict fix.Francois Romieu
- use adequate MAC_VER id (see 01dc7fec4025f6bb72b6b98ec88b375346b6dbbb) - remove duplicate rtl_firmware_info record - remove duplicate functions Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-04-26Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Resolved logic conflicts causing a build failure due to drivers/net/r8169.c changes using a patch from Stephen Rothwell. Signed-off-by: David S. Miller <davem@davemloft.net>
2011-04-24r8169: don't request firmware when there's no userspace.François Romieu
The firmware is cached during the first successfull call to open() and released once the network device is unregistered. The driver uses the cached firmware between open() and unregister_netdev(). So far the firmware is optional : a failure to load the firmware does not prevent open() to success. It is thus necessary to 1) unregister all 816x / 810[23] devices and 2) force a driver probe to issue a new firmware load. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Fixed-by: Ciprian Docan <docan@eden.rutgers.edu> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
2011-04-18r8169: TSO fixes.Francois Romieu
- the MSS value is actually contained in a 11 bits wide (0x7ff) field. The extra bit in the former MSSMask did encompass the TSO command bit ("LargeSend") as well (0xfff). Oops. - the Tx descriptor layout is not the same through the whole chipset family. The 8169 documentation, the 8168c documentation and Realtek's drivers (8.020.00, 1.019.00, 6.014.00) highlight two layouts: 1. 8169, 8168 up to 8168b (included) and 8101 2. {8102e, 8168c} and beyond - notwithstanding the "first descriptor" and "last descriptor" bits, the same Tx descriptor content is enforced when a packet consists of several descriptors. The chipsets are documented to require it. Credits go to David Dillow <dave@thedillows.org> for the original patch. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Realtek <nic_swsd@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-04-10net: r8169: convert to hw_featuresMichał Mirosław
Simple conversion with a bit of needed cleanup. This also fixes: - confusion around vlan_features in rtl8169_vlan_mode(), - problem with broken TSO for too big MTU (the limit is set at 0xFFF --- max MSS field value). SG+IP_CSUM+TSO is left disabled by default, based on suggestion by David Dillow. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-03-30net/r8169: support RTL8168Ehayeswang
Support RTL8168E/RTL8111E. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>