1.\" Copyright (c) 1997, 1998 2.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by Bill Paul. 15.\" 4. Neither the name of the author nor the names of any co-contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29.\" THE POSSIBILITY OF SUCH DAMAGE. 30.\" 31.\" $FreeBSD$ 32.\" 33.Dd November 4, 1998 34.Dt RL 4 35.Os 36.Sh NAME 37.Nm rl 38.Nd RealTek 8129/8139/8139C+ fast ethernet device driver 39.Sh SYNOPSIS 40.Cd "device miibus" 41.Cd "device rl" 42.Sh DESCRIPTION 43The 44.Nm 45driver provides support for PCI ethernet adapters and embedded 46controllers based on the RealTek 8129 and 8139 fast ethernet controller 47chips, including the following: 48.Pp 49.Bl -bullet -compact -offset indent 50.It 51Allied Telesyn AT2550 52.It 53Farallon NetLINE 10/100 PCI 54.It 55Genius GF100TXR, 56.It 57NDC Communications NE100TX-E 58.It 59OvisLink LEF-8129TX 60.It 61OvisLink LEF-8139TX, 62.It 63Netronix Inc. EA-1210 NetEther 10/100 64.It 65KTX-9130TX 10/100 Fast Ethernet, 66.It 67Encore ENL832-TX 10/100 M PCI, 68.It 69Longshine LCS-8038TX-R 70.It 71SMC EZ Card 10/100 PCI 1211-TX 72.It 73Compaq HNE-300 74.It 75LevelOne FPC-0106TX 76.It 77Edimax EP-4103DL CardBus 78.It 79Nortel Networks 10/100BaseTX 80.It 81D-Link DFE-690TXD 82.It 83D-Link DFE-530TX+ 84.It 85D-Link DFE-538TX (same as 530+?) 86.It 87Corega FEther CB-TXD 88.It 89Corega FEtherII CB-TXD 90.It 91Peppercon AG ROL-F 92.It 93Planex FNW-3800-TX 94.It 95Accton EN1207D 96.It 97GigaFast Ethernet EE100-AXP 98.It 99CompUSA no-name 10/100 PCI ethernet NIC 100.It 101Belkin F5D5000 102.El 103.Pp 104The RealTek 8129/8139 series controllers use bus master DMA but do not use a 105descriptor-based data transfer mechanism. 106The receiver uses a 107single fixed size ring buffer from which packets must be copied 108into mbufs. 109For transmission, there are only four outbound packet 110address registers which require all outgoing packets to be stored 111as contiguous buffers. 112Furthermore, outbound packet buffers must 113be longword aligned or else transmission will fail. 114.Pp 115The 8129 differs from the 8139 in that the 8139 has an internal 116PHY which is controlled through special direct access registers 117whereas the 8129 uses an external PHY via an MII bus. 118The 8139 119supports both 10 and 100Mbps speeds in either full or half duplex. 120The 8129 can support the same speeds and modes given an appropriate 121PHY chip. 122.Pp 123Support is also provided for the special C+ mode of the 8139C+ chip. 124By default, the 8139C+ is back backwards compatible with the 8139, but 125in C+ mode it supports advanced features such as descriptor-based DMA, 12664-bit addressing, TCP/IP checksum offload on both receive and transmit, 127hardware VLAN tag insertion and extraction, and TCP large send. 128When used with an 8139C+ chip, the 129.Nm 130driver makes use of all of these features, except for TCP large send, 131since there is currently no OS support for it. Transmit interrupt 132moderation is also used to improve performance at high frame rates. 133The receive and transmit checksum offload capabilities are on by default 134but can be toggled off using the 135.Xr ifconfig 8 136command. 137.Pp 138The 139.Nm 140driver supports the following media types: 141.Pp 142.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 143.It autoselect 144Enable autoselection of the media type and options. 145This is only 146supported if the PHY chip attached to the RealTek controller 147supports NWAY autonegotiation. 148The user can manually override 149the autoselected mode by adding media options to the 150.Pa /etc/rc.conf 151file. 152.It 10baseT/UTP 153Set 10Mbps operation. 154The 155.Ar mediaopt 156option can also be used to select either 157.Ar full-duplex 158or 159.Ar half-duplex 160modes. 161.It 100baseTX 162Set 100Mbps (fast ethernet) operation. 163The 164.Ar mediaopt 165option can also be used to select either 166.Ar full-duplex 167or 168.Ar half-duplex 169modes. 170.El 171.Pp 172The 173.Nm 174driver supports the following media options: 175.Pp 176.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 177.It full-duplex 178Force full duplex operation 179.It half-duplex 180Force half duplex operation. 181.El 182.Pp 183Note that the 100baseTX media type is only available if supported 184by the adapter. 185For more information on configuring this device, see 186.Xr ifconfig 8 . 187.Sh DIAGNOSTICS 188.Bl -diag 189.It "rl%d: couldn't map memory" 190A fatal initialization error has occurred. 191.It "rl%d: couldn't map interrupt" 192A fatal initialization error has occurred. 193.It "rl%d: watchdog timeout" 194The device has stopped responding to the network, or there is a problem with 195the network connection (cable). 196.It "rl%d: no memory for rx list" 197The driver failed to allocate an mbuf for the receiver ring. 198.It "rl%d: no memory for tx list" 199The driver failed to allocate an mbuf for the transmitter ring when 200allocating a pad buffer or collapsing an mbuf chain into a cluster. 201.It "rl%d: chip is in D3 power state -- setting to D0" 202This message applies only to adapters which support power 203management. 204Some operating systems place the controller in low power 205mode when shutting down, and some PCI BIOSes fail to bring the chip 206out of this state before configuring it. 207The controller loses all of 208its PCI configuration in the D3 state, so if the BIOS does not set 209it back to full power mode in time, it won't be able to configure it 210correctly. 211The driver tries to detect this condition and bring 212the adapter back to the D0 (full power) state, but this may not be 213enough to return the driver to a fully operational condition. 214If 215you see this message at boot time and the driver fails to attach 216the device as a network interface, you will have to perform second 217warm boot to have the device properly configured. 218.Pp 219Note that this condition only occurs when warm booting from another 220operating system. 221If you power down your system prior to booting 222.Fx , 223the card should be configured correctly. 224.El 225.Sh SEE ALSO 226.Xr arp 4 , 227.Xr miibus 4 , 228.Xr netintro 4 , 229.Xr ng_ether 4 , 230.Xr ifconfig 8 231.Rs 232.%B The RealTek 8129, 8139 and 8139C+ datasheets 233.%O http://www.realtek.com.tw 234.Re 235.Sh HISTORY 236The 237.Nm 238device driver first appeared in 239.Fx 3.0 . 240.Sh AUTHORS 241The 242.Nm 243driver was written by 244.An Bill Paul Aq wpaul@ctr.columbia.edu . 245.Sh BUGS 246Since outbound packets must be longword aligned, the transmit 247routine has to copy an unaligned packet into an mbuf cluster buffer 248before transmission. 249The driver abuses the fact that the cluster buffer 250pool is allocated at system startup time in a contiguous region starting 251at a page boundary. 252Since cluster buffers are 2048 bytes, they are 253longword aligned by definition. 254The driver probably should not be 255depending on this characteristic. 256.Pp 257The RealTek data sheets are of especially poor quality, 258and there is a lot of information missing 259particularly concerning the receiver operation. 260One particularly 261important fact that the data sheets fail to mention relates to the 262way in which the chip fills in the receive buffer. 263When an interrupt 264is posted to signal that a frame has been received, it is possible that 265another frame might be in the process of being copied into the receive 266buffer while the driver is busy handling the first one. 267If the driver 268manages to finish processing the first frame before the chip is done 269DMAing the rest of the next frame, the driver may attempt to process 270the next frame in the buffer before the chip has had a chance to finish 271DMAing all of it. 272.Pp 273The driver can check for an incomplete frame by inspecting the frame 274length in the header preceding the actual packet data: an incomplete 275frame will have the magic length of 0xFFF0. 276When the driver encounters 277this value, it knows that it has finished processing all currently 278available packets. 279Neither this magic value nor its significance are 280documented anywhere in the RealTek data sheets. 281