From: bj0rn@blox.se (Bjorn Ekwall)
To: waltje@nic.NL.Mugnet.ORG
Subject: Re: NET-2 and the D-Link Ethernet driver
X-Mailer: Mail User's Shell (7.2.4 2/2/92)
Message-ID: <m0nvKUE-0001OLC@blox.se>
Date: Tue, 18 May 1993 07:45:13 +0000


Hello Fred!

> My collegue put a copy of your article regarding the Dlink 0.20
> driver on my desk.  I wasn't aware such a driver already existed...
> 
> Anyway.  I'd like to get a copy of your driver to add it to the
> current "new" kernel code (called NET-2).  Many people are waiting
> for it, and now is the time to add it... right?

That's true, I'm waiting too :-)

Enclosed is the most current release that has been shipped so far (== v 0.20+).
Note that there are some things that still needs some attention:

	- There is a not yet fully tested part of the code for handling
	  alternations of transmitter pages. Enable with "-DD_LINK_FIFO".

	- I am only 99% sure that I have not missed any valid
	  interrupt-code from the adapter.

	- There is always(?) a spurious IRQ 7 interrupt at boot. This might
	  come from the port being initialized by lp_init(), but I haven't
	  been able to stomp it out. Kludge found in d_link_interrupt().

Anyway, there seems to be some people out there using the driver,
and I haven't received any bugreports yet on this version
(hope that Murphy doesn't read email :-))


Good luck with the code,

Bjorn Ekwall == bj0rn@blox.se


= = = = = = Release shar-file follows = = = = = = = = = = = = = = = = = = =
Now, here it is!

A driver for the D-Link Ethernet pocket adapter in the parallel port,
to use with Linux on a laptop PC.

It has been tested with mount, rsh, ftp, telnet and remote X-clients.
TCP/IP throughput can be expected to be around 70-80 kbytes/second.

It now "runs" on:
	- linux 0.99pl5, (with supplied patch for linux/net/tcp/dev.c)
	- linux 0.99pl6, and later
(using a 386-25 Taiwan-made with 5Mb DRAM + 120Mb disk (60Mb == linux)).

Since this still is an alpha-release, some bugs might still be lurking...

All comments/requests/fixes to Bjorn Ekwall == bj0rn@blox.se

*** If you read nothing else, at least check around line 20 in the source! ***

(You may want to unshar this in /linux/net/tcp)

This is version 0.20
---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----
= = = = = = Release shar-file ends = = = = = = = = = = = = = = = = = = =



          CONTENTS:

            1. Introduction.
            2. License.
            3. Files in this release.
            4. Installation.
            5. Known problems and some solutions.
            6. Acknowledgments.


          1. INTRODUCTION.

          This is an Ethernet driver for the D-Link Ethernet pocket
          adapter for the parallel port, used with Linux on a laptop.

          This is an ALPHA release, i.e. it might not work flawlessly! (:-)
          It now runs on SLS (beg. of February) linux 0.99pl5, patched
          in linux/net/tcp/dev.c, and 0.99pl6 (and later), in a 386-25
          Taiwan-made with 5Mb DRAM + 120Mb disk (60Mb == linux).

          I have used this driver for ftp, telnet and X-clients on
          remote machines. Transmissions with ftp seems to work as
          good as can be expected (i.e. about 80k bytes/sec) from a
          parallel port...:-)

          All comments/fixes to Bjorn Ekwall (bj0rn@blox.se).


          2. LICENSE.

          This program is free software; you can redistribute it
          and/or modify it under the terms of the GNU General Public
          License as published by the Free Software Foundation; either
          version 2, or (at your option) any later version.

          This program is distributed in the hope that it will be
          useful, but WITHOUT ANY WARRANTY; without even the implied
          warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
          PURPOSE. See the GNU General Public License for more
          details.

          You should have received a copy of the GNU General Public
          License along with this program; if not, write to the Free
          Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
          02139, USA.


          3. FILES IN THIS RELEASE.

          README.d_link  This file.
          d_link.c       The Source (,may it be with You :-).
          Makefile.new   Replaced "we.o" with "d_link.o"
          Space.c.new    An entry for "d_link" instead of "wdxxx"


          4. INSTALLATION.

           o Replace (or edit) /linux/net/tcp/Makefile with
             Makefile.new (save the original!). Actually, you only
             have to make sure that "d_link.o" is included in the list
             at "OBJS =".

           o Replace /linux/net/tcp/Space.c with Space.c.new (save the
             original!). If your kernel source is later than 0.99p5,
             check your original for any greater differences
             (shouldn't really be any).

           o Copy d_link.c to /linux/net/tcp if you unshared somewhere
             else.

           o If you have linux 0.99p5, then add two lines close to the
             end of /linux/net/tcp/dev.c (thanks Ross Biro, for the
             information!):
              ...
                      }
                         }
                       skb->next = NULL;
                       skb->prev = NULL;
                       sti();
                       /* this will send it through the process again. */
                       dev->queue_xmit (skb, dev, -i-1);
             + if (dev->tbusy)
             + return;
                     }
                 }

              ...

           o Read the NET_FAQ and the relevant files in /etc/inet
             (hint: "hosts")

           o Make sure that TCP/IP is included in your config, and
             then do:
               # cd /linux
               # make clean
               # make depend
               # make Image (or whatever magic you usually do)

           o I use lilo to boot multiple kernels, so that I at least
             can have one working kernel :-). If you do too, append
             these lines to /etc/lilo/config:
                  ...
                  image = /usr/src/linux/Image
                       label = newlinux
                       root = /dev/hda2 (or whatever YOU have...)
                  ...

               # /etc/lilo/install

           o Do "sync" and reboot the new kernel with a D-Link pocket
             adapter connected.

          Now, watch for any fireworks (try to ignore (or live with)
          the smoke... :-) or:

               do
                    read NET-FAQ and all info in /etc/inet
                    if fix in code needed...
			 vi /linux/net/tcp/d_link.c
			 cd /linux
                         make Image
			 /etc/lilo/install
                         sync
                         reboot
                    endif
                    try it...
               until satisfied


          5. KNOWN "PROBLEMS" AND SOME SOLUTIONS.

           o Some machines have trouble handling the parallel port and
             the adapter at high speed. If you experience problems
             like "Strange interrupt...", try to uncomment the
             "#define REALLY_SLOW_IO" near line 20 in d_link.c

           o A frequent number of "eth0: transmit timed out..." might
             indicate a heavy load on your network or some strange
             internal driver bug. You can decrease the number of
             messages by changing about 25 lines into the function
             "d_link_start_xmit()", where it looks like:
                  if (tickssofar < 5)
             Change the "5" to something greater, like 10, 20 or
             whatever... Every "tick" equals 10 milliseconds.

           o There has been some "hangs" when communicating with other
             systems. As of now I'm not clear of where the trouble
             might come from. It seems that reception of large
             amounts of information can trigger this. Try to be
             patient and see if the machines can clear up the mess
             without any help (can happen!). If not, try to switch to
             another virtual console and call the other system with
             telnet and see what happens. If your machine seems
             completely locked, there might be a race of transmit and
             receive interrupts emanating from inet_bh() in dev.c .
             The reason why this driver can trigger this is not quite
             clear yet.

           o There will always(?) be a spurious IRQ 7 interrupt at
             boot. This might come from the port being initialized by
             lp_init(), but I haven't been able to stomp it out.
             Kludge can be found in d_link_interrupt().

           o The code inside d_link_interrupt() is somewhat of a
             guesswork since I'm not quite clear about how the adapter
             REALLY tells us about its internal status. Since my only
             source of information is the asm-source (:-), I'm not
             sure of how to improve on it. Some more turns around the
             edit_a_hack-compile-boot-tryout loop...

           o There is some rudimentary support for debugging, see
	     the source. Use "-DD_LINK_DEBUG=3" when compiling.


          6. ACKNOWLEDGMENTS.

          This driver wouldn't have been done without the base
          (and support) from Ross Biro (bir7@leland.stanford.edu).
          The driver also relies upon GPL-ed source from D-Link Inc.
          and from Russel Nelson at Crynwr Software (nelson@crynwr.com).
          Additional input also from Donald Becker (becker@super.org).
          Alpha release primary victim^H^H^H^H^H^Htester:
          Erik Proper (erikp@cs.kun.nl).


          Happy hacking!

          Bjorn Ekwall == bj0rn@blox.se
