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