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