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