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