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 July 16, 2005 34.Dt RL 4 35.Os 36.Sh NAME 37.Nm rl 38.Nd "RealTek 8129/8139 Fast Ethernet device driver" 39.Sh SYNOPSIS 40To compile support for the 41.Nm 42driver into your kernel, place the following lines in your 43kernel configuration file: 44.Bd -ragged -offset indent 45.Cd "device miibus" 46.Cd "device rl" 47.Ed 48.Pp 49Alternatively, to load the 50.Nm 51driver at boot time, place the following line in 52.Xr loader.conf 5 : 53.Bd -literal -offset indent 54if_rl_load="YES" 55.Ed 56.Sh DESCRIPTION 57The 58.Nm 59driver provides support for PCI Ethernet adapters and embedded 60controllers based on the RealTek 8129 and 8139 Fast Ethernet controller 61chips. 62.Pp 63The RealTek 8129/8139 series controllers use bus master DMA but do not use a 64descriptor-based data transfer mechanism. 65The receiver uses a 66single fixed size ring buffer from which packets must be copied 67into mbufs. 68For transmission, there are only four outbound packet 69address registers which require all outgoing packets to be stored 70as contiguous buffers. 71Furthermore, outbound packet buffers must 72be longword aligned or else transmission will fail. 73.Pp 74The 8129 differs from the 8139 in that the 8139 has an internal 75PHY which is controlled through special direct access registers 76whereas the 8129 uses an external PHY via an MII bus. 77The 8139 78supports both 10 and 100Mbps speeds in either full or half duplex. 79The 8129 can support the same speeds and modes given an appropriate 80PHY chip. 81.Pp 82Note: support for the 8139C+ chip is provided by the 83.Xr re 4 84driver. 85.Pp 86The 87.Nm 88driver supports the following media types: 89.Pp 90.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 91.It autoselect 92Enable autoselection of the media type and options. 93This is only 94supported if the PHY chip attached to the RealTek controller 95supports NWAY autonegotiation. 96The user can manually override 97the autoselected mode by adding media options to the 98.Pa /etc/rc.conf 99file. 100.It 10baseT/UTP 101Set 10Mbps operation. 102The 103.Ar mediaopt 104option can also be used to select either 105.Ar full-duplex 106or 107.Ar half-duplex 108modes. 109.It 100baseTX 110Set 100Mbps (Fast Ethernet) operation. 111The 112.Ar mediaopt 113option can also be used to select either 114.Ar full-duplex 115or 116.Ar half-duplex 117modes. 118.El 119.Pp 120The 121.Nm 122driver supports the following media options: 123.Pp 124.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 125.It full-duplex 126Force full duplex operation 127.It half-duplex 128Force half duplex operation. 129.El 130.Pp 131Note that the 100baseTX media type is only available if supported 132by the adapter. 133For more information on configuring this device, see 134.Xr ifconfig 8 . 135.Sh HARDWARE 136Adapters supported by the 137.Nm 138driver include: 139.Pp 140.Bl -bullet -compact 141.It 142Accton 143.Dq Cheetah 144EN1207D (MPX 5030/5038; RealTek 8139 clone) 145.It 146Allied Telesyn AT2550 147.It 148Allied Telesyn AT2500TX 149.It 150Belkin F5D5000 151.It 152BUFFALO (Melco INC.) LPC-CB-CLX (CardBus) 153.It 154Compaq HNE-300 155.It 156CompUSA no-name 10/100 PCI Ethernet NIC 157.It 158Corega FEther CB-TXD 159.It 160Corega FEtherII CB-TXD 161.It 162D-Link DFE-528TX 163.It 164D-Link DFE-530TX+ 165.It 166D-Link DFE-538TX 167.It 168D-Link DFE-690TXD 169.It 170Edimax EP-4103DL CardBus 171.It 172Encore ENL832-TX 10/100 M PCI 173.It 174Farallon NetLINE 10/100 PCI 175.It 176Genius GF100TXR 177.It 178GigaFast Ethernet EE100-AXP 179.It 180KTX-9130TX 10/100 Fast Ethernet 181.It 182LevelOne FPC-0106TX 183.It 184Longshine LCS-8038TX-R 185.It 186NDC Communications NE100TX-E 187.It 188Netronix Inc.\& EA-1210 NetEther 10/100 189.It 190Nortel Networks 10/100BaseTX 191.It 192OvisLink LEF-8129TX 193.It 194OvisLink LEF-8139TX 195.It 196Peppercon AG ROL-F 197.It 198Planex FNW-3800-TX 199.It 200SMC EZ Card 10/100 PCI 1211-TX 201.It 202SOHO (PRAGMATIC) UE-1211C 203.El 204.Sh DIAGNOSTICS 205.Bl -diag 206.It "rl%d: couldn't map memory" 207A fatal initialization error has occurred. 208.It "rl%d: couldn't map interrupt" 209A fatal initialization error has occurred. 210.It "rl%d: watchdog timeout" 211The device has stopped responding to the network, or there is a problem with 212the network connection (cable). 213.It "rl%d: no memory for rx list" 214The driver failed to allocate an mbuf for the receiver ring. 215.It "rl%d: no memory for tx list" 216The driver failed to allocate an mbuf for the transmitter ring when 217allocating a pad buffer or collapsing an mbuf chain into a cluster. 218.It "rl%d: chip is in D3 power state -- setting to D0" 219This message applies only to adapters which support power 220management. 221Some operating systems place the controller in low power 222mode when shutting down, and some PCI BIOSes fail to bring the chip 223out of this state before configuring it. 224The controller loses all of 225its PCI configuration in the D3 state, so if the BIOS does not set 226it back to full power mode in time, it will not be able to configure it 227correctly. 228The driver tries to detect this condition and bring 229the adapter back to the D0 (full power) state, but this may not be 230enough to return the driver to a fully operational condition. 231If 232you see this message at boot time and the driver fails to attach 233the device as a network interface, you will have to perform second 234warm boot to have the device properly configured. 235.Pp 236Note that this condition only occurs when warm booting from another 237operating system. 238If you power down your system prior to booting 239.Fx , 240the card should be configured correctly. 241.El 242.Sh SEE ALSO 243.Xr arp 4 , 244.Xr miibus 4 , 245.Xr netintro 4 , 246.Xr ng_ether 4 , 247.Xr polling 4 , 248.Xr ifconfig 8 249.Rs 250.%B The RealTek 8129, 8139 and 8139C+ datasheets 251.%O http://www.realtek.com.tw 252.Re 253.Sh HISTORY 254The 255.Nm 256device driver first appeared in 257.Fx 3.0 . 258.Sh AUTHORS 259The 260.Nm 261driver was written by 262.An Bill Paul Aq wpaul@ctr.columbia.edu . 263.Sh BUGS 264Since outbound packets must be longword aligned, the transmit 265routine has to copy an unaligned packet into an mbuf cluster buffer 266before transmission. 267The driver abuses the fact that the cluster buffer 268pool is allocated at system startup time in a contiguous region starting 269at a page boundary. 270Since cluster buffers are 2048 bytes, they are 271longword aligned by definition. 272The driver probably should not be 273depending on this characteristic. 274.Pp 275The RealTek data sheets are of especially poor quality, 276and there is a lot of information missing 277particularly concerning the receiver operation. 278One particularly 279important fact that the data sheets fail to mention relates to the 280way in which the chip fills in the receive buffer. 281When an interrupt 282is posted to signal that a frame has been received, it is possible that 283another frame might be in the process of being copied into the receive 284buffer while the driver is busy handling the first one. 285If the driver 286manages to finish processing the first frame before the chip is done 287DMAing the rest of the next frame, the driver may attempt to process 288the next frame in the buffer before the chip has had a chance to finish 289DMAing all of it. 290.Pp 291The driver can check for an incomplete frame by inspecting the frame 292length in the header preceding the actual packet data: an incomplete 293frame will have the magic length of 0xFFF0. 294When the driver encounters 295this value, it knows that it has finished processing all currently 296available packets. 297Neither this magic value nor its significance are 298documented anywhere in the RealTek data sheets. 299