1.\" $OpenBSD: rl.4,v 1.11 2001/03/08 06:18:34 aaron Exp $ 2.\" 3.\" Copyright (c) 1997, 1998 4.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by Bill Paul. 17.\" 4. Neither the name of the author nor the names of any co-contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 25.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31.\" THE POSSIBILITY OF SUCH DAMAGE. 32.\" 33.\" $FreeBSD: rl.4,v 1.7 1998/12/24 18:52:47 wpaul Exp $ 34.\" 35.Dd November 4, 1998 36.Dt RL 4 37.Os 38.Sh NAME 39.Nm rl 40.Nd RealTek 8129/8139 Fast Ethernet driver 41.Sh SYNOPSIS 42.Cd "rl* at pci? dev ? function ?" 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. This includes the Allied Telesyn AT2550, Genius GF100TXR, 49NDC Communications NE100TX-E, OvisLink LEF-8129TX, OvisLink LEF-8139TX, 50Netronix Inc. EA-1210 NetEther 10/100, KTX-9130TX 10/100 Fast Ethernet, 51Encore ENL832-TX 10/100 M PCI, Longshine LCS-8038TX-R, the 52SMC EZ Card 10/100 PCI 1211-TX, and various other cheap adapters. 53.Pp 54The RealTek controllers use bus master DMA but do not use a 55descriptor-based data transfer mechanism. The receiver uses a 56single fixed size ring buffer from which packets must be copied 57into mbufs. For transmission, there are only four outbound packet 58address registers which require all outgoing packets to be stored 59as contiguous buffers. Furthermore, outbound packet buffers must 60be longword aligned or else transmission will fail. 61.Pp 62The 8129 differs from the 8139 in that the 8139 has an internal 63PHY which is controlled through special direct access registers 64whereas the 8129 uses an external PHY via an MII bus. The 8139 65supports both 10 and 100Mbps speeds in either full or half duplex. 66The 8129 can support the same speeds and modes given an appropriate 67PHY chip. 68.Pp 69The 70.Nm 71driver supports the following media types: 72.Pp 73.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 74.It autoselect 75Enable autoselection of the media type and options. This is only 76supported if the PHY chip attached to the RealTek controller 77supports NWAY autonegotiation. The user can manually override 78the autoselected mode by adding media options to the appropriate 79.Pa /etc/hostname.rlX 80file. 81.It 10baseT/UTP 82Set 10Mbps operation. The 83.Ar mediaopt 84option can also be used to select either 85.Ar full-duplex 86or 87.Ar half-duplex 88modes. 89.It 100baseTX 90Set 100Mbps (Fast Ethernet) operation. The 91.Ar mediaopt 92option can also be used to select either 93.Ar full-duplex 94or 95.Ar half-duplex 96modes. 97.El 98.Pp 99The 100.Nm 101driver supports the following media options: 102.Pp 103.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 104.It full-duplex 105Force full duplex operation 106.It half-duplex 107Force half duplex operation. 108.El 109.Pp 110Note that the 100baseTX media type is only available if supported 111by the adapter. 112For more information on configuring this device, see 113.Xr ifconfig 8 . 114.Sh DIAGNOSTICS 115.Bl -diag 116.It "rl%d: couldn't map memory" 117A fatal initialization error has occurred. 118.It "rl%d: couldn't map interrupt" 119A fatal initialization error has occurred. 120.It "rl%d: watchdog timeout" 121The device has stopped responding to the network, or there is a problem with 122the network connection (cable). 123.It "rl%d: no memory for rx list" 124The driver failed to allocate an mbuf for the receiver ring. 125.It "rl%d: no memory for tx list" 126The driver failed to allocate an mbuf for the transmitter ring when 127allocating a pad buffer or collapsing an mbuf chain into a cluster. 128.It "rl%d: chip is in D3 power state -- setting to D0" 129This message applies only to adapters which support power 130management. Some operating systems place the controller in low power 131mode when shutting down, and some PCI BIOSes fail to bring the chip 132out of this state before configuring it. The controller loses all of 133its PCI configuration in the D3 state, so if the BIOS does not set 134it back to full power mode in time, it won't be able to configure it 135correctly. The driver tries to detect this condition and bring 136the adapter back to the D0 (full power) state, but this may not be 137enough to return the driver to a fully operational condition. If 138you see this message at boot time and the driver fails to attach 139the device as a network interface, you will have to perform second 140warm boot to have the device properly configured. 141.Pp 142Note that this condition only occurs when warm booting from another 143operating system. If you power down your system prior to booting 144.Ox , 145the card should be configured correctly. 146.El 147.Sh SEE ALSO 148.Xr arp 4 , 149.Xr netintro 4 , 150.Xr ifconfig 8 151.Rs 152.%B The RealTek 8129 and 8139 datasheets 153.%O ftp.realtek.com.tw:/lancard/data sheet 154.Re 155.Sh HISTORY 156The 157.Nm 158device driver first appeared in 159.Fx 3.0 . 160.Ox 161support first appeared in 162.Ox 2.5 . 163.Sh AUTHORS 164The 165.Nm 166driver was written by 167.An Bill Paul Aq wpaul@ctr.columbia.edu . 168.Sh BUGS 169Since outbound packets must be longword aligned, the transmit 170routine has to copy an unaligned packet into an mbuf cluster buffer 171before transmission. The driver abuses the fact that the cluster buffer 172pool is allocated at system startup time in a contiguous region starting 173at a page boundary. Since cluster buffers are 2048 bytes, they are 174longword aligned by definition. The driver probably should not be 175depending on this characteristic. 176.Pp 177The RealTek data sheets are of especially poor quality: the grammar 178and spelling are awful and there is a lot of information missing, 179particularly concerning the receiver operation. One particularly 180important fact that the data sheets fail to mention relates to the 181way in which the chip fills in the receive buffer. When an interrupt 182is posted to signal that a frame has been received, it is possible that 183another frame might be in the process of being copied into the receive 184buffer while the driver is busy handling the first one. If the driver 185manages to finish processing the first frame before the chip is done 186DMAing the rest of the next frame, the driver may attempt to process 187the next frame in the buffer before the chip has had a chance to finish 188DMAing all of it. 189.Pp 190The driver can check for an incomplete frame by inspecting the frame 191length in the header preceding the actual packet data: an incomplete 192frame will have the magic length of 0xFFF0. When the driver encounters 193this value, it knows that it has finished processing all currently 194available packets. Neither this magic value nor its significance are 195documented anywhere in the RealTek data sheets. 196