Usenet comp.os.linux.announce (1993-2013)
 help / color / mirror / Atom feed
* Linux Ethernet HOWTO
@ 1993-08-31 15:51 Paul Gortmaker
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Gortmaker @ 1993-08-31 15:51 UTC (permalink / raw)


Archive-Name: linux/howto/ethernet
Last-Modified: August 28, 1993

Linux Ethernet HOWTO v0.1 -- Last updated August 28, 1993
---------------------------------------------------------------------------
0. Introduction

	This is the Ethernet-HOWTO, which is a compilation of information
	about which ethernet devices can be used for Linux, and how to
	set them up.

	This Ethernet-HOWTO is by Donald J. Becker and Paul Gortmaker.
	It covers what cards you should and shouldn't buy; how to set
	them up, how to run more than one, and other common problems and
	questions. It does *not* cover the software end of things, as that
	is covered in the NET-2 HOWTO. You can freely distribute this 
	document as long as you distribute an original copy with the 
	author's names intact.

	Most of this information came from Donald J. Becker 
	<becker@super.org> who is responsible for writing and 
	supporting most of the ethernet drivers that are presently
	available. Bj0rn Ekwall <bj0rn@blox.se> is responsible for
	the D-Link pocket driver. A special thanks to others who have helped
	with the device drivers and testing.

0.1 Disclaimer

	This document is *not* gospel. However, it is probably the most
	up to date info that you will be able to find. Nobody is responsible
	for what happens to your hardware but yourself. If your ethercard
	goes up in smoke (...nearly impossible!) we take no responsibility.

0.2 Questions already?

        If you have questions about your ethernet card, please READ this
	document first. You may also want to join the NET channel of the
	Linux-activists mailing list by sending mail to
                linux-activists-request@niksula.hut.fi
        with the line
                X-Mn-Admin: join NET
        at the top of the message body (not the subject). Note that the NET
	channel is primarily used for discussion of the networking code, and
	you may not see much discussion about a particular driver.
        Furthermore keep in mind that the NET channel is for development
	discussions only. General questions on how to configure your system
	should be directed to comp.os.linux.help unless you are actively
	involved in the development of part of the networking for Linux.

0.3 Related Documentation

	Much of this info came from small files and saved postings by Donald
	himself. These can be found in /pub/linux/info on ftp.super.org
	[192.31.192.1] Of course, if you are setting up an Ethernet card,
	then you will want to read the NET-2 HOWTO so that you can actually
	do something with it.

0.4 New versions of this document

        New versions of this document can be retrieved via anonymous
        FTP from sunsite.unc.edu:/pub/Linux/docs/HOWTO/*.  It will also be
	posted to the newsgroup comp.os.linux.announce.

0.5 Feedback

	Any corrections can be sent to one of us (paul@cain.mmtc.rmit.oz.au
	or becker@super.org) We will *attempt* to keep this up to date as
	more drivers become available, and as NET-2 matures.

1. Supported Ethernet Cards for Linux

	The only thing that one needs to use an ethernet card with Linux 
	is the appropriate driver. For this, it is essential that the man-
	ufacturer will release the technical programming information to
	the general public without you (or anyone) having to sign your life
	away. A good guide for the likelihood of getting documentation
	(or, if you aren't writing code, the likelihood that someone
	else will write that driver you really, really need)
	is the availability of the Crynwr (nee Clarkson) packet
	driver.  Given the documentation, you can write a driver for
	your card and use it for Linux, at least in theory.

	Most cards come with drivers for MS-DOS interfaces such as
	NDIS and ODI, but these are useless for Linux.  Many people
	have suggested directly linking them in or automatic
	translation, but this is nearly impossible.  The MS-DOS
	drivers expect to be in 16 bit mode and hook into "software
	interrupts", both incompatible with the Linux kernel.  This
	incompatibility is actually a feature, as some Linux drivers
	are considerably better than their MS-DOS counterparts.  The
	"8390" series drivers, for instance, use ping-pong transmit
	buffers, which are only now being introduced in the MS-DOS world.

	Keep in mind that PC ethercards have the widest variety of
	interfaces (shared memory, programmed I/O, bus-master, or slave
	DMA) of any computer hardware for anything, and supporting a
	new ethercard sometimes requires re-thinking most of the
	lower-level networking code.  Also, similar product numbers
	don't always indicate similar products.  For instance, the
	3c50* product line is wildly different between members.

	Here is what drivers are and aren't available.

1.1 3com Ethernet cards

	Supported:
		3c503, 3c503/16 --
			3Com shared-memory ethercards.  They also have a
        		programmed I/O mode that doesn't use the 8390 
			facilities (their engineers found too many bugs!)  
			It should be about the same speed as the same bus 
			width WD80x3, but I don't have a 16 bit version 
			to benchmark. Unless you are a light user, spend
			the extra money and get the 16 bit model, as the
			savings aren't huge. The 3c503 does not have "EEPROM
			setup", so the diagnostic/setup program isn't needed 
			before running the card with Linux. The shared memory 
			address of the 3c503 is set using jumpers that
		        are shared with the boot PROM address.  This is
			confusing to people familiar with other ISA cards, 
			where you always leave the jumper set to "disable" 
			unless you have a boot PROM. The Linux 3c503 driver 
			will work with the 3c503 programmed-I/O mode, but this 
		        is slower and less reliable than shared memory mode.

			Also, programmed-I/O mode is not tested when updating
			the drivers, and the deadman (deadcard?) check code 
			may be falsely triggered on some machines.
			The IRQ line is set in software, with no hints
			from e.g. EEPROM.  Unlike the MS-DOS driver, the 
			Linux driver has capability to autoIRQ: it uses the 
			first available IRQ line in {5,2,3,4}, selected each 
			time the card is 'ifconfig'ed.  (Older driver versions 
			selected the IRQ at boot time.)  The ioctl() call 
			in 'ifconfig' will return EAGAIN if no IRQ line is 
			available at that time. 

		3c509 --
			A new card for 3Com. It should be cheap and have
			excellent performance. The drawbacks are that it
			_requires_ very low interrupt latency, and it isn't
			rated for bus speeds greater than 8Mhz. The driver is 
			written, working, and included in pl12. But it
			seems to triggers a Linux TCP bug, so it's not built
			as part of the default kernel.

			There is also an alpha version of a Linux 3c509
			diagnostic and EEPROM setup program, but for now
			users that don't like the defaults should use the
			MS-DOS EEPROM setup program.
 
		3c579 --
			The EISA version of the 509. The current EISA version
			uses the same 16 bit wide chip rather than a 32 bit
			interface, so the performance increase isn't stunning.
			The 3c509 driver should work with the EISA
			version, but I have neither an EISA machine nor
			a 3c579 to test it on.

	Unsupported:

		3c501 --
			Too brain-damaged to use. Available surplus from many
			places. Avoid it like the plague. However, if you are
			a bit of a masochist, there is some code in /pub/linux
			on ftp.super.org --> look for 3c501.c Again, do not
			purchase this card, even as a joke.  It's performance
			is horrible, and it breaks in many ways.  

			For those not yet convinced, the 3c501 can only do one
			thing at a time -- while you are removing one packet
			from the single-packet buffer it cannot receive
			another packet, nor can it receive a packet while are
			loading a transmit packet.  This was fine for a
			network between two 8088-based computers where
			processing each packet and replying took 10's of
			msecs, but modern networks send back-to-back
			packets for almost every transaction.

		3c505 --
			Not available at present.

		3c507 --
			Not available at present.

1.2 Western Digital / SMC Cards

	The ethernet part of Western Digital has been bought by SMC.  The
	SMC Elite and SMC Elite Plus are the same as late-model WD8003 
	and WD8013 cards.

	Supported:

		WD8003, WD8013, SMC Elite, SMC Elite Plus --
			A shared memory design by Western Digital. The
			8 bit 8003 is slightly less expensive, but only
			worth the savings for light use. Over the
			years the design has added more registers and an
			EEPROM.  Clones usually go by the '8013' name, and 
			usually use a non-EEPROM (jumpered) design. This part
			of WD has been sold to SMC, so you'll usually see 
			something link SMC/WD8013 or SMC Elite Plus (WD8013).  
			The shared memory makes the cards 10-20% faster,
			especially with larger packets. More importantly
			(to me at least) it avoids a few bugs in the
			programmed-I/O mode of the 8390, allows safe
			multi-threaded access to the packet buffer, and 
			doesn't have a programmed-I/O data register that 
			hangs your machine during warm-boot probes.  

1.3 NExxxx Cards

	The prefix "NE" came from Novell Ethernet.  Novell followed the 
	cheapest NatSemi databook design and sold the manufacturing rights 
	(spun off?) Eagle, just to get reasonably-priced ethercards into 
	the market.

	Supported:

		NE1000, NE2000 --
			The now-generic name for a bare-bones design around 
			the NatSemi 8390. They use programmed I/O rather than
			shared memory, leading to easier installation but 
			slightly lower performance and a few problems. Again,
			the savings of using an 8 bit NE1000 over the NE2000
			are only warranted if you expect light use. Some 
			recently introduced NE2000 clones use the National
			Semiconductor "AT/LANTic" 83905 chip, which offers 
			a shared memory mode similar to the 8013 and EEPROM
			or software configuration. Some problems can arise
			with poor clones. See the question and answer section
			later in this document, and the section on clones.

		NE1500, NE2100 --
			The AT1500 driver, recently added to the list of
			supported cards, also supports the NE1500, NE2100 and
			clones. The driver shipped with pl12 kernel doesn't 
			detect non-AT1500 cards with autoprobe, but will work 
			fine if you specify the base address explicitly and 
			jumper for DMA channel 5.

1.3 Hewlett Packard Cards

	HP-LAN ethercards: Nicely made, but hard to find.  The model
	numbers don't encode anything, so you'll have to go by the 
	description. 

	Supported:

		 272[45]* series, 27245, 27247, 27250 --
			They use programmed I/O, similar to the NE*000 boards,
			but the data transfer port can be "turned off" when 
			you aren't accessing it, avoiding problem with 
			autoprobing drivers. Note that few people seem to use 
			them, and I've had conflicting reports about changes 
			between versions with the same model number -- later
			versions may not work.

1.4 D-Link 

	There is a file /usr/src/linux/net/inet/README.DLINK that you
	should read if you are going to use D-Link stuff. Note, however 
	that the installation info in this file is no longer valid, as it
	applied to pre NET-2 kernels. It is now a part of the standard kernel.
	
	Supported:

		DE-600 --
			Laptop users and other folk who might want a quick 
			way to put their computer onto the ethernet may want 
			to use this. The driver is included with the default 
			kernel source tree as of pl12 and possibly earlier. 
			Bjorn Ekwall <bj0rn@blox.se> wrote the original. 
			Expect about 80kb/s transfer speed from this via the 
			parallel port. The file mentioned above contains 
			a "Known Problems and..." section. I will not repeat 
			it here. But you should read it.  (Hint applied gently 
			with a sledgehammer.)

		DE100, DE200, DE-220-T --
			The manual says that it is 100% compatible with the
			NE2000.  This is not true. You should call them and tell
			them you are using their card with Linux, and that they
			should correct their documentation.  Some pre-0.99pl12 
			driver versions may have trouble recognizing the DE2** 
			series as 16 bit cards, and these cards are the most 
			widely reported as having the spurious transfer address
			mismatch errors.

1.5 Cabletron

	Yes, another one of these companies that won't release its
	programming information. They waited for months before actually
	confirming that all their information was proprietary. If you feel
	like asking them why they don't want to release their info so that
	people can use their cards, write to pkelly@ctron.com. You should
	read section 8.1 of this document, as it has specific information
	pertaining to Cabletron.

	Supported:

		E10**, E10**-x, E20**, E20**-x --
			These are NEx000 almost-clones that are reported to work
			with the standard NEx000 drivers, thanks to a 
			ctron-specific check during the probe. If there are 
			any problems, they are unlikely to be fixed, as the 
			programming information is unavailable.

	Unsupported:

		E21** --
			Again, there is not much one can do when the
			programming information is proprietary. Feel free
			to ask pkelly@ctron.com.  This is the only 8390-base
			ethercard series that isn't supported by Linux.

1.6	Allied Telesis:

	Allied Telesis is the worlds largest maker of separate
	transceivers thanks to their low prices, and they now have a
	series of low-cost ethercards using the 79C960 version of the AMD
	LANCE.  These are bus-master cards, and thus probably the fastest
	ISA bus ethercards available (although the 3c509 has lower latency
	thanks to predictive interrupts).  The driver for the AT1500
	series is new in the 0.99pl12 kernel, but it won't work
	"out-of-the-box" with >16M machines.  (NB This isn't a fundamental
	limitation, so stop pointing and laughing at the ISA bus.  The
	driver just needs a hook to allocate low-memory buffers for the
	bus-master DMA, and should be just as fast on >16M systems.)

	The current (pl12) driver defaults to DMA5.  Future driver
	versions may figure out a way to autoDMA.

	There is a special $20 one-unit-only evaluation offer on the AT1500T
	(the TP-only model) until mid-September 1993.  The normal list
	price is $80-$100.
	

1.6 Other (less common card supplier) Companies

	Arcnet:
		There is no Arcnet driver for Linux. Feel free to write a 
		driver.  There might be people with home systems
		that will be able to use it with discarded hardware. 
		With the very low cost and better performance of ethernet,
		I expect that most places will be giving away their Arcnet
		hardware for free.

		An advantage of Arcnet is that all of the cards have identical
		interfaces, so once a driver is available it will work for everyone.

	Digital / DEC
		There is an alpha version of a driver for the early model DEC
		DEPCA.  DEC is refusing to release information on the later
		models.  (The rumor is that they don't have enough money to
		write and print one!)

	Intel:
		Not too many of these cards around at present. The Intel Ether-
		Express is unsupported at present.

	PureData:
		The PureData PDUC8028 and PDI8023 series of cards are reported
		to work, thanks to special probe code contributed by Mike
		Jagdis <jaggy@purplet.demon.co.uk>.  The support is integrated
		with the WD driver.

	Xircom:
		Another group that won't release documentation. No cards 
		supported.  Don't look for any support in the future unless 
		they release their programming information. And this is
		highly unlikely, as they *forbid* you from even reverse-
		engineering their drivers. Here is some of the results from
		people who have tried to deal with Xircom.

		"I had no end of problems trying to work with Xircom.  
		After spending months talking to them and working up a
		prospectus, I was told that no information would be forthcoming
		and that they were not interested in markets other than the
		ISA/DOS market. (I was trying to interface the pocket adapters
		to an Amiga). I won't work with them anymore and I won't
		recommend their products to anyone." 

		"They (Xircom) won't give it (programming info.) out. BSDI
		was was able to get the spec and write a driver for it, but
		only by promising not to give out the source."

	Zenith:
		The Zenith Z-note is unsupported at present.

2. Clones of popular Ethernet cards.

	Due to the popular design of some cards,  different companies will
	make "clones" or replicas of the original card. However, one must
	be careful, as some of these clones are not 100% compatible, and
	can be troublesome. Some common problems with "not-quite-clones"
	are noted in the question and answer section of this document.

2.1 WD80x3 Clones that are reported to work.

	AT-LAN-TEC 8013
	PureData (not a 8013 clone, but the 8013 driver has special code)
	LANNET LEC-45
	PE-8013 (WD-8013 Compatible)

2.2 NE2000 Clones that are reported to work.

	Alta Combo NE2000 clone
	Aritsoft LANtastic AE-2 (OK, but has flawed error-reporting registers)
	Asante Etherpak 2001/2003
	AT-LAN-TEC NE2000 clone (uses Winbond chip that traps SCSI drivers)
	Cabletron products: E10**,  E10**-x,  E20**, E20**-x
	Cnet UTP 10baseT (NE 2000 emulation)
	D-Link Ethernet II (bad clones, but the driver checks for them)
	4-Dimension FD0490 EtherBoard16
	LTC E-NET/16 P/N: 8300-200-002 (lipka@lip.hanse.de)
	Network Solutions HE-203
	SIIG Inc E-Lan/200 (NE 2000 comp.)
	SVEC 4 Dimension Ethernet

3 The Card to buy is....

	For impatient users that just want a quick, cheap answer the 
	summary is: get 16 bit thinnet 8013 cards. For more detail as
	to the who what where and why, read on.

3.1 Eight bit vs 16 bit.

	Unless you are a light user, or are confined to using the smaller
	ISA slot, the use of the 8 bit cards like the wd8003 and the 3c503
	is really not worth the cost savings. Get the 8013 or the 3c503/16
	instead.

3.2 Prices are a bit steep for the XXXX card.

	I keep track of the current low-price vendors, just because it's
	asked so often.  Call AT-LAN-TEC at 301-948-7070.  Ask for their
	technical support person, "Vincent Bono".  As with all purchases,
	you should indicate you are buying this for a Linux system.
	The last I checked the price for 10 NE2000s was $690, or $69 ea.!
	NB Their current NE2000 clone is a model that "traps" other
	drivers that probe into their address space.

	AT-LAN-TEC also carries a clone, non-EEPROM 8013 board for $89,
	and a NE2100 clone.  Either is a better choice if the very lowest
	price isn't essential. 

	I've also ordered Alta "Combo" NE2000 cards from Network Express
	(aka Main Street Computers) in Fl.  A bit more expensive, but
	they have bigger ads in Computer Shopper. If you are looking for
	prices on your own, try the back of LAN magazine.

	Currently (late Aug. '93) there is a market-share war going on in
	the ethercard business.  Both Allied-Telesis and Accton have
	special evaluation deals going on if you call them directly and
	reference the right advertisement.  (AT1500T $20, max. one, and
	Accton NE2000 clone $30+$5s&h, max. 2.)

3.3 Type of cable that your card should support.

	Unless you have to conform to an existing network, you will want
	to use thinnet or thin ethernet cable. This is the style with the
	standard BNC connectors. See the next section on concerns with
	different types of ethernet cable.

	Most ethercards also come in a "Combo" version for only $10-$20 more.
	These have both twisted pair and thinnet transceiver built-in,
	allowing you to change your mind later.

4. Cables, Coax, Twisted pairs etc.
   
	If you are starting a network from scratch, it's considerably less
	expensive to use thin ethernet, RG58 co-ax cable with BNC connectors,
	than old-fashioned thick ethernet, RG-5 cable with N connectors, or
	10baseT, twisted pair telco-style cables with RJ-45 "phone"
	connectors.

4.1 Thin Ethernet (thinnet).

	Thin ethernet is the "ether of choice".  The cable is inexpensive.  If
	you are making your own cables solid-core RG58A is $0.09/ft. and
	stranded RG58AU is $0.15/ft.  Twist-on BNC connectors are < $2 ea.,
	and other misc. pieces are similarly inexpensive.  It is essential
	that you properly terminate each end of the cable with 50 ohm
	terminators, so budget $2 ea. for a pair.  It's also vital that
	your cable have no "stubs" -- the 'T' connectors must be attached
	directly to the ethercards.

4.2 Twisted Pair.

	Twisted pair networks require active hubs, which start around $300,
	and the raw cable cost can actually be higher than thinnet.  They are
	usually sold using the claim that you can use your existing telephone
	wiring, but it's a rare installation where that turns out to be the
	case.  The claim that you can upgrade to higher speeds is also
	suspect, as most proposed schemes use higher-grade (read $$) cable and
	more sophisticated termination ($$$) than you would likely install on
	speculation.

4.3 Thick Ethernet.

	Thick ethernet is mostly obsolete, and is usually used only to remain
	compatible with an existing implementation.  You can stretch the rules
	and connect short spans of thick and thin ethernet together with a
	passive $3 N-to-BNC connector, and that's often the best solution to
	expanding an existing thicknet.  A correct (but expensive) solution is
	to use a repeater in this case.

5 Technical Information.

	For those who want to play with the present drivers, or try to make
	up their own driver for a card that is presently unsupported, this
	information should be useful. If you do not fall into this category,
	then perhaps you will want to skip this section.

5.1 Probed Addresses.

	While trying to determine what ethernet card is there, the following
	addresses are autoprobed, assuming the type and specs of the card
	have not been set in the kernel. In /usr/src/linux/net/inet/CONFIG,
	one can set the cards that are compiled in to the kernel. As of 
	0.99pl12, doing a "make config" will ask what cards are to be 
	supported. The file names below are in /usr/src/linux/net/inet/
	----------------------------------------------------------------
	wd.c:   0x300, 0x280, 0x380, 0x240
	3c503:  0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2a0, 0x2e0
	ne.c:   0x300, 0x280, 0x320, 0x340, 0x360
	hp.c:   0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240
	lance.c:0x300, 0x320, 0x340, 0x360
	----------------------------------------------------------------
	There are some NE2000 clone ethercards out there that are waiting black
	holes for autoprobe drivers.  While many NE2000 clones are
	safe until they are enabled, some can't be reset to a safe mode.
	These dangerous ethercards will hang any I/O access to their
	"dataports".  The typical dangerous locations are:

	Ethercard jumpered base     Dangerous locations (base + 0x10 - 0x1f)
		0x300 *				0x310-0x317
		0x320				0x330-0x337
		0x340				0x350-0x357
		0x360				0x370-0x377

	* The 0x300 location is the traditional place to put an ethercard, but
	it's also a popular place to put other devices (often SCSI
	controllers).  The 0x320 location is often the next one chosen, but
	that's bad for for the AHA1542 driver probe.  The 0x360 location is
	bad, because it conflicts with the parallel port at 0x378.

	To avoid these lurking ethercard, here are the things you can do:

        o Probe for the device's BIOS in memory space.  This is easy
	  and always safe, but it only works for cards that always have
	  BIOSes, like primary SCSI controllers.

	o Avoid probing any of the above locations until you think
	  you've located your device.  The NE2000 clones have a reset range
	  from <base>+0x18 - <base>+0x1f that will read as 0xff, so probe
	  there first if possible.  It's also safe to probe in the 8390
	  space at <base>+0x00 - <base>+0x0f, but that area will return
	  quasi-random values

	o If you must probe in the dangerous range, for instance if your
	  target device has only a few port locations, first check that
	  there isn't an NE2000 there. You can see how to do this by 
	  looking at the probe code in /usr/src/linux/net/inet/ne.c

5.2 Skeleton / Prototype Driver.

	OK. So you have decided that you want to write a driver for the
	Foobar Ethernet card, as you have the programming information,
	and it hasn't been done yet. (...these are the two main require-
	ments ;-) You can use the skeleton network driver that is provided
	with the Linux kernel source tree. It can be found in the file
	/usr/src/linux/net/inet/README.DRIVERS as of 0.99pl12, and later.

	It's also very useful to look at the Crynwr (nee Clarkson) driver
	for your target ethercard, if it's available.  Russ Nelson
	<nelson@crynwr.com> wrote most of these, and he has been very
	helpful with his code reviews of the current Linux drivers.

5.3 Driver Interface to the Kernel

	Here are some notes that may help when trying to figure out what
	the code in the driver segments is doing, or perhaps what it is
	supposed to be doing.

	-----------------------------------------------------

	int ethif_init(struct device *dev)
	{
	    ...
		dev->send_packet = &ei_send_packet;
		dev->open = &ei_open;
		dev->stop = &ei_close;
		dev->hard_start_xmit = &ei_start_xmit;
		...
	}

	int ethif_init(struct device *dev)

	This function is put into the device structure in Space.c.  It is
	called only at boot time, and returns '0' iff the ethercard 'dev'
	exists.

	-----------------------------------------------------

	static int ei_open(struct device *dev)
	static int ei_close(struct device *dev)

	This routine opens and initializes the board in response to an
	socket ioctl() usually called by 'config' or 'ifconfig'.  It is
	commonly stuffed into the 'struct device' by ethif_init().

	The inverse routine is ei_close(), which should shut down the
	ethercard, free the IRQs and DMA channels if the hardware permits,
	and turn off anything that will save power (like the transceiver).

	(Note: As of NET-2, the relevant program is '/etc/ifconfig' - and
	the device *can* be turned off or on via passing 'up' or 'down'
	to 'ifconfig' from the command line with the device name.)

	-----------------------------------------------------

	static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
		dev->hard_start_xmit = &ei_start_xmit;

	This routine puts packets to be transmitted into the hardware.  It
	is usually stuffed into the 'struct device' by ethif_init().

	When the hardware can't accept additional packets it should set
	the dev->tbusy flag.  When additional room is available, usually
	during a transmit-complete interrupt, dev->tbusy should be cleared
	and the higher levels informed with mark_bh(INET_BH).
	[[Note: pre0.99.4 kernels didn't use this interface for all packets.]]
	
	-----------------------------------------------------

	...
	    if (dev_rint(buffer, length, is_skb ? IN_SKBUFF : 0, dev))
		   stats->rx_dropped++;
	...
	A received packet is passed to the higher levels using dev_rint().
	If the unadorned packet data in a memory buffer, dev_rint will copy
	it into a 'skbuff' for you.  Otherwise a new skbuff should be
	kmalloc()ed, filled, and passed to dev_rint() with the IN_SKBUFF flag.

	-----------------------------------------------------

5.4 Interrupts and Linux
	There are two kinds of interrupt handlers in Linux:
	fast ones and slow ones. You decide what kind you are installing by
	the flags you pass to irqaction().  The fast ones, such as the serial
	interrupt handler, run with _all_ interrupts disabled.  The normal
	interrupt handlers, such as the one for ethercard drivers, runs with
	other interrupts enabled.

	There is a two-level interrupt structure.  The "fast" part handles the
	device register, removes the packets, and perhaps sets a flag.   After
	it is done, and interrupts are re-enabled, the slow part is run if the
	flag is set.

	The flag between the two parts is set by:
		mark_bh(INET_BH);

	Usually this flag is set within dev_rint() during a received-packet
	interrupt, and set directly by the device driver during a
	transmit-complete interrupt.

	You might wonder why all interrupt handlers cannot run in
	"normal mode" with other interrupts enabled.  Ross Biro uses this
	scenario to illustrate the problem:
		o You get a serial interrupt, and start processing it.
	          The serial interrupt is now masked.
		o You get a network interrupt, and you start transferring
	          a maximum-sized 1500 byte packet from the card.
		o Another character comes in, but this time the interrupts
		  are masked!

	The "fast" interrupt structure solves this problem by allowing
	bounded-time interrupt handlers to run without the risk of leaving
	their interrupt lines masked by another interrupt request.

	There is an additional distinction between fast and slow interrupt
	handlers -- the arguments passed to the handler.  A "slow" handler is
	defined as

		static void
		handle_interrupt(int reg_ptr)
		{
		    int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
		    struct device *dev = irq2dev_map[irq];
		...

	While a fast handler gets the interrupt number directly

		static void
		handle_fast_interrupt(int irq)
		{
		...

	--------------------------------------------------------------

5.4 Unresolved Questions / Concerns

	There may be some benefit from processing packet data as it is
	transferred to and from the ethercard, especially with very fast
	processors transferring data to a slow ethercard.  As I see it this
	question has multiple parts:
		1) Is there any useful processing power available, perhaps
		   during the ISA bus recovery period, or while the 8390
		   remote DMA is preparing for another transfer??
		2) Is there any useful but simple work that can be done
		   between/during each word of the copy, such as calculating
		   a CRC, or discarding obviously unwanted packets??
		3) would the complexity of an interface to do this make future
		   ethercard drivers impossible??

    There should be a better structure than Space.c  Drivers should be
	able to autoprobe for all installed ethercards rather than just
	quitting after finding the first.  I've written code to do this,
	but the constant promise (threat?) of DDI has prevented me from
	making it standard.

	A related topic is the problem of driver probes corrupting
	unrelated hardware. Even worse is a probe into a dataport that
	isn't set up to transfer data, which will freeze the machine.  The
	common suggestion is a boot-time device registry that records
	already-used I/O ports and shared memory.

6 Possible Problems, Questions and Troubleshooting.

	This section tries to answer any unresolved questions, and not so
	common solutions to common problems.

6.01 Problem with NE2000 Clones -- "DMA address mismatch"

	Is the chip a real NatSemi 8390? (DP8390, DP83901, DP83902 or DP83905)?
	If not, some clone chips don't correctly implement the transfer
	verification register.  MS-DOS drivers never do error checking, 
	so it doesn't matter to them.

	Are most of the messages off by a factor of 2?
	If so:	Are you using the NE2000 in a 16 bit slot?
		Is it jumpered to use only 8 bit transfers?
	The Linux driver expects a NE2000 to be a 16 bit slot.  A NE1000 can
	be in either size slot.  This problem can also occur with some clones,
	notably D-Link 16 bit cards, that don't have the correct ID bytes
	in the station address PROM. [[ This should be fixed in pl12.]]

	Are you running the bus faster than 8Mhz?
	If you can change the speed (faster or slower), see if that
	makes a difference.  Most NE2000 clones will run at 16Mhz, but
	some may not.  Changing speed can also mask a noisy bus.

	What other devices are on the bus?
	If moving the devices around changes the reliability, then you
	have a bus noise problem -- just what that error message was
	designed to detect.  Congratulations, you've probably found the
	source of other problems as well.

6.02 Problem with NE2000 Clones -- Machine Hangs during Boot.

	Problem:  The machine hangs during boot right after the "8390..."  or
		  "WD...." message.  Removing the NE2000 fixes the problem.

	Solution: Change your NE2000 base address to 0x360 (or 0x340 for
		  pl12 or later kernels.)

	Reason:   Your NE2000 clone isn't a good enough clone.  An active 
		  NE2000 is a bottomless pit that will trap any driver
		  autoprobing in its space.  The other ethercard drivers take
		  great pain to reset the NE2000 so that it's safe, but some
		  clones cannot be reset.  Clone chips to watch out for: 
		  Winbond 83C901.  Changing the NE2000 to a less-popular
		  address will move it out of the way of other autoprobes, 
		  allowing your machine to boot.  

	Problem:  The machine hangs during the SCSI probe at boot.

	Solution: It's the same problem as above, change the 
		  ethercard's address.

	Problem:  The machine hangs during the soundcard probe at boot.

	Solution: No, that's really during the silent SCSI probe, and it's
			  the same problem as above.


6.03 Detected Non-existent Ethercard

	Problem:  A WD80*3 is falsely detected.  Removing the sound or 
		  MIDI card eliminates the "detected" message.

	Solution: Update your ethercard driver: new versions include an
		  additional sanity check.

	Reason:   Some MIDI ports happen to produce the same checksum as a 
		  WD ethercard.

6.04 Error messages from the 80*3

	Problem:  You get messages such as the following with your 80*3:
			eth0: bogus packet size, status = ........
			kmalloc called with impossibly large argument (65400)
			eth0: Couldn't allocate sk_buff of size 65400
			eth0: receiver overrun
 
	Reason:   There is a shared memory problem.

	Solution: If the problem is sparodic, you have hardware problems.
		  Typical problems that are easy to fix are board conflicts, 
		  having cache or "shadow ROM" enabled for that region, or 
		  running your bus faster than 8Mhz.  There are also a 
		  surprising number of memory failures on ethernet cards, 
		  so run a diagnostic program if you have one for your 
		  ethercard.

		  If the problem is continual, and you have have to reboot
		  to fix the problem, record the boot-time probe message 
		  and mail it to becker@super.org  Take particular note of
		  the shared memory location.

6.05 Choosing the Interrupt of the 3c503 

	Problem:  The 3c503 picks IRQ n at boot, but this is needed for some
		  other device which needs IRQ n. (eg. CD ROM driver, etc.)
		  Can this be fixed without compiling this into the kernel?

	Solution: The 3c503 driver probes for a free IRQ line in the order
		  {5, 9, 3, 4}, and it should pick a line which isn't being 
		  used.  The pre-pl12 (SLS 1.02) driver picked the IRQ line 
		  at boot-time, and the current driver (pl12) chooses when
		  the card is open()/'ifconfig'ed.

		  Alternately, you can fix the IRQ at boot by passing 
		  parameters via LILO.  The following selects IRQ9, base 
		  location 0x300, <ignored value>, and if_port #1 (the 
		  external transceiver).  
			lilo: linux ether=9,0x300,0,1,eth0

		  The following selects IRQ3, probes for the base location,
		  <ignored value>, and the default if_port #0 (the internal 
		  transceiver) 
			lilo: linux ether=3,0,0,0,eth0

6.06 Choosing the Output of the 3c503 (thicknet vs. thinnet)

	Problem:  The supplied 3c503 drivers don't use the AUI (thicknet) port.
		  How does one choose it over the default thinnet port?

	Solution: The 3c503 AUI port can be selected at boot-time with 0.99pl12
		  and later.  The selection is overloaded onto the low bit of 
		  the currently-unused dev->rmem_start variable, so a boot-time
		  parameter of:
			lilo: linux ether=0,0,0,1,eth0
		  should work.  A boot line to force IRQ 5, port base 0x300, 
		  and use an external transceiver is:
			lilo: linux ether=5,0x300,0,1,eth0

6.07 Using More than one Ethernet Card. (eg. a gateway machine.)

	Problem:  What needs to be done so that Linux can run two 
		  ethernet cards?

	Solution: Add another entry to Space.c, naming it "eth1" instead 
		  of "eth0".  If you want routing to work well you should
		  use a recent kernel, say 0.99pl11 or later.  You may also
		  want to verify that your driver writer kept all of the
		  per-card variables in 'dev->priv'.  Most do, but the pl12
		  AT1500/LANCE driver has a single static low-memory buffer.

7 Networking with a Laptop Computer
	There are currently only a few ways to put your laptop on a network.
	You can use the NET-2 SLIP code (and run at serial line speeds);
	you can buy one of the few laptops that come with a NE2000-compatible
	ethercard or PCMCIA slot built-in; you can get a laptop with a 
	docking station and plug in an ISA ethercard; or you can use a 
	parallel port Ethernet adapter such as the D-Link DE-600.

7.1 Option 1 -- using SLIP

	This is the cheapest solution, but by far the most difficult. Also,
	you will not get very high transmission rates. Since SLIP is not
	really related to ethernet cards, it will not be discussed further
	here. See the NET-2 HOWTO.

7.2 Option 2 -- NE2000 Compatible Card built in or PCMCIA slot and ethercard.

	The second solution severely limits your laptop choices and is fairly
	expensive.  Be sure to read the specifications carefully, you may find
	that you will have to buy an additional non-standard transceiver to
	actually put the machine on a network.

7.3 Option 3 -- ISA Ethercard in the Docking Station.

	I recommend the third solution.  Docking stations for laptops typically
	cost about $250 and provide two full-size ISA slots, two serial and one
	parallel port.  Most (all?) docking stations are powered off of the
	laptop's batteries, and a few allow adding extra batteries in the
	docking station if you use short ISA cards.  You can add an inexpensive
	ethercard and enjoy full-speed ethernet performance.

7.4 Option 4 -- Pocket / Parallel port Adaptors.

	The "pocket" ethernet adaptors may also fit your need.
	Until recently they actually costed more than a docking station and
	cheap ethercard, and most tie you down with a wall-brick power supply.
	The only pocket adaptor driver right now is for the D-Link.
	I'm also working on a driver for the AT-LAN-TEC/RealTek pocket adaptor.
	Most other companies, especially Xircom, treat the programming
	information as a trade secret, so support will likely be slow in
	coming.

	You can sometimes avoid the wall-brick with the adaptors by buying
	or making a cable that draws power from the laptop's keyboard
	port.
	

8 Miscellaneous.

	Any other associated stuff that didn't fit in anywhere else gets
	dumped here. It may not be relevant, and it may not be of general
	interest but it is here anyway.

8.1 The Cabletron Story. (...as related by Donald J. Becker)

	This is a rather funny story, albeit true. -- Enjoy! P.G.

		I contacted Cabletron in early December 1992 for 
	programming information 11, 1992 (I had called and sent 
	several earlier messages).  I was referred through several 
	different people, and each one took several days to 
	respond before they forwarded me to the next.  Eventually 
	I was told I should deal with their (outside?) developer 
	Mr. Dev.Null.  I persisted, and around March it seemed 
	that I had finally succeed: Cabletron offered to send me 
	an evaluation board (unrequested) and everything I needed 
	to use it (what I wanted).  The hardware showed up right 
	away, and I waited, expecting the the programming 
	information information as well.  About a month later I 
	contacted them, and they told me that "all I needed to use 
	it" was the standard MS-DOS NDIS drivers, a binary on 
	standard driver disk.  The disk envelope was covered in 
	legalese, including no-disassembly, no-reverse-engineering 
	clauses.  It was May (and a few email exchanges later) 
	before I figured out that I had been "slow rolled", and 
	had wasted about 20 hours on this particular windmill.  

	The story isn't over yet.  People have written to me say 
	they have vetoed several medium-sized purchases from 
	Cabletron based on the lack of Linux drivers.  Cabletron 
	must have noticed this because yesterday I got a call 
	_from_ Cabletron (the first!) stating that they will be 
	independently writing a Linux driver.  Of course, their 
	lawyers probably haven't read the GPL yet...  
	


		----------- end of Ethernet HOWTO ------------


-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu


^ permalink raw reply	[flat|nested] 3+ messages in thread
* Linux Ethernet HOWTO
@ 1993-09-13  0:31 Paul Gortmaker
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Gortmaker @ 1993-09-13  0:31 UTC (permalink / raw)


Archive-Name: linux/howto/ethernet
Last-Modified: August 28, 1993

Linux Ethernet HOWTO v0.1 -- Last updated August 28, 1993
---------------------------------------------------------------------------
0. Introduction

	This is the Ethernet-HOWTO, which is a compilation of information
	about which ethernet devices can be used for Linux, and how to
	set them up.

	This Ethernet-HOWTO is by Donald J. Becker and Paul Gortmaker.
	It covers what cards you should and shouldn't buy; how to set
	them up, how to run more than one, and other common problems and
	questions. It does *not* cover the software end of things, as that
	is covered in the NET-2 HOWTO. You can freely distribute this 
	document as long as you distribute an original copy with the 
	author's names intact.

	Most of this information came from Donald J. Becker 
	<becker@super.org> who is responsible for writing and 
	supporting most of the ethernet drivers that are presently
	available. Bj0rn Ekwall <bj0rn@blox.se> is responsible for
	the D-Link pocket driver. A special thanks to others who have helped
	with the device drivers and testing.

0.1 Disclaimer

	This document is *not* gospel. However, it is probably the most
	up to date info that you will be able to find. Nobody is responsible
	for what happens to your hardware but yourself. If your ethercard
	goes up in smoke (...nearly impossible!) we take no responsibility.

0.2 Questions already?

        If you have questions about your ethernet card, please READ this
	document first. You may also want to join the NET channel of the
	Linux-activists mailing list by sending mail to
                linux-activists-request@niksula.hut.fi
        with the line
                X-Mn-Admin: join NET
        at the top of the message body (not the subject). Note that the NET
	channel is primarily used for discussion of the networking code, and
	you may not see much discussion about a particular driver.
        Furthermore keep in mind that the NET channel is for development
	discussions only. General questions on how to configure your system
	should be directed to comp.os.linux.help unless you are actively
	involved in the development of part of the networking for Linux.

0.3 Related Documentation

	Much of this info came from small files and saved postings by Donald
	himself. These can be found in /pub/linux/info on ftp.super.org
	[192.31.192.1] Of course, if you are setting up an Ethernet card,
	then you will want to read the NET-2 HOWTO so that you can actually
	do something with it.

0.4 New versions of this document

        New versions of this document can be retrieved via anonymous
        FTP from sunsite.unc.edu:/pub/Linux/docs/HOWTO/*.  It will also be
	posted to the newsgroup comp.os.linux.announce.

0.5 Feedback

	Any corrections can be sent to one of us (paul@cain.mmtc.rmit.oz.au
	or becker@super.org) We will *attempt* to keep this up to date as
	more drivers become available, and as NET-2 matures.

1. Supported Ethernet Cards for Linux

	The only thing that one needs to use an ethernet card with Linux 
	is the appropriate driver. For this, it is essential that the man-
	ufacturer will release the technical programming information to
	the general public without you (or anyone) having to sign your life
	away. A good guide for the likelihood of getting documentation
	(or, if you aren't writing code, the likelihood that someone
	else will write that driver you really, really need)
	is the availability of the Crynwr (nee Clarkson) packet
	driver.  Given the documentation, you can write a driver for
	your card and use it for Linux, at least in theory.

	Most cards come with drivers for MS-DOS interfaces such as
	NDIS and ODI, but these are useless for Linux.  Many people
	have suggested directly linking them in or automatic
	translation, but this is nearly impossible.  The MS-DOS
	drivers expect to be in 16 bit mode and hook into "software
	interrupts", both incompatible with the Linux kernel.  This
	incompatibility is actually a feature, as some Linux drivers
	are considerably better than their MS-DOS counterparts.  The
	"8390" series drivers, for instance, use ping-pong transmit
	buffers, which are only now being introduced in the MS-DOS world.

	Keep in mind that PC ethercards have the widest variety of
	interfaces (shared memory, programmed I/O, bus-master, or slave
	DMA) of any computer hardware for anything, and supporting a
	new ethercard sometimes requires re-thinking most of the
	lower-level networking code.  Also, similar product numbers
	don't always indicate similar products.  For instance, the
	3c50* product line is wildly different between members.

	Here is what drivers are and aren't available.

1.1 3com Ethernet cards

	Supported:
		3c503, 3c503/16 --
			3Com shared-memory ethercards.  They also have a
        		programmed I/O mode that doesn't use the 8390 
			facilities (their engineers found too many bugs!)  
			It should be about the same speed as the same bus 
			width WD80x3, but I don't have a 16 bit version 
			to benchmark. Unless you are a light user, spend
			the extra money and get the 16 bit model, as the
			savings aren't huge. The 3c503 does not have "EEPROM
			setup", so the diagnostic/setup program isn't needed 
			before running the card with Linux. The shared memory 
			address of the 3c503 is set using jumpers that
		        are shared with the boot PROM address.  This is
			confusing to people familiar with other ISA cards, 
			where you always leave the jumper set to "disable" 
			unless you have a boot PROM. The Linux 3c503 driver 
			will work with the 3c503 programmed-I/O mode, but this 
		        is slower and less reliable than shared memory mode.

			Also, programmed-I/O mode is not tested when updating
			the drivers, and the deadman (deadcard?) check code 
			may be falsely triggered on some machines.
			The IRQ line is set in software, with no hints
			from e.g. EEPROM.  Unlike the MS-DOS driver, the 
			Linux driver has capability to autoIRQ: it uses the 
			first available IRQ line in {5,2,3,4}, selected each 
			time the card is 'ifconfig'ed.  (Older driver versions 
			selected the IRQ at boot time.)  The ioctl() call 
			in 'ifconfig' will return EAGAIN if no IRQ line is 
			available at that time. 

		3c509 --
			A new card for 3Com. It should be cheap and have
			excellent performance. The drawbacks are that it
			_requires_ very low interrupt latency, and it isn't
			rated for bus speeds greater than 8Mhz. The driver is 
			written, working, and included in pl12. But it
			seems to triggers a Linux TCP bug, so it's not built
			as part of the default kernel.

			There is also an alpha version of a Linux 3c509
			diagnostic and EEPROM setup program, but for now
			users that don't like the defaults should use the
			MS-DOS EEPROM setup program.
 
		3c579 --
			The EISA version of the 509. The current EISA version
			uses the same 16 bit wide chip rather than a 32 bit
			interface, so the performance increase isn't stunning.
			The 3c509 driver should work with the EISA
			version, but I have neither an EISA machine nor
			a 3c579 to test it on.

	Unsupported:

		3c501 --
			Too brain-damaged to use. Available surplus from many
			places. Avoid it like the plague. However, if you are
			a bit of a masochist, there is some code in /pub/linux
			on ftp.super.org --> look for 3c501.c Again, do not
			purchase this card, even as a joke.  It's performance
			is horrible, and it breaks in many ways.  

			For those not yet convinced, the 3c501 can only do one
			thing at a time -- while you are removing one packet
			from the single-packet buffer it cannot receive
			another packet, nor can it receive a packet while are
			loading a transmit packet.  This was fine for a
			network between two 8088-based computers where
			processing each packet and replying took 10's of
			msecs, but modern networks send back-to-back
			packets for almost every transaction.

		3c505 --
			Not available at present.

		3c507 --
			Not available at present.

1.2 Western Digital / SMC Cards

	The ethernet part of Western Digital has been bought by SMC.  The
	SMC Elite and SMC Elite Plus are the same as late-model WD8003 
	and WD8013 cards.

	Supported:

		WD8003, WD8013, SMC Elite, SMC Elite Plus --
			A shared memory design by Western Digital. The
			8 bit 8003 is slightly less expensive, but only
			worth the savings for light use. Over the
			years the design has added more registers and an
			EEPROM.  Clones usually go by the '8013' name, and 
			usually use a non-EEPROM (jumpered) design. This part
			of WD has been sold to SMC, so you'll usually see 
			something link SMC/WD8013 or SMC Elite Plus (WD8013).  
			The shared memory makes the cards 10-20% faster,
			especially with larger packets. More importantly
			(to me at least) it avoids a few bugs in the
			programmed-I/O mode of the 8390, allows safe
			multi-threaded access to the packet buffer, and 
			doesn't have a programmed-I/O data register that 
			hangs your machine during warm-boot probes.  

1.3 NExxxx Cards

	The prefix "NE" came from Novell Ethernet.  Novell followed the 
	cheapest NatSemi databook design and sold the manufacturing rights 
	(spun off?) Eagle, just to get reasonably-priced ethercards into 
	the market.

	Supported:

		NE1000, NE2000 --
			The now-generic name for a bare-bones design around 
			the NatSemi 8390. They use programmed I/O rather than
			shared memory, leading to easier installation but 
			slightly lower performance and a few problems. Again,
			the savings of using an 8 bit NE1000 over the NE2000
			are only warranted if you expect light use. Some 
			recently introduced NE2000 clones use the National
			Semiconductor "AT/LANTic" 83905 chip, which offers 
			a shared memory mode similar to the 8013 and EEPROM
			or software configuration. Some problems can arise
			with poor clones. See the question and answer section
			later in this document, and the section on clones.

		NE1500, NE2100 --
			The AT1500 driver, recently added to the list of
			supported cards, also supports the NE1500, NE2100 and
			clones. The driver shipped with pl12 kernel doesn't 
			detect non-AT1500 cards with autoprobe, but will work 
			fine if you specify the base address explicitly and 
			jumper for DMA channel 5.

1.3 Hewlett Packard Cards

	HP-LAN ethercards: Nicely made, but hard to find.  The model
	numbers don't encode anything, so you'll have to go by the 
	description. 

	Supported:

		 272[45]* series, 27245, 27247, 27250 --
			They use programmed I/O, similar to the NE*000 boards,
			but the data transfer port can be "turned off" when 
			you aren't accessing it, avoiding problem with 
			autoprobing drivers. Note that few people seem to use 
			them, and I've had conflicting reports about changes 
			between versions with the same model number -- later
			versions may not work.

1.4 D-Link 

	There is a file /usr/src/linux/net/inet/README.DLINK that you
	should read if you are going to use D-Link stuff. Note, however 
	that the installation info in this file is no longer valid, as it
	applied to pre NET-2 kernels. It is now a part of the standard kernel.
	
	Supported:

		DE-600 --
			Laptop users and other folk who might want a quick 
			way to put their computer onto the ethernet may want 
			to use this. The driver is included with the default 
			kernel source tree as of pl12 and possibly earlier. 
			Bjorn Ekwall <bj0rn@blox.se> wrote the original. 
			Expect about 80kb/s transfer speed from this via the 
			parallel port. The file mentioned above contains 
			a "Known Problems and..." section. I will not repeat 
			it here. But you should read it.  (Hint applied gently 
			with a sledgehammer.)

		DE100, DE200, DE-220-T --
			The manual says that it is 100% compatible with the
			NE2000.  This is not true. You should call them and tell
			them you are using their card with Linux, and that they
			should correct their documentation.  Some pre-0.99pl12 
			driver versions may have trouble recognizing the DE2** 
			series as 16 bit cards, and these cards are the most 
			widely reported as having the spurious transfer address
			mismatch errors.

1.5 Cabletron

	Yes, another one of these companies that won't release its
	programming information. They waited for months before actually
	confirming that all their information was proprietary. If you feel
	like asking them why they don't want to release their info so that
	people can use their cards, write to pkelly@ctron.com. You should
	read section 8.1 of this document, as it has specific information
	pertaining to Cabletron.

	Supported:

		E10**, E10**-x, E20**, E20**-x --
			These are NEx000 almost-clones that are reported to work
			with the standard NEx000 drivers, thanks to a 
			ctron-specific check during the probe. If there are 
			any problems, they are unlikely to be fixed, as the 
			programming information is unavailable.

	Unsupported:

		E21** --
			Again, there is not much one can do when the
			programming information is proprietary. Feel free
			to ask pkelly@ctron.com.  This is the only 8390-base
			ethercard series that isn't supported by Linux.

1.6	Allied Telesis:

	Allied Telesis is the worlds largest maker of separate
	transceivers thanks to their low prices, and they now have a
	series of low-cost ethercards using the 79C960 version of the AMD
	LANCE.  These are bus-master cards, and thus probably the fastest
	ISA bus ethercards available (although the 3c509 has lower latency
	thanks to predictive interrupts).  The driver for the AT1500
	series is new in the 0.99pl12 kernel, but it won't work
	"out-of-the-box" with >16M machines.  (NB This isn't a fundamental
	limitation, so stop pointing and laughing at the ISA bus.  The
	driver just needs a hook to allocate low-memory buffers for the
	bus-master DMA, and should be just as fast on >16M systems.)

	The current (pl12) driver defaults to DMA5.  Future driver
	versions may figure out a way to autoDMA.

	There is a special $20 one-unit-only evaluation offer on the AT1500T
	(the TP-only model) until mid-September 1993.  The normal list
	price is $80-$100.
	

1.6 Other (less common card supplier) Companies

	Arcnet:
		There is no Arcnet driver for Linux. Feel free to write a 
		driver.  There might be people with home systems
		that will be able to use it with discarded hardware. 
		With the very low cost and better performance of ethernet,
		I expect that most places will be giving away their Arcnet
		hardware for free.

		An advantage of Arcnet is that all of the cards have identical
		interfaces, so once a driver is available it will work for everyone.

	Digital / DEC
		There is an alpha version of a driver for the early model DEC
		DEPCA.  DEC is refusing to release information on the later
		models.  (The rumor is that they don't have enough money to
		write and print one!)

	Intel:
		Not too many of these cards around at present. The Intel Ether-
		Express is unsupported at present.

	PureData:
		The PureData PDUC8028 and PDI8023 series of cards are reported
		to work, thanks to special probe code contributed by Mike
		Jagdis <jaggy@purplet.demon.co.uk>.  The support is integrated
		with the WD driver.

	Xircom:
		Another group that won't release documentation. No cards 
		supported.  Don't look for any support in the future unless 
		they release their programming information. And this is
		highly unlikely, as they *forbid* you from even reverse-
		engineering their drivers. Here is some of the results from
		people who have tried to deal with Xircom.

		"I had no end of problems trying to work with Xircom.  
		After spending months talking to them and working up a
		prospectus, I was told that no information would be forthcoming
		and that they were not interested in markets other than the
		ISA/DOS market. (I was trying to interface the pocket adapters
		to an Amiga). I won't work with them anymore and I won't
		recommend their products to anyone." 

		"They (Xircom) won't give it (programming info.) out. BSDI
		was was able to get the spec and write a driver for it, but
		only by promising not to give out the source."

	Zenith:
		The Zenith Z-note is unsupported at present.

2. Clones of popular Ethernet cards.

	Due to the popular design of some cards,  different companies will
	make "clones" or replicas of the original card. However, one must
	be careful, as some of these clones are not 100% compatible, and
	can be troublesome. Some common problems with "not-quite-clones"
	are noted in the question and answer section of this document.

2.1 WD80x3 Clones that are reported to work.

	AT-LAN-TEC 8013
	PureData (not a 8013 clone, but the 8013 driver has special code)
	LANNET LEC-45
	PE-8013 (WD-8013 Compatible)

2.2 NE2000 Clones that are reported to work.

	Alta Combo NE2000 clone
	Aritsoft LANtastic AE-2 (OK, but has flawed error-reporting registers)
	Asante Etherpak 2001/2003
	AT-LAN-TEC NE2000 clone (uses Winbond chip that traps SCSI drivers)
	Cabletron products: E10**,  E10**-x,  E20**, E20**-x
	Cnet UTP 10baseT (NE 2000 emulation)
	D-Link Ethernet II (bad clones, but the driver checks for them)
	4-Dimension FD0490 EtherBoard16
	LTC E-NET/16 P/N: 8300-200-002 (lipka@lip.hanse.de)
	Network Solutions HE-203
	SIIG Inc E-Lan/200 (NE 2000 comp.)
	SVEC 4 Dimension Ethernet

3 The Card to buy is....

	For impatient users that just want a quick, cheap answer the 
	summary is: get 16 bit thinnet 8013 cards. For more detail as
	to the who what where and why, read on.

3.1 Eight bit vs 16 bit.

	Unless you are a light user, or are confined to using the smaller
	ISA slot, the use of the 8 bit cards like the wd8003 and the 3c503
	is really not worth the cost savings. Get the 8013 or the 3c503/16
	instead.

3.2 Prices are a bit steep for the XXXX card.

	I keep track of the current low-price vendors, just because it's
	asked so often.  Call AT-LAN-TEC at 301-948-7070.  Ask for their
	technical support person, "Vincent Bono".  As with all purchases,
	you should indicate you are buying this for a Linux system.
	The last I checked the price for 10 NE2000s was $690, or $69 ea.!
	NB Their current NE2000 clone is a model that "traps" other
	drivers that probe into their address space.

	AT-LAN-TEC also carries a clone, non-EEPROM 8013 board for $89,
	and a NE2100 clone.  Either is a better choice if the very lowest
	price isn't essential. 

	I've also ordered Alta "Combo" NE2000 cards from Network Express
	(aka Main Street Computers) in Fl.  A bit more expensive, but
	they have bigger ads in Computer Shopper. If you are looking for
	prices on your own, try the back of LAN magazine.

	Currently (late Aug. '93) there is a market-share war going on in
	the ethercard business.  Both Allied-Telesis and Accton have
	special evaluation deals going on if you call them directly and
	reference the right advertisement.  (AT1500T $20, max. one, and
	Accton NE2000 clone $30+$5s&h, max. 2.)

3.3 Type of cable that your card should support.

	Unless you have to conform to an existing network, you will want
	to use thinnet or thin ethernet cable. This is the style with the
	standard BNC connectors. See the next section on concerns with
	different types of ethernet cable.

	Most ethercards also come in a "Combo" version for only $10-$20 more.
	These have both twisted pair and thinnet transceiver built-in,
	allowing you to change your mind later.

4. Cables, Coax, Twisted pairs etc.
   
	If you are starting a network from scratch, it's considerably less
	expensive to use thin ethernet, RG58 co-ax cable with BNC connectors,
	than old-fashioned thick ethernet, RG-5 cable with N connectors, or
	10baseT, twisted pair telco-style cables with RJ-45 "phone"
	connectors.

4.1 Thin Ethernet (thinnet).

	Thin ethernet is the "ether of choice".  The cable is inexpensive.  If
	you are making your own cables solid-core RG58A is $0.09/ft. and
	stranded RG58AU is $0.15/ft.  Twist-on BNC connectors are < $2 ea.,
	and other misc. pieces are similarly inexpensive.  It is essential
	that you properly terminate each end of the cable with 50 ohm
	terminators, so budget $2 ea. for a pair.  It's also vital that
	your cable have no "stubs" -- the 'T' connectors must be attached
	directly to the ethercards.

4.2 Twisted Pair.

	Twisted pair networks require active hubs, which start around $300,
	and the raw cable cost can actually be higher than thinnet.  They are
	usually sold using the claim that you can use your existing telephone
	wiring, but it's a rare installation where that turns out to be the
	case.  The claim that you can upgrade to higher speeds is also
	suspect, as most proposed schemes use higher-grade (read $$) cable and
	more sophisticated termination ($$$) than you would likely install on
	speculation.

4.3 Thick Ethernet.

	Thick ethernet is mostly obsolete, and is usually used only to remain
	compatible with an existing implementation.  You can stretch the rules
	and connect short spans of thick and thin ethernet together with a
	passive $3 N-to-BNC connector, and that's often the best solution to
	expanding an existing thicknet.  A correct (but expensive) solution is
	to use a repeater in this case.

5 Technical Information.

	For those who want to play with the present drivers, or try to make
	up their own driver for a card that is presently unsupported, this
	information should be useful. If you do not fall into this category,
	then perhaps you will want to skip this section.

5.1 Probed Addresses.

	While trying to determine what ethernet card is there, the following
	addresses are autoprobed, assuming the type and specs of the card
	have not been set in the kernel. In /usr/src/linux/net/inet/CONFIG,
	one can set the cards that are compiled in to the kernel. As of 
	0.99pl12, doing a "make config" will ask what cards are to be 
	supported. The file names below are in /usr/src/linux/net/inet/
	----------------------------------------------------------------
	wd.c:   0x300, 0x280, 0x380, 0x240
	3c503:  0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2a0, 0x2e0
	ne.c:   0x300, 0x280, 0x320, 0x340, 0x360
	hp.c:   0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240
	lance.c:0x300, 0x320, 0x340, 0x360
	----------------------------------------------------------------
	There are some NE2000 clone ethercards out there that are waiting black
	holes for autoprobe drivers.  While many NE2000 clones are
	safe until they are enabled, some can't be reset to a safe mode.
	These dangerous ethercards will hang any I/O access to their
	"dataports".  The typical dangerous locations are:

	Ethercard jumpered base     Dangerous locations (base + 0x10 - 0x1f)
		0x300 *				0x310-0x317
		0x320				0x330-0x337
		0x340				0x350-0x357
		0x360				0x370-0x377

	* The 0x300 location is the traditional place to put an ethercard, but
	it's also a popular place to put other devices (often SCSI
	controllers).  The 0x320 location is often the next one chosen, but
	that's bad for for the AHA1542 driver probe.  The 0x360 location is
	bad, because it conflicts with the parallel port at 0x378.

	To avoid these lurking ethercard, here are the things you can do:

        o Probe for the device's BIOS in memory space.  This is easy
	  and always safe, but it only works for cards that always have
	  BIOSes, like primary SCSI controllers.

	o Avoid probing any of the above locations until you think
	  you've located your device.  The NE2000 clones have a reset range
	  from <base>+0x18 - <base>+0x1f that will read as 0xff, so probe
	  there first if possible.  It's also safe to probe in the 8390
	  space at <base>+0x00 - <base>+0x0f, but that area will return
	  quasi-random values

	o If you must probe in the dangerous range, for instance if your
	  target device has only a few port locations, first check that
	  there isn't an NE2000 there. You can see how to do this by 
	  looking at the probe code in /usr/src/linux/net/inet/ne.c

5.2 Skeleton / Prototype Driver.

	OK. So you have decided that you want to write a driver for the
	Foobar Ethernet card, as you have the programming information,
	and it hasn't been done yet. (...these are the two main require-
	ments ;-) You can use the skeleton network driver that is provided
	with the Linux kernel source tree. It can be found in the file
	/usr/src/linux/net/inet/README.DRIVERS as of 0.99pl12, and later.

	It's also very useful to look at the Crynwr (nee Clarkson) driver
	for your target ethercard, if it's available.  Russ Nelson
	<nelson@crynwr.com> wrote most of these, and he has been very
	helpful with his code reviews of the current Linux drivers.

5.3 Driver Interface to the Kernel

	Here are some notes that may help when trying to figure out what
	the code in the driver segments is doing, or perhaps what it is
	supposed to be doing.

	-----------------------------------------------------

	int ethif_init(struct device *dev)
	{
	    ...
		dev->send_packet = &ei_send_packet;
		dev->open = &ei_open;
		dev->stop = &ei_close;
		dev->hard_start_xmit = &ei_start_xmit;
		...
	}

	int ethif_init(struct device *dev)

	This function is put into the device structure in Space.c.  It is
	called only at boot time, and returns '0' iff the ethercard 'dev'
	exists.

	-----------------------------------------------------

	static int ei_open(struct device *dev)
	static int ei_close(struct device *dev)

	This routine opens and initializes the board in response to an
	socket ioctl() usually called by 'config' or 'ifconfig'.  It is
	commonly stuffed into the 'struct device' by ethif_init().

	The inverse routine is ei_close(), which should shut down the
	ethercard, free the IRQs and DMA channels if the hardware permits,
	and turn off anything that will save power (like the transceiver).

	(Note: As of NET-2, the relevant program is '/etc/ifconfig' - and
	the device *can* be turned off or on via passing 'up' or 'down'
	to 'ifconfig' from the command line with the device name.)

	-----------------------------------------------------

	static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
		dev->hard_start_xmit = &ei_start_xmit;

	This routine puts packets to be transmitted into the hardware.  It
	is usually stuffed into the 'struct device' by ethif_init().

	When the hardware can't accept additional packets it should set
	the dev->tbusy flag.  When additional room is available, usually
	during a transmit-complete interrupt, dev->tbusy should be cleared
	and the higher levels informed with mark_bh(INET_BH).
	[[Note: pre0.99.4 kernels didn't use this interface for all packets.]]
	
	-----------------------------------------------------

	...
	    if (dev_rint(buffer, length, is_skb ? IN_SKBUFF : 0, dev))
		   stats->rx_dropped++;
	...
	A received packet is passed to the higher levels using dev_rint().
	If the unadorned packet data in a memory buffer, dev_rint will copy
	it into a 'skbuff' for you.  Otherwise a new skbuff should be
	kmalloc()ed, filled, and passed to dev_rint() with the IN_SKBUFF flag.

	-----------------------------------------------------

5.4 Interrupts and Linux
	There are two kinds of interrupt handlers in Linux:
	fast ones and slow ones. You decide what kind you are installing by
	the flags you pass to irqaction().  The fast ones, such as the serial
	interrupt handler, run with _all_ interrupts disabled.  The normal
	interrupt handlers, such as the one for ethercard drivers, runs with
	other interrupts enabled.

	There is a two-level interrupt structure.  The "fast" part handles the
	device register, removes the packets, and perhaps sets a flag.   After
	it is done, and interrupts are re-enabled, the slow part is run if the
	flag is set.

	The flag between the two parts is set by:
		mark_bh(INET_BH);

	Usually this flag is set within dev_rint() during a received-packet
	interrupt, and set directly by the device driver during a
	transmit-complete interrupt.

	You might wonder why all interrupt handlers cannot run in
	"normal mode" with other interrupts enabled.  Ross Biro uses this
	scenario to illustrate the problem:
		o You get a serial interrupt, and start processing it.
	          The serial interrupt is now masked.
		o You get a network interrupt, and you start transferring
	          a maximum-sized 1500 byte packet from the card.
		o Another character comes in, but this time the interrupts
		  are masked!

	The "fast" interrupt structure solves this problem by allowing
	bounded-time interrupt handlers to run without the risk of leaving
	their interrupt lines masked by another interrupt request.

	There is an additional distinction between fast and slow interrupt
	handlers -- the arguments passed to the handler.  A "slow" handler is
	defined as

		static void
		handle_interrupt(int reg_ptr)
		{
		    int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
		    struct device *dev = irq2dev_map[irq];
		...

	While a fast handler gets the interrupt number directly

		static void
		handle_fast_interrupt(int irq)
		{
		...

	--------------------------------------------------------------

5.4 Unresolved Questions / Concerns

	There may be some benefit from processing packet data as it is
	transferred to and from the ethercard, especially with very fast
	processors transferring data to a slow ethercard.  As I see it this
	question has multiple parts:
		1) Is there any useful processing power available, perhaps
		   during the ISA bus recovery period, or while the 8390
		   remote DMA is preparing for another transfer??
		2) Is there any useful but simple work that can be done
		   between/during each word of the copy, such as calculating
		   a CRC, or discarding obviously unwanted packets??
		3) would the complexity of an interface to do this make future
		   ethercard drivers impossible??

    There should be a better structure than Space.c  Drivers should be
	able to autoprobe for all installed ethercards rather than just
	quitting after finding the first.  I've written code to do this,
	but the constant promise (threat?) of DDI has prevented me from
	making it standard.

	A related topic is the problem of driver probes corrupting
	unrelated hardware. Even worse is a probe into a dataport that
	isn't set up to transfer data, which will freeze the machine.  The
	common suggestion is a boot-time device registry that records
	already-used I/O ports and shared memory.

6 Possible Problems, Questions and Troubleshooting.

	This section tries to answer any unresolved questions, and not so
	common solutions to common problems.

6.01 Problem with NE2000 Clones -- "DMA address mismatch"

	Is the chip a real NatSemi 8390? (DP8390, DP83901, DP83902 or DP83905)?
	If not, some clone chips don't correctly implement the transfer
	verification register.  MS-DOS drivers never do error checking, 
	so it doesn't matter to them.

	Are most of the messages off by a factor of 2?
	If so:	Are you using the NE2000 in a 16 bit slot?
		Is it jumpered to use only 8 bit transfers?
	The Linux driver expects a NE2000 to be a 16 bit slot.  A NE1000 can
	be in either size slot.  This problem can also occur with some clones,
	notably D-Link 16 bit cards, that don't have the correct ID bytes
	in the station address PROM. [[ This should be fixed in pl12.]]

	Are you running the bus faster than 8Mhz?
	If you can change the speed (faster or slower), see if that
	makes a difference.  Most NE2000 clones will run at 16Mhz, but
	some may not.  Changing speed can also mask a noisy bus.

	What other devices are on the bus?
	If moving the devices around changes the reliability, then you
	have a bus noise problem -- just what that error message was
	designed to detect.  Congratulations, you've probably found the
	source of other problems as well.

6.02 Problem with NE2000 Clones -- Machine Hangs during Boot.

	Problem:  The machine hangs during boot right after the "8390..."  or
		  "WD...." message.  Removing the NE2000 fixes the problem.

	Solution: Change your NE2000 base address to 0x360 (or 0x340 for
		  pl12 or later kernels.)

	Reason:   Your NE2000 clone isn't a good enough clone.  An active 
		  NE2000 is a bottomless pit that will trap any driver
		  autoprobing in its space.  The other ethercard drivers take
		  great pain to reset the NE2000 so that it's safe, but some
		  clones cannot be reset.  Clone chips to watch out for: 
		  Winbond 83C901.  Changing the NE2000 to a less-popular
		  address will move it out of the way of other autoprobes, 
		  allowing your machine to boot.  

	Problem:  The machine hangs during the SCSI probe at boot.

	Solution: It's the same problem as above, change the 
		  ethercard's address.

	Problem:  The machine hangs during the soundcard probe at boot.

	Solution: No, that's really during the silent SCSI probe, and it's
			  the same problem as above.


6.03 Detected Non-existent Ethercard

	Problem:  A WD80*3 is falsely detected.  Removing the sound or 
		  MIDI card eliminates the "detected" message.

	Solution: Update your ethercard driver: new versions include an
		  additional sanity check.

	Reason:   Some MIDI ports happen to produce the same checksum as a 
		  WD ethercard.

6.04 Error messages from the 80*3

	Problem:  You get messages such as the following with your 80*3:
			eth0: bogus packet size, status = ........
			kmalloc called with impossibly large argument (65400)
			eth0: Couldn't allocate sk_buff of size 65400
			eth0: receiver overrun
 
	Reason:   There is a shared memory problem.

	Solution: If the problem is sparodic, you have hardware problems.
		  Typical problems that are easy to fix are board conflicts, 
		  having cache or "shadow ROM" enabled for that region, or 
		  running your bus faster than 8Mhz.  There are also a 
		  surprising number of memory failures on ethernet cards, 
		  so run a diagnostic program if you have one for your 
		  ethercard.

		  If the problem is continual, and you have have to reboot
		  to fix the problem, record the boot-time probe message 
		  and mail it to becker@super.org  Take particular note of
		  the shared memory location.

6.05 Choosing the Interrupt of the 3c503 

	Problem:  The 3c503 picks IRQ n at boot, but this is needed for some
		  other device which needs IRQ n. (eg. CD ROM driver, etc.)
		  Can this be fixed without compiling this into the kernel?

	Solution: The 3c503 driver probes for a free IRQ line in the order
		  {5, 9, 3, 4}, and it should pick a line which isn't being 
		  used.  The pre-pl12 (SLS 1.02) driver picked the IRQ line 
		  at boot-time, and the current driver (pl12) chooses when
		  the card is open()/'ifconfig'ed.

		  Alternately, you can fix the IRQ at boot by passing 
		  parameters via LILO.  The following selects IRQ9, base 
		  location 0x300, <ignored value>, and if_port #1 (the 
		  external transceiver).  
			lilo: linux ether=9,0x300,0,1,eth0

		  The following selects IRQ3, probes for the base location,
		  <ignored value>, and the default if_port #0 (the internal 
		  transceiver) 
			lilo: linux ether=3,0,0,0,eth0

6.06 Choosing the Output of the 3c503 (thicknet vs. thinnet)

	Problem:  The supplied 3c503 drivers don't use the AUI (thicknet) port.
		  How does one choose it over the default thinnet port?

	Solution: The 3c503 AUI port can be selected at boot-time with 0.99pl12
		  and later.  The selection is overloaded onto the low bit of 
		  the currently-unused dev->rmem_start variable, so a boot-time
		  parameter of:
			lilo: linux ether=0,0,0,1,eth0
		  should work.  A boot line to force IRQ 5, port base 0x300, 
		  and use an external transceiver is:
			lilo: linux ether=5,0x300,0,1,eth0

6.07 Using More than one Ethernet Card. (eg. a gateway machine.)

	Problem:  What needs to be done so that Linux can run two 
		  ethernet cards?

	Solution: Add another entry to Space.c, naming it "eth1" instead 
		  of "eth0".  If you want routing to work well you should
		  use a recent kernel, say 0.99pl11 or later.  You may also
		  want to verify that your driver writer kept all of the
		  per-card variables in 'dev->priv'.  Most do, but the pl12
		  AT1500/LANCE driver has a single static low-memory buffer.

7 Networking with a Laptop Computer
	There are currently only a few ways to put your laptop on a network.
	You can use the NET-2 SLIP code (and run at serial line speeds);
	you can buy one of the few laptops that come with a NE2000-compatible
	ethercard or PCMCIA slot built-in; you can get a laptop with a 
	docking station and plug in an ISA ethercard; or you can use a 
	parallel port Ethernet adapter such as the D-Link DE-600.

7.1 Option 1 -- using SLIP

	This is the cheapest solution, but by far the most difficult. Also,
	you will not get very high transmission rates. Since SLIP is not
	really related to ethernet cards, it will not be discussed further
	here. See the NET-2 HOWTO.

7.2 Option 2 -- NE2000 Compatible Card built in or PCMCIA slot and ethercard.

	The second solution severely limits your laptop choices and is fairly
	expensive.  Be sure to read the specifications carefully, you may find
	that you will have to buy an additional non-standard transceiver to
	actually put the machine on a network.

7.3 Option 3 -- ISA Ethercard in the Docking Station.

	I recommend the third solution.  Docking stations for laptops typically
	cost about $250 and provide two full-size ISA slots, two serial and one
	parallel port.  Most (all?) docking stations are powered off of the
	laptop's batteries, and a few allow adding extra batteries in the
	docking station if you use short ISA cards.  You can add an inexpensive
	ethercard and enjoy full-speed ethernet performance.

7.4 Option 4 -- Pocket / Parallel port Adaptors.

	The "pocket" ethernet adaptors may also fit your need.
	Until recently they actually costed more than a docking station and
	cheap ethercard, and most tie you down with a wall-brick power supply.
	The only pocket adaptor driver right now is for the D-Link.
	I'm also working on a driver for the AT-LAN-TEC/RealTek pocket adaptor.
	Most other companies, especially Xircom, treat the programming
	information as a trade secret, so support will likely be slow in
	coming.

	You can sometimes avoid the wall-brick with the adaptors by buying
	or making a cable that draws power from the laptop's keyboard
	port.
	

8 Miscellaneous.

	Any other associated stuff that didn't fit in anywhere else gets
	dumped here. It may not be relevant, and it may not be of general
	interest but it is here anyway.

8.1 The Cabletron Story. (...as related by Donald J. Becker)

	This is a rather funny story, albeit true. -- Enjoy! P.G.

		I contacted Cabletron in early December 1992 for 
	programming information 11, 1992 (I had called and sent 
	several earlier messages).  I was referred through several 
	different people, and each one took several days to 
	respond before they forwarded me to the next.  Eventually 
	I was told I should deal with their (outside?) developer 
	Mr. Dev.Null.  I persisted, and around March it seemed 
	that I had finally succeed: Cabletron offered to send me 
	an evaluation board (unrequested) and everything I needed 
	to use it (what I wanted).  The hardware showed up right 
	away, and I waited, expecting the the programming 
	information information as well.  About a month later I 
	contacted them, and they told me that "all I needed to use 
	it" was the standard MS-DOS NDIS drivers, a binary on 
	standard driver disk.  The disk envelope was covered in 
	legalese, including no-disassembly, no-reverse-engineering 
	clauses.  It was May (and a few email exchanges later) 
	before I figured out that I had been "slow rolled", and 
	had wasted about 20 hours on this particular windmill.  

	The story isn't over yet.  People have written to me say 
	they have vetoed several medium-sized purchases from 
	Cabletron based on the lack of Linux drivers.  Cabletron 
	must have noticed this because yesterday I got a call 
	_from_ Cabletron (the first!) stating that they will be 
	independently writing a Linux driver.  Of course, their 
	lawyers probably haven't read the GPL yet...  
	


		----------- end of Ethernet HOWTO ------------


-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu


^ permalink raw reply	[flat|nested] 3+ messages in thread
* Linux Ethernet HOWTO
@ 1993-10-08 21:05 Paul Gortmaker
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Gortmaker @ 1993-10-08 21:05 UTC (permalink / raw)


Archive-Name: linux/howto/ethernet
Last-Modified: August 28, 1993

Linux Ethernet HOWTO v0.1 -- Last updated August 28, 1993
---------------------------------------------------------------------------
0. Introduction

	This is the Ethernet-HOWTO, which is a compilation of information
	about which ethernet devices can be used for Linux, and how to
	set them up.

	This Ethernet-HOWTO is by Donald J. Becker and Paul Gortmaker.
	It covers what cards you should and shouldn't buy; how to set
	them up, how to run more than one, and other common problems and
	questions. It does *not* cover the software end of things, as that
	is covered in the NET-2 HOWTO. You can freely distribute this 
	document as long as you distribute an original copy with the 
	author's names intact.

	Most of this information came from Donald J. Becker 
	<becker@super.org> who is responsible for writing and 
	supporting most of the ethernet drivers that are presently
	available. Bj0rn Ekwall <bj0rn@blox.se> is responsible for
	the D-Link pocket driver. A special thanks to others who have helped
	with the device drivers and testing.

0.1 Disclaimer

	This document is *not* gospel. However, it is probably the most
	up to date info that you will be able to find. Nobody is responsible
	for what happens to your hardware but yourself. If your ethercard
	goes up in smoke (...nearly impossible!) we take no responsibility.

0.2 Questions already?

        If you have questions about your ethernet card, please READ this
	document first. You may also want to join the NET channel of the
	Linux-activists mailing list by sending mail to
                linux-activists-request@niksula.hut.fi
        with the line
                X-Mn-Admin: join NET
        at the top of the message body (not the subject). Note that the NET
	channel is primarily used for discussion of the networking code, and
	you may not see much discussion about a particular driver.
        Furthermore keep in mind that the NET channel is for development
	discussions only. General questions on how to configure your system
	should be directed to comp.os.linux.help unless you are actively
	involved in the development of part of the networking for Linux.

0.3 Related Documentation

	Much of this info came from small files and saved postings by Donald
	himself. These can be found in /pub/linux/info on ftp.super.org
	[192.31.192.1] Of course, if you are setting up an Ethernet card,
	then you will want to read the NET-2 HOWTO so that you can actually
	do something with it.

0.4 New versions of this document

        New versions of this document can be retrieved via anonymous
        FTP from sunsite.unc.edu:/pub/Linux/docs/HOWTO/*.  It will also be
	posted to the newsgroup comp.os.linux.announce.

0.5 Feedback

	Any corrections can be sent to one of us (paul@cain.mmtc.rmit.oz.au
	or becker@super.org) We will *attempt* to keep this up to date as
	more drivers become available, and as NET-2 matures.

1. Supported Ethernet Cards for Linux

	The only thing that one needs to use an ethernet card with Linux 
	is the appropriate driver. For this, it is essential that the man-
	ufacturer will release the technical programming information to
	the general public without you (or anyone) having to sign your life
	away. A good guide for the likelihood of getting documentation
	(or, if you aren't writing code, the likelihood that someone
	else will write that driver you really, really need)
	is the availability of the Crynwr (nee Clarkson) packet
	driver.  Given the documentation, you can write a driver for
	your card and use it for Linux, at least in theory.

	Most cards come with drivers for MS-DOS interfaces such as
	NDIS and ODI, but these are useless for Linux.  Many people
	have suggested directly linking them in or automatic
	translation, but this is nearly impossible.  The MS-DOS
	drivers expect to be in 16 bit mode and hook into "software
	interrupts", both incompatible with the Linux kernel.  This
	incompatibility is actually a feature, as some Linux drivers
	are considerably better than their MS-DOS counterparts.  The
	"8390" series drivers, for instance, use ping-pong transmit
	buffers, which are only now being introduced in the MS-DOS world.

	Keep in mind that PC ethercards have the widest variety of
	interfaces (shared memory, programmed I/O, bus-master, or slave
	DMA) of any computer hardware for anything, and supporting a
	new ethercard sometimes requires re-thinking most of the
	lower-level networking code.  Also, similar product numbers
	don't always indicate similar products.  For instance, the
	3c50* product line is wildly different between members.

	Here is what drivers are and aren't available.

1.1 3com Ethernet cards

	Supported:
		3c503, 3c503/16 --
			3Com shared-memory ethercards.  They also have a
        		programmed I/O mode that doesn't use the 8390 
			facilities (their engineers found too many bugs!)  
			It should be about the same speed as the same bus 
			width WD80x3, but I don't have a 16 bit version 
			to benchmark. Unless you are a light user, spend
			the extra money and get the 16 bit model, as the
			savings aren't huge. The 3c503 does not have "EEPROM
			setup", so the diagnostic/setup program isn't needed 
			before running the card with Linux. The shared memory 
			address of the 3c503 is set using jumpers that
		        are shared with the boot PROM address.  This is
			confusing to people familiar with other ISA cards, 
			where you always leave the jumper set to "disable" 
			unless you have a boot PROM. The Linux 3c503 driver 
			will work with the 3c503 programmed-I/O mode, but this 
		        is slower and less reliable than shared memory mode.

			Also, programmed-I/O mode is not tested when updating
			the drivers, and the deadman (deadcard?) check code 
			may be falsely triggered on some machines.
			The IRQ line is set in software, with no hints
			from e.g. EEPROM.  Unlike the MS-DOS driver, the 
			Linux driver has capability to autoIRQ: it uses the 
			first available IRQ line in {5,2,3,4}, selected each 
			time the card is 'ifconfig'ed.  (Older driver versions 
			selected the IRQ at boot time.)  The ioctl() call 
			in 'ifconfig' will return EAGAIN if no IRQ line is 
			available at that time. 

		3c509 --
			A new card for 3Com. It should be cheap and have
			excellent performance. The drawbacks are that it
			_requires_ very low interrupt latency, and it isn't
			rated for bus speeds greater than 8Mhz. The driver is 
			written, working, and included in pl12. But it
			seems to triggers a Linux TCP bug, so it's not built
			as part of the default kernel.

			There is also an alpha version of a Linux 3c509
			diagnostic and EEPROM setup program, but for now
			users that don't like the defaults should use the
			MS-DOS EEPROM setup program.
 
		3c579 --
			The EISA version of the 509. The current EISA version
			uses the same 16 bit wide chip rather than a 32 bit
			interface, so the performance increase isn't stunning.
			The 3c509 driver should work with the EISA
			version, but I have neither an EISA machine nor
			a 3c579 to test it on.

	Unsupported:

		3c501 --
			Too brain-damaged to use. Available surplus from many
			places. Avoid it like the plague. However, if you are
			a bit of a masochist, there is some code in /pub/linux
			on ftp.super.org --> look for 3c501.c Again, do not
			purchase this card, even as a joke.  It's performance
			is horrible, and it breaks in many ways.  

			For those not yet convinced, the 3c501 can only do one
			thing at a time -- while you are removing one packet
			from the single-packet buffer it cannot receive
			another packet, nor can it receive a packet while are
			loading a transmit packet.  This was fine for a
			network between two 8088-based computers where
			processing each packet and replying took 10's of
			msecs, but modern networks send back-to-back
			packets for almost every transaction.

		3c505 --
			Not available at present.

		3c507 --
			Not available at present.

1.2 Western Digital / SMC Cards

	The ethernet part of Western Digital has been bought by SMC.  The
	SMC Elite and SMC Elite Plus are the same as late-model WD8003 
	and WD8013 cards.

	Supported:

		WD8003, WD8013, SMC Elite, SMC Elite Plus --
			A shared memory design by Western Digital. The
			8 bit 8003 is slightly less expensive, but only
			worth the savings for light use. Over the
			years the design has added more registers and an
			EEPROM.  Clones usually go by the '8013' name, and 
			usually use a non-EEPROM (jumpered) design. This part
			of WD has been sold to SMC, so you'll usually see 
			something link SMC/WD8013 or SMC Elite Plus (WD8013).  
			The shared memory makes the cards 10-20% faster,
			especially with larger packets. More importantly
			(to me at least) it avoids a few bugs in the
			programmed-I/O mode of the 8390, allows safe
			multi-threaded access to the packet buffer, and 
			doesn't have a programmed-I/O data register that 
			hangs your machine during warm-boot probes.  

1.3 NExxxx Cards

	The prefix "NE" came from Novell Ethernet.  Novell followed the 
	cheapest NatSemi databook design and sold the manufacturing rights 
	(spun off?) Eagle, just to get reasonably-priced ethercards into 
	the market.

	Supported:

		NE1000, NE2000 --
			The now-generic name for a bare-bones design around 
			the NatSemi 8390. They use programmed I/O rather than
			shared memory, leading to easier installation but 
			slightly lower performance and a few problems. Again,
			the savings of using an 8 bit NE1000 over the NE2000
			are only warranted if you expect light use. Some 
			recently introduced NE2000 clones use the National
			Semiconductor "AT/LANTic" 83905 chip, which offers 
			a shared memory mode similar to the 8013 and EEPROM
			or software configuration. Some problems can arise
			with poor clones. See the question and answer section
			later in this document, and the section on clones.

		NE1500, NE2100 --
			The AT1500 driver, recently added to the list of
			supported cards, also supports the NE1500, NE2100 and
			clones. The driver shipped with pl12 kernel doesn't 
			detect non-AT1500 cards with autoprobe, but will work 
			fine if you specify the base address explicitly and 
			jumper for DMA channel 5.

1.3 Hewlett Packard Cards

	HP-LAN ethercards: Nicely made, but hard to find.  The model
	numbers don't encode anything, so you'll have to go by the 
	description. 

	Supported:

		 272[45]* series, 27245, 27247, 27250 --
			They use programmed I/O, similar to the NE*000 boards,
			but the data transfer port can be "turned off" when 
			you aren't accessing it, avoiding problem with 
			autoprobing drivers. Note that few people seem to use 
			them, and I've had conflicting reports about changes 
			between versions with the same model number -- later
			versions may not work.

1.4 D-Link 

	There is a file /usr/src/linux/net/inet/README.DLINK that you
	should read if you are going to use D-Link stuff. Note, however 
	that the installation info in this file is no longer valid, as it
	applied to pre NET-2 kernels. It is now a part of the standard kernel.
	
	Supported:

		DE-600 --
			Laptop users and other folk who might want a quick 
			way to put their computer onto the ethernet may want 
			to use this. The driver is included with the default 
			kernel source tree as of pl12 and possibly earlier. 
			Bjorn Ekwall <bj0rn@blox.se> wrote the original. 
			Expect about 80kb/s transfer speed from this via the 
			parallel port. The file mentioned above contains 
			a "Known Problems and..." section. I will not repeat 
			it here. But you should read it.  (Hint applied gently 
			with a sledgehammer.)

		DE100, DE200, DE-220-T --
			The manual says that it is 100% compatible with the
			NE2000.  This is not true. You should call them and tell
			them you are using their card with Linux, and that they
			should correct their documentation.  Some pre-0.99pl12 
			driver versions may have trouble recognizing the DE2** 
			series as 16 bit cards, and these cards are the most 
			widely reported as having the spurious transfer address
			mismatch errors.

1.5 Cabletron

	Yes, another one of these companies that won't release its
	programming information. They waited for months before actually
	confirming that all their information was proprietary. If you feel
	like asking them why they don't want to release their info so that
	people can use their cards, write to pkelly@ctron.com. You should
	read section 8.1 of this document, as it has specific information
	pertaining to Cabletron.

	Supported:

		E10**, E10**-x, E20**, E20**-x --
			These are NEx000 almost-clones that are reported to work
			with the standard NEx000 drivers, thanks to a 
			ctron-specific check during the probe. If there are 
			any problems, they are unlikely to be fixed, as the 
			programming information is unavailable.

	Unsupported:

		E21** --
			Again, there is not much one can do when the
			programming information is proprietary. Feel free
			to ask pkelly@ctron.com.  This is the only 8390-base
			ethercard series that isn't supported by Linux.

1.6	Allied Telesis:

	Allied Telesis is the worlds largest maker of separate
	transceivers thanks to their low prices, and they now have a
	series of low-cost ethercards using the 79C960 version of the AMD
	LANCE.  These are bus-master cards, and thus probably the fastest
	ISA bus ethercards available (although the 3c509 has lower latency
	thanks to predictive interrupts).  The driver for the AT1500
	series is new in the 0.99pl12 kernel, but it won't work
	"out-of-the-box" with >16M machines.  (NB This isn't a fundamental
	limitation, so stop pointing and laughing at the ISA bus.  The
	driver just needs a hook to allocate low-memory buffers for the
	bus-master DMA, and should be just as fast on >16M systems.)

	The current (pl12) driver defaults to DMA5.  Future driver
	versions may figure out a way to autoDMA.

	There is a special $20 one-unit-only evaluation offer on the AT1500T
	(the TP-only model) until mid-September 1993.  The normal list
	price is $80-$100.
	

1.6 Other (less common card supplier) Companies

	Arcnet:
		There is no Arcnet driver for Linux. Feel free to write a 
		driver.  There might be people with home systems
		that will be able to use it with discarded hardware. 
		With the very low cost and better performance of ethernet,
		I expect that most places will be giving away their Arcnet
		hardware for free.

		An advantage of Arcnet is that all of the cards have identical
		interfaces, so once a driver is available it will work for everyone.

	Digital / DEC
		There is an alpha version of a driver for the early model DEC
		DEPCA.  DEC is refusing to release information on the later
		models.  (The rumor is that they don't have enough money to
		write and print one!)

	Intel:
		Not too many of these cards around at present. The Intel Ether-
		Express is unsupported at present.

	PureData:
		The PureData PDUC8028 and PDI8023 series of cards are reported
		to work, thanks to special probe code contributed by Mike
		Jagdis <jaggy@purplet.demon.co.uk>.  The support is integrated
		with the WD driver.

	Xircom:
		Another group that won't release documentation. No cards 
		supported.  Don't look for any support in the future unless 
		they release their programming information. And this is
		highly unlikely, as they *forbid* you from even reverse-
		engineering their drivers. Here is some of the results from
		people who have tried to deal with Xircom.

		"I had no end of problems trying to work with Xircom.  
		After spending months talking to them and working up a
		prospectus, I was told that no information would be forthcoming
		and that they were not interested in markets other than the
		ISA/DOS market. (I was trying to interface the pocket adapters
		to an Amiga). I won't work with them anymore and I won't
		recommend their products to anyone." 

		"They (Xircom) won't give it (programming info.) out. BSDI
		was was able to get the spec and write a driver for it, but
		only by promising not to give out the source."

	Zenith:
		The Zenith Z-note is unsupported at present.

2. Clones of popular Ethernet cards.

	Due to the popular design of some cards,  different companies will
	make "clones" or replicas of the original card. However, one must
	be careful, as some of these clones are not 100% compatible, and
	can be troublesome. Some common problems with "not-quite-clones"
	are noted in the question and answer section of this document.

2.1 WD80x3 Clones that are reported to work.

	AT-LAN-TEC 8013
	PureData (not a 8013 clone, but the 8013 driver has special code)
	LANNET LEC-45
	PE-8013 (WD-8013 Compatible)

2.2 NE2000 Clones that are reported to work.

	Alta Combo NE2000 clone
	Aritsoft LANtastic AE-2 (OK, but has flawed error-reporting registers)
	Asante Etherpak 2001/2003
	AT-LAN-TEC NE2000 clone (uses Winbond chip that traps SCSI drivers)
	Cabletron products: E10**,  E10**-x,  E20**, E20**-x
	Cnet UTP 10baseT (NE 2000 emulation)
	D-Link Ethernet II (bad clones, but the driver checks for them)
	4-Dimension FD0490 EtherBoard16
	LTC E-NET/16 P/N: 8300-200-002 (lipka@lip.hanse.de)
	Network Solutions HE-203
	SIIG Inc E-Lan/200 (NE 2000 comp.)
	SVEC 4 Dimension Ethernet

3 The Card to buy is....

	For impatient users that just want a quick, cheap answer the 
	summary is: get 16 bit thinnet 8013 cards. For more detail as
	to the who what where and why, read on.

3.1 Eight bit vs 16 bit.

	Unless you are a light user, or are confined to using the smaller
	ISA slot, the use of the 8 bit cards like the wd8003 and the 3c503
	is really not worth the cost savings. Get the 8013 or the 3c503/16
	instead.

3.2 Prices are a bit steep for the XXXX card.

	I keep track of the current low-price vendors, just because it's
	asked so often.  Call AT-LAN-TEC at 301-948-7070.  Ask for their
	technical support person, "Vincent Bono".  As with all purchases,
	you should indicate you are buying this for a Linux system.
	The last I checked the price for 10 NE2000s was $690, or $69 ea.!
	NB Their current NE2000 clone is a model that "traps" other
	drivers that probe into their address space.

	AT-LAN-TEC also carries a clone, non-EEPROM 8013 board for $89,
	and a NE2100 clone.  Either is a better choice if the very lowest
	price isn't essential. 

	I've also ordered Alta "Combo" NE2000 cards from Network Express
	(aka Main Street Computers) in Fl.  A bit more expensive, but
	they have bigger ads in Computer Shopper. If you are looking for
	prices on your own, try the back of LAN magazine.

	Currently (late Aug. '93) there is a market-share war going on in
	the ethercard business.  Both Allied-Telesis and Accton have
	special evaluation deals going on if you call them directly and
	reference the right advertisement.  (AT1500T $20, max. one, and
	Accton NE2000 clone $30+$5s&h, max. 2.)

3.3 Type of cable that your card should support.

	Unless you have to conform to an existing network, you will want
	to use thinnet or thin ethernet cable. This is the style with the
	standard BNC connectors. See the next section on concerns with
	different types of ethernet cable.

	Most ethercards also come in a "Combo" version for only $10-$20 more.
	These have both twisted pair and thinnet transceiver built-in,
	allowing you to change your mind later.

4. Cables, Coax, Twisted pairs etc.
   
	If you are starting a network from scratch, it's considerably less
	expensive to use thin ethernet, RG58 co-ax cable with BNC connectors,
	than old-fashioned thick ethernet, RG-5 cable with N connectors, or
	10baseT, twisted pair telco-style cables with RJ-45 "phone"
	connectors.

4.1 Thin Ethernet (thinnet).

	Thin ethernet is the "ether of choice".  The cable is inexpensive.  If
	you are making your own cables solid-core RG58A is $0.09/ft. and
	stranded RG58AU is $0.15/ft.  Twist-on BNC connectors are < $2 ea.,
	and other misc. pieces are similarly inexpensive.  It is essential
	that you properly terminate each end of the cable with 50 ohm
	terminators, so budget $2 ea. for a pair.  It's also vital that
	your cable have no "stubs" -- the 'T' connectors must be attached
	directly to the ethercards.

4.2 Twisted Pair.

	Twisted pair networks require active hubs, which start around $300,
	and the raw cable cost can actually be higher than thinnet.  They are
	usually sold using the claim that you can use your existing telephone
	wiring, but it's a rare installation where that turns out to be the
	case.  The claim that you can upgrade to higher speeds is also
	suspect, as most proposed schemes use higher-grade (read $$) cable and
	more sophisticated termination ($$$) than you would likely install on
	speculation.

4.3 Thick Ethernet.

	Thick ethernet is mostly obsolete, and is usually used only to remain
	compatible with an existing implementation.  You can stretch the rules
	and connect short spans of thick and thin ethernet together with a
	passive $3 N-to-BNC connector, and that's often the best solution to
	expanding an existing thicknet.  A correct (but expensive) solution is
	to use a repeater in this case.

5 Technical Information.

	For those who want to play with the present drivers, or try to make
	up their own driver for a card that is presently unsupported, this
	information should be useful. If you do not fall into this category,
	then perhaps you will want to skip this section.

5.1 Probed Addresses.

	While trying to determine what ethernet card is there, the following
	addresses are autoprobed, assuming the type and specs of the card
	have not been set in the kernel. In /usr/src/linux/net/inet/CONFIG,
	one can set the cards that are compiled in to the kernel. As of 
	0.99pl12, doing a "make config" will ask what cards are to be 
	supported. The file names below are in /usr/src/linux/net/inet/
	----------------------------------------------------------------
	wd.c:   0x300, 0x280, 0x380, 0x240
	3c503:  0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2a0, 0x2e0
	ne.c:   0x300, 0x280, 0x320, 0x340, 0x360
	hp.c:   0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240
	lance.c:0x300, 0x320, 0x340, 0x360
	----------------------------------------------------------------
	There are some NE2000 clone ethercards out there that are waiting black
	holes for autoprobe drivers.  While many NE2000 clones are
	safe until they are enabled, some can't be reset to a safe mode.
	These dangerous ethercards will hang any I/O access to their
	"dataports".  The typical dangerous locations are:

	Ethercard jumpered base     Dangerous locations (base + 0x10 - 0x1f)
		0x300 *				0x310-0x317
		0x320				0x330-0x337
		0x340				0x350-0x357
		0x360				0x370-0x377

	* The 0x300 location is the traditional place to put an ethercard, but
	it's also a popular place to put other devices (often SCSI
	controllers).  The 0x320 location is often the next one chosen, but
	that's bad for for the AHA1542 driver probe.  The 0x360 location is
	bad, because it conflicts with the parallel port at 0x378.

	To avoid these lurking ethercard, here are the things you can do:

        o Probe for the device's BIOS in memory space.  This is easy
	  and always safe, but it only works for cards that always have
	  BIOSes, like primary SCSI controllers.

	o Avoid probing any of the above locations until you think
	  you've located your device.  The NE2000 clones have a reset range
	  from <base>+0x18 - <base>+0x1f that will read as 0xff, so probe
	  there first if possible.  It's also safe to probe in the 8390
	  space at <base>+0x00 - <base>+0x0f, but that area will return
	  quasi-random values

	o If you must probe in the dangerous range, for instance if your
	  target device has only a few port locations, first check that
	  there isn't an NE2000 there. You can see how to do this by 
	  looking at the probe code in /usr/src/linux/net/inet/ne.c

5.2 Skeleton / Prototype Driver.

	OK. So you have decided that you want to write a driver for the
	Foobar Ethernet card, as you have the programming information,
	and it hasn't been done yet. (...these are the two main require-
	ments ;-) You can use the skeleton network driver that is provided
	with the Linux kernel source tree. It can be found in the file
	/usr/src/linux/net/inet/README.DRIVERS as of 0.99pl12, and later.

	It's also very useful to look at the Crynwr (nee Clarkson) driver
	for your target ethercard, if it's available.  Russ Nelson
	<nelson@crynwr.com> wrote most of these, and he has been very
	helpful with his code reviews of the current Linux drivers.

5.3 Driver Interface to the Kernel

	Here are some notes that may help when trying to figure out what
	the code in the driver segments is doing, or perhaps what it is
	supposed to be doing.

	-----------------------------------------------------

	int ethif_init(struct device *dev)
	{
	    ...
		dev->send_packet = &ei_send_packet;
		dev->open = &ei_open;
		dev->stop = &ei_close;
		dev->hard_start_xmit = &ei_start_xmit;
		...
	}

	int ethif_init(struct device *dev)

	This function is put into the device structure in Space.c.  It is
	called only at boot time, and returns '0' iff the ethercard 'dev'
	exists.

	-----------------------------------------------------

	static int ei_open(struct device *dev)
	static int ei_close(struct device *dev)

	This routine opens and initializes the board in response to an
	socket ioctl() usually called by 'config' or 'ifconfig'.  It is
	commonly stuffed into the 'struct device' by ethif_init().

	The inverse routine is ei_close(), which should shut down the
	ethercard, free the IRQs and DMA channels if the hardware permits,
	and turn off anything that will save power (like the transceiver).

	(Note: As of NET-2, the relevant program is '/etc/ifconfig' - and
	the device *can* be turned off or on via passing 'up' or 'down'
	to 'ifconfig' from the command line with the device name.)

	-----------------------------------------------------

	static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
		dev->hard_start_xmit = &ei_start_xmit;

	This routine puts packets to be transmitted into the hardware.  It
	is usually stuffed into the 'struct device' by ethif_init().

	When the hardware can't accept additional packets it should set
	the dev->tbusy flag.  When additional room is available, usually
	during a transmit-complete interrupt, dev->tbusy should be cleared
	and the higher levels informed with mark_bh(INET_BH).
	[[Note: pre0.99.4 kernels didn't use this interface for all packets.]]
	
	-----------------------------------------------------

	...
	    if (dev_rint(buffer, length, is_skb ? IN_SKBUFF : 0, dev))
		   stats->rx_dropped++;
	...
	A received packet is passed to the higher levels using dev_rint().
	If the unadorned packet data in a memory buffer, dev_rint will copy
	it into a 'skbuff' for you.  Otherwise a new skbuff should be
	kmalloc()ed, filled, and passed to dev_rint() with the IN_SKBUFF flag.

	-----------------------------------------------------

5.4 Interrupts and Linux
	There are two kinds of interrupt handlers in Linux:
	fast ones and slow ones. You decide what kind you are installing by
	the flags you pass to irqaction().  The fast ones, such as the serial
	interrupt handler, run with _all_ interrupts disabled.  The normal
	interrupt handlers, such as the one for ethercard drivers, runs with
	other interrupts enabled.

	There is a two-level interrupt structure.  The "fast" part handles the
	device register, removes the packets, and perhaps sets a flag.   After
	it is done, and interrupts are re-enabled, the slow part is run if the
	flag is set.

	The flag between the two parts is set by:
		mark_bh(INET_BH);

	Usually this flag is set within dev_rint() during a received-packet
	interrupt, and set directly by the device driver during a
	transmit-complete interrupt.

	You might wonder why all interrupt handlers cannot run in
	"normal mode" with other interrupts enabled.  Ross Biro uses this
	scenario to illustrate the problem:
		o You get a serial interrupt, and start processing it.
	          The serial interrupt is now masked.
		o You get a network interrupt, and you start transferring
	          a maximum-sized 1500 byte packet from the card.
		o Another character comes in, but this time the interrupts
		  are masked!

	The "fast" interrupt structure solves this problem by allowing
	bounded-time interrupt handlers to run without the risk of leaving
	their interrupt lines masked by another interrupt request.

	There is an additional distinction between fast and slow interrupt
	handlers -- the arguments passed to the handler.  A "slow" handler is
	defined as

		static void
		handle_interrupt(int reg_ptr)
		{
		    int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
		    struct device *dev = irq2dev_map[irq];
		...

	While a fast handler gets the interrupt number directly

		static void
		handle_fast_interrupt(int irq)
		{
		...

	--------------------------------------------------------------

5.4 Unresolved Questions / Concerns

	There may be some benefit from processing packet data as it is
	transferred to and from the ethercard, especially with very fast
	processors transferring data to a slow ethercard.  As I see it this
	question has multiple parts:
		1) Is there any useful processing power available, perhaps
		   during the ISA bus recovery period, or while the 8390
		   remote DMA is preparing for another transfer??
		2) Is there any useful but simple work that can be done
		   between/during each word of the copy, such as calculating
		   a CRC, or discarding obviously unwanted packets??
		3) would the complexity of an interface to do this make future
		   ethercard drivers impossible??

    There should be a better structure than Space.c  Drivers should be
	able to autoprobe for all installed ethercards rather than just
	quitting after finding the first.  I've written code to do this,
	but the constant promise (threat?) of DDI has prevented me from
	making it standard.

	A related topic is the problem of driver probes corrupting
	unrelated hardware. Even worse is a probe into a dataport that
	isn't set up to transfer data, which will freeze the machine.  The
	common suggestion is a boot-time device registry that records
	already-used I/O ports and shared memory.

6 Possible Problems, Questions and Troubleshooting.

	This section tries to answer any unresolved questions, and not so
	common solutions to common problems.

6.01 Problem with NE2000 Clones -- "DMA address mismatch"

	Is the chip a real NatSemi 8390? (DP8390, DP83901, DP83902 or DP83905)?
	If not, some clone chips don't correctly implement the transfer
	verification register.  MS-DOS drivers never do error checking, 
	so it doesn't matter to them.

	Are most of the messages off by a factor of 2?
	If so:	Are you using the NE2000 in a 16 bit slot?
		Is it jumpered to use only 8 bit transfers?
	The Linux driver expects a NE2000 to be a 16 bit slot.  A NE1000 can
	be in either size slot.  This problem can also occur with some clones,
	notably D-Link 16 bit cards, that don't have the correct ID bytes
	in the station address PROM. [[ This should be fixed in pl12.]]

	Are you running the bus faster than 8Mhz?
	If you can change the speed (faster or slower), see if that
	makes a difference.  Most NE2000 clones will run at 16Mhz, but
	some may not.  Changing speed can also mask a noisy bus.

	What other devices are on the bus?
	If moving the devices around changes the reliability, then you
	have a bus noise problem -- just what that error message was
	designed to detect.  Congratulations, you've probably found the
	source of other problems as well.

6.02 Problem with NE2000 Clones -- Machine Hangs during Boot.

	Problem:  The machine hangs during boot right after the "8390..."  or
		  "WD...." message.  Removing the NE2000 fixes the problem.

	Solution: Change your NE2000 base address to 0x360 (or 0x340 for
		  pl12 or later kernels.)

	Reason:   Your NE2000 clone isn't a good enough clone.  An active 
		  NE2000 is a bottomless pit that will trap any driver
		  autoprobing in its space.  The other ethercard drivers take
		  great pain to reset the NE2000 so that it's safe, but some
		  clones cannot be reset.  Clone chips to watch out for: 
		  Winbond 83C901.  Changing the NE2000 to a less-popular
		  address will move it out of the way of other autoprobes, 
		  allowing your machine to boot.  

	Problem:  The machine hangs during the SCSI probe at boot.

	Solution: It's the same problem as above, change the 
		  ethercard's address.

	Problem:  The machine hangs during the soundcard probe at boot.

	Solution: No, that's really during the silent SCSI probe, and it's
			  the same problem as above.


6.03 Detected Non-existent Ethercard

	Problem:  A WD80*3 is falsely detected.  Removing the sound or 
		  MIDI card eliminates the "detected" message.

	Solution: Update your ethercard driver: new versions include an
		  additional sanity check.

	Reason:   Some MIDI ports happen to produce the same checksum as a 
		  WD ethercard.

6.04 Error messages from the 80*3

	Problem:  You get messages such as the following with your 80*3:
			eth0: bogus packet size, status = ........
			kmalloc called with impossibly large argument (65400)
			eth0: Couldn't allocate sk_buff of size 65400
			eth0: receiver overrun
 
	Reason:   There is a shared memory problem.

	Solution: If the problem is sparodic, you have hardware problems.
		  Typical problems that are easy to fix are board conflicts, 
		  having cache or "shadow ROM" enabled for that region, or 
		  running your bus faster than 8Mhz.  There are also a 
		  surprising number of memory failures on ethernet cards, 
		  so run a diagnostic program if you have one for your 
		  ethercard.

		  If the problem is continual, and you have have to reboot
		  to fix the problem, record the boot-time probe message 
		  and mail it to becker@super.org  Take particular note of
		  the shared memory location.

6.05 Choosing the Interrupt of the 3c503 

	Problem:  The 3c503 picks IRQ n at boot, but this is needed for some
		  other device which needs IRQ n. (eg. CD ROM driver, etc.)
		  Can this be fixed without compiling this into the kernel?

	Solution: The 3c503 driver probes for a free IRQ line in the order
		  {5, 9, 3, 4}, and it should pick a line which isn't being 
		  used.  The pre-pl12 (SLS 1.02) driver picked the IRQ line 
		  at boot-time, and the current driver (pl12) chooses when
		  the card is open()/'ifconfig'ed.

		  Alternately, you can fix the IRQ at boot by passing 
		  parameters via LILO.  The following selects IRQ9, base 
		  location 0x300, <ignored value>, and if_port #1 (the 
		  external transceiver).  
			lilo: linux ether=9,0x300,0,1,eth0

		  The following selects IRQ3, probes for the base location,
		  <ignored value>, and the default if_port #0 (the internal 
		  transceiver) 
			lilo: linux ether=3,0,0,0,eth0

6.06 Choosing the Output of the 3c503 (thicknet vs. thinnet)

	Problem:  The supplied 3c503 drivers don't use the AUI (thicknet) port.
		  How does one choose it over the default thinnet port?

	Solution: The 3c503 AUI port can be selected at boot-time with 0.99pl12
		  and later.  The selection is overloaded onto the low bit of 
		  the currently-unused dev->rmem_start variable, so a boot-time
		  parameter of:
			lilo: linux ether=0,0,0,1,eth0
		  should work.  A boot line to force IRQ 5, port base 0x300, 
		  and use an external transceiver is:
			lilo: linux ether=5,0x300,0,1,eth0

6.07 Using More than one Ethernet Card. (eg. a gateway machine.)

	Problem:  What needs to be done so that Linux can run two 
		  ethernet cards?

	Solution: Add another entry to Space.c, naming it "eth1" instead 
		  of "eth0".  If you want routing to work well you should
		  use a recent kernel, say 0.99pl11 or later.  You may also
		  want to verify that your driver writer kept all of the
		  per-card variables in 'dev->priv'.  Most do, but the pl12
		  AT1500/LANCE driver has a single static low-memory buffer.

7 Networking with a Laptop Computer
	There are currently only a few ways to put your laptop on a network.
	You can use the NET-2 SLIP code (and run at serial line speeds);
	you can buy one of the few laptops that come with a NE2000-compatible
	ethercard or PCMCIA slot built-in; you can get a laptop with a 
	docking station and plug in an ISA ethercard; or you can use a 
	parallel port Ethernet adapter such as the D-Link DE-600.

7.1 Option 1 -- using SLIP

	This is the cheapest solution, but by far the most difficult. Also,
	you will not get very high transmission rates. Since SLIP is not
	really related to ethernet cards, it will not be discussed further
	here. See the NET-2 HOWTO.

7.2 Option 2 -- NE2000 Compatible Card built in or PCMCIA slot and ethercard.

	The second solution severely limits your laptop choices and is fairly
	expensive.  Be sure to read the specifications carefully, you may find
	that you will have to buy an additional non-standard transceiver to
	actually put the machine on a network.

7.3 Option 3 -- ISA Ethercard in the Docking Station.

	I recommend the third solution.  Docking stations for laptops typically
	cost about $250 and provide two full-size ISA slots, two serial and one
	parallel port.  Most (all?) docking stations are powered off of the
	laptop's batteries, and a few allow adding extra batteries in the
	docking station if you use short ISA cards.  You can add an inexpensive
	ethercard and enjoy full-speed ethernet performance.

7.4 Option 4 -- Pocket / Parallel port Adaptors.

	The "pocket" ethernet adaptors may also fit your need.
	Until recently they actually costed more than a docking station and
	cheap ethercard, and most tie you down with a wall-brick power supply.
	The only pocket adaptor driver right now is for the D-Link.
	I'm also working on a driver for the AT-LAN-TEC/RealTek pocket adaptor.
	Most other companies, especially Xircom, treat the programming
	information as a trade secret, so support will likely be slow in
	coming.

	You can sometimes avoid the wall-brick with the adaptors by buying
	or making a cable that draws power from the laptop's keyboard
	port.
	

8 Miscellaneous.

	Any other associated stuff that didn't fit in anywhere else gets
	dumped here. It may not be relevant, and it may not be of general
	interest but it is here anyway.

8.1 The Cabletron Story. (...as related by Donald J. Becker)

	This is a rather funny story, albeit true. -- Enjoy! P.G.

		I contacted Cabletron in early December 1992 for 
	programming information 11, 1992 (I had called and sent 
	several earlier messages).  I was referred through several 
	different people, and each one took several days to 
	respond before they forwarded me to the next.  Eventually 
	I was told I should deal with their (outside?) developer 
	Mr. Dev.Null.  I persisted, and around March it seemed 
	that I had finally succeed: Cabletron offered to send me 
	an evaluation board (unrequested) and everything I needed 
	to use it (what I wanted).  The hardware showed up right 
	away, and I waited, expecting the the programming 
	information information as well.  About a month later I 
	contacted them, and they told me that "all I needed to use 
	it" was the standard MS-DOS NDIS drivers, a binary on 
	standard driver disk.  The disk envelope was covered in 
	legalese, including no-disassembly, no-reverse-engineering 
	clauses.  It was May (and a few email exchanges later) 
	before I figured out that I had been "slow rolled", and 
	had wasted about 20 hours on this particular windmill.  

	The story isn't over yet.  People have written to me say 
	they have vetoed several medium-sized purchases from 
	Cabletron based on the lack of Linux drivers.  Cabletron 
	must have noticed this because yesterday I got a call 
	_from_ Cabletron (the first!) stating that they will be 
	independently writing a Linux driver.  Of course, their 
	lawyers probably haven't read the GPL yet...  
	


		----------- end of Ethernet HOWTO ------------


-- 
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1993-10-08 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-08-31 15:51 Linux Ethernet HOWTO Paul Gortmaker
  -- strict thread matches above, loose matches on Subject: below --
1993-09-13  0:31 Paul Gortmaker
1993-10-08 21:05 Paul Gortmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox