summaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
Commit message (Collapse)AuthorAgeFilesLines
* r8169: fix missing loop variable incrementFrancois Romieu2008-01-121-1/+1
| | | | | | 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>
* [NET]: Fix drivers to handle napi_disable() disabling interrupts.David S. Miller2008-01-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* r8169 endiannessAl Viro2007-12-221-2/+2
| | | | | | | 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>
* r8169: prevent bit sign expansion error in mdio_writeFrancois Romieu2007-11-101-3/+3
| | | | | | | | | | | | | 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>
* r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (bis repetita)Mark Lord2007-11-101-16/+0
| | | | | | | | 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>
* r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (partly)Mark Lord2007-11-101-0/+1
| | | | | | | | | | | | 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>
* r8169: do not enable the TBI for the 8168 and the 81x0Francois Romieu2007-11-101-1/+2
| | | | | | | | | | | | 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>
* r8169: add PCI ID for the 8168 in the Abit Fatal1ty F-190HD motherboardCiaran McCreesh2007-11-101-0/+2
| | | | | | Signed-off-by: Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: remove poll_locked logicStephen Hemminger2007-10-281-8/+4
| | | | | | | | Disabling napi polling early is well enough. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: napi configStephen Hemminger2007-10-281-0/+4
| | | | | | | | | Don't call napi_disable if not configured and make sure that any misuse of napi_xxx in future fails with a compile error. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: more phy init for the 8168Francois Romieu2007-10-181-0/+34
| | | | | | | | Realtek's r8168 driver version 8.003.00 adds new init sequences (they do not appear in version 8.002.00). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: update the phy init for the 8168CFrancois Romieu2007-10-181-0/+2
| | | | | | | | | The values have been updated between version 8.002.00 and version 8.003.00 of Realtek's r8168 driver. This modification syncs the 8168C with version 8.003.00. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: phy init cleanupFrancois Romieu2007-10-181-7/+11
| | | | | | | Consistent use of hexadecimal. No change of behavior otherwise. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: phy init for the 8168Francois Romieu2007-10-181-0/+52
| | | | | | | | The values have been extracted from Realtek's r8168 driver version 8.002.00. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: make room for more phy init changesFrancois Romieu2007-10-181-25/+31
| | | | | | | | The code is reworked to easily add phy-dependant init changes. No change of behavior should be noticed. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: remove dead woodFrancois Romieu2007-10-181-64/+2
| | | | | Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: add MAC identifiersFrancois Romieu2007-10-181-23/+64
| | | | | | | | | | | | | | | | | | | | The identifiers have been extracted from Realtek's drivers: - version 8.002.00 of the r8168 driver - version 6.002.00 of the r8169 driver - version 1.002.00 of the r8101 driver 1. RTL_GIGA_MAC_VER_17 (8168Bf) is isolated from RTL_GIGA_MAC_VER_12 (8168Be) Both are still handled the same in rtl8169_set_speed_xmii and in rtl_set_rx_mode to avoid changes of behavior in this patch. 2. RTL_GIGA_MAC_VER_16 (8101Ec) is isolated from RTL_GIGA_MAC_VER_13 (8101Eb) Same thing as above with relation to rtl8169_set_speed_xmii, rtl_set_rx_mode and rtl_hw_start_8101. 3. The remaining new identifiers should not hurt. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: use the existing symbolic name of vendor PCI ID 0x1259Francois Romieu2007-10-181-1/+1
| | | | | Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: remove private net_device_stats structureFrancois Romieu2007-10-181-17/+17
| | | | | | | Use net_device_stats in the net_device structure. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: MSI supportFrancois Romieu2007-10-181-6/+44
| | | | | | | | | It is currently limited to the tested 0x8136 and 0x8168. 8169sb/8110sb ought to handle it as well where they support MSI. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw> Tester-Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
* r8169: convert bitfield to plain enum maskFrancois Romieu2007-10-181-3/+11
| | | | | Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: KERN_XXX vs PFX (trivial)Joe Perches2007-10-181-2/+2
| | | | | | | | Wrong ordering in printk. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: add KERN_DEBUG to dprintk (trivial)Joe Perches2007-10-181-2/+3
| | | | | | | | | - prefix dprintk with KERN_DEBUG - fix a bug with existing use of dprintk (PFX KERN_INFO PFX) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: endiannessAl Viro2007-10-101-13/+13
| | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* [netdrvr] Stop using legacy hooks ->self_test_count, ->get_stats_countJeff Garzik2007-10-101-3/+8
| | | | | | | These have been superceded by the new ->get_sset_count() hook. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* [ETHTOOL] Provide default behaviors for a few ethtool sub-ioctlsJeff Garzik2007-10-101-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | For the operations get-tx-csum get-sg get-tso get-ufo the default ethtool_op_xxx behavior is fine for all drivers, so we permit op==NULL to imply the default behavior. This provides a more uniform behavior across all drivers, eliminating ethtool(8) "ioctl not supported" errors on older drivers that had not been updated for the latest sub-ioctls. The ethtool_op_xxx() functions are left exported, in case anyone wishes to call them directly from a driver-private implementation -- a not-uncommon case. Should an ethtool_op_xxx() helper remain unused for a while, except by net/core/ethtool.c, we can un-export it at a later date. [ Resolved conflicts with set/get value ethtool patch... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* [NET]: Nuke SET_MODULE_OWNER macro.Ralf Baechle2007-10-101-1/+0
| | | | | | | | | | | | It's been a useless no-op for long enough in 2.6 so I figured it's time to remove it. The number of people that could object because they're maintaining unified 2.4 and 2.6 drivers is probably rather small. [ Handled drivers added by netdev tree and some missed IRDA cases... -DaveM ] Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* [NET]: Make NAPI polling independent of struct net_device objects.Stephen Hemminger2007-10-101-26/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several devices have multiple independant RX queues per net device, and some have a single interrupt doorbell for several queues. In either case, it's easier to support layouts like that if the structure representing the poll is independant from the net device itself. The signature of the ->poll() call back goes from: int foo_poll(struct net_device *dev, int *budget) to int foo_poll(struct napi_struct *napi, int budget) The caller is returned the number of RX packets processed (or the number of "NAPI credits" consumed if you want to get abstract). The callee no longer messes around bumping dev->quota, *budget, etc. because that is all handled in the caller upon return. The napi_struct is to be embedded in the device driver private data structures. Furthermore, it is the driver's responsibility to disable all NAPI instances in it's ->stop() device close handler. Since the napi_struct is privatized into the driver's private data structures, only the driver knows how to get at all of the napi_struct instances it may have per-device. With lots of help and suggestions from Rusty Russell, Roland Dreier, Michael Chan, Jeff Garzik, and Jamal Hadi Salim. Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra, Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan. [ Ported to current tree and all drivers converted. Integrated Stephen's follow-on kerneldoc additions, and restored poll_list handling to the old style to fix mutual exclusion issues. -DaveM ] Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* r8169: revert part of 6dccd16b7c2703e8bbf8bca62b5cf248332afbe2Francois Romieu2007-10-051-3/+13
| | | | | | | | | | | | | | | | The 8169/8110SC currently announces itself as: [...] eth0: RTL8169sc/8110sc at 0x........, ..:..:..:..:..:.., XID 18000000 IRQ .. ^^^^^^^^ It uses RTL_GIGA_MAC_VER_05 and this part of the changeset can cut its performance by a factor of 2~2.5 as reported by Timo. (the driver includes code just before the hunk to write the ChipCmd register when mac_version == RTL_GIGA_MAC_VER_0[1-4]) Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Timo Jantunen <jeti@welho.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
* r8169: workaround against ignored TxPoll writes (8168)Francois Romieu2007-09-191-0/+9
| | | | | | | | | | | | | | | | | | | | The 8168 ignores the requests to fetch the Tx descriptors when the relevant TxPoll bit is already set. It easily kills the performances of the 8168. David Gundersen has noticed that it is enough to wait for the completion of the DMA transfer (NPQ bit is cleared) before writing the TxPoll register again. The extra IO traffic added by the proposed workaround could be minimalized but it is not a high-priority task. Fix for: http://bugzilla.kernel.org/show_bug.cgi?id=7924 http://bugzilla.kernel.org/show_bug.cgi?id=8688 (http://bugzilla.kernel.org/show_bug.cgi?id=7555 ?) Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: David Gundersen <gundy@iinet.net.au> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: correct phy parameters for the 8110SCEdward Hsu2007-09-191-1/+4
| | | | | | | | | | | | The phys of the 8110SC (RTL_GIGA_MAC_VER_{05/06}) act abnormally in gigabit mode if they are applied the parameters in rtl8169_hw_phy_config which actually aim the 8110S/SB. It is ok to return early from rtl8169_hw_phy_config as it does not apply to the 8101 and 8168 families. Signed-off-by: Edward Hsu <edward_hsu@realtek.com.tw> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
* Merge branch 'r8169-for-jeff-20070806' of ↵Jeff Garzik2007-08-071-8/+16
|\ | | | | | | git://electric-eye.fr.zoreil.com/home/romieu/linux-2.6 into upstream-fixes
| * r8169: avoid needless NAPI poll schedulingFrancois Romieu2007-08-071-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | Theory : though needless, it should not have hurt. Practice: it does not play nice with DEBUG_SHIRQ + LOCKDEP + UP (see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=242572). The patch makes sense in itself but I should dig why it has an effect on #242572 (assuming that NAPI do not change in a near future). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
| * r8169: PHY power-on fixRoger So2007-08-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix extracted from Realtek's driver (8.002.00/20070713) for the PHY attached to 8111/8168b chipsets. The check against mac_version is just usual paranoia during the bugfix period of the kernel cycle. -- FR Tested on Asus M2A-VM motherboard by Roger So. No regression on my Asrock 945G DVI either (built-in 8168 + 2x8169). Signed-off-by: Roger So <roger.so@gmail.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* | [NET]: ethtool_perm_addr only has one implementationMatthew Wilcox2007-07-311-1/+0
|/ | | | | | | | | All drivers implement ethtool get_perm_addr the same way -- by calling the generic function. So we can inline the generic function into the caller and avoid going through the drivers. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: David S. Miller <davem@davemloft.net>
* drivers/*: mark variables with uninitialized_var()Jeff Garzik2007-07-171-1/+1
| | | | | | | | Mark variables in drivers/* with uninitialized_var() if such a warning appears, and analysis proves that the var is initialized properly on all paths it is used. Signed-off-by: Jeff Garzik <jeff@garzik.org>
* r8169: perform RX config change after mac filteringFrancois Romieu2007-07-081-1/+2
| | | | | | | | It does not really make sense to update the RX config register before the mac filtering registers. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: mac address change supportFrancois Romieu2007-07-081-0/+36
| | | | | | | | | | | Merged from Realtek's r8169-6.001 driver. I have added some locking to protect against the arp monitoring timer in the bonding driver. Accessing the configuration registers is otherwise performed under RTNL locking. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: display some extra debug information during startupFrancois Romieu2007-07-081-2/+4
| | | | | | | | It does not cost much and it will ease the identification of (so far) unknown devices. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: add endianess annotations to [RT]xDescRolf Eike Beer2007-07-081-6/+6
| | | | | | Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: align the IP header when there is no DMA constraintFrancois Romieu2007-07-081-3/+6
| | | | | | | | | | | | | | Align the IP header when the chipset can DMA at any location (plain 0x8169). Otherwise (0x8136/0x8168) obey the constraint imposed by the hardware. This patch complements the previous alignment rework done for copybreak. Original idea from Philip Craig <philipc@snapgear.com> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Philip Craig <philipc@snapgear.com> Cc: Mike Isely <isely@pobox.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: add bit description for the TxPoll registerFrancois Romieu2007-07-081-1/+6
| | | | | Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: cleanupFrancois Romieu2007-07-081-202/+145
| | | | | | | | | | | | | | | No functionnal change: - trim the old history log - whitespace/indent/case police - unsigned int where signedness does not matter - removal of obsolete assert - needless cast from void * (dev_instance) - remove dead code once related to power management - use netdev_alloc_skb. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Stephen Hemminger <shemminger@linux-foundation.org> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: remove the media optionFrancois Romieu2007-07-081-67/+5
| | | | | | | | | | | It has been documented as deprecated: - in MODULE_PARM_DESC since may 2005 ; - at the top of the source file and in printk since june 2004. Good bye. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: small 8101 commentFrancois Romieu2007-07-081-0/+4
| | | | | | | Extracted from version 1.001.00 of Realtek's r8101. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: confusion between hardware and IP header alignmentFrancois Romieu2007-07-081-7/+5
| | | | | | | | | | | | | The rx copybreak part is straightforward. The align field in struct rtl_cfg_info is related to the alignment requirements of the DMA operation. Its value is set at 2 to limit the scale of possible regression but my old v1.21 8169 datasheet claims a 8 bytes requirements (which never appeared in the driver, of course) and the 8101/8168 go with a plain 8 bytes alignment. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: merge with version 8.001.00 of Realtek's r8168 driverFrancois Romieu2007-07-081-30/+89
| | | | | | | | | | | | | | | | | This one includes: - more tweaks to rtl_hw_start_8168 - a work around for a Rx FiFO overflow issue on the 8168Bb - rtl8169_{intr_mask/napi_event} are replaced with per-device fields, namely tp->{intr/napi}_event - rtl_cfg_info is converted to C99 for readability but the values are not changed for the 8169/8110 and the 8101 Includes ChipCmd fix from Bernhard Walle <bwalle@suse.de> (2007/02/24). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: merge with version 6.001.00 of Realtek's r8169 driverFrancois Romieu2007-07-081-35/+55
| | | | | | | | | | | | | | | | | | | | | | | | | - new identifier for the 8110SCe - the PCI latency timer is set unconditionally. This part is identical in Realtek's r8168 (8.001.00) and r8101 (1.001.00) - initialization of the cache line size register is for the 8169s only - more magic in rtl_hw_start_8169 - it is not possible to factor out the setting of the the irq event mask with the 8168 and the 8101 any more. Pushed it into the hw_start handler. - rtl_set_rx_tx_config_registers() and write to the ChipCmd register are issued identically for the whole 8169/8110 family: the 8110SCd/8110SCe are handled the same way - work around for AMD platform. Some registers definitions in Realtek's driver are let aside for later. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: prettify mac_versionFrancois Romieu2007-07-081-10/+10
| | | | | | | ...still a bit yucky though. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
* r8169: populate the hw_start handler for the 8110Francois Romieu2007-07-081-9/+38
| | | | | | | | | | Same thing as the previous change for rtl_hw_start_8168. The 8101 related code in rtl_hw_start_8169 (see RTL_GIGA_MAC_VER_13) goes away. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
OpenPOWER on IntegriCloud