1eed6f750SBill Paul.\" Copyright (c) 2003 26cee741bSBill Paul.\" Bill Paul <wpaul@windriver.com>. All rights reserved. 36cee741bSBill Paul.\" 46cee741bSBill Paul.\" Redistribution and use in source and binary forms, with or without 56cee741bSBill Paul.\" modification, are permitted provided that the following conditions 66cee741bSBill Paul.\" are met: 76cee741bSBill Paul.\" 1. Redistributions of source code must retain the above copyright 86cee741bSBill Paul.\" notice, this list of conditions and the following disclaimer. 96cee741bSBill Paul.\" 2. Redistributions in binary form must reproduce the above copyright 106cee741bSBill Paul.\" notice, this list of conditions and the following disclaimer in the 116cee741bSBill Paul.\" documentation and/or other materials provided with the distribution. 126cee741bSBill Paul.\" 3. All advertising materials mentioning features or use of this software 136cee741bSBill Paul.\" must display the following acknowledgement: 146cee741bSBill Paul.\" This product includes software developed by Bill Paul. 156cee741bSBill Paul.\" 4. Neither the name of the author nor the names of any co-contributors 166cee741bSBill Paul.\" may be used to endorse or promote products derived from this software 176cee741bSBill Paul.\" without specific prior written permission. 186cee741bSBill Paul.\" 196cee741bSBill Paul.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 206cee741bSBill Paul.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 216cee741bSBill Paul.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 226cee741bSBill Paul.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 236cee741bSBill Paul.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 246cee741bSBill Paul.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 256cee741bSBill Paul.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 266cee741bSBill Paul.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 276cee741bSBill Paul.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 286cee741bSBill Paul.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 296cee741bSBill Paul.\" THE POSSIBILITY OF SUCH DAMAGE. 306cee741bSBill Paul.\" 316cee741bSBill Paul.\" $FreeBSD$ 326cee741bSBill Paul.\" 33*a9a35c9eSJohannes Totz.Dd November 7, 2022 346cee741bSBill Paul.Dt RE 4 356cee741bSBill Paul.Os 366cee741bSBill Paul.Sh NAME 376cee741bSBill Paul.Nm re 3836fe3847SPyun YongHyeon.Nd "RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver" 396cee741bSBill Paul.Sh SYNOPSIS 4016d78bb8STom RhodesTo compile this driver into the kernel, 4116d78bb8STom Rhodesplace the following lines in your 4290296834STom Rhodeskernel configuration file: 4386e3186eSTom Rhodes.Bd -ragged -offset indent 446cee741bSBill Paul.Cd "device miibus" 456cee741bSBill Paul.Cd "device re" 4686e3186eSTom Rhodes.Ed 4786e3186eSTom Rhodes.Pp 4816d78bb8STom RhodesAlternatively, to load the driver as a 4916d78bb8STom Rhodesmodule at boot time, place the following line in 5086e3186eSTom Rhodes.Xr loader.conf 5 : 5186e3186eSTom Rhodes.Bd -literal -offset indent 5286e3186eSTom Rhodesif_re_load="YES" 5386e3186eSTom Rhodes.Ed 546cee741bSBill Paul.Sh DESCRIPTION 556cee741bSBill PaulThe 566cee741bSBill Paul.Nm 576cee741bSBill Pauldriver provides support for various NICs based on the RealTek RTL8139C+, 5836fe3847SPyun YongHyeonRTL8169, RTL816xS, RTL811xS, RTL8168, RTL810xE and RTL8111 PCI and 59ed510fb0SBill PaulPCIe Ethernet controllers. 606cee741bSBill Paul.Pp 6136fe3847SPyun YongHyeonNICs based on the 8139C+ and 810xE are capable of 10 and 100Mbps speeds 62ed510fb0SBill Paulover CAT5 cable. 6336fe3847SPyun YongHyeonNICs based on the 8169, 816xS, 811xS, 8168 and 8111 are capable of 10, 100 6436fe3847SPyun YongHyeonand 1000Mbps operation. 656cee741bSBill Paul.Pp 666cee741bSBill PaulAll NICs supported by the 676cee741bSBill Paul.Nm 686cee741bSBill Pauldriver have TCP/IP checksum offload and hardware VLAN tagging/insertion 695203edcdSRuslan Ermilovfeatures, and use a descriptor-based DMA mechanism. 705203edcdSRuslan ErmilovThey are also 716cee741bSBill Paulcapable of TCP large send (TCP segmentation offload). 726cee741bSBill Paul.Pp 736cee741bSBill PaulThe 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY. 746cee741bSBill PaulThe 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY. 7536fe3847SPyun YongHyeonThe 816xS, 811xS, 8168 and 8111 are single-chip devices containing both a 7636fe3847SPyun YongHyeon10/100/1000 MAC and 10/100/1000 copper PHY. 775203edcdSRuslan ErmilovStandalone 10/100/1000 cards are available 785203edcdSRuslan Ermilovin both 32-bit PCI and 64-bit PCI models. 795203edcdSRuslan ErmilovThe 8110S is designed for 806cee741bSBill Paulembedded LAN-on-motherboard applications. 816cee741bSBill Paul.Pp 826cee741bSBill PaulThe 8169, 8169S and 8110S also support jumbo frames, which can be configured 836cee741bSBill Paulvia the interface MTU setting. 842157b8d6SJohn-Mark GurneyThe MTU is limited to 7422, since the chip cannot transmit larger frames. 856cee741bSBill PaulSelecting an MTU larger than 1500 bytes with the 866cee741bSBill Paul.Xr ifconfig 8 876cee741bSBill Paulutility configures the adapter to receive and transmit jumbo frames. 886cee741bSBill Paul.Pp 896cee741bSBill PaulThe 906cee741bSBill Paul.Nm 916cee741bSBill Pauldriver supports the following media types: 922898777bSRuslan Ermilov.Bl -tag -width ".Cm 10baseT/UTP" 936cee741bSBill Paul.It Cm autoselect 946cee741bSBill PaulEnable autoselection of the media type and options. 956cee741bSBill PaulThe user can manually override 966cee741bSBill Paulthe autoselected mode by adding media options to 976cee741bSBill Paul.Xr rc.conf 5 . 986cee741bSBill Paul.It Cm 10baseT/UTP 996cee741bSBill PaulSet 10Mbps operation. 1006cee741bSBill PaulThe 1016cee741bSBill Paul.Xr ifconfig 8 1022898777bSRuslan Ermilov.Cm mediaopt 1036cee741bSBill Pauloption can also be used to select either 1046cee741bSBill Paul.Cm full-duplex 1056cee741bSBill Paulor 1066cee741bSBill Paul.Cm half-duplex 1076cee741bSBill Paulmodes. 1086cee741bSBill Paul.It Cm 100baseTX 1092898777bSRuslan ErmilovSet 100Mbps (Fast Ethernet) operation. 1106cee741bSBill PaulThe 1116cee741bSBill Paul.Xr ifconfig 8 1122898777bSRuslan Ermilov.Cm mediaopt 1136cee741bSBill Pauloption can also be used to select either 1146cee741bSBill Paul.Cm full-duplex 1156cee741bSBill Paulor 1166cee741bSBill Paul.Cm half-duplex 1176cee741bSBill Paulmodes. 1186cee741bSBill Paul.It Cm 1000baseTX 1196cee741bSBill PaulSet 1000baseTX operation over twisted pair. 1206cee741bSBill PaulThe RealTek gigE chips support 1000Mbps in 1216cee741bSBill Paul.Cm full-duplex 1226cee741bSBill Paulmode only. 1236cee741bSBill Paul.\" .It Cm 1000baseSX 1242898777bSRuslan Ermilov.\" Set 1000Mbps (Gigabit Ethernet) operation. 1256cee741bSBill Paul.\" Both 1266cee741bSBill Paul.\" .Cm full-duplex 1276cee741bSBill Paul.\" and 1286cee741bSBill Paul.\" .Cm half-duplex 1296cee741bSBill Paul.\" modes are supported. 1306cee741bSBill Paul.El 1316cee741bSBill Paul.Pp 1326cee741bSBill PaulThe 1336cee741bSBill Paul.Nm 1346cee741bSBill Pauldriver supports the following media options: 1352898777bSRuslan Ermilov.Bl -tag -width ".Cm full-duplex" 1366cee741bSBill Paul.It Cm full-duplex 1376cee741bSBill PaulForce full duplex operation. 1386cee741bSBill Paul.It Cm half-duplex 1396cee741bSBill PaulForce half duplex operation. 1406cee741bSBill Paul.El 1416cee741bSBill Paul.Pp 1426cee741bSBill PaulFor more information on configuring this device, see 1436cee741bSBill Paul.Xr ifconfig 8 . 144318f7adfSChristian Brueffer.Sh HARDWARE 145318f7adfSChristian BruefferThe 146318f7adfSChristian Brueffer.Nm 14736fe3847SPyun YongHyeondriver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, RTL8168, 14836fe3847SPyun YongHyeonRTL810xE and RTL8111 based Fast Ethernet and Gigabit Ethernet adapters including: 149318f7adfSChristian Brueffer.Pp 150318f7adfSChristian Brueffer.Bl -bullet -compact 151318f7adfSChristian Brueffer.It 152318f7adfSChristian BruefferAlloy Computer Products EtherGOLD 1439E 10/100 (8139C+) 153318f7adfSChristian Brueffer.It 154318f7adfSChristian BruefferCompaq Evo N1015v Integrated Ethernet (8139C+) 155318f7adfSChristian Brueffer.It 156318f7adfSChristian BruefferCorega CG-LAPCIGT Gigabit Ethernet (8169S) 157318f7adfSChristian Brueffer.It 158f62ed2dcSAnton BerezinD-Link DGE-528(T) Gigabit Ethernet (8169S) 159f62ed2dcSAnton Berezin.It 160318f7adfSChristian BruefferGigabyte 7N400 Pro2 Integrated Gigabit Ethernet (8110S) 161318f7adfSChristian Brueffer.It 1622b2092c6SChristian BruefferLevelOne GNC-0105T (8169S) 1632b2092c6SChristian Brueffer.It 164cc2824b8SBjoern A. ZeebLinkSys EG1032 (32-bit PCI) 165cc2824b8SBjoern A. Zeeb.It 166318f7adfSChristian BruefferPLANEX COMMUNICATIONS Inc.\& GN-1200TC (8169S) 167318f7adfSChristian Brueffer.It 168938e9a89SKevin LoTP-Link TG-3468 v2 Gigabit Ethernet (8168) 169938e9a89SKevin Lo.It 17063003044SPyun YongHyeonUSRobotics USR997902 Gigabit Ethernet (8169S) 17163003044SPyun YongHyeon.It 172318f7adfSChristian BruefferXterasys XN-152 10/100/1000 NIC (8169) 173318f7adfSChristian Brueffer.El 174d66a21e9SPyun YongHyeon.Sh LOADER TUNABLES 175d66a21e9SPyun YongHyeonTunables can be set at the 176d66a21e9SPyun YongHyeon.Xr loader 8 177d66a21e9SPyun YongHyeonprompt before booting the kernel or stored in 178d66a21e9SPyun YongHyeon.Xr loader.conf 5 . 179d66a21e9SPyun YongHyeon.Bl -tag -width "xxxxxx" 180da65f7d0SPyun YongHyeon.It Va hw.re.intr_filter 181da65f7d0SPyun YongHyeonThis tunable makes driver use interrupt filter handler on 182da65f7d0SPyun YongHyeoncontrollers that support MSI/MSI-X capability. 183da65f7d0SPyun YongHyeonIf MSI/MSI-X is disabled by administrator this tunable has no 184da65f7d0SPyun YongHyeoneffect and driver will use interrupt filter handler. 185da65f7d0SPyun YongHyeonThe default value is 0 to use interrupt thread handler. 186d66a21e9SPyun YongHyeon.It Va hw.re.msi_disable 187d66a21e9SPyun YongHyeonThis tunable disables MSI support on the Ethernet hardware. 188d66a21e9SPyun YongHyeonThe default value is 0. 189da65f7d0SPyun YongHyeon.It Va hw.re.msix_disable 190da65f7d0SPyun YongHyeonThis tunable disables MSI-X support on the Ethernet hardware. 191da65f7d0SPyun YongHyeonThe default value is 0. 192239169b1SPyun YongHyeon.It Va hw.re.prefer_iomap 193239169b1SPyun YongHyeonThis tunable controls which register mapping should be used on the 194239169b1SPyun YongHyeonspecified device. 195239169b1SPyun YongHyeonA non-zero value enables I/O space register mapping. 196239169b1SPyun YongHyeonThe default value is 0 to use memory space register mapping. 197d66a21e9SPyun YongHyeon.El 198da65f7d0SPyun YongHyeon.Sh SYSCTL VARIABLES 199da65f7d0SPyun YongHyeonThe following variables are available as both 200da65f7d0SPyun YongHyeon.Xr sysctl 8 201da65f7d0SPyun YongHyeonvariables and 202da65f7d0SPyun YongHyeon.Xr loader 8 203da65f7d0SPyun YongHyeontunables: 204da65f7d0SPyun YongHyeon.Bl -tag -width "xxxxxx" 205da65f7d0SPyun YongHyeon.It Va dev.re.%d.int_rx_mod 206da65f7d0SPyun YongHyeonMaximum amount of time to delay receive interrupt processing in 207da65f7d0SPyun YongHyeonunits of 1us. 208da65f7d0SPyun YongHyeonThe accepted range is 0 to 65, the default is 65(65us). 209da65f7d0SPyun YongHyeonValue 0 completely disables the interrupt moderation. 210da65f7d0SPyun YongHyeonThe interface need to be brought down and up again before a change 211da65f7d0SPyun YongHyeontakes effect. 212da65f7d0SPyun YongHyeon.El 2136cee741bSBill Paul.Sh DIAGNOSTICS 2146cee741bSBill Paul.Bl -diag 2156cee741bSBill Paul.It "re%d: couldn't map memory" 2166cee741bSBill PaulA fatal initialization error has occurred. 2176cee741bSBill Paul.It "re%d: couldn't map ports" 2186cee741bSBill PaulA fatal initialization error has occurred. 2196cee741bSBill Paul.It "re%d: couldn't map interrupt" 2206cee741bSBill PaulA fatal initialization error has occurred. 2216cee741bSBill Paul.It "re%d: no memory for softc struct!" 2226cee741bSBill PaulThe driver failed to allocate memory for per-device instance information 2236cee741bSBill Paulduring initialization. 2246cee741bSBill Paul.It "re%d: failed to enable memory mapping!" 2256cee741bSBill PaulThe driver failed to initialize PCI shared memory mapping. 2266cee741bSBill PaulThis might 2276cee741bSBill Paulhappen if the card is not in a bus-master slot. 2286cee741bSBill Paul.It "re%d: no memory for jumbo buffers!" 2296cee741bSBill PaulThe driver failed to allocate memory for jumbo frames during 2306cee741bSBill Paulinitialization. 2316cee741bSBill Paul.It "re%d: watchdog timeout" 2326cee741bSBill PaulThe device has stopped responding to the network, or there is a problem with 2336cee741bSBill Paulthe network connection (cable). 2346cee741bSBill Paul.El 2356cee741bSBill Paul.Sh SEE ALSO 236a25ecdffSChristian Brueffer.Xr altq 4 , 2376cee741bSBill Paul.Xr arp 4 , 238130b84f5SChristian Brueffer.Xr miibus 4 , 2396cee741bSBill Paul.Xr netintro 4 , 2406cee741bSBill Paul.Xr ng_ether 4 , 241a6c410e7SChristian Brueffer.Xr polling 4 , 242e0fb7b7bSMarius Strobl.Xr rgephy 4 , 2436cee741bSBill Paul.Xr vlan 4 , 2446cee741bSBill Paul.Xr ifconfig 8 2456cee741bSBill Paul.Rs 2466cee741bSBill Paul.%T RealTek Semiconductor RTL8139C+, RTL8169, RTL8169S and RTL8110S datasheets 247f80a9407SWolfram Schneider.%U https://www.realtek.com 2486cee741bSBill Paul.Re 2496cee741bSBill Paul.Sh HISTORY 2506cee741bSBill PaulThe 2516cee741bSBill Paul.Nm 2526cee741bSBill Pauldevice driver first appeared in 2536cee741bSBill Paul.Fx 5.2 . 2546cee741bSBill Paul.Sh AUTHORS 2556cee741bSBill PaulThe 2566cee741bSBill Paul.Nm 2576cee741bSBill Pauldriver was written by 2586c899950SBaptiste Daroussin.An Bill Paul Aq Mt wpaul@windriver.com . 2596cee741bSBill Paul.Sh BUGS 2606cee741bSBill PaulThe Xterasys XN-152 32-bit PCI NIC, which uses the RTL8169 MAC and 2616cee741bSBill PaulMarvell 88E1000 PHY, has a defect that causes DMA corruption 2625203edcdSRuslan Ermilovif the board is plugged into a 64-bit PCI slot. 2635203edcdSRuslan ErmilovThe defect 2646cee741bSBill Paullies in the board design, not the chip itself: the PCI REQ64# and ACK64# 2655203edcdSRuslan Ermilovlines should be pulled high, but they are not. 2665203edcdSRuslan ErmilovThe result is that the 2676cee741bSBill Paul8169 chip is tricked into performing 64-bit DMA transfers even though 2686cee741bSBill Paula 64-bit data path between the NIC and the bus does not actually exist. 2696cee741bSBill Paul.Pp 2706cee741bSBill PaulUnfortunately, it is not possible to correct this problem in software, 2715203edcdSRuslan Ermilovhowever it is possible to detect it. 2725203edcdSRuslan ErmilovWhen the 2736cee741bSBill Paul.Nm 2746cee741bSBill Pauldriver is loaded, it will run a diagnostic routine designed to 2756cee741bSBill Paulvalidate DMA operation by placing the chip in digital loopback mode 2765203edcdSRuslan Ermilovand initiating a packet transmission. 2775203edcdSRuslan ErmilovIf the card functions properly, 2786cee741bSBill Paulthe transmitted data will 2795203edcdSRuslan Ermilovbe echoed back unmodified. 2805203edcdSRuslan ErmilovIf the echoed data is corrupt, the driver 2815203edcdSRuslan Ermilovwill print an error message on the console and abort the device attach. 2825203edcdSRuslan ErmilovThe 283e7f8dd75SRebecca Cranuser should ensure the NIC is installed in a 32-bit PCI slot to 2846cee741bSBill Paulavoid this problem. 2856cee741bSBill Paul.Pp 2866cee741bSBill PaulThe RealTek 8169, 8169S and 8110S chips appear to only be capable of 2876cee741bSBill Paultransmitting jumbo frames up to 7.5K in size. 288*a9a35c9eSJohannes Totz.Pp 289*a9a35c9eSJohannes TotzIf this driver is causing problems then an updated driver from 290*a9a35c9eSJohannes Totzthe vendor can be found in ports under net/realtek-re-kmod. 291