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