Linux and the RealTek RTL8129/8139 Chips

This page contains information on using Linux with the Realtek RTL8129 and RTL8139 Fast Ethernet Controllers for PCI. The master copy of this page resides on the CESDIS WWW server.

The Linux driver for the RealTek RTL8129/8139 is available from this web page.

This driver was written to support the Beowulf cluster project at CESDIS. For Beowulf-specific information, read the Beowulf project description.

This driver is for the RealTek 8129 and 8139 chips only. The 8019 and 8029 chips are unrelated designs. They are PCI NE2000 clones, and are supported by updates to the NE2000 driver available from the Linux PCI NE2000 update page.

Usage instructions

Read the Network Drivers as Modules page for instructions. You should, of course, substitute the "rtl8139.c" as the driver file name.


Programming info:Online information is available at http://www.realtek.com.tw/cn/cn.html

Support

Support for the RTL8139 driver is handled through the mailing lists linux-realtek@beowulf.gsfc.nasa.gov for bug reports and problems, and linux-realtek-announce@beowulf.gsfc.nasa.gov for news and general information. Do not use the -announce mailing list for questions!

To subscribe or unsubscribe to a list, send a message with the contents "subscribe" (or "unsubscribe") to the list name with an appended "-request" e.g.:

echo subscribe | /bin/mail linux-realtek-announce-request@beowulf.gsfc.nasa.gov to get on the low-volume information list, and echo subscribe | /bin/mail linux-realtek-request@beowulf.gsfc.nasa.gov if you want to know more about bugs and driver development.

The most recent testing version may be available from ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/test/rtl8139.c. If this link is invalid, the released version is the most recent publically available driver.

Diagnotic program

Two diagnostic programs are available, mii-diag and rtl8139-diag. Full documentation is available from the Network Adapter Diagnostic page.

The MII diagnostic program allows examining the link status and configuring the transceiver.

The RTL8139-specific diagnostic program is used to examine the device registers, EEPROM values, and MII transceiver management registers. The command for compiling this program is at the bottom of the source file. This program may optionally be compiled with an additional MII register diagnostic library by using the following compile command:

  cc -o rtl8139-diag -O -DLIBMII rtl8139-diag.c libmii.c

Driver Operation and Comments

The RTL8129 series is a low-cost design, and thus should be considered a "connectivity solution" rather a performance-oriented product.

The RTL8139 series improves on the integration and feature set, adding advanced features such as 802.3x Flow Control and incorporating the transceiver onto a single chip. The data transfer engine remains the same, with much improved PCI burst performance in the B and C versions.

While the chip is a bus master, it's not a descriptor-based bus master. The receive side transfers packets into a single linear ring (compile-time selectable as 8KB, 16KB, 32KB or 64KB) in host memory. The driver immediately copies the packets from the ring to newly-allocated buffers ("skbuffs"). Most other Fast Ethernet designs use a descriptor-based architecture, which allows packets the chip to transfer directly into pre-allocated maximum-sized skbuffs. The driver then optionally copies only tiny packets into smaller-sized skbuffs.

On the transmit side four register sets hold the address and size of the packets to be transmitted. While this results in a rather small, fixed-size transmit queue, four entries is adequate for full performance in most environments.

The transmit performance loss comes from an initially undocumented (yes, that means it took many hours to find) word-alignment requirement of the current chip. Linux cache-aligns the IP header and following payload data when constructing a packet. When the 14 byte Ethernet header is prepended, the complete packet is 2-byte aligned, but not 4-byte aligned. The result is that all IP packets must be copied to an alignment buffer before being queued for transmit.

RTL8129/RTL8139 Multicast Support

The RTL chips can match a single unicast address (their own station address) and support a 64 slot statistical (aka hash) filter for initial filtering of unwanted multicast packets. This filter functionality appears to be implemented the "usual" way: taking the CRC intermediate result just after destination address arrives, and using six bits as the index into a table of which multicast packets are acceptable.

Compatibility, Errata and Bugs

The driver has been tested with

but not with all combinations of each.

If you encounter Rx overflow errors and transmit timeouts you may have the card in a non-bus-master slot. Other possible problems are older PCI implementations, especially i486-class motherboards, that have bugs when using long PCI burst transfers.

Cards using RTL8139 chips

There are too many vendors selling RTL8139 boards to list them all. The RTL8139 and RTL8139A chips have the ability to load a different PCI Vendor and Device ID from the EEPROM. Combined with a unique chip label, some boards give the appearance of being new and unique chips. Identified chips that fall into this category are

A few commonly available board with the Realtek chip are:

Revision History

v0.11 of 10/19/97
Corrected the MII management register read routine. The N-Way auto-negotiated duplex is now correct set.
v0.12 of 10/19/97
Updated the N-Way duplex report to emit the speed (if known).
v0.13 of 10/27/97
Additions to support the 8139 MII-like registers.
v0.99B
Release for the 2.0.34 kernel.
v1.00
Released for the 2.0.36 and 2.1.117 kernels.
Rewritten PCI probe code to use the PCI-Ethernet-common probe.
Dynamic fall-back for the Tx Threshold implemented.
Added MII ioctl().
v1.02 of 9/3/98
Fixed tx_timeout() to fully restart the chip.
v1.03 of 9/16/98
Changed Tx-descriptor-free criteria from "loaded on the chip" to "completely transmitted" to avoid transmitter hang on error.
v1.04 of 9/22/98
Changed the force-full-duplex option processing and emitted a message when full duplex is forced.
v1.05 of 2/25/99
Fixed a broken loop that could lock up the machine during some transmit timeouts. (Li Dekai, mail.xanet.edu.cn)
Added link change support in the interrupt handler.
v1.06 of 3/16/99
Fixed a index roll-over bug that occurs when 2^32-1 packets are transmitted, and reordered the Tx queue clean-up code in an attempt to avoid transmit timeouts.

Related Links


Top
Linux Network Drivers Page
CESDIS is located at the NASA Goddard Space Flight Center in Greenbelt MD.
Author:Donald Becker, becker@cesdis.gsfc.nasa.gov.