/*
Written 1997-1998 by Donald Becker.
This software may be used and distributed according to the terms
of the GNU General Public License, incorporated herein by reference.
This driver is for the 3Com ISA EtherLink XL "Corkscrew" 3c515 ethercard.
The author may be reached as becker@scyld.com, or C/O
Scyld Computing Corporation
410 Severn Ave., Suite 210
Annapolis MD 21403
2000/2/2- Added support for kernel-level ISAPnP
by Stephen Frost <sfrost@snowman.net> and Alessandro Zummo
Cleaned up for 2.3.x/softnet by Jeff Garzik and Alan Cox.
2001/11/17 - Added ethtool support (jgarzik)
2002/10/28 - Locking updates for 2.5 (alan@lxorguk.ukuu.org.uk)
*/
#define DRV_NAME "3c515"
#define DRV_VERSION "0.99t-ac"
#define DRV_RELDATE "28-Oct-2002"
static char *version =
DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " becker@scyld.com and others\n";
#define CORKSCREW 1
/* "Knobs" that adjust features and parameters. */
/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1512 effectively disables this feature. */
static int rx_copybreak = 200;
/* Allow setting MTU to a larger size, bypassing the normal ethernet setup. */
static const int mtu = 1500;
/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
static int max_interrupt_work = 20;
/* Enable the automatic media selection code -- usually set. */
#define AUTOMEDIA 1
/* Allow the use of fragment bus master transfers instead of only
programmed-I/O for Vortex cards. Full-bus-master transfers are always
enabled by default on Boomerang cards. If VORTEX_BUS_MASTER is defined,
the feature may be turned on using 'options'. */
#define VORTEX_BUS_MASTER
/* A few values that may be tweaked. */
/* Keep the ring sizes a power of two for efficiency. */
#define TX_RING_SIZE 16
#define RX_RING_SIZE 16
#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */
#include <linux/module.h>
#include <linux/isapnp.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/ethtool.h>
#include <linux/bitops.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/dma.h>
#define NEW_MULTICAST
#include <linux/delay.h>
#define MAX_UNITS 8
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("3Com 3c515 Corkscrew driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
/* "Knobs" for adjusting internal parameters. */
/* Put out somewhat more debugging messages. (0 - no msg, 1 minimal msgs). */
#define DRIVER_DEBUG 1
/* Some values here only for performance evaluation and path-coverage
debugging. */
static int rx_nocopy, rx_copy, queued_packet;
/* Number of times to check to see if the Tx FIFO has space, used in some
limited cases. */
#define WAIT_TX_AVAIL 200
/* Operational parameter that usually are not changed. */
#define TX_TIMEOUT 40 /* Time in jiffies before concluding Tx hung */
/* The size here is somewhat misleading: the Corkscrew also uses the ISA
aliased registers at <base>+0x400.
*/
#define CORKSCREW_TOTAL_SIZE 0x20
#ifdef DRIVER_DEBUG
static int corkscrew_debug = DRIVER_DEBUG;
#else
static int corkscrew_debug = 1;
#endif
#define CORKSCREW_ID 10
/*
Theory of Operation
I. Board Compatibility
This device driver is designed for the 3Com 3c515 ISA Fast EtherLink XL,
3Com's ISA bus adapter for Fast Ethernet. Due to the unique I/O port layout,
it's not practical to integrate this driver with the other EtherLink drivers.
II. Board-specific settings
The Corkscrew has an EEPROM for configuration, but no special settings are
needed for Linux.
III. Driver operation
The 3c515 series use an interface that's very similar to the 3c900 "Boomerang"
PCI cards, with the bus master interface extensively modified to work with
the ISA bus.
The card is capable of full-bus-master transfers with separate
lists of transmit and receive descriptors, similar to the AMD LANCE/PCnet,
DEC Tulip and Intel Speedo3.
This driver uses a "RX_COPYBREAK" scheme rather than a fixed intermediate
receive buffer. This scheme allocates full-sized skbuffs as receive
buffers. The value RX_COPYBREAK is used as the copying breakpoint: it is
chosen to trade-off the memory wasted by passing the full-sized skbuff to
the queue layer for all frames vs. the copying cost of copying a frame to a
correctly-sized skbuff.
IIIC. Synchronization
The driver runs as two independent, single-threaded flows of control. One
is the send-packet routine, which enforces single-threaded use by the netif
layer. The other thread is the interrupt handler, which is single
threaded by the hardware and other software.
IV. Notes
Thanks to Terry Murphy of 3Com for providing documentation and a development
board.
The names "Vortex", "Boomerang" and "Corkscrew" are the internal 3Com
project names. I use these names to eliminate confusion -- 3Com product
numbers and names are very similar and often confused.
The new chips support both ethernet (1.5K) and FDDI (4.5K) frame sizes!
This driver only supports ethernet frames because of the recent MTU limit
of 1.5K, but the changes to support 4.5K are minimal.
*/
/* Operational definitions.
These are not used by other compilation units and thus are not
exported in
|