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