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