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