1.\" $OpenBSD: dc.4,v 1.21 2001/04/23 15:30:25 aaron Exp $ 2.\" 3.\" Copyright (c) 1997, 1998, 1999 4.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by Bill Paul. 17.\" 4. Neither the name of the author nor the names of any co-contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 25.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31.\" THE POSSIBILITY OF SUCH DAMAGE. 32.\" 33.\" $FreeBSD: src/share/man/man4/dc.4,v 1.1 1999/12/04 17:41:24 wpaul Exp $ 34.\" 35.Dd November 20, 1999 36.Dt DC 4 37.Os 38.Sh NAME 39.Nm dc 40.Nd DEC/Intel 21143 and clone 10/100 Ethernet driver 41.Sh SYNOPSIS 42.Cd "dc* at pci? dev ? function ?" 43.Sh DESCRIPTION 44The 45.Nm 46driver provides support for several PCI and CardBus Fast Ethernet adapters 47and embedded controllers based on the following chipsets: 48.Pp 49.Bl -bullet -compact -offset indent 50.It 51DEC/Intel 21143 PCI and CardBus 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 PCI and AN983 Centaur-P PCI 60.It 61ADMtek AN985 Centaur-C CardBus 62.It 63Lite-On 82c168 and 82c169 PNIC 64.It 65Lite-On/Macronix 82c115 PNIC II 66.It 67Xircom X3201-based CardBus 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 are based on the 21143 design with 73various modifications. 74The 21143 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 offers several receive filter programming options including 78perfect filtering, inverse perfect filtering and hash table filtering. 79.Pp 80Some clone chips duplicate the 21143 fairly closely while others 81only maintain superficial similarities. 82Some support only MII media attachments. 83Others use different receiver filter programming mechanisms. 84At least one supports only chained DMA descriptors 85(most support both chained descriptors and contiguously allocated 86fixed size rings). 87Some chips (especially the PNIC) also have peculiar 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 minimum. 92.Pp 93These chips are used by many vendors which makes it 94difficult provide a complete list of all supported cards. 95The following NICs are known to work with the 96.Nm 97driver at this time: 98.Pp 99.Bl -bullet -compact -offset indent 100.It 101Digital DE500-BA 10/100 (21143, non-MII) 102.It 103Built in DE500-BA on DEC Alpha workstations (21143, non-MII) 104.It 105Built in Ethernet on LinkSys EtherFast 10/100 Instant GigaDrive (DM9102, MII) 106.It 107Kingston KNE100TX (21143, MII) 108.It 109D-Link DFE-570TX (21143, MII, quad port) 110.It 111NDC SOHOware SFA110A (98713A) 112.It 113NDC SOHOware SFA110A Rev B4 (98715AEC-C) 114.It 115SVEC PN102-TX (98713) 116.It 117CNet Pro120A (98715A or 98713A) and CNet Pro120B (98715) 118.It 119Compex RL100-TX (98713 or 98713A) 120.It 121LinkSys LNE100TX (PNIC 82c168, 82c169) 122.It 123NetGear FA310-TX Rev. D1, D2 or D3 (PNIC 82c169) 124.It 125Matrox FastNIC 10/100 (PNIC 82c168, 82c169) 126.It 127Kingston KNE110TX (PNIC 82c169) 128.It 129LinkSys LNE100TX v2.0 (PNIC II 82c115) 130.It 131Jaton XpressNet (Davicom DM9102) 132.It 133Alfa Inc GFC2204 (ASIX AX88140A) 134.It 135CNet Pro110B (ASIX AX88140A) 136.It 137LinkSys LNE100TX v4.x (ADMtek AN983 Centaur-P) 138.It 139Xircom CardBus, including RealPort models (Xircom X3201) 140.It 141IBM EtherJet 10/100 CardBus (Intel 21143) 142.It 143Accton EN1217 (98715) and EN2242 (ADMtek Centaur) 144.It 145Mototech ME316 (ADMtek Centaur) 146.El 147.Pp 148The 149.Nm 150driver supports the following media types: 151.Pp 152.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 153.It autoselect 154Enable autoselection of the media type and options. 155The user can manually override 156the autoselected mode by adding media options to the 157.Xr hostname.if 5 158file. 159.Pp 160Note: the built-in NWAY autonegotiation on the original PNIC 82c168 161chip is horribly broken and is not supported by the 162.Nm 163driver at this time: the chip will operate in any speed or duplex 164mode, however these must be set manually. 165The original 82c168 appears on very early revisions of the LinkSys LNE100TX 166and Matrox FastNIC. 167.It 10baseT/UTP 168Set 10Mbps operation. 169The 170.Ar mediaopt 171option can also be used to enable 172.Ar full-duplex 173operation. 174Not specifying 175.Ar full duplex 176implies 177.Ar half-duplex 178mode. 179.It 100baseTX 180Set 100Mbps (Fast Ethernet) operation. 181The 182.Ar mediaopt 183option can also be used to enable 184.Ar full-duplex 185operation. 186Not specifying 187.Ar full duplex 188implies 189.Ar half-duplex 190mode. 191.El 192.Pp 193The 194.Nm 195driver supports the following media options: 196.Pp 197.Bl -tag -width xxxxxxxxxxxxxxxxxxxx 198.It full-duplex 199Force full duplex operation. 200The interface will operate in half duplex mode if this media option 201is not specified. 202.El 203.Pp 204Note that the 100baseTX media type may not be available on certain 205Intel 21143 adapters which support 10mbps media attachments only. 206For more information on configuring this device, see 207.Xr ifconfig 8 . 208.Sh DIAGNOSTICS 209.Bl -diag 210.It "dc%d: couldn't map ports/memory" 211A fatal initialization error has occurred. 212.It "dc%d: couldn't map interrupt" 213A fatal initialization error has occurred. 214.It "dc%d: watchdog timeout" 215A packet was queued for transmission and a transmit command was 216issued, however the device failed to acknowledge the transmission 217before a timeout expired. 218This can happen if the device is unable to deliver interrupts for some 219reason, or if there is a problem with the network connection (cable). 220.It "dc%d: no memory for rx list" 221The driver failed to allocate an mbuf for the receiver ring. 222.It "dc%d: TX underrun -- increasing TX threshold" 223The device generated a transmit underrun error while attempting to 224DMA and transmit a packet. 225This happens if the host is not able to DMA the packet data into the NIC's 226FIFO fast enough. 227The driver will 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, the NIC will not begin transmission until the entire packet 235has been transferred into its FIFO memory. 236.It "dc%d: chip is in D3 power state -- setting to D0" 237This message applies only to adapters which support power management. 238Some operating systems place the controller in low power 239mode when shutting down, and some PCI BIOSes fail to bring the chip 240out of this state before configuring it. 241The controller loses all of its PCI configuration in the D3 state, 242so if the BIOS does not set it back to full power mode in time, 243it won't be able to configure it correctly. 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 you see this message at boot time and the driver fails to attach 248the device as a network interface, you will have to perform a second 249warm boot to have the device properly configured. 250.Pp 251Note that this condition only occurs when warm booting from another 252operating system. 253If you power down your system prior to booting 254.Ox , 255the card should be configured correctly. 256.El 257.Sh SEE ALSO 258.Xr arp 4 , 259.Xr netintro 4 , 260.Xr ifconfig 8 261.Rs 262.%T ADMtek AL981 and AL983 data sheets 263.%O http://www.admtek.com.tw 264.Re 265.Rs 266.%T ASIX Electronics AX88140A and AX88141 data sheets 267.%O http://www.asix.com.tw 268.Re 269.Rs 270.%T Davicom DM9102 data sheet 271.%O http://www.davicom8.com 272.Re 273.Rs 274.%T Intel 21143 Hardware Reference Manual 275.%O http://developer.intel.com 276.Re 277.Rs 278.%T Macronix 98713/A, 98715/A and 98725 data sheets 279.%O http://www.macronix.com 280.Re 281.Rs 282.%T Macronix 98713/A and 98715/A app notes 283.%O http://www.macronix.com 284.Re 285.Sh HISTORY 286The 287.Nm 288device driver first appeared in 289.Fx 4.0 . 290.Ox 291support was added in 292.Ox 2.7 . 293.Sh AUTHORS 294The 295.Nm 296driver was written by Bill Paul <wpaul@ee.columbia.edu> and ported to 297.Ox 298by Aaron Campbell <aaron@openbsd.org>. 299.Sh BUGS 300The Macronix application notes claim that in order to put the 301chips in normal operation, the driver must write a certain magic 302number into the CSR16 register. 303The numbers are documented in the app notes, but the exact meaning of the 304bits is not. 305.Pp 306The 98713A seems to have a problem with 10Mbps full duplex mode. 307The transmitter works but the receiver tends to produce many 308unexplained errors leading to very poor overall performance. 309The 98715A does not exhibit this problem. 310All other modes on the 98713A 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 is to work around problems with some NIC/PCI bus combinations where 326the PNIC can transmit corrupt frames when operating at 100Mbps, 327probably due to PCI DMA burst transfer errors. 328.Pp 329The 82c168 and 82c169 PNIC chips also have a receiver bug that 330sometimes manifests during periods of heavy receive and transmit 331activity, where the chip will improperly DMA received frames to 332the host. 333The chips appear to upload several kilobytes of garbage 334data along with the received frame data, dirtying several RX buffers 335instead of just the expected one. 336The 337.Nm 338driver detects this condition and will salvage the frame, however 339it incurs a serious performance penalty in the process. 340.Pp 341The PNIC chips also sometimes generate a transmit underrun error when 342the driver attempts to download the receiver filter setup frame, which 343can result in the receive filter being incorrectly programmed. 344The 345.Nm 346driver will watch for this condition and requeue the setup frame until 347it is transferred successfully. 348.Pp 349The ADMtek AL981 chip (and possibly the AN983 as well) has been observed 350to sometimes wedge on transmit: this appears to happen when the driver 351queues a sequence of frames which cause it to wrap from the end of 352the transmit descriptor ring back to the beginning. 353The 354.Nm 355driver attempts to avoid this condition by not queuing any frames past 356the end of the transmit ring during a single invocation of the 357.Fn dc_start 358routine. 359This workaround has a negligible impact on transmit performance. 360.Pp 361The 362.Fn mii_tick 363function does not currently run for ASIX boards, meaning cable disconnects 364and reconnects can go unnoticed. 365The AX88140A and AX88141 data sheets indicate that they don't have RX or TX 366state registers (the bits are reserved). 367Therefore, we can't seem to reliably detect when the adapter is idle. 368.Pp 369The Davicom interfaces require a grossly high PCI latency timer value to 370function properly. 371This means when a Davicom adapter is present in the machine, it is given 372an unfairly high amount of bandwidth on the PCI bus, unnecessarily taking 373time away from other devices. 374Therefore, Davicom network cards are not recommended for use with 375.Ox . 376Be careful; some motherboards have Davicom interfaces built-in. 377