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