ETHERNE.TXT                                                        ThR
                                                            2002-06-08


Introduction

EtherNE is a package of hardware schematics and software drivers and
source code to enable an Atari ST or compatible machines to connect to
ethernet.

When designing this ethernet solution for the Atari ST I had the
following objectives:

- no need to open the Atari thus use of an external port of the Atari
- use of readily available standard ethernet hardware
- as simple as possible interface hardware
- as fast and compact driver software as possible
- support of STing, MagicNet and MINTNet IP stacks.

To start from well stablished hardware I chose standard NE2000
compatible cards with ISA bus interface (PCI cards are not supported)
as a basis of the hardware solution. To interface the NE card to the
ST EtherNE contains three types of interface hardware solutions:

  ACSI-ISA interface (below called EtherNEA)
  - hardware design by me
  - hardware is e.g. available from Elmar Hilgart
      elmar.hilgart@asamnet.de, http://www.asamnet.de/~hilgarte
  - This is suitable for all machines with ACSI bus, e.g. (Mega) ST, TT

  Cartridge Port (ROM port)-ISA interface (below called EtherNEC)
  - hardware design by Lyndon Amsdon and me
  - hardware is available from Lyndon Amsdon
      bindon@madasafish.com, http://hardware.atari.org
  - This is suitable for all machines with Cartridge Port bus, e.g. 
    (Mega) ST, TT, (Mega) STE, Falcon.

  Milan ISA slot (below called EtherNEM)
  - this is just using a standard ISA slot built into the Milan.


Software wise EtherNE supports various IP networking stacks:
	STinG (version 1.26 tested)
	MagicNet (version from Oct. 2001 tested)
	MintNet (sockdev.xdd version 1.5 PL1 has been tested)


Choosing a hardware solution

Q: Should I use EtherNEA hardware or EtherNEC hardware?

A: For the Falcon only the EtherNEC cartridge port interface is
applicable.  If your machine has both an ACSI port and a Cartridge
Port and you have a harddisk at the ACSI port you might want to use
EtherNEC because this will be faster than having EtherNEA to share the
bandwidth with the harddisk.  Speedwise there is no big difference,
EtherNEC seems to be a bit faster for reads from the NE card and a bit
slower for writes to the NE card. A future DMA enabled version of
EtherNEA may be much faster however (some day). Note that the
Cartridge Port +5V feeds the NE2000 card as well. Thus you do not need
an extra power supply for EtherNEC whereas you need one for EtherNEA.
The EtherNEC hardware is simpler.

Hence most often EtherNEC will be used and EtherNEA may only be
considered if the CP must be used for something else (e.g. dongle).


Q: What NE2000 (clone) card shall use?

A: This package works only with ISA cards. Go for new single chip
cards (I tested e.g. a card with Realtek 8019 chip). They support
faster read and write cycles than the old NE1000 and NE2000 (clone)
cards with jumpers and are cheap.

These new cards are all PC "plug and play" without jumpers. For use
with either EtherNEA or EtherNEC they need upfront one time
configuration in a PC.  You need to set them to IO address 0x300
and choose the cable type (BNC or twisted pair) by using the DOS
configuration utility supplied by the manufacturer of the card. With
EtherNEC *only* these new cards will work reliably.


I tested the following ISA ethernet cards with the EtherNEA interface:

- Lantech EN2000: fairly new NE2000 clone using the Realtek RTL 8019AS
chip. Originally I had encountered problems with this card until I
found out that only 8KByte buffer RAM where available in 8-bit bus
mode although it has 16KByte. This turned out to be true for all 16
bit cards. This might be due to compatibility to the old NE1000 (8bit
cards) that had only 8KB RAM. Advantage of this card - and probably
all cards with this chip and possibly all new single chip cards - is
its speed. It supports fast ISA bus cycle with no wait states.

- E2000-1: old NE2000 clone with Winbond W89C90 chip
This card works OK.

- NE-2: old NE2000 clone with UMC UM9090 chip
This card works OK.

- NE1: this is in a very old NE1000 clone card with Winbond 
W89C90 chip. The NE1000 is the 8-bit predecessor of the 
NE2000. I augmented the buffer RAM on the card to 16Kbyte and it
worked quite well.

All old cards above I tested require slow ISA bus cycles and request
ISA bus wait states.  Hence if you got an old NE2000 or NE1000 clone
and you really want to use it then you have to go for EtherNEA as only
it has an "slow mode" option to support these.  Old cards do not work
reliably with EtherNEC because it is too fast for them and the
hardware currently has no slow mode option.

The driver software automatically detects if a card is NE1000 or
NE2000 compatible and does appropriate setup automatically. It assumes
the NE1000 card has been upgraded to 16KByte of buffer RAM however.


Choosing an IP networking software stack

All combinations of interface hardware and IP stacks are
covered. Drivers in this package include:

EtherNEA ACSI interface, "fast" option:
	ENEAF.STX	STing
	ENEAF.MIF	MagicNet/MINTNet

EtherNEA ACSI interface, "slow" option:
	ENEAS.STX	STing
	ENEAS.MIF	MagiCNet/MINTNet

EtherNEC cartridge port interface
	ENEC.STX	STing
	ENEC.MIF	MagicNet/MINTNet
	ENEC3.STX	STing (>=68020 only, e.g. Falcon, TT)
	ENEC3.MIF	MagicNet/MINTNet (>=68020 only, e.g. Falcon, TT)

Milan ISA slot
	ENEM.STX	STing
	ENEM.MIF	MagicNet/MINTNet

The MagiCNet versions also serve under MINTNet but require renaming
the extension to XIF.

Thus you can choose the stack that better fits your application
software requirements.


Driver software installation:

Setup STing or MagiCNet as advised in the documentation. Copy the STX
driver to the Sting directory or MIF driver to the
gemsys\magic\extension directory then reboot.

Please note that the drivers ENEA?.STX and ENEA?.MIF can only handle
an EtherNEA interface hardware set to ACSI port 3 fixed. The ACSI port
address is hardwired for optimum driver speed. If you really require a
driver to support another ACSI port address please contact me.

Please note that the drivers ENEM.STX and ENEM.MIF for the Milan can
*only* handle an NE2000 card set to ISA IO-address $300. If you really
require a driver to support another ISA IO-address please contact me.


The driver software source code is available in directory SRC. Please
see the file SRC\ARCHITEC.TXT for details on the innards of the
drivers.  Please note that I publish all this code under the GNU
public license.  See file COPYING.TXT. Any additions or changes by you
must also published under this license and brought to my attention.


Set-up under STiNG

Just copy the appropriate ENE*.STX to the STING directory where
SERIAL.STX and other STiNG drivers are located. Then reboot.

You must use STNGPORT.CPX to setup and activate the ETHERNEA.STX
driver. Even though there is no hardware base address to be configured
as with other ethernet hardware, you still need to set the interfaces
IP address and netmask. Note that you can read the NE card's MAC
address as it is extracted by ENE*.STX from the card hardware and
displayed by STNGPORT.CPX but you can not change it.

Further you need to add a line to STiNG's ROUTE.TAB for example:
192.168.1.0		255.255.255.0		EtherNet	0.0.0.0

Please note you need to spell "EtherNet" exactly like this.

Performance of the driver depends on STiNG's port polling
frequency. By default this is set to 50 milliseconds by the entry

THREADING   = 50

in the file DEFAULT.CFG. On my 8 MHz ST I experimented and changed
this to read 10 to get optimum FTP performance. On a faster machine
this may be unnecessary.

To avoid receiver buffer overflows in the NE card I propose to 
change
RCV_WND = 10000
to
RCV_WND = 5500
in DEFAULT.CFG. I did not do any other changes to DEFAULT.CFG shipped
with STiNG 1.26.

Apart from STNGPORT.CPX I use no other STing CPX.


Set-up under MagiCNet

Follow Vassilis Papathanassiou's instructions to set up MagiCNet and
copy the ENE*.MIF to GEMSYS\MAGIC\XTENSION where also SOCKET.DEV
lives. Then reboot. You shall see the message of the EtherNE driver
also indicating the device created (usually en0) plus the MAC address
of the NE2000 card (six bytes separated by colons).
Check with ifconfig.ttp that the interface en0 is there and is up.

Hints how to change the TCP receive window under MagiCNet (like I did 
for STing) are welcome.

BTW: My current MagiCNet setup and tests with ping, CAB and AFTP and
Vassilis' FTP-Server work fine with a standard harddisk partition with
8.3 filenames only.


Set-up under MINTNet

Setup MINTNet as described in the MINTNet documentation.  Copy the
ENE*.MIF driver to the appropriate directory and rename the extension
to XIF. Then reboot. You shall see the message of the EtherNE driver
also indicating the device created (usually en0) plus the MAC address
of the NE2000 card (six bytes separated by colons).
Check with ifconfig.ttp that the interface en0 is there and is up.
Make sure you use a new sockdev.xdd. Version 1.5 PL 1 has been reported
to work by Jan Krupka. Jan reported a serious problem when using an
old sockdev.xdd.

Features and Limitations

- No interrupt operation

- No use of ACSI-DMA by EtherNEA

- Only 8KByte buffer RAM. Thus only 4 full size Ethernet packets can
  be buffered on receive. Exception: NE1000 cards with 16KByte RAM are
  supported.

- Only one ethernet packet made ready to send at a time thus no back
  to back transmits.


Driver performance

The driver software has been carefully optimized for speed. In
particular packet data is directly transferred from the NE2000 card
packet buffer RAM to the STiNG or MagicNet datagram buffers. Further
"double buffering" in RAM is avoided.

EtherNEA performs about 50Kbyte/sec ftp up or download from/to RAM
disk to/from a Linux server using AFTP 1.41 on an Atari ST with
8MHz. As I have my SCSI harddisk connected to a SCSI interface also
hooked to the ACSI bus, speed is about half of this when doing ftp
to/from harddisk.  This is roughly true both for MagiCNet and
STing. The ping performance of MagicNet however is drastically better
than STing both in terms of throughput (reaction to 100HZ pings) and
smaller round-trip time.

Measurements by Lyndon Amsdon using EtherNEC on a Falcon with 25MHz
bus indicate 150Kbyte/s download and 100KByte/s on upload using AFTP
1.44. Lyndon and me observed issues with later versions of AFTP. We
both had also issues with the latest version of GAPFTP. Preliminary
measurements by Lyndon seem to indicate a slighty lower performance
under MINTNet although software optimisations haven't been done.

I obtained stable up- and down-load from PC to ST by running Vassilis'
FTP server on the ST and WS-FTP (client) on the PC both under STing and
MagiCNet.


OS compatibility

I tested this ethernet solution with both plain TOS 1.04 (STing) and 
Magic 5.3 (STing and MagiCNet).
On the other side of the Network I tested both with Windows 95 
(WS-FTP95 LE and MSIE in ftp mode) and Linux (SuSe 5.3).
Using CAB and aFTP, I tested HTTP and FTP access to the internet via 
an Elsa Lancom 1000 ISDN router hooked to the EtherNet.
Lyndon Amsdon and Jan Krupka did tests under MINT (MINTNet).


Hardware compatibility

I have tested both EtherNEA and EtherNEC with an original Atari 260ST
(albeit with 4MB RAM). A ACSI-SCSI interface with my SCSI harddisk was
also hooked to the ASCI port.  For EtherNEA please note that in case
of other hardware devices using the ACSI port -like harddisks- their
driver software MUST do proper locking to ensure mutually exclusive
use of the ACSI bus using the system variable "flock". Otherwise loss
or corruption of data may occur! If in doubt do a harddisk backup
*first*.

Lyndon tested EtherNEC both with an STE and a Falcon.

Jan Krupka tested EtherNEC both with a TT and a Falcon.


Things for the future

Fill the list of cards that work/do not work.

Add code to set the interface MAC address to support cards that do 
not have a PROM with MAC address.

Add code to read the driver statistics specific for NE chip sets.

Add code to set or change the ISA IO address for EtherNEM Milan
drivers.

Helping to improve net perfomance; could the difference of 400KB/s
gross and 100KB/s net be reduced?

Similar hardware adapters for the Mega ST bus and the VME bus that are
present in some ST compatible machines seem possible. If somebody came
up with hardware solutions I would consider adding drivers for those.

I am contemplating to add DMA mode to EtherNEA (this gross rate of 1.5
MByte/s is tempting).

I have been asked by several people: an adapter for the SCSI bus would
be very complex both in terms of hardware and software. I would be
surprised if somebody came up with a solution.

At all german PC retailers I know of ISA NE2000 cards are still
available although the ISA bus is not any more present in new PCs. As
NE2000 cards will longer be available for the PCI bus I would
appreciate information about PCI to see if it was reasonable to build
an adapter.


Disclaimer

This package is provided to you as is. I do not guarantee any features
nor do I take any responsibility for any damage or loss you may suffer
when using this hardware and/or software.  I advise you should backup
your harddisk before using EtherNEA if your harddisk is connected to
the ACSI port.


Credits

I wish to thank the following people:

National Semiconductor for providing all data sheets and application
notes on the Internet for the original NE chips.

The Linux guys for their open driver source code. This code helped me
a lot to write good drivers.

Lyndon Amsdon for his work on EtherNEC hardware and his testing
efforts.

Elmar Hilgart for his work on EtherNEA hardware.

Mariusz Buras for his ideas on 68030 optimization and support to write
drivers for the Milan.

Jan Krupka for testing with MINTNet, TT and Falcon.

Peter Rottengatter and Ronald Andersson for the STinG IP stack.

Vassilis Papathanassiou for the MagiCNet IP stack.

Kay Roemer for the MINTNet IP stack.


Contact Information

Suggestions, bug reports, flames to

Dr. Thomas Redelberger
EMail:     redetho@gmx.de
Web:       http://home.arcor.de/thomas.redelberger

Copyright 2001, 2002 Dr. Thomas Redelberger
EtherNEC hardware copyright 2002 is also with Lyndon Amsdon.

