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