aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcnet32.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-21 16:22:47 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-21 16:22:47 -0500
commit0b5bf225c06e62eb6066fc5b7ccf4f296356c503 (patch)
tree931d1f5033618a203d0db18cef8eae290a442e3a /drivers/net/pcnet32.c
parent4a5e8e296cfdeef18312c08199f25c00ec148f41 (diff)
[netdrvr] pcnet32: other source formatting cleanups
- undo some Lindent damage by indenting member names - remove history at top of .c file, this is stored in the kernel repo changelog (in greater detail, even).
Diffstat (limited to 'drivers/net/pcnet32.c')
-rw-r--r--drivers/net/pcnet32.c228
1 files changed, 54 insertions, 174 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 861361018640..9595f74da93f 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -156,126 +156,6 @@ static int homepna[MAX_UNITS];
156 */ 156 */
157 157
158/* 158/*
159 * History:
160 * v0.01: Initial version
161 * only tested on Alpha Noname Board
162 * v0.02: changed IRQ handling for new interrupt scheme (dev_id)
163 * tested on a ASUS SP3G
164 * v0.10: fixed an odd problem with the 79C974 in a Compaq Deskpro XL
165 * looks like the 974 doesn't like stopping and restarting in a
166 * short period of time; now we do a reinit of the lance; the
167 * bug was triggered by doing ifconfig eth0 <ip> broadcast <addr>
168 * and hangs the machine (thanks to Klaus Liedl for debugging)
169 * v0.12: by suggestion from Donald Becker: Renamed driver to pcnet32,
170 * made it standalone (no need for lance.c)
171 * v0.13: added additional PCI detecting for special PCI devices (Compaq)
172 * v0.14: stripped down additional PCI probe (thanks to David C Niemi
173 * and sveneric@xs4all.nl for testing this on their Compaq boxes)
174 * v0.15: added 79C965 (VLB) probe
175 * added interrupt sharing for PCI chips
176 * v0.16: fixed set_multicast_list on Alpha machines
177 * v0.17: removed hack from dev.c; now pcnet32 uses ethif_probe in Space.c
178 * v0.19: changed setting of autoselect bit
179 * v0.20: removed additional Compaq PCI probe; there is now a working one
180 * in arch/i386/bios32.c
181 * v0.21: added endian conversion for ppc, from work by cort@cs.nmt.edu
182 * v0.22: added printing of status to ring dump
183 * v0.23: changed enet_statistics to net_devive_stats
184 * v0.90: added multicast filter
185 * added module support
186 * changed irq probe to new style
187 * added PCnetFast chip id
188 * added fix for receive stalls with Intel saturn chipsets
189 * added in-place rx skbs like in the tulip driver
190 * minor cleanups
191 * v0.91: added PCnetFast+ chip id
192 * back port to 2.0.x
193 * v1.00: added some stuff from Donald Becker's 2.0.34 version
194 * added support for byte counters in net_dev_stats
195 * v1.01: do ring dumps, only when debugging the driver
196 * increased the transmit timeout
197 * v1.02: fixed memory leak in pcnet32_init_ring()
198 * v1.10: workaround for stopped transmitter
199 * added port selection for modules
200 * detect special T1/E1 WAN card and setup port selection
201 * v1.11: fixed wrong checking of Tx errors
202 * v1.20: added check of return value kmalloc (cpeterso@cs.washington.edu)
203 * added save original kmalloc addr for freeing (mcr@solidum.com)
204 * added support for PCnetHome chip (joe@MIT.EDU)
205 * rewritten PCI card detection
206 * added dwio mode to get driver working on some PPC machines
207 * v1.21: added mii selection and mii ioctl
208 * v1.22: changed pci scanning code to make PPC people happy
209 * fixed switching to 32bit mode in pcnet32_open() (thanks
210 * to Michael Richard <mcr@solidum.com> for noticing this one)
211 * added sub vendor/device id matching (thanks again to
212 * Michael Richard <mcr@solidum.com>)
213 * added chip id for 79c973/975 (thanks to Zach Brown <zab@zabbo.net>)
214 * v1.23 fixed small bug, when manual selecting MII speed/duplex
215 * v1.24 Applied Thomas' patch to use TxStartPoint and thus decrease TxFIFO
216 * underflows. Added tx_start_pt module parameter. Increased
217 * TX_RING_SIZE from 16 to 32. Added #ifdef'd code to use DXSUFLO
218 * for FAST[+] chipsets. <kaf@fc.hp.com>
219 * v1.24ac Added SMP spinlocking - Alan Cox <alan@redhat.com>
220 * v1.25kf Added No Interrupt on successful Tx for some Tx's <kaf@fc.hp.com>
221 * v1.26 Converted to pci_alloc_consistent, Jamey Hicks / George France
222 * <jamey@crl.dec.com>
223 * - Fixed a few bugs, related to running the controller in 32bit mode.
224 * 23 Oct, 2000. Carsten Langgaard, carstenl@mips.com
225 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
226 * v1.26p Fix oops on rmmod+insmod; plug i/o resource leak - Paul Gortmaker
227 * v1.27 improved CSR/PROM address detection, lots of cleanups,
228 * new pcnet32vlb module option, HP-PARISC support,
229 * added module parameter descriptions,
230 * initial ethtool support - Helge Deller <deller@gmx.de>
231 * v1.27a Sun Feb 10 2002 Go Taniguchi <go@turbolinux.co.jp>
232 * use alloc_etherdev and register_netdev
233 * fix pci probe not increment cards_found
234 * FD auto negotiate error workaround for xSeries250
235 * clean up and using new mii module
236 * v1.27b Sep 30 2002 Kent Yoder <yoder1@us.ibm.com>
237 * Added timer for cable connection state changes.
238 * v1.28 20 Feb 2004 Don Fry <brazilnut@us.ibm.com>
239 * Jon Mason <jonmason@us.ibm.com>, Chinmay Albal <albal@in.ibm.com>
240 * Now uses ethtool_ops, netif_msg_* and generic_mii_ioctl.
241 * Fixes bogus 'Bus master arbitration failure', pci_[un]map_single
242 * length errors, and transmit hangs. Cleans up after errors in open.
243 * Jim Lewis <jklewis@us.ibm.com> added ethernet loopback test.
244 * Thomas Munck Steenholdt <tmus@tmus.dk> non-mii ioctl corrections.
245 * v1.29 6 Apr 2004 Jim Lewis <jklewis@us.ibm.com> added physical
246 * identification code (blink led's) and register dump.
247 * Don Fry added timer for 971/972 so skbufs don't remain on tx ring
248 * forever.
249 * v1.30 18 May 2004 Don Fry removed timer and Last Transmit Interrupt
250 * (ltint) as they added complexity and didn't give good throughput.
251 * v1.30a 22 May 2004 Don Fry limit frames received during interrupt.
252 * v1.30b 24 May 2004 Don Fry fix bogus tx carrier errors with 79c973,
253 * assisted by Bruce Penrod <bmpenrod@endruntechnologies.com>.
254 * v1.30c 25 May 2004 Don Fry added netif_wake_queue after pcnet32_restart.
255 * v1.30d 01 Jun 2004 Don Fry discard oversize rx packets.
256 * v1.30e 11 Jun 2004 Don Fry recover after fifo error and rx hang.
257 * v1.30f 16 Jun 2004 Don Fry cleanup IRQ to allow 0 and 1 for PCI,
258 * expanding on suggestions from Ralf Baechle <ralf@linux-mips.org>,
259 * and Brian Murphy <brian@murphy.dk>.
260 * v1.30g 22 Jun 2004 Patrick Simmons <psimmons@flash.net> added option
261 * homepna for selecting HomePNA mode for PCNet/Home 79C978.
262 * v1.30h 24 Jun 2004 Don Fry correctly select auto, speed, duplex in bcr32.
263 * v1.30i 28 Jun 2004 Don Fry change to use module_param.
264 * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test.
265 * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam().
266 * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4
267 * to allow loopback test to work unchanged.
268 * v1.31b 06 Oct 2005 Don Fry changed alloc_ring to show name of device
269 * if allocation fails
270 * v1.31c 01 Nov 2005 Don Fry Allied Telesyn 2700/2701 FX are 100Mbit only.
271 * Force 100Mbit FD if Auto (ASEL) is selected.
272 * See Bugzilla 2669 and 4551.
273 * v1.32 18 Mar2006 Thomas Bogendoerfer and Don Fry added Multi-Phy
274 * handling for supporting AT-270x FTX cards with FX and Tx PHYs.
275 * Philippe Seewer assisted with auto negotiation and testing.
276 */
277
278/*
279 * Set the number of Tx and Rx buffers, using Log_2(# buffers). 159 * Set the number of Tx and Rx buffers, using Log_2(# buffers).
280 * Reasonable default values are 4 Tx buffers, and 16 Rx buffers. 160 * Reasonable default values are 4 Tx buffers, and 16 Rx buffers.
281 * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). 161 * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4).
@@ -310,31 +190,31 @@ static int homepna[MAX_UNITS];
310 190
311/* The PCNET32 Rx and Tx ring descriptors. */ 191/* The PCNET32 Rx and Tx ring descriptors. */
312struct pcnet32_rx_head { 192struct pcnet32_rx_head {
313 u32 base; 193 u32 base;
314 s16 buf_length; 194 s16 buf_length;
315 s16 status; 195 s16 status;
316 u32 msg_length; 196 u32 msg_length;
317 u32 reserved; 197 u32 reserved;
318}; 198};
319 199
320struct pcnet32_tx_head { 200struct pcnet32_tx_head {
321 u32 base; 201 u32 base;
322 s16 length; 202 s16 length;
323 s16 status; 203 s16 status;
324 u32 misc; 204 u32 misc;
325 u32 reserved; 205 u32 reserved;
326}; 206};
327 207
328/* The PCNET32 32-Bit initialization block, described in databook. */ 208/* The PCNET32 32-Bit initialization block, described in databook. */
329struct pcnet32_init_block { 209struct pcnet32_init_block {
330 u16 mode; 210 u16 mode;
331 u16 tlen_rlen; 211 u16 tlen_rlen;
332 u8 phys_addr[6]; 212 u8 phys_addr[6];
333 u16 reserved; 213 u16 reserved;
334 u32 filter[2]; 214 u32 filter[2];
335 /* Receive and transmit ring base, along with extra bits. */ 215 /* Receive and transmit ring base, along with extra bits. */
336 u32 rx_ring; 216 u32 rx_ring;
337 u32 tx_ring; 217 u32 tx_ring;
338}; 218};
339 219
340/* PCnet32 access functions */ 220/* PCnet32 access functions */
@@ -355,46 +235,46 @@ struct pcnet32_access {
355struct pcnet32_private { 235struct pcnet32_private {
356 struct pcnet32_init_block init_block; 236 struct pcnet32_init_block init_block;
357 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */ 237 /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */
358 struct pcnet32_rx_head *rx_ring; 238 struct pcnet32_rx_head *rx_ring;
359 struct pcnet32_tx_head *tx_ring; 239 struct pcnet32_tx_head *tx_ring;
360 dma_addr_t dma_addr; /* DMA address of beginning of this 240 dma_addr_t dma_addr;/* DMA address of beginning of this
361 object, returned by 241 object, returned by pci_alloc_consistent */
362 pci_alloc_consistent */ 242 struct pci_dev *pci_dev;
363 struct pci_dev *pci_dev; /* Pointer to the associated pci device 243 const char *name;
364 structure */
365 const char *name;
366 /* The saved address of a sent-in-place packet/buffer, for skfree(). */ 244 /* The saved address of a sent-in-place packet/buffer, for skfree(). */
367 struct sk_buff **tx_skbuff; 245 struct sk_buff **tx_skbuff;
368 struct sk_buff **rx_skbuff; 246 struct sk_buff **rx_skbuff;
369 dma_addr_t *tx_dma_addr; 247 dma_addr_t *tx_dma_addr;
370 dma_addr_t *rx_dma_addr; 248 dma_addr_t *rx_dma_addr;
371 struct pcnet32_access a; 249 struct pcnet32_access a;
372 spinlock_t lock; /* Guard lock */ 250 spinlock_t lock; /* Guard lock */
373 unsigned int cur_rx, cur_tx; /* The next free ring entry */ 251 unsigned int cur_rx, cur_tx; /* The next free ring entry */
374 unsigned int rx_ring_size; /* current rx ring size */ 252 unsigned int rx_ring_size; /* current rx ring size */
375 unsigned int tx_ring_size; /* current tx ring size */ 253 unsigned int tx_ring_size; /* current tx ring size */
376 unsigned int rx_mod_mask; /* rx ring modular mask */ 254 unsigned int rx_mod_mask; /* rx ring modular mask */
377 unsigned int tx_mod_mask; /* tx ring modular mask */ 255 unsigned int tx_mod_mask; /* tx ring modular mask */
378 unsigned short rx_len_bits; 256 unsigned short rx_len_bits;
379 unsigned short tx_len_bits; 257 unsigned short tx_len_bits;
380 dma_addr_t rx_ring_dma_addr; 258 dma_addr_t rx_ring_dma_addr;
381 dma_addr_t tx_ring_dma_addr; 259 dma_addr_t tx_ring_dma_addr;
382 unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ 260 unsigned int dirty_rx, /* ring entries to be freed. */
383 struct net_device_stats stats; 261 dirty_tx;
384 char tx_full; 262
385 char phycount; /* number of phys found */ 263 struct net_device_stats stats;
386 int options; 264 char tx_full;
387 unsigned int shared_irq:1, /* shared irq possible */ 265 char phycount; /* number of phys found */
388 dxsuflo:1, /* disable transmit stop on uflo */ 266 int options;
389 mii:1; /* mii port available */ 267 unsigned int shared_irq:1, /* shared irq possible */
390 struct net_device *next; 268 dxsuflo:1, /* disable transmit stop on uflo */
391 struct mii_if_info mii_if; 269 mii:1; /* mii port available */
392 struct timer_list watchdog_timer; 270 struct net_device *next;
393 struct timer_list blink_timer; 271 struct mii_if_info mii_if;
394 u32 msg_enable; /* debug message level */ 272 struct timer_list watchdog_timer;
273 struct timer_list blink_timer;
274 u32 msg_enable; /* debug message level */
395 275
396 /* each bit indicates an available PHY */ 276 /* each bit indicates an available PHY */
397 u32 phymask; 277 u32 phymask;
398}; 278};
399 279
400static void pcnet32_probe_vlbus(void); 280static void pcnet32_probe_vlbus(void);