1<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
2
3<book id="TulipUserGuide">
4 <bookinfo>
5  <title>Tulip Driver User's Guide</title>
6  
7  <authorgroup>
8   <author>
9    <firstname>Jeff</firstname>
10    <surname>Garzik</surname>
11    <affiliation>
12     <address>
13      <email>jgarzik@mandrakesoft.com</email>
14     </address>
15    </affiliation>
16   </author>
17  </authorgroup>
18
19  <copyright>
20   <year>2001</year>
21   <holder>Jeff Garzik</holder>
22  </copyright>
23
24  <legalnotice>
25   <para>
26     This documentation is free software; you can redistribute
27     it and/or modify it under the terms of the GNU General Public
28     License as published by the Free Software Foundation; either
29     version 2 of the License, or (at your option) any later
30     version.
31   </para>
32      
33   <para>
34     This program is distributed in the hope that it will be
35     useful, but WITHOUT ANY WARRANTY; without even the implied
36     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
37     See the GNU General Public License for more details.
38   </para>
39      
40   <para>
41     You should have received a copy of the GNU General Public
42     License along with this program; if not, write to the Free
43     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
44     MA 02111-1307 USA
45   </para>
46      
47   <para>
48     For more details see the file COPYING in the source
49     distribution of Linux.
50   </para>
51  </legalnotice>
52 </bookinfo>
53
54 <toc></toc>
55
56  <chapter id="intro">
57    <title>Introduction</title>
58<para>
59The Tulip Ethernet Card Driver
60is maintained by Jeff Garzik (<email>jgarzik@mandrakesoft.com</email>).
61</para>
62
63<para>
64The Tulip driver was developed by Donald Becker and changed by
65Jeff Garzik, Takashi Manabe and a cast of thousands.
66</para>
67
68<para>
69For 2.4.x and later kernels, the Linux Tulip driver is available at
70<ULink URL="http://sourceforge.net/projects/tulip/">http://sourceforge.net/projects/tulip/</ULink>
71</para>
72
73<para>
74	This driver is for the Digital "Tulip" Ethernet adapter interface.
75	It should work with most DEC 21*4*-based chips/ethercards, as well as
76	with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and ASIX.
77</para>
78
79<para>
80        The original author may be reached as becker@scyld.com, or C/O
81        Scyld Computing Corporation,
82        410 Severn Ave., Suite 210,
83        Annapolis MD 21403
84</para>
85
86<para>
87	Additional information on Donald Becker's tulip.c
88	is available at <ULink URL="http://www.scyld.com/network/tulip.html">http://www.scyld.com/network/tulip.html</ULink>
89</para>
90
91  </chapter>
92
93  <chapter id="drvr-compat">
94    <title>Driver Compatibility</title>
95
96<para>
97This device driver is designed for the DECchip "Tulip", Digital's
98single-chip ethernet controllers for PCI (now owned by Intel).
99Supported members of the family
100are the 21040, 21041, 21140, 21140A, 21142, and 21143.  Similar work-alike
101chips from Lite-On, Macronics, ASIX, Compex and other listed below are also
102supported.
103</para>
104
105<para>
106These chips are used on at least 140 unique PCI board designs.  The great
107number of chips and board designs supported is the reason for the
108driver size and complexity.  Almost of the increasing complexity is in the
109board configuration and media selection code.  There is very little
110increasing in the operational critical path length.
111</para>
112  </chapter>
113
114  <chapter id="board-settings">
115    <title>Board-specific Settings</title>
116
117<para>
118PCI bus devices are configured by the system at boot time, so no jumpers
119need to be set on the board.  The system BIOS preferably should assign the
120PCI INTA signal to an otherwise unused system IRQ line.
121</para>
122
123<para>
124Some boards have EEPROMs tables with default media entry.  The factory default
125is usually "autoselect".  This should only be overridden when using
126transceiver connections without link beat e.g. 10base2 or AUI, or (rarely!)
127for forcing full-duplex when used with old link partners that do not do
128autonegotiation.
129</para>
130  </chapter>
131
132  <chapter id="driver-operation">
133    <title>Driver Operation</title>
134
135<sect1><title>Ring buffers</title>
136
137<para>
138The Tulip can use either ring buffers or lists of Tx and Rx descriptors.
139This driver uses statically allocated rings of Rx and Tx descriptors, set at
140compile time by RX/TX_RING_SIZE.  This version of the driver allocates skbuffs
141for the Rx ring buffers at open() time and passes the skb->data field to the
142Tulip as receive data buffers.  When an incoming frame is less than
143RX_COPYBREAK bytes long, a fresh skbuff is allocated and the frame is
144copied to the new skbuff.  When the incoming frame is larger, the skbuff is
145passed directly up the protocol stack and replaced by a newly allocated
146skbuff.
147</para>
148
149<para>
150The RX_COPYBREAK value is chosen to trade-off the memory wasted by
151using a full-sized skbuff for small frames vs. the copying costs of larger
152frames.  For small frames the copying cost is negligible (esp. considering
153that we are pre-loading the cache with immediately useful header
154information).  For large frames the copying cost is non-trivial, and the
155larger copy might flush the cache of useful data.  A subtle aspect of this
156choice is that the Tulip only receives into longword aligned buffers, thus
157the IP header at offset 14 isn't longword aligned for further processing.
158Copied frames are put into the new skbuff at an offset of "+2", thus copying
159has the beneficial effect of aligning the IP header and preloading the
160cache.
161</para>
162
163</sect1>
164
165<sect1><title>Synchronization</title>
166<para>
167The driver runs as two independent, single-threaded flows of control.  One
168is the send-packet routine, which enforces single-threaded use by the
169dev->tbusy flag.  The other thread is the interrupt handler, which is single
170threaded by the hardware and other software.
171</para>
172
173<para>
174The send packet thread has partial control over the Tx ring and 'dev->tbusy'
175flag.  It sets the tbusy flag whenever it's queuing a Tx packet. If the next
176queue slot is empty, it clears the tbusy flag when finished otherwise it sets
177the 'tp->tx_full' flag.
178</para>
179
180<para>
181The interrupt handler has exclusive control over the Rx ring and records stats
182from the Tx ring.  (The Tx-done interrupt can't be selectively turned off, so
183we can't avoid the interrupt overhead by having the Tx routine reap the Tx
184stats.)	 After reaping the stats, it marks the queue entry as empty by setting
185the 'base' to zero.	 Iff the 'tp->tx_full' flag is set, it clears both the
186tx_full and tbusy flags.
187</para>
188
189</sect1>
190
191  </chapter>
192
193  <chapter id="errata">
194    <title>Errata</title>
195
196<para>
197The old DEC databooks were light on details.
198The 21040 databook claims that CSR13, CSR14, and CSR15 should each be the last
199register of the set CSR12-15 written.  Hmmm, now how is that possible?
200</para>
201
202<para>
203The DEC SROM format is very badly designed not precisely defined, leading to
204part of the media selection junkheap below.  Some boards do not have EEPROM
205media tables and need to be patched up.  Worse, other boards use the DEC
206design kit media table when it isn't correct for their board.
207</para>
208
209<para>
210We cannot use MII interrupts because there is no defined GPIO pin to attach
211them.  The MII transceiver status is polled using an kernel timer.
212</para>
213  </chapter>
214
215  <chapter id="changelog">
216    <title>Driver Change History</title>
217
218    <sect1><title>Version 0.9.14 (February 20, 2001)</title>
219    <itemizedlist>
220    <listitem><para>Fix PNIC problems (Manfred Spraul)</para></listitem>
221    <listitem><para>Add new PCI id for Accton comet</para></listitem>
222    <listitem><para>Support Davicom tulips</para></listitem>
223    <listitem><para>Fix oops in eeprom parsing</para></listitem>
224    <listitem><para>Enable workarounds for early PCI chipsets</para></listitem>
225    <listitem><para>IA64, hppa csr0 support</para></listitem>
226    <listitem><para>Support media types 5, 6</para></listitem>
227    <listitem><para>Interpret a bit more of the 21142 SROM extended media type 3</para></listitem>
228    <listitem><para>Add missing delay in eeprom reading</para></listitem>
229    </itemizedlist>
230    </sect1>
231
232    <sect1><title>Version 0.9.11 (November 3, 2000)</title>
233    <itemizedlist>
234    <listitem><para>Eliminate extra bus accesses when sharing interrupts (prumpf)</para></listitem>
235    <listitem><para>Barrier following ownership descriptor bit flip (prumpf)</para></listitem>
236    <listitem><para>Endianness fixes for >14 addresses in setup frames (prumpf)</para></listitem>
237    <listitem><para>Report link beat to kernel/userspace via netif_carrier_*. (kuznet)</para></listitem>
238    <listitem><para>Better spinlocking in set_rx_mode.</para></listitem>
239    <listitem><para>Fix I/O resource request failure error messages (DaveM catch)</para></listitem>
240    <listitem><para>Handle DMA allocation failure.</para></listitem>
241    </itemizedlist>
242    </sect1>
243
244    <sect1><title>Version 0.9.10 (September 6, 2000)</title>
245    <itemizedlist>
246    <listitem><para>Simple interrupt mitigation (via jamal)</para></listitem>
247    <listitem><para>More PCI ids</para></listitem>
248    </itemizedlist>
249    </sect1>
250
251    <sect1><title>Version 0.9.9 (August 11, 2000)</title>
252    <itemizedlist>
253    <listitem><para>More PCI ids</para></listitem>
254    </itemizedlist>
255    </sect1>
256
257    <sect1><title>Version 0.9.8 (July 13, 2000)</title>
258    <itemizedlist>
259    <listitem><para>Correct signed/unsigned comparison for dummy frame index</para></listitem>
260    <listitem><para>Remove outdated references to struct enet_statistics</para></listitem>
261    </itemizedlist>
262    </sect1>
263
264    <sect1><title>Version 0.9.7 (June 17, 2000)</title>
265    <itemizedlist>
266    <listitem><para>Timer cleanups (Andrew Morton)</para></listitem>
267    <listitem><para>Alpha compile fix (somebody?)</para></listitem>
268    </itemizedlist>
269    </sect1>
270
271    <sect1><title>Version 0.9.6 (May 31, 2000)</title>
272    <itemizedlist>
273    <listitem><para>Revert 21143-related support flag patch</para></listitem>
274    <listitem><para>Add HPPA/media-table debugging printk</para></listitem>
275    </itemizedlist>
276    </sect1>
277
278    <sect1><title>Version 0.9.5 (May 30, 2000)</title>
279    <itemizedlist>
280    <listitem><para>HPPA support (willy@puffingroup)</para></listitem>
281    <listitem><para>CSR6 bits and tulip.h cleanup (Chris Smith)</para></listitem>
282    <listitem><para>Improve debugging messages a bit</para></listitem>
283    <listitem><para>Add delay after CSR13 write in t21142_start_nway</para></listitem>
284    <listitem><para>Remove unused ETHER_STATS code</para></listitem>
285    <listitem><para>Convert 'extern inline' to 'static inline' in tulip.h (Chris Smith)</para></listitem>
286    <listitem><para>Update DS21143 support flags in tulip_chip_info[]</para></listitem>
287    <listitem><para>Use spin_lock_irq, not _irqsave/restore, in tulip_start_xmit()</para></listitem>
288    <listitem><para>Add locking to set_rx_mode()</para></listitem>
289    <listitem><para>Fix race with chip setting DescOwned bit (Hal Murray)</para></listitem>
290    <listitem><para>Request 100% of PIO and MMIO resource space assigned to card</para></listitem>
291    <listitem><para>Remove error message from pci_enable_device failure</para></listitem>
292    </itemizedlist>
293    </sect1>
294
295    <sect1><title>Version 0.9.4.3 (April 14, 2000)</title>
296    <itemizedlist>
297    <listitem><para>mod_timer fix (Hal Murray)</para></listitem>
298    <listitem><para>PNIC2 resuscitation (Chris Smith)</para></listitem>
299    </itemizedlist>
300    </sect1>
301
302    <sect1><title>Version 0.9.4.2 (March 21, 2000)</title>
303    <itemizedlist>
304    <listitem><para>Fix 21041 CSR7, CSR13/14/15 handling</para></listitem>
305    <listitem><para>Merge some PCI ids from tulip 0.91x</para></listitem>
306    <listitem><para>Merge some HAS_xxx flags and flag settings from tulip 0.91x</para></listitem>
307    <listitem><para>asm/io.h fix (submitted by many) and cleanup</para></listitem>
308    <listitem><para>s/HAS_NWAY143/HAS_NWAY/</para></listitem>
309    <listitem><para>Cleanup 21041 mode reporting</para></listitem>
310    <listitem><para>Small code cleanups</para></listitem>
311    </itemizedlist>
312    </sect1>
313
314    <sect1><title>Version 0.9.4.1 (March 18, 2000)</title>
315    <itemizedlist>
316    <listitem><para>Finish PCI DMA conversion (davem)</para></listitem>
317    <listitem><para>Do not netif_start_queue() at end of tulip_tx_timeout() (kuznet)</para></listitem>
318    <listitem><para>PCI DMA fix (kuznet)</para></listitem>
319    <listitem><para>eeprom.c code cleanup</para></listitem>
320    <listitem><para>Remove Xircom Tulip crud</para></listitem>
321    </itemizedlist>
322    </sect1>
323  </chapter>
324
325</book>
326