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: src/share/man/man4/rl.4,v 1.15.2.8 2003/02/17 21:20:39 trhodes Exp $ 32.\" $DragonFly: src/share/man/man4/rl.4,v 1.6 2007/03/11 10:22:52 swildner Exp $ 33.\" 34.Dd November 4, 1998 35.Dt RL 4 36.Os 37.Sh NAME 38.Nm rl 39.Nd RealTek 8129/8139 fast ethernet device driver 40.Sh SYNOPSIS 41.Cd "device miibus" 42.Cd "device rl" 43.Sh DESCRIPTION 44The 45.Nm 46driver provides support for PCI ethernet adapters and embedded 47controllers based on the RealTek 8129 and 8139 fast ethernet controller 48chips. 49This includes the Allied Telesyn AT2550, Farallon NetLINE 10/100 PCI, 50Genius GF100TXR, 51NDC Communications NE100TX-E, OvisLink LEF-8129TX, OvisLink LEF-8139TX, 52Netronix Inc. EA-1210 NetEther 10/100, KTX-9130TX 10/100 Fast Ethernet, 53Encore ENL832-TX 10/100 M PCI, Longshine LCS-8038TX-R, the 54SMC EZ Card 10/100 PCI 1211-TX, and various other cheap adapters. 55It also supports the Accton EN1207D which has a 56chip labeled MPX5030 (or MPX5038) which appears to be a RealTek workalike. 57.Pp 58The RealTek controllers use bus master DMA but do not use a 59descriptor-based data transfer mechanism. 60The receiver uses a 61single fixed size ring buffer from which packets must be copied 62into mbufs. 63For transmission, there are only four outbound packet 64address registers which require all outgoing packets to be stored 65as contiguous buffers. 66Furthermore, outbound packet buffers must 67be longword aligned or else transmission will fail. 68.Pp 69The 8129 differs from the 8139 in that the 8139 has an internal 70PHY which is controlled through special direct access registers 71whereas the 8129 uses an external PHY via an MII bus. 72The 8139 73supports both 10 and 100Mbps speeds in either full or half duplex. 74The 8129 can support the same speeds and modes given an appropriate 75PHY chip. 76.Pp 77The 78.Nm 79driver supports the following media types: 80.Pp 81.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 82.It autoselect 83Enable autoselection of the media type and options. 84This is only 85supported if the PHY chip attached to the RealTek controller 86supports NWAY autonegotiation. 87The user can manually override 88the autoselected mode by adding media options to the 89.Pa /etc/rc.conf 90file. 91.It 10baseT/UTP 92Set 10Mbps operation. 93The 94.Ar mediaopt 95option can also be used to select either 96.Ar full-duplex 97or 98.Ar half-duplex 99modes. 100.It 100baseTX 101Set 100Mbps (fast ethernet) operation. 102The 103.Ar mediaopt 104option can also be used to select either 105.Ar full-duplex 106or 107.Ar half-duplex 108modes. 109.El 110.Pp 111The 112.Nm 113driver supports the following media options: 114.Pp 115.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 116.It full-duplex 117Force full duplex operation 118.It half-duplex 119Force half duplex operation. 120.El 121.Pp 122Note that the 100baseTX media type is only available if supported 123by the adapter. 124For more information on configuring this device, see 125.Xr ifconfig 8 . 126.Sh DIAGNOSTICS 127.Bl -diag 128.It "rl%d: couldn't map memory" 129A fatal initialization error has occurred. 130.It "rl%d: couldn't map interrupt" 131A fatal initialization error has occurred. 132.It "rl%d: watchdog timeout" 133The device has stopped responding to the network, or there is a problem with 134the network connection (cable). 135.It "rl%d: no memory for rx list" 136The driver failed to allocate an mbuf for the receiver ring. 137.It "rl%d: no memory for tx list" 138The driver failed to allocate an mbuf for the transmitter ring when 139allocating a pad buffer or collapsing an mbuf chain into a cluster. 140.It "rl%d: chip is in D3 power state -- setting to D0" 141This message applies only to adapters which support power 142management. 143Some operating systems place the controller in low power 144mode when shutting down, and some PCI BIOSes fail to bring the chip 145out of this state before configuring it. 146The controller loses all of 147its PCI configuration in the D3 state, so if the BIOS does not set 148it back to full power mode in time, it won't be able to configure it 149correctly. 150The driver tries to detect this condition and bring 151the adapter back to the D0 (full power) state, but this may not be 152enough to return the driver to a fully operational condition. 153If 154you see this message at boot time and the driver fails to attach 155the device as a network interface, you will have to perform second 156warm boot to have the device properly configured. 157.Pp 158Note that this condition only occurs when warm booting from another 159operating system. 160If you power down your system prior to booting 161.Dx , 162the card should be configured correctly. 163.El 164.Sh SEE ALSO 165.Xr arp 4 , 166.Xr ifmedia 4 , 167.Xr miibus 4 , 168.Xr netintro 4 , 169.Xr ng_ether 4 , 170.Xr polling 4 , 171.Xr ifconfig 8 172.Rs 173.%B The RealTek 8129 and 8139 datasheets 174.%O ftp.realtek.com.tw:/lancard/data sheet 175.Re 176.Sh HISTORY 177The 178.Nm 179device driver first appeared in 180.Fx 3.0 . 181.Sh AUTHORS 182The 183.Nm 184driver was written by 185.An Bill Paul Aq wpaul@ctr.columbia.edu . 186.Sh BUGS 187Since outbound packets must be longword aligned, the transmit 188routine has to copy an unaligned packet into an mbuf cluster buffer 189before transmission. 190The driver abuses the fact that the cluster buffer 191pool is allocated at system startup time in a contiguous region starting 192at a page boundary. 193Since cluster buffers are 2048 bytes, they are 194longword aligned by definition. 195The driver probably should not be 196depending on this characteristic. 197.Pp 198The RealTek data sheets are of especially poor quality, 199and there is a lot of information missing 200particularly concerning the receiver operation. 201One particularly 202important fact that the data sheets fail to mention relates to the 203way in which the chip fills in the receive buffer. 204When an interrupt 205is posted to signal that a frame has been received, it is possible that 206another frame might be in the process of being copied into the receive 207buffer while the driver is busy handling the first one. 208If the driver 209manages to finish processing the first frame before the chip is done 210DMAing the rest of the next frame, the driver may attempt to process 211the next frame in the buffer before the chip has had a chance to finish 212DMAing all of it. 213.Pp 214The driver can check for an incomplete frame by inspecting the frame 215length in the header preceding the actual packet data: an incomplete 216frame will have the magic length of 0xFFF0. 217When the driver encounters 218this value, it knows that it has finished processing all currently 219available packets. 220Neither this magic value nor its significance are 221documented anywhere in the RealTek data sheets. 222