RL(4)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸŽ€ RL(4) πŸŽ€

okay so bestie, welcome to the manual page for rl β€” the RealTek 8129/8139 Fast Ethernet device driver β€” living in the Kernel Interfaces Manual. this is a 4th-section driver page, it's giving vintage FreeBSD NIC energy, and we're gonna get through it together πŸ’–


✨ SYNOPSIS ✨

so if you wanna bake this driver into the kernel (no modules, just vibes), drop these lines into your kernel config file:

device miibus
device rl

or, alternative route bestie β€” load it as a module at boot time by putting this line in loader.conf(5):

if_rl_load="YES"

both are valid, pick your fighter πŸ’…


🌸 DESCRIPTION 🌸

the rl driver is out here providing support for PCI Ethernet adapters and embedded controllers based on the RealTek 8129 and 8139 Fast Ethernet controller chips. that's the whole job. iconic honestly.

so here's the tea on how the RealTek 8129/8139 series controllers work: they use bus master DMA but β€” and this is the key part β€” they do not use a descriptor-based data transfer mechanism. nope.

the receiver uses a single fixed size ring buffer that packets have to get copied out of into mbufs. and for transmission? there are literally only four outbound packet address registers, which means all outgoing packets have to be stored as contiguous buffers. also, outbound packet buffers must be longword aligned or else your transmission will straight up fail 😭 no cap.

now the 8129 vs the 8139, the family drama: the 8139 has an internal PHY that's controlled through special direct access registers, whereas the 8129 uses an external PHY via an MII bus. the 8139 supports both 10 and 100Mbps speeds in either full or half duplex. the 8129 can do the same speeds and modes given an appropriate PHY chip. so like, it can slay, but it needs the right accessory 🫢

Note: support for the 8139C+ chip is provided by the re(4) driver. different driver, different era, don't come for me.

πŸ¦‹ media types πŸ¦‹

the rl driver supports these media types, bestie:

  • autoselect β€” turns on autoselection of the media type and options. this is only supported if the PHY chip attached to the RealTek controller does NWAY autonegotiation. and yes, you can manually override the autoselected mode by adding media options to the /etc/rc.conf file. main character energy, you're in control πŸ’…
  • 10baseT/UTP β€” sets 10Mbps operation. the mediaopt option can also be used to pick either full-duplex or half-duplex modes.
  • 100baseTX β€” sets 100Mbps (Fast Ethernet) operation. mediaopt can also be used here to pick full-duplex or half-duplex.

🧚 media options 🧚

  • full-duplex β€” forces full duplex operation.
  • half-duplex β€” forces half duplex operation.
heads up babes: the 100baseTX media type is only available if supported by the adapter. so check before you commit. for more info on configuring this device, peep ifconfig(8).

πŸ‘‘ HARDWARE πŸ‘‘

adapters supported by the rl driver include β€” and yes i'm listing every single one, no skipping, we respect the full roster 🫑

  • Accton β€œCheetah” EN1207D (MPX 5030/5038; RealTek 8139 clone)
  • Allied Telesyn AT2550
  • Allied Telesyn AT2500TX
  • Belkin F5D5000
  • BUFFALO (Melco INC.) LPC-CB-CLX (CardBus)
  • Compaq HNE-300
  • CompUSA no-name 10/100 PCI Ethernet NIC
  • Corega FEther CB-TXD
  • Corega FEtherII CB-TXD
  • D-Link DFE-520TX (rev. C1)
  • D-Link DFE-528TX
  • D-Link DFE-530TX+
  • D-Link DFE-538TX
  • D-Link DFE-690TXD
  • Edimax EP-4103DL CardBus
  • Encore ENL832-TX 10/100 M PCI
  • Farallon NetLINE 10/100 PCI
  • Genius GF100TXR
  • GigaFast Ethernet EE100-AXP
  • KTX-9130TX 10/100 Fast Ethernet
  • LevelOne FPC-0106TX
  • Longshine LCS-8038TX-R
  • NDC Communications NE100TX-E
  • Netronix Inc. EA-1210 NetEther 10/100
  • Nortel Networks 10/100BaseTX
  • OvisLink LEF-8129TX
  • OvisLink LEF-8139TX
  • Peppercon AG ROL-F
  • Planex FNW-3603-TX
  • Planex FNW-3800-TX
  • SMC EZ Card 10/100 PCI 1211-TX
  • SOHO (PRAGMATIC) UE-1211C

⭐ LOADER TUNABLES ⭐

  • dev.rl.%unit.prefer_iomap β€” this tunable controls which register mapping should be used on the specified device. a non-zero value enables I/O space register mapping. for controllers that have no I/O space register mapping, this tunable should be set to 0 so it uses memory space register mapping instead. the default value is 1, i.e. I/O space register mapping. lowkey important, don't sleep on it πŸ”₯
  • dev.rl.%unit.twister_enable β€” a non-zero value enables the long cable tuning on the specified device. disabled by default. so if your cable is doing the most, you know where to go πŸ‘€

πŸ’€ DIAGNOSTICS πŸ’€

  • rl%d: couldn't map memory β€” a fatal initialization error has occurred. 😭
  • rl%d: couldn't map interrupt β€” a fatal initialization error has occurred. also 😭
  • rl%d: watchdog timeout β€” the device has stopped responding to the network, or there's a problem with the network connection (cable). check ya cable bestie.
  • rl%d: no memory for rx list β€” the driver failed to allocate an mbuf for the receiver ring.
  • rl%d: no memory for tx list β€” the driver failed to allocate an mbuf for the transmitter ring when allocating a pad buffer or collapsing an mbuf chain into a cluster.
  • rl%d: chip is in D3 power state -- setting to D0 β€” okay this one's a whole saga, so sit down. this message applies only to adapters which support power management. some operating systems place the controller in low power mode when shutting down, and some PCI BIOSes fail to bring the chip out of this state before configuring it. the controller loses all of its PCI configuration in the D3 state, so if the BIOS doesn't set it back to full power mode in time, it won't be able to configure it correctly. the driver tries to detect this condition and bring the adapter back to the D0 (full power) state, but that may not be enough to return the driver to a fully operational condition. if you see this message at boot time and the driver fails to attach the device as a network interface, you'll have to perform second warm boot to have the device properly configured.
note that this condition only occurs when warm booting from another operating system. if you power down your system prior to booting FreeBSD, the card should be configured correctly. so like, full shutdown = problem solved ✨

🌈 SEE ALSO 🌈

altq(4), arp(4), miibus(4), netintro(4), ng_ether(4), polling(4), ifconfig(8)

and also the RealTek 8129, 8139 and 8139C+ datasheets over at https://www.realtek.com. go read the source, bestie, i dare you πŸ“š


πŸ•°οΈ HISTORY πŸ•°οΈ

the rl device driver first appeared in FreeBSD 3.0. throwback era fr fr.


🫢 AUTHORS 🫢

the rl driver was written by Bill Paul <wpaul@ctr.columbia.edu>. thank you bill, king behavior πŸ‘‘


πŸ™ˆ BUGS πŸ™ˆ

okay, the messy part. buckle up.

since outbound packets must be longword aligned, the transmit routine has to copy an unaligned packet into an mbuf cluster buffer before transmission. the driver abuses the fact that the cluster buffer pool is allocated at system startup time in a contiguous region starting at a page boundary. and since cluster buffers are 2048 bytes, they're longword aligned by definition. the driver probably should not be depending on this characteristic. it's giving "works on my machine" πŸ’€ but it's documented, so.

second thing: the RealTek data sheets are of especially poor quality, and there's a lot of information missing, particularly concerning the receiver operation. one particularly important fact the data sheets fail to mention relates to the way in which the chip fills in the receive buffer. when an interrupt is posted to signal that a frame has been received, it's possible that another frame might be in the process of being copied into the receive buffer while the driver is busy handling the first one. if the driver manages to finish processing the first frame before the chip is done DMAing the rest of the next frame, the driver may attempt to process the next frame in the buffer before the chip has had a chance to finish DMAing all of it. 😬

the driver can check for an incomplete frame by inspecting the frame length in the header preceding the actual packet data: an incomplete frame will have the magic length of 0xFFF0. when the driver encounters this value, it knows it has finished processing all currently available packets. and β€” plot twist β€” neither this magic value nor its significance are documented anywhere in the RealTek data sheets. iconique of them, truly πŸŽ€


that's the whole page bestie!! this one's from the Debian packaging of the man page, dated January 16, 2013 β€” vintage, retro, and still here. go forth and configure your 8139 responsibly!! βœ¨πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from