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