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