1.\" $OpenBSD: rl.4,v 1.37 2013/07/16 16:05:49 schwarze 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 $Mdocdate: July 16 2013 $ 36.Dt RL 4 37.Os 38.Sh NAME 39.Nm rl 40.Nd Realtek 8129/8139 10/100 Ethernet device 41.Sh SYNOPSIS 42.Cd "rl* at pci?" 43.Cd "rl* at cardbus?" 44.Cd "rlphy* at mii?" 45.Sh DESCRIPTION 46The 47.Nm 48driver provides support for PCI Ethernet adapters and embedded 49controllers based on the Realtek 8129 and 8139 Fast Ethernet controller 50chips. 51This includes, among others, the following cards: 52.Pp 53.Bl -item -offset indent -compact 54.It 55Accton MPX5030 CardBus 56.It 57Allied Telesyn AT2550 58.It 59Corega FEther CB-TXD 10/100 Ethernet 60.It 61D-Link DFE-520TX C1, DFE-530TX+, DFE-538TX, DFE-690TXD 62.It 63Encore ENL832-TX-RENT 10/100 M PCI 64.It 65Genius GF100TXR 66.It 67KTX-9130TX 10/100 Fast Ethernet 68.It 69Longshine LCS-8038TX-R 70.It 71NDC Communications NE100TX-E 72.It 73Netgear FA311 v2 74.It 75Netronix Inc. EA-1210 NetEther 10/100 76.It 77Nortel BayStack 21 78.It 79OvisLink LEF-8129TX, LEF-8139TX 80.It 81SMC EZ Card 10/100 PCI 1211-TX 82.It 83TRENDnet TE100-PCBUSR CardBus 84.El 85.Pp 86The Realtek controllers use bus master DMA but do not use a 87descriptor-based data transfer mechanism. 88The receiver uses a single fixed size ring buffer from which packets must be 89copied into mbufs. 90For transmission, there are only four outbound packet 91address registers which require all outgoing packets to be stored 92as contiguous buffers. 93Furthermore, outbound packet buffers must be longword aligned or else 94transmission will fail. 95.Pp 96The 8129 differs from the 8139 in that the 8139 has an internal 97PHY which is controlled through special direct access registers 98whereas the 8129 uses an external PHY via an MII bus. 99The 8139 supports both 10 and 100Mbps speeds in either full or half duplex. 100The 8129 can support the same speeds and modes given an appropriate 101PHY chip. 102.Pp 103The 104.Nm 105driver supports the following media types: 106.Bl -tag -width full-duplex 107.It autoselect 108Enable autoselection of the media type and options. 109This is only supported if the PHY chip attached to the Realtek controller 110supports NWAY autonegotiation. 111The user can manually override the autoselected mode by adding media options 112to the appropriate 113.Xr hostname.if 5 114file. 115.It 10baseT 116Set 10Mbps operation. 117The 118.Ar mediaopt 119option can also be used to select either 120.Ar full-duplex 121or 122.Ar half-duplex 123modes. 124.It 100baseTX 125Set 100Mbps (Fast Ethernet) operation. 126The 127.Ar mediaopt 128option can also be used to select either 129.Ar full-duplex 130or 131.Ar half-duplex 132modes. 133.El 134.Pp 135The 136.Nm 137driver supports the following media options: 138.Bl -tag -width full-duplex 139.It full-duplex 140Force full duplex operation. 141.It half-duplex 142Force half duplex operation. 143.El 144.Pp 145Note that the 100baseTX media type is only available if supported 146by the adapter. 147For more information on configuring this device, see 148.Xr ifconfig 8 . 149.Sh DIAGNOSTICS 150.Bl -diag 151.It "rl0: couldn't map memory" 152A fatal initialization error has occurred. 153.It "rl0: couldn't map interrupt" 154A fatal initialization error has occurred. 155.It "rl0: watchdog timeout" 156The device has stopped responding to the network, or there is a problem with 157the network connection (cable). 158.It "rl0: no memory for rx list" 159The driver failed to allocate an mbuf for the receiver ring. 160.It "rl0: no memory for tx list" 161The driver failed to allocate an mbuf for the transmitter ring when 162allocating a pad buffer or collapsing an mbuf chain into a cluster. 163.El 164.Sh SEE ALSO 165.Xr arp 4 , 166.Xr ifmedia 4 , 167.Xr intro 4 , 168.Xr netintro 4 , 169.Xr rlphy 4 , 170.Xr hostname.if 5 , 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.Ox 182support first appeared in 183.Ox 2.5 . 184.Sh AUTHORS 185The 186.Nm 187driver was written by 188.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . 189.Sh BUGS 190Since outbound packets must be longword aligned, the transmit 191routine has to copy an unaligned packet into an mbuf cluster buffer 192before transmission. 193The driver abuses the fact that the cluster buffer 194pool is allocated at system startup time in a contiguous region starting 195at a page boundary. 196Since cluster buffers are 2048 bytes, they are 197longword aligned by definition. 198The driver probably should not be 199depending on this characteristic. 200.Pp 201The Realtek data sheets are of especially poor quality: the grammar 202and spelling are awful and there is a lot of information missing, 203particularly concerning the receiver operation. 204One particularly important fact that the data sheets fail to mention 205relates to the way in which the chip fills in the receive buffer. 206When an interrupt is posted to signal that a frame has been received, 207it is possible that another frame might be in the process of being 208copied into the receive buffer while the driver is busy handling 209the first one. 210If the driver 211manages to finish processing the first frame before the chip is done 212DMAing the rest of the next frame, the driver may attempt to process 213the next frame in the buffer before the chip has had a chance to finish 214DMAing all of it. 215.Pp 216The driver can check for an incomplete frame by inspecting the frame 217length in the header preceding the actual packet data: an incomplete 218frame will have the magic length of 0xFFF0. 219When the driver encounters this value, it knows that it has finished 220processing all currently available packets. 221Neither this magic value nor its significance are 222documented anywhere in the Realtek data sheets. 223