1.\" Copyright (c) 1997, 1998, 1999 2.\" Bill Paul <wpaul@ee.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 December 26, 2020 32.Dt DC 4 33.Os 34.Sh NAME 35.Nm dc 36.Nd "DEC/Intel 21143 and clone 10/100 Ethernet 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 dc" 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_dc_load="YES" 51.Ed 52.Sh DESCRIPTION 53The 54.Nm 55driver provides support for several PCI Fast Ethernet adapters and 56embedded controllers based on the DEC/Intel 21143 chipset and clones. 57.Pp 58All of supported chipsets have the same general register layout, DMA 59descriptor format and method of operation. 60All of the clone chips 61are based on the 21143 design with various modifications. 62The 6321143 itself has support for 10baseT, BNC, AUI, MII and symbol 64media attachments, 10 and 100Mbps speeds in full or half duplex, 65built in NWAY autonegotiation and wake on LAN. 66The 21143 also 67offers several receive filter programming options including 68perfect filtering, inverse perfect filtering and hash table 69filtering. 70.Pp 71Some clone chips duplicate the 21143 fairly closely while others 72only maintain superficial similarities. 73Some support only MII 74media attachments. 75Others use different receiver filter programming 76mechanisms. 77At least one supports only chained DMA descriptors 78(most support both chained descriptors and contiguously allocated 79fixed size rings). 80Some chips (especially the PNIC) also have 81peculiar bugs. 82The 83.Nm 84driver does its best to provide generalized support for all 85of these chipsets in order to keep special case code to a minimum. 86.Pp 87These chips are used by many vendors which makes it 88difficult to provide a complete list of all supported cards. 89.Pp 90The 91.Nm 92driver supports the following media types: 93.Bl -tag -width ".Cm 10baseT/UTP" 94.It Cm autoselect 95Enable autoselection of the media type and options. 96The user can manually override 97the autoselected mode by adding media options to the 98.Pa /etc/rc.conf 99file. 100.Pp 101Note: the built-in NWAY autonegotiation on the original PNIC 82c168 102chip is horribly broken and is not supported by the 103.Nm 104driver at this time (see the 105.Sx BUGS 106section for details). 107The original 82c168 appears 108on very early revisions of the LinkSys LNE100TX and Matrox FastNIC. 109.It Cm 10baseT/UTP 110Set 10Mbps operation. 111The 112.Cm mediaopt 113option can also be used to enable 114.Cm full-duplex 115operation. 116Not specifying 117.Cm full-duplex 118implies 119.Cm half-duplex 120mode. 121.It Cm 100baseTX 122Set 100Mbps (Fast Ethernet) operation. 123The 124.Cm mediaopt 125option can also be used to enable 126.Cm full-duplex 127operation. 128Not specifying 129.Cm full-duplex 130implies 131.Cm half-duplex 132mode. 133.El 134.Pp 135The 136.Nm 137driver supports the following media options: 138.Bl -tag -width ".Cm full-duplex" 139.It Cm full-duplex 140Force full duplex operation. 141The interface will operate in 142half duplex mode if this media option is not specified. 143.El 144.Pp 145Note that the 100baseTX media type may not be available on certain 146Intel 21143 adapters which support 10Mbps media attachments only. 147For more information on configuring this device, see 148.Xr ifconfig 8 . 149.Sh HARDWARE 150The 151.Nm 152driver provides support for the following chipsets: 153.Pp 154.Bl -bullet -compact 155.It 156DEC/Intel 21143 157.It 158ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513 159Centaur II 160.It 161ALi/ULi M5261 and M5263 162.It 163ASIX Electronics AX88140A and AX88141 164.It 165Conexant LANfinity RS7112 (miniPCI) 166.It 167Davicom DM9009, DM9100, DM9102 and DM9102A 168.It 169Lite-On 82c168 and 82c169 PNIC 170.It 171Lite-On/Macronix 82c115 PNIC II 172.It 173Macronix 98713, 98713A, 98715, 98715A, 98715AEC-C, 98725, 98727 and 98732 174.It 175Xircom X3201 (cardbus only) 176.El 177.Pp 178The 179following NICs are known to work with the 180.Nm 181driver at this time: 182.Pp 183.Bl -bullet -compact 184.It 1853Com OfficeConnect 10/100B (ADMtek AN985 Centaur-P) 186.It 187Abocom FE2500 188.It 189Accton EN1217 (98715A) 190.It 191Accton EN2242 MiniPCI 192.It 193Adico AE310TX (98715A) 194.It 195Alfa Inc GFC2204 (ASIX AX88140A) 196.It 197Built in 10Mbps only Ethernet on Compaq Presario 7900 series 198desktops (21143, non-MII) 199.It 200Built in Ethernet on LinkSys EtherFast 10/100 Instant GigaDrive (DM9102, MII) 201.It 202CNet Pro110B (ASIX AX88140A) 203.It 204CNet Pro120A (98715A or 98713A) and CNet Pro120B (98715) 205.It 206Compex RL100-TX (98713 or 98713A) 207.It 208D-Link DFE-570TX (21143, MII, quad port) 209.It 210Digital DE500-BA 10/100 (21143, non-MII) 211.It 212ELECOM Laneed LD-CBL/TXA (ADMtek AN985) 213.It 214Hawking CB102 CardBus 215.It 216IBM EtherJet Cardbus Adapter 217.It 218Intel PRO/100 Mobile Cardbus (versions that use the X3201 chipset) 219.It 220Jaton XpressNet (Davicom DM9102) 221.It 222Kingston KNE100TX (21143, MII) 223.It 224Kingston KNE110TX (PNIC 82c169) 225.It 226LinkSys LNE100TX (PNIC 82c168, 82c169) 227.It 228LinkSys LNE100TX v2.0 (PNIC II 82c115) 229.It 230LinkSys LNE100TX v4.0/4.1 (ADMtek AN985 Centaur-P) 231.It 232Matrox FastNIC 10/100 (PNIC 82c168, 82c169) 233.It 234Melco LGY-PCI-TXL 235.It 236Microsoft MN-120 10/100 CardBus (ADMTek Centaur-C) 237.It 238Microsoft MN-130 10/100 PCI (ADMTek Centaur-P) 239.It 240NDC SOHOware SFA110A (98713A) 241.It 242NDC SOHOware SFA110A Rev B4 (98715AEC-C) 243.It 244NetGear FA310-TX Rev.\& D1, D2 or D3 (PNIC 82c169) 245.It 246Netgear FA511 247.It 248PlaneX FNW-3602-T (ADMtek AN985) 249.It 250SMC EZ Card 10/100 1233A-TX (ADMtek AN985) 251.It 252SVEC PN102-TX (98713) 253.It 254Xircom Cardbus Realport 255.It 256Xircom Cardbus Ethernet 10/100 257.It 258Xircom Cardbus Ethernet II 10/100 259.El 260.Sh DIAGNOSTICS 261.Bl -diag 262.It "dc%d: couldn't map ports/memory" 263A fatal initialization error has occurred. 264.It "dc%d: couldn't map interrupt" 265A fatal initialization error has occurred. 266.It "dc%d: watchdog timeout" 267A packet was queued for transmission and a transmit command was 268issued, but the device failed to acknowledge the transmission 269before a timeout expired. 270This can happen if the device is unable 271to deliver interrupts for some reason, of if there is a problem with 272the network connection (cable or network equipment) that results in a loss 273of link. 274.It "dc%d: no memory for rx list" 275The driver failed to allocate an mbuf for the receiver ring. 276.It "dc%d: TX underrun -- increasing TX threshold" 277The device generated a transmit underrun error while attempting to 278DMA and transmit a packet. 279This happens if the host is not able to 280DMA the packet data into the NIC's FIFO fast enough. 281The driver 282will dynamically increase the transmit start threshold so that 283more data must be DMAed into the FIFO before the NIC will start 284transmitting it onto the wire. 285.It "dc%d: TX underrun -- using store and forward mode" 286The device continued to generate transmit underruns even after all 287possible transmit start threshold settings had been tried, so the 288driver programmed the chip for store and forward mode. 289In this mode, 290the NIC will not begin transmission until the entire packet has been 291transferred into its FIFO memory. 292.It "dc%d: chip is in D3 power state -- setting to D0" 293This message applies only to adapters which support power 294management. 295Some operating systems place the controller in low power 296mode when shutting down, and some PCI BIOSes fail to bring the chip 297out of this state before configuring it. 298The controller loses all of 299its PCI configuration in the D3 state, so if the BIOS does not set 300it back to full power mode in time, it will not be able to configure it 301correctly. 302The driver tries to detect this condition and bring 303the adapter back to the D0 (full power) state, but this may not be 304enough to return the driver to a fully operational condition. 305If 306you see this message at boot time and the driver fails to attach 307the device as a network interface, you will have to perform a second 308warm boot to have the device properly configured. 309.Pp 310Note that this condition only occurs when warm booting from another 311operating system. 312If you power down your system prior to booting 313.Fx , 314the card should be configured correctly. 315.El 316.Sh SEE ALSO 317.Xr altq 4 , 318.Xr arp 4 , 319.Xr miibus 4 , 320.Xr netintro 4 , 321.Xr ng_ether 4 , 322.Xr polling 4 , 323.Xr vlan 4 , 324.Xr ifconfig 8 325.Rs 326.%T ADMtek AL981, AL983 and AL985 data sheets 327.%U http://www.admtek.com.tw 328.Re 329.Rs 330.%T ASIX Electronics AX88140A and AX88141 data sheets 331.%U http://www.asix.com.tw 332.Re 333.Rs 334.%T Davicom DM9102 data sheet 335.%U http://www.davicom.com.tw/userfile/24247/DM9102H-DS-F01-021508.pdf 336.Re 337.Rs 338.%T Intel 21143 Hardware Reference Manual 339.%U http://developer.intel.com 340.Re 341.Rs 342.%T Macronix 98713/A, 98715/A and 98725 data sheets 343.%U http://www.macronix.com 344.Re 345.Rs 346.%T Macronix 98713/A and 98715/A app notes 347.%U http://www.macronix.com 348.Re 349.Sh HISTORY 350The 351.Nm 352device driver first appeared in 353.Fx 4.0 . 354.Sh AUTHORS 355The 356.Nm 357driver was written by 358.An Bill Paul Aq Mt wpaul@ee.columbia.edu . 359.Sh BUGS 360The Macronix application notes claim that in order to put the 361chips in normal operation, the driver must write a certain magic 362number into the CSR16 register. 363The numbers are documented in 364the app notes, but the exact meaning of the bits is not. 365.Pp 366The 98713A seems to have a problem with 10Mbps full duplex mode. 367The transmitter works but the receiver tends to produce many 368unexplained errors leading to very poor overall performance. 369The 37098715A does not exhibit this problem. 371All other modes on the 37298713A seem to work correctly. 373.Pp 374The original 82c168 PNIC chip has built in NWAY support which is 375used on certain early LinkSys LNE100TX and Matrox FastNIC cards, 376however it is horribly broken and difficult to use reliably. 377Consequently, autonegotiation is not currently supported for this 378chipset: the driver defaults the NIC to 10baseT half duplex, and it is 379up to the operator to manually select a different mode if necessary. 380(Later cards use an external MII transceiver to implement NWAY 381autonegotiation and work correctly.) 382.Pp 383The 384.Nm 385driver programs 82c168 and 82c169 PNIC chips to use the store and 386forward setting for the transmit start threshold by default. 387This 388is to work around problems with some NIC/PCI bus combinations where 389the PNIC can transmit corrupt frames when operating at 100Mbps, 390probably due to PCI DMA burst transfer errors. 391.Pp 392The 82c168 and 82c169 PNIC chips also have a receiver bug that 393sometimes manifests during periods of heavy receive and transmit 394activity, where the chip will improperly DMA received frames to 395the host. 396The chips appear to upload several kilobytes of garbage 397data along with the received frame data, dirtying several RX buffers 398instead of just the expected one. 399The 400.Nm 401driver detects this condition and will salvage the frame; however, 402it incurs a serious performance penalty in the process. 403.Pp 404The PNIC chips also sometimes generate a transmit underrun error when 405the driver attempts to download the receiver filter setup frame, which 406can result in the receive filter being incorrectly programmed. 407The 408.Nm 409driver will watch for this condition and requeue the setup frame until 410it is transferred successfully. 411.Pp 412The ADMtek AL981 chip (and possibly the AN985 as well) has been observed 413to sometimes wedge on transmit: this appears to happen when the driver 414queues a sequence of frames which cause it to wrap from the end of the 415transmit descriptor ring back to the beginning. 416The 417.Nm 418driver attempts to avoid this condition by not queuing any frames past 419the end of the transmit ring during a single invocation of the 420.Fn dc_start 421routine. 422This workaround has a negligible impact on transmit performance. 423