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