home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / linux / howto.ethernet.part2 < prev    next >
Encoding:
Text File  |  1995-07-25  |  61.3 KB  |  1,581 lines

  1. Subject: Linux Ethernet HOWTO (part 2/2)
  2. Newsgroups: comp.os.linux.announce,comp.os.linux.admin,comp.answers,news.answers,comp.dcoms.lan.ethernet,comp.sys.ibm.pc.hardware.networking,aus.computers.linux
  3. From: Paul Gortmaker <gpg109@rsphysse.anu.edu.au>
  4. Date: Fri, 18 Nov 1994 17:05:21 GMT
  5.  
  6. Archive-Name: linux/howto/ethernet/part2
  7. Last-modified: 20 Oct 94
  8.  
  9.  
  10. ---This is part 2/2---
  11.  
  12.   And if you just want to verify that this is the case, you can reach
  13.   Xircom at 1-800-874-7875 or +1-818-878-7600.
  14.  
  15.  
  16.   3.25.1.  PE1, PE2, PE3-10B*
  17.  
  18.  
  19.   Status -- Not Supported
  20.  
  21.   Not to get your hopes up, but if you have one of these parallel port
  22.   adaptors, you may be able to use it in the DOS emulator with the
  23.   Xircom-supplied DOS drivers. You will have to allow DOSEMU access to
  24.   your parallel port, and will probably have to play with SIG (DOSEMU's
  25.   Silly Interrupt Generator). I have no idea if this will work, but if
  26.   you have any success with it, let me know, and I will include it here.
  27.  
  28.  
  29.   3.26.  Zenith
  30.  
  31.  
  32.  
  33.   3.26.1.  Z-Note
  34.  
  35.  
  36.   Status -- Supported
  37.  
  38.   The built-in Z-Note network adaptor is based on the Intel i82593 using
  39.   two DMA channels. There is an (alpha?) driver available in the present
  40.   kernel version. As with all notebook and pocket adaptors, it is under
  41.   the `Pocket and portable adaptors' section when running make config.
  42.   See ``Programming the Intel chips'' for more technical information.
  43.   Also note that the IBM ThinkPad 300 is compatible with the Z-Note.
  44.  
  45.  
  46.   4.  Clones of popular Ethernet cards.
  47.  
  48.  
  49.   Due to the popular design of some cards, different companies will make
  50.   `clones' or replicas of the original card. However, one must be
  51.   careful, as some of these clones are not 100 % compatible, and can be
  52.   troublesome. Some common problems with `not-quite-clones' are noted in
  53.   ``the FAQ section''.
  54.  
  55.   This section used to have a listing of a whole bunch of clones that
  56.   were reported to work, but seeing as nearly all clones will work, it
  57.   makes more sense to list the ones that don't work 100 % .
  58.  
  59.  
  60.   4.1.  NE2000 Clones with Problems
  61.  
  62.  
  63.   Here is a list of some of the NE-2000 clones that are known to have
  64.   various problems. Most of them aren't fatal. In the case of the ones
  65.   listed as `bad clones' -- this usually indicates that the cards don't
  66.   have the two NE2000 identifier bytes. NEx000-clones have a Station
  67.   Address PROM (SAPROM) in the packet buffer memory space.  NE2000
  68.   clones have 0x57,0x57 in bytes 0x0e,0x0f of the SAPROM, while other
  69.   supposed NE2000 clones must be detected by their SA prefix.
  70.  
  71.   Accton NE2000 -- might not get detected at boot, see ``ne2000
  72.   problems''.
  73.  
  74.   Aritsoft LANtastic AE-2 -- OK, but has flawed error-reporting
  75.   registers.
  76.  
  77.   AT-LAN-TEC NE2000 -- clone uses Winbond chip that traps SCSI drivers
  78.  
  79.   Cabletron E10**, E20**, E10**-x, E20**-x -- bad clones, but the driver
  80.   checks for them. See ``E10**''.
  81.  
  82.   D-Link Ethernet II -- bad clones, but the driver checks for them. See
  83.   ``DE-100 / DE-200''.
  84.  
  85.   DFI DFINET-300, DFINET-400 -- bad clones, but the driver checks for
  86.   them. See ``DFI-300 / DFI-400''
  87.  
  88.  
  89.   4.2.  WD8013 Clones with Problems
  90.  
  91.  
  92.   I haven't heard of any bad clones of these cards, except for some
  93.   chamelion-type cards that can be set to look like a ne2000 card or a
  94.   wd8013 card. There is really no need to purchase one of these `double-
  95.   identity' cards anyway.
  96.  
  97.  
  98.   5.  Cables, Coax, Twisted Pair
  99.  
  100.   If you are starting a network from scratch, it's considerably less
  101.   expensive to use thin ethernet, RG58 co-ax cable with BNC connectors,
  102.   than old-fashioned thick ethernet, RG-5 cable with N connectors, or
  103.   10baseT, twisted pair telco-style cables with RJ-45 eight wire `phone'
  104.   connectors. See ``Type of cable...'' for an introductory look at
  105.   cables.
  106.  
  107.  
  108.   5.1.  Thin Ethernet (thinnet)
  109.  
  110.  
  111.   Thin ethernet is the `ether of choice'. The cable is inexpensive. If
  112.   you are making your own cables solid-core RG58A is $0.09/ft. and
  113.   stranded RG58AU is $0.15/ft. Twist-on BNC connectors are < $2 ea., and
  114.   other misc. pieces are similarly inexpensive. It is essential that you
  115.   properly terminate each end of the cable with 50 ohm terminators, so
  116.   budget $2 ea. for a pair. It's also vital that your cable have no
  117.   `stubs' -- the `T' connectors must be attached directly to the
  118.   ethercards. The only drawback is that if you have a big loop of
  119.   machines connected together, and some bonehead breaks the loop by
  120.   taking one cable off the side of his tee, the whole network goes down
  121.   because it sees an infinite impedance (open circuit) instead of the
  122.   required 50 ohm termination. Note that you can remove the tee piece
  123.   from the card itself without killing the whole subnet, as long as you
  124.   don't remove the cables from the tee itself. Of course this will
  125.   disturb the machine that you pull the actual tee off of. 8-) And if
  126.   you are doing a small network of two machines, you *still* need the
  127.   tees and the 50 ohm terminators -- you *can't* just cable them
  128.   together!
  129.  
  130.  
  131.   5.2.  Twisted Pair
  132.  
  133.  
  134.   Twisted pair networks require active hubs, which start around $200,
  135.   and the raw cable cost can actually be higher than thinnet. They are
  136.   usually sold using the claim that you can use your existing telephone
  137.   wiring, but it's a rare installation where that turns out to be the
  138.   case. The claim that you can upgrade to higher speeds is also suspect,
  139.   as most proposed schemes use higher-grade (read $$) cable and more
  140.   sophisticated termination ($$$) than you would likely install on
  141.   speculation. New gizmos are floating around which allow you to daisy-
  142.   chain machines together, and the like. For example, Falleron sells
  143.   EtherWave adaptors and transceivers. This device allows multiple
  144.   10baseT devices to be daisy-chained. They also sell a 3c509 clone that
  145.   includes the EtherWave transceiver.  The drawback is that it's more
  146.   expensive and less reliable than a cheap ($100-$150) mini-hub and
  147.   another ethercard.  IMO, you should either go for the hub approach or
  148.   switch over to 10base2 thinnet.
  149.  
  150.   On the other hand, hubs are rapidly dropping in price, all 100Mb/sec
  151.   ethernet proposals use twisted pair, and most new business
  152.   installations use twisted pair. (This is probably to avoid the problem
  153.   with idiots messing with the BNC's as described above.)
  154.  
  155.   If you are only connecting two machines, it is possible to avoid using
  156.   a hub, by swapping the Rx and Tx pairs (1-2 and 3-6).
  157.  
  158.   Also, Russ Nelson adds that `New installations should use Category 5
  159.   wiring. Anything else is a waste of your installer's time, as 100Base-
  160.   whatever is going to require Cat 5.'
  161.   5.3.  Thick Ethernet
  162.  
  163.   Thick ethernet is mostly obsolete, and is usually used only to remain
  164.   compatible with an existing implementation. You can stretch the rules
  165.   and connect short spans of thick and thin ethernet together with a
  166.   passive $3 N-to-BNC connector, and that's often the best solution to
  167.   expanding an existing thicknet. A correct (but expensive) solution is
  168.   to use a repeater in this case.
  169.  
  170.   6.  Technical Information
  171.  
  172.  
  173.   For those who want to play with the present drivers, or try to make up
  174.   their own driver for a card that is presently unsupported, this
  175.   information should be useful. If you do not fall into this category,
  176.   then perhaps you will want to skip this section.
  177.  
  178.  
  179.   6.1.  Probed Addresses
  180.  
  181.  
  182.  
  183.   While trying to determine what ethernet card is there, the following
  184.   addresses are autoprobed, assuming the type and specs of the card have
  185.   not been set in the kernel. The file names below are in
  186.   /usr/src/linux/drivers/net/
  187.  
  188.  
  189.   ______________________________________________________________________
  190.           3c501.c         0x280, 0x300
  191.           3c503.c:        0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2a0, 0x2e0
  192.           3c505.c:        0x300, 0x280, 0x310
  193.           3c507.c:        0x300, 0x320, 0x340, 0x280
  194.           3c509.c:        Special ID Port probe
  195.           apricot.c       0x300
  196.           at1700.c:       0x300, 0x280, 0x380, 0x320, 0x340, 0x260, 0x2a0, 0x240
  197.           atp.c:          0x378, 0x278, 0x3bc
  198.           depca.c         0x300, 0x200
  199.           d_link.c:       0x378
  200.           eexpress.c:     0x300, 0x270, 0x320, 0x340
  201.           hp.c:           0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240
  202.           hp-plus.c       0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340
  203.           lance.c:        0x300, 0x320, 0x340, 0x360
  204.           ne.c:           0x300, 0x280, 0x320, 0x340, 0x360
  205.           ni52.c          0x300, 0x280, 0x360, 0x320, 0x340
  206.           ni65.c          0x300, 0x320, 0x340, 0x360
  207.           smc-ultra.c:    0x200, 0x220, 0x240, 0x280, 0x300, 0x340, 0x380
  208.           wd.c:           0x300, 0x280, 0x380, 0x240
  209.   ______________________________________________________________________
  210.  
  211.  
  212.  
  213.   There are some NE2000 clone ethercards out there that are waiting
  214.   black holes for autoprobe drivers. While many NE2000 clones are safe
  215.   until they are enabled, some can't be reset to a safe mode.  These
  216.   dangerous ethercards will hang any I/O access to their `dataports'.
  217.   The typical dangerous locations are:
  218.  
  219.   ______________________________________________________________________
  220.           Ethercard jumpered base     Dangerous locations (base + 0x10 - 0x1f)
  221.                   0x300 *                         0x310-0x317
  222.                   0x320                           0x330-0x337
  223.                   0x340                           0x350-0x357
  224.                   0x360                           0x370-0x377
  225.   ______________________________________________________________________
  226.  
  227.   * The 0x300 location is the traditional place to put an ethercard, but
  228.   it's also a popular place to put other devices (often SCSI
  229.   controllers). The 0x320 location is often the next one chosen, but
  230.   that's bad for for the AHA1542 driver probe. The 0x360 location is
  231.   bad, because it conflicts with the parallel port at 0x378.
  232.  
  233.   To avoid these lurking ethercards, here are the things you can do:
  234.  
  235.  
  236.   o  Probe for the device's BIOS in memory space. This is easy and
  237.      always safe, but it only works for cards that always have BIOSes,
  238.      like primary SCSI controllers.
  239.  
  240.   o  Avoid probing any of the above locations until you think you've
  241.      located your device. The NE2000 clones have a reset range from
  242.      <base>+0x18 to <base>+0x1f that will read as 0xff, so probe there
  243.      first if possible. It's also safe to probe in the 8390 space at
  244.      <base>+0x00 - <base>+0x0f, but that area will return quasi-random
  245.      values
  246.  
  247.   o  If you must probe in the dangerous range, for instance if your
  248.      target device has only a few port locations, first check that there
  249.      isn't an NE2000 there. You can see how to do this by looking at the
  250.      probe code in /usr/src/linux/net/inet/ne.c
  251.  
  252.   o  Use the `reserve' boot time argument to protect volatile areas from
  253.      being probed. See the information on using boot time arguments with
  254.      LILO in ``The reserve command''
  255.  
  256.  
  257.   6.2.  Skeleton / prototype driver
  258.  
  259.  
  260.  
  261.   OK. So you have decided that you want to write a driver for the Foobar
  262.   Ethernet card, as you have the programming information, and it hasn't
  263.   been done yet. (...these are the two main requirements ;-) You can use
  264.   the skeleton network driver that is provided with the Linux kernel
  265.   source tree. It can be found in the file
  266.   /usr/src/linux/drivers/net/skeleton.c as of 0.99pl15, and later.
  267.  
  268.   It's also very useful to look at the Crynwr (nee Clarkson) driver for
  269.   your target ethercard, if it's available. Russ Nelson
  270.   nelson@crynwr.com has been actively updating and writing these, and he
  271.   has been very helpful with his code reviews of the current Linux
  272.   drivers.
  273.  
  274.  
  275.   6.3.  Driver interface to the kernel
  276.  
  277.  
  278.   Here are some notes that may help when trying to figure out what the
  279.   code in the driver segments is doing, or perhaps what it is supposed
  280.   to be doing.
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.   ______________________________________________________________________
  294.           int ethif_init(struct device *dev)
  295.           {
  296.               ...
  297.                   dev->send_packet = &ei_send_packet;
  298.                   dev->open = &ei_open;
  299.                   dev->stop = &ei_close;
  300.                   dev->hard_start_xmit = &ei_start_xmit;
  301.                   ...
  302.           }
  303.  
  304.           int ethif_init(struct device *dev)
  305.   ______________________________________________________________________
  306.  
  307.  
  308.  
  309.   This function is put into the device structure in Space.c. It is
  310.   called only at boot time, and returns `0' iff the ethercard `dev'
  311.   exists.
  312.  
  313.  
  314.   ______________________________________________________________________
  315.           static int ei_open(struct device *dev)
  316.           static int ei_close(struct device *dev)
  317.   ______________________________________________________________________
  318.  
  319.  
  320.  
  321.   This routine opens and initializes the board in response to an socket
  322.   ioctl() usually called by `ifconfig'. It is commonly stuffed into the
  323.   `struct device' by ethif_init().
  324.  
  325.   The inverse routine is ei_close(), which should shut down the
  326.   ethercard, free the IRQs and DMA channels if the hardware permits, and
  327.   turn off anything that will save power (like the transceiver).
  328.  
  329.  
  330.   ______________________________________________________________________
  331.           static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
  332.                   dev->hard_start_xmit = &ei_start_xmit;
  333.   ______________________________________________________________________
  334.  
  335.  
  336.  
  337.   This routine puts packets to be transmitted into the hardware. It is
  338.   usually stuffed into the `struct device' by ethif_init().
  339.  
  340.   When the hardware can't accept additional packets it should set the
  341.   dev->tbusy flag. When additional room is available, usually during a
  342.   transmit-complete interrupt, dev->tbusy should be cleared and the
  343.   higher levels informed with mark_bh(INET_BH).
  344.  
  345.  
  346.   ______________________________________________________________________
  347.               if (dev_rint(buffer, length, is_skb ? IN_SKBUFF : 0, dev))
  348.                      stats->rx_dropped++;
  349.   ______________________________________________________________________
  350.  
  351.  
  352.  
  353.   A received packet is passed to the higher levels using dev_rint().  If
  354.   the unadorned packet data in a memory buffer, dev_rint will copy it
  355.   into a `skbuff' for you. Otherwise a new skbuff should be kmalloc()ed,
  356.   filled, and passed to dev_rint() with the IN_SKBUFF flag.
  357.  
  358.  
  359.   ______________________________________________________________________
  360.           int s=socket(AF_INET,SOCK_PACKET,htons(ETH_P_ALL));
  361.   ______________________________________________________________________
  362.  
  363.  
  364.  
  365.   Gives you a socket receving every protocol type. Do recvfrom() calls
  366.   to it and it will fill the sockaddr with device type in sa_family and
  367.   the device name in the sa_data array. I don't know who originally
  368.   invented SOCK_PACKET for Linux (its been in for ages) but its superb
  369.   stuff.  You can use it to send stuff raw too (both only as root).
  370.  
  371.  
  372.  
  373.   6.4.  Interrupts and Linux
  374.  
  375.  
  376.   There are two kinds of interrupt handlers in Linux: fast ones and slow
  377.   ones. You decide what kind you are installing by the flags you pass to
  378.   irqaction(). The fast ones, such as the serial interrupt handler, run
  379.   with _all_ interrupts disabled. The normal interrupt handlers, such as
  380.   the one for ethercard drivers, runs with other interrupts enabled.
  381.  
  382.   There is a two-level interrupt structure. The `fast' part handles the
  383.   device register, removes the packets, and perhaps sets a flag.  After
  384.   it is done, and interrupts are re-enabled, the slow part is run if the
  385.   flag is set.
  386.  
  387.   The flag between the two parts is set by:
  388.  
  389.  
  390.        mark_bh(INET_BH);
  391.  
  392.  
  393.   Usually this flag is set within dev_rint() during a received-packet
  394.   interrupt, and set directly by the device driver during a transmit-
  395.   complete interrupt.
  396.  
  397.   You might wonder why all interrupt handlers cannot run in `normal
  398.   mode' with other interrupts enabled. Ross Biro uses this scenario to
  399.   illustrate the problem:
  400.  
  401.  
  402.   o  You get a serial interrupt, and start processing it.  The serial
  403.      interrupt is now masked.
  404.  
  405.   o  You get a network interrupt, and you start transferring a maximum-
  406.      sized 1500 byte packet from the card.
  407.  
  408.   o  Another character comes in, but this time the interrupts are
  409.      masked!
  410.  
  411.   The `fast' interrupt structure solves this problem by allowing
  412.   bounded-time interrupt handlers to run without the risk of leaving
  413.   their interrupt lines masked by another interrupt request.
  414.  
  415.   There is an additional distinction between fast and slow interrupt
  416.   handlers -- the arguments passed to the handler. A `slow' handler is
  417.   defined as
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.   ______________________________________________________________________
  426.  
  427.                   static void
  428.                   handle_interrupt(int reg_ptr)
  429.                   {
  430.                       int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
  431.                       struct device *dev = irq2dev_map[irq];
  432.                   ...
  433.   ______________________________________________________________________
  434.  
  435.  
  436.  
  437.   While a fast handler gets the interrupt number directly
  438.  
  439.  
  440.   ______________________________________________________________________
  441.  
  442.                   static void
  443.                   handle_fast_interrupt(int irq)
  444.                   {
  445.                   ...
  446.   ______________________________________________________________________
  447.  
  448.  
  449.  
  450.   A final aspect of network performance is latency. The only board that
  451.   really addresses this is the 3c509, which allows a predictive
  452.   interrupt to be posted. It provides an interrupt response timer so
  453.   that the driver can fine-tune how early an interrupt is generated.
  454.  
  455.   Alan Cox has some advice for anyone wanting to write drivers that are
  456.   to be used with pl14 kernels and newer. He says:
  457.  
  458.   `Any driver intended for pl14 should use the new alloc_skb() and
  459.   kfree_skbmem() functions rather than using kmalloc() to obtain a
  460.   sk_buff. The new pl14 skeleton does this correctly. For drivers
  461.   wishing to remain compatible with both sets the define
  462.   `HAVE_ALLOC_SKB' indicates these functions must be used.
  463.  
  464.   In essence replace
  465.  
  466.  
  467.        skb=(struct sk_buff *)kmalloc(size)
  468.  
  469.  
  470.   with
  471.  
  472.  
  473.        skb=alloc_skb(size)
  474.  
  475.  
  476.   and
  477.  
  478.  
  479.        kfree_s(skb,size)
  480.  
  481.  
  482.   with
  483.  
  484.  
  485.        kfree_skbmem(skb,size)  /* Only sk_buff memory though */
  486.  
  487.  
  488.   Any questions should I guess be directed to me (Alan Cox) since I made
  489.   the change.  This is a change to allow tracking of sk_buff's and
  490.   sanity checks on buffers and stack behaviour. If a driver produces the
  491.   message'File: ??? Line: ??? passed a non skb!' then it is probable the
  492.   driver is not using the new sk_buff allocators.'
  493.  
  494.  
  495.  
  496.   6.5.  Programmed I/O vs. Shared Memory vs. DMA
  497.  
  498.  
  499.   Ethernet is 10Mbs. (Don't be pedantic, 3Mbs and 100Mbs don't count.)
  500.   If you can already send and receive back-to-back packets, you just
  501.   can't put more bits over the wire. Every modern ethercard can receive
  502.   back-to-back packets. The Linux DP8390 drivers come pretty close to
  503.   sending back-to-back packets (depending on the current interrupt
  504.   latency) and the 3c509 and AT1500 hardware has no problem at all
  505.   automatically sending back-to-back packets.
  506.  
  507.   The ISA bus can do 5.3MB/sec (42Mb/sec), which sounds like more than
  508.   enough. You can use that bandwidth in several ways:
  509.  
  510.  
  511.   6.5.1.  Programmed I/O
  512.  
  513.  
  514.   Pro: Doesn't use any constrained system resources, just a few I/O
  515.   registers, and has no 16M limit.
  516.  
  517.   Con: Usually the slowest transfer rate, the CPU is waiting the whole
  518.   time, and interleaved packet access is usually difficult to
  519.   impossible.
  520.  
  521.  
  522.   6.5.2.  Shared memory
  523.  
  524.  
  525.   Pro: Simple, faster than programmed I/O, and allows random access to
  526.   packets.
  527.  
  528.   Con: Uses up memory space (a big one for DOS users, only a minor issue
  529.   under Linux), and it still ties up the CPU.
  530.  
  531.  
  532.   6.5.3.  Slave (normal) Direct Memory Access
  533.  
  534.  
  535.   Pro: Frees up the CPU during the actual data transfer.
  536.  
  537.   Con: Checking boundary conditions, allocating contiguous buffers, and
  538.   programming the DMA registers makes it the slowest of all techniques.
  539.   It also uses up a scarce DMA channel, and requires aligned low memory
  540.   buffers.
  541.  
  542.  
  543.   6.5.4.  Master Direct Memory Access (bus-master)
  544.  
  545.  
  546.   Pro: Frees up the CPU during the data transfer, can string together
  547.   buffers, can require little or no CPU time lost on the ISA bus.
  548.  
  549.   Con: Requires low-memory buffers and a DMA channel. Any bus-master
  550.   will have problems with other bus-masters that are bus-hogs, such as
  551.   some primitive SCSI adaptors. A few badly-designed motherboard
  552.   chipsets have problems with bus-masters. And a reason for not using
  553.   any type of DMA device is using a Cyrix 486 processor designed for
  554.   plug-in replacement of a 386: these processors must flush their cache
  555.   with each DMA cycle. (This includes the Cx486DLC, Ti486DLC, Cx486SLC,
  556.   Ti486SLC, etc.)
  557.   6.6.  Programming the Intel chips (i82586 and i82593)
  558.  
  559.  
  560.   These chips are used on a number of cards, namely the 3c507 ('86), the
  561.   Intel EtherExpress 16 ('86), Microdyne's exos205t ('86), the Z-Note
  562.   ('93), and the Racal-Interlan ni5210 ('86).
  563.  
  564.   Russ Nelson writes: `Most boards based on the 82586 can reuse quite a
  565.   bit of their code.  More, in fact, than the 8390-based adapters. There
  566.   are only three differences between them:
  567.  
  568.  
  569.   o  The code to get the Ethernet address,
  570.  
  571.   o  The code to trigger CA on the 82586, and
  572.  
  573.   o  The code to reset the 82586.
  574.  
  575.   The Intel EtherExpress 16 is an exception, as it I/O maps the 82586.
  576.   Yes, I/O maps it. Fairly clunky, but it works.
  577.  
  578.   Garrett Wollman did an AT&T driver for BSD that uses the BSD
  579.   copyright. The latest version I have (Sep '92) only uses a single
  580.   transmit buffer. You can and should do better than this if you've got
  581.   the memory. The AT&T and 3c507 adapters do; the ni5210 doesn't.
  582.  
  583.   The people at Intel gave me a very big clue on how you queue up
  584.   multiple transmit packets. You set up a list of NOP- > XMIT- > NOP- >
  585.   XMIT- > NOP- > XMIT- > beginning) blocks, then you set the `next'
  586.   pointer of all the NOP blocks to themselves. Now you start the command
  587.   unit on this chain. It continually processes the first NOP block. To
  588.   transmit a packet, you stuff it into the next transmit block, then
  589.   point the NOP to it. To transmit the next packet, you stuff the next
  590.   transmit block and point the previous NOP to *it*. In this way, you
  591.   don't have to wait for the previous transmit to finish, you can queue
  592.   up multiple packets without any ambiguity as to whether it got
  593.   accepted, and you can avoid the command unit start-up delay.'
  594.  
  595.  
  596.   6.7.  Technical information from 3Com
  597.  
  598.  
  599.   From: Cameron Spitzer 764-6339 <camerons@nad.3com.com >Subject:
  600.   getting 3Com Adapter manuals Date: Mon, 27 Sep 1993 21:17:07 +0200
  601.  
  602.   Since this is becoming a FAQ, I'm going to tread the thin ice of No
  603.   Commercial Use and answer it here.
  604.  
  605.   3Com's Ethernet Adapters are documented for driver writers in our
  606.   `Technical References' (TRs). These manuals describe the programmer
  607.   interfaces to the boards but they don't talk about the diagnostics,
  608.   installation programs, etc that end users can see.
  609.  
  610.   The Network Adapter Division marketing department has the TRs to give
  611.   away. To keep this program efficient, we centralized it in a thing
  612.   called `CardFacts.' CardFacts is an automated phone system. You call
  613.   it with a touch-tone phone and it faxes you stuff. To get a TR, call
  614.   CardFacts at 408-727-7021. Ask it for Developer's Order Form, document
  615.   number 9070. Have your fax number ready when you call. Fill out the
  616.   order form and fax it to 408-764-5004.  Manuals are shipped by Federal
  617.   Express 2nd Day Service.
  618.  
  619.   If you don't have a fax and nobody you know has a fax, really and
  620.   truly, *then* send mail to Terry_Murphy@3Mail.3Com.com and tell her
  621.   about your problem.  PLEASE use the fax thing if you possibly can.
  622.  
  623.   After you get a manual, if you still can't figure out how to program
  624.   the board, try our `CardBoard' BBS at 1-800-876-3266, and if you can't
  625.   do that, write Andy_Chan@3Mail.3com.com and ask him for alternatives.
  626.   If you have a real stumper that nobody has figured out yet, the fellow
  627.   who needs to know about it is Steve_Lebus@3Mail.3com.com.
  628.  
  629.   There are people here who think we are too free with the manuals, and
  630.   they are looking for evidence that the system is too expensive, or
  631.   takes too much time and effort. That's why it's important to try to
  632.   use CardFacts *before* you start calling and mailing the people I
  633.   named here.
  634.  
  635.   There are even people who think we should be like Diamond and Xircom,
  636.   requiring tight `partnership' with driver writers to prevent poorly
  637.   performing drivers from getting written. So far, 3Com customers have
  638.   been really good about this, and there's no problem with the level of
  639.   requests we've been getting. We need your continued cooperation and
  640.   restraint to keep it that way.
  641.  
  642.   Cameron Spitzer, 408-764-6339 3Com NAD Santa Clara work:
  643.   camerons@nad.3com.com home: cls@truffula.sj.ca.us
  644.  
  645.  
  646.  
  647.   6.8.  Notes on AMD PCnet / LANCE Based cards
  648.  
  649.  
  650.   The AMD LANCE (Local Area Network Controller for Ethernet) was the
  651.   original offering, and has since been replaced by the `PCnet-ISA'
  652.   chip, otherwise known as the 79C960.  A relatively new chip from AMD,
  653.   the 79C960, is the heart of many new cards being released at present.
  654.   Note that the name `LANCE' has stuck, and some people will refer to
  655.   the new chip by the old name. Dave Roberts of the Network Products
  656.   Division of AMD was kind enough to contribute the following
  657.   information regarding this chip:
  658.  
  659.   `As for the architecture itself, AMD developed it originally and
  660.   reduced it to a single chip -- the PCnet(tm)-ISA -- over a year ago.
  661.   It's been selling like hotcakes ever since.
  662.  
  663.   Functionally, it is equivalent to a NE1500. The register set is
  664.   identical to the old LANCE with the 1500/2100 architecture additions.
  665.   Older 1500/2100 drivers will work on the PCnet-ISA.  The NE1500 and
  666.   NE2100 architecture is basically the same.  Initially Novell called it
  667.   the 2100, but then tried to distinguish between coax and 10BASE-T
  668.   cards. Anything that was 10BASE-T only was to be numbered in the 1500
  669.   range. That's the only difference.
  670.  
  671.   Many companies offer PCnet-ISA based products, including HP, Racal-
  672.   Datacom, Allied Telesis, Boca Research, Kingston Technology, etc.  The
  673.   cards are basically the same except that some manufacturers have added
  674.   `jumperless' features that allow the card to be configured in
  675.   software. Most have not. AMD offers a standard design package for a
  676.   card that uses the PCnet-ISA and many manufacturers use our design
  677.   without change.  What this means is that anybody who wants to write
  678.   drivers for most PCnet-ISA based cards can just get the data-sheet
  679.   from AMD. Call our literature distribution center at (800)222-9323 and
  680.   ask for the Am79C960, PCnet-ISA data sheet. It's free.
  681.  
  682.   A quick way to understand whether the card is a `stock' card is to
  683.   just look at it. If it's stock, it should just have one large chip on
  684.   it, a crystal, a small IEEE address PROM, possibly a socket for a boot
  685.   ROM, and a connector (1, 2, or 3, depending on the media options
  686.   offered). Note that if it's a coax card, it will have some transceiver
  687.   stuff built onto it as well, but that should be near the connector and
  688.   away from the PCnet-ISA.'
  689.   There is also some info regarding the LANCE chip in the file lance.c
  690.   which is included in the standard kernel.
  691.  
  692.  
  693.   6.9.  Multicast and Promiscuous Mode
  694.  
  695.  
  696.   One of the things Donald has been working on recently is the major
  697.   remaining item on the ethercard feature list: implementing multicast
  698.   and promiscuous mode hooks.  All of the released (i.e. not ALPHA) ISA
  699.   drivers now support promiscuous mode. There was a minor problem with
  700.   8390 based cards with capturing multicast packets, in that the
  701.   promiscuous mode setting in 8390.c around line 574 should be 0x18 and
  702.   not 0x10. If you have an up to date kernel, this will already be
  703.   fixed.
  704.  
  705.   Donald writes: `At first I was planning to do it while implementing
  706.   either the /dev/* or DDI interface, but that's not really the correct
  707.   way to do it. We should only enable multicast or promiscuous modes
  708.   when something wants to look at the packets, and shut it down when
  709.   that application is finished, neither of which is strongly related to
  710.   when the hardware is opened or released.
  711.  
  712.   I'll start by discussing promiscuous mode, which is conceptually easy
  713.   to implement. For most hardware you only have to set a register bit,
  714.   and from then on you get every packet on the wire. Well, it's almost
  715.   that easy; for some hardware you have to shut the board (potentially
  716.   dropping a few packet), reconfigure it, and then re-enable the
  717.   ethercard. This is grungy and risky, but the alternative seems to be
  718.   to have every application register before you open the ethercard at
  719.   boot-time.
  720.  
  721.   OK, so that's easy, so I'll move on something that's not quite so
  722.   obvious: Multicast. It can be done two ways:
  723.  
  724.  
  725.   1. Use promiscuous mode, and a packet filter like the Berkeley packet
  726.      filter (BPF). The BPF is a pattern matching stack language, where
  727.      you write a program that picks out the addresses you are interested
  728.      in. Its advantage is that it's very general and programmable. Its
  729.      disadvantage is that there is no general way for the kernel to
  730.      avoid turning on promiscuous mode and running every packet on the
  731.      wire through every registered packet filter. See ``The Berkeley
  732.      Packet Filter'' for more info.
  733.  
  734.  
  735.   2. Using the built-in multicast filter that most etherchips have.
  736.  
  737.   I guess I should list what a few ethercards/chips provide:
  738.  
  739.  
  740.  
  741.           Chip/card  Promiscuous  Multicast filter
  742.           ----------------------------------------
  743.           Seeq8001/3c501  Yes     Binary filter (1)
  744.           3Com/3c509      Yes     Binary filter (1)
  745.           8390            Yes     Autodin II six bit hash (2) (3)
  746.           LANCE           Yes     Autodin II six bit hash (2) (3)
  747.           i82586          Yes     Hidden Autodin II six bit hash (2) (4)
  748.  
  749.  
  750.  
  751.  
  752.  
  753.   1. These cards claim to have a filter, but it's a simple yes/no
  754.      `accept all multicast packets', or `accept no multicast packets'.
  755.   2. AUTODIN II is the standard ethernet CRC (checksum) polynomial. In
  756.      this scheme multicast addresses are hashed and looked up in a hash
  757.      table. If the corresponding bit is enabled, this packet is
  758.      accepted. Ethernet packets are laid out so that the hardware to do
  759.      this is trivial -- you just latch six (usually) bits from the CRC
  760.      circuit (needed anyway for error checking) after the first six
  761.      octets (the destination address), and use them as an index into the
  762.      hash table (six bits -- a 64-bit table).
  763.  
  764.  
  765.   3. These chips use the six bit hash, and must have the table computed
  766.      and loaded by the host. This means the kernel must include the CRC
  767.      code.
  768.  
  769.  
  770.   4. The 82586 uses the six bit hash internally, but it computes the
  771.      hash table itself from a list of multicast addresses to accept.
  772.  
  773.   Note that none of these chips do perfect filtering, and we still need
  774.   a middle-level module to do the final filtering. Also note that in
  775.   every case we must keep a complete list of accepted multicast
  776.   addresses to recompute the hash table when it changes.
  777.  
  778.   My first pass at device-level support is detailed in the new outline
  779.   driver skeleton.c
  780.  
  781.   It looks like the following:
  782.  
  783.  
  784.   ______________________________________________________________________
  785.           #ifdef HAVE_MULTICAST
  786.           static void set_multicast_list(struct device *dev, int num_addrs,
  787.                            void *addrs);
  788.           #endif
  789.           .
  790.           .
  791.  
  792.           ethercard_open() {
  793.           ...
  794.           #ifdef HAVE_MULTICAST
  795.                   dev->set_multicast_list = &set_multicast_list;
  796.           #endif
  797.           ...
  798.  
  799.           #ifdef HAVE_MULTICAST
  800.           /* Set or clear the multicast filter for this adaptor.
  801.              num_addrs -- -1      Promiscuous mode, receive all packets
  802.              num_addrs -- 0       Normal mode, clear multicast list
  803.              num_addrs > 0        Multicast mode, receive normal and
  804.                   MC packets, and do best-effort filtering.
  805.            */
  806.           static void
  807.           set_multicast_list(struct device *dev, int num_addrs, void *addrs)
  808.           {
  809.           ...
  810.   ______________________________________________________________________
  811.  
  812.  
  813.  
  814.   Any comments, criticism, etc. are welcome.'
  815.  
  816.  
  817.   6.10.  The Berkeley Packet Filter (BPF)
  818.  
  819.  
  820.  
  821.   I'm not bitterly opposed to it, but I'm coming to the conclusion that
  822.   the BPF functionality should not be provided by the kernel, but should
  823.   be in a (hopefully little-used) compatibility library.
  824.  
  825.   For those not in the know: BPF (the Berkeley Packet Filter) is an
  826.   mechanism for specifying to the kernel networking layers what packets
  827.   you are interested in. It's implemented as a specialized stack
  828.   language interpreter built into a low level of the networking code. An
  829.   application passes a program written in this language to the kernel,
  830.   and the kernel runs the program on each incoming packet. If the kernel
  831.   has multiple BPF applications, each program is run on each packet.
  832.  
  833.   The problem is that it's difficult to deduce what kind of packets the
  834.   application is really interested in from the packet filter program, so
  835.   the general solution is to always run the filter. Imagine a program
  836.   that registers a BPF program to pick up a low data-rate stream sent to
  837.   a multicast address.  Most ethernet cards have a hardware multicast
  838.   address filter implemented as a 64 entry hash table that ignores most
  839.   unwanted multicast packets, so the capability exists to make this a
  840.   very inexpensive operation. But with the BFP the kernel must switch
  841.   the interface to promiscuous mode, receive _all_ packets, and run them
  842.   through this filter. This is work, BTW, that's very difficult to
  843.   account back to the process requesting the packets.
  844.  
  845.  
  846.   7.  Networking with a Laptop/Notebook Computer
  847.  
  848.  
  849.   There are currently only a few ways to put your laptop on a network.
  850.   You can use the SLIP code (and run at serial line speeds); you can buy
  851.   one of the few laptops that come with a NE2000-compatible ethercard;
  852.   you can get a notebook with a supported PCMCIA slot built-in; you can
  853.   get a laptop with a docking station and plug in an ISA ethercard; or
  854.   you can use a parallel port Ethernet adapter such as the D-Link
  855.   DE-600.
  856.  
  857.  
  858.   7.1.  Using SLIP
  859.  
  860.  
  861.   This is the cheapest solution, but by far the most difficult. Also,
  862.   you will not get very high transmission rates. Since SLIP is not
  863.   really related to ethernet cards, it will not be discussed further
  864.   here. See the NET-2 Howto.
  865.  
  866.  
  867.   7.2.  Built in NE2000
  868.  
  869.  
  870.   This solution severely limits your laptop choices and is fairly
  871.   expensive. Be sure to read the specifications carefully, as you may
  872.   find that you will have to buy an additional non-standard transceiver
  873.   to actually put the machine on a network. A good idea might be to boot
  874.   the notebook with a kernel that has ne2000 support, and make sure it
  875.   gets detected and works before you lay down your cash.
  876.  
  877.  
  878.  
  879.   7.3.  PCMCIA Support
  880.  
  881.  
  882.   As this area of Linux development is fairly young, I'd suggest that
  883.   you join the LAPTOPS mailing channel. See ``Mailing lists...''  which
  884.   describes how to join a mailing list channel.
  885.  
  886.  
  887.   Try and determine exactly what hardware you have (ie. card
  888.   manufacturer, PCMCIA chip controller manufacturer) and then ask on the
  889.   LAPTOPS channel. Regardless, don't expect things to be all that
  890.   simple.  Expect to have to fiddle around a bit, and patch kernels,
  891.   etc.  Maybe someday you will be able to type `make config' 8-)
  892.  
  893.   At present, the two PCMCIA chipsets that are supported are the TCIC/2
  894.   and the intel i82365.
  895.  
  896.   There is a number of programs on tsx-11.mit.edu in
  897.   /pub/linux/packages/laptops/ that you may find useful. These range
  898.   from PCMCIA Ethercard drivers to programs that communicate with the
  899.   PCMCIA controller chip. Note that these drivers are usually tied to a
  900.   specific PCMCIA chip (ie. the intel 82365 or the TCIC/2)
  901.  
  902.   For NE2000 compatible cards, some people have had success with just
  903.   configuring the card under DOS, and then booting linux from the DOS
  904.   command prompt via loadlin.
  905.  
  906.   For those that are net-surfing you can try:
  907.  
  908.   Don's PCMCIA Stuff (http://cesdis.gsfc.nasa.gov/linux/pcmcia.html)
  909.  
  910.   Anyway, the PCMCIA driver problem isn't specific to the Linux world.
  911.   It's been a real disaster in the MS-DOS world. In that world people
  912.   expect the hardware to work if they just follow the manual.  They
  913.   might not expect it to interoperate with any other hardware or
  914.   software, or operate optimally, but they do expect that the software
  915.   shipped with the product will function. Many PCMCIA adaptors don't
  916.   even pass this test.
  917.  
  918.   Things are looking up for Linux users that want PCMCIA support, as
  919.   substantial progress is being made. Pioneering this effort is David
  920.   Hinds.
  921.  
  922.  
  923.   7.4.  ISA Ethercard in the Docking Station.
  924.  
  925.  
  926.   Docking stations for laptops typically cost about $250 and provide two
  927.   full-size ISA slots, two serial and one parallel port. Most docking
  928.   stations are powered off of the laptop's batteries, and a few allow
  929.   adding extra batteries in the docking station if you use short ISA
  930.   cards. You can add an inexpensive ethercard and enjoy full-speed
  931.   ethernet performance.
  932.  
  933.  
  934.   7.5.  Pocket / parallel port adaptors.
  935.  
  936.  
  937.   The `pocket' ethernet adaptors may also fit your need.  Until recently
  938.   they actually costed more than a docking station and cheap ethercard,
  939.   and most tie you down with a wall-brick power supply.  At present, you
  940.   can choose from the D-Link, or the RealTek adaptor.  Most other
  941.   companies, especially Xircom, (see ``Xircom'') treat the programming
  942.   information as a trade secret, so support will likely be slow in
  943.   coming. (if ever!)
  944.  
  945.   Note that the transfer speed will not be all that great (perhaps
  946.   100kB/s tops?) due to the limitations of the parallel port interface.
  947.  
  948.   See ``DE-600 / DE-620'' and ``RealTek'' for supported pocket adaptors.
  949.  
  950.   You can sometimes avoid the wall-brick with the adaptors by buying or
  951.   making a cable that draws power from the laptop's keyboard port. (See
  952.   ``keyboard power'')
  953.   8.  Frequently Asked Questions
  954.  
  955.  
  956.   Here are some of the more frequently asked questions about using Linux
  957.   with an Ethernet connection. Some of the more specific questions are
  958.   sorted on a `per manufacturer basis'.  However, since this document is
  959.   basically `old' by the time you get it, any `new' problems will not
  960.   appear here instantly. For these, I suggest that you make efficient
  961.   use of your newsreader. For example, nn users would type
  962.  
  963.  
  964.        nn -xX -s'3c'
  965.  
  966.  
  967.   to get all the news articles in your subscribed list that have `3c' in
  968.   the subject. (ie. 3com, 3c509, 3c503, etc.)  The moral: Read the man
  969.   page for your newsreader.
  970.  
  971.  
  972.   8.1.  Alpha Drivers -- Getting and Using them
  973.  
  974.  
  975.   I heard that there is an alpha driver available for my card.  Where
  976.   can I get it?
  977.  
  978.   The newest of the `new' drivers can be found on Donald's new ftp site:
  979.   cesdis.gsfc.nasa.gov in the /pub/linux/ area. Things change here quite
  980.   frequently, so just look around for it.  There is still all the stuff
  981.   on the old ftp site ftp.super.org in /pub/linux, but this is not being
  982.   actively maintained, and hence will be of limited value to most
  983.   people.
  984.  
  985.   As of recent v1.1 kernels, the `useable' alpha drivers have been
  986.   included in the standard kernel source tree. When running make config
  987.   you will be asked if you want to be offered ALPHA test drivers.
  988.  
  989.   Now, if it really is an alpha, or pre-alpha driver, then please treat
  990.   it as such. In other words, don't complain because you can't figure
  991.   out what to do with it. If you can't figure out how to install it,
  992.   then you probably shouldn't be testing it.  Also, if it brings your
  993.   machine down, don't complain. Instead, send us a well documented bug
  994.   report, or even better, a patch!
  995.  
  996.   People reading this while net-surfing may want to check out:
  997.  
  998.   Don's Linux Home Page
  999.   (http://cesdis.gsfc.nasa.gov/pub/linux/linux.html)
  1000.  
  1001.   for the latest dirt on what is new and upcoming.
  1002.  
  1003.  
  1004.   8.2.  Using More than one Ethernet Card per Machine
  1005.  
  1006.  
  1007.   What needs to be done so that Linux can run two ethernet cards?
  1008.  
  1009.   The hooks for multiple ethercards are all there.  You can enable
  1010.   additional ethercards with LILO parameters such as:
  1011.  
  1012.  
  1013.        LILO: linux ether=5,0x300,0,1,eth0 ether=15,0x280,eth1
  1014.  
  1015.  
  1016.   These boot time arguments can be made permanent so that you don't have
  1017.   to re-enter them every time. See the LILO manual, and ``Passing
  1018.   Ethernet Arguments...''  where there are tips on using LILO to pass
  1019.   boot-time ethernet card arguments.
  1020.  
  1021.   Also note that only *one* ethercard is auto-probed for, and the second
  1022.   *must* be specified as above.  This avoids a lot of possible boot time
  1023.   hangs caused by probing sensitive cards. Probing for the second card
  1024.   can be achieved by using something as simple as ether=0,0,eth1. In
  1025.   this case eth0 and eth1 will be assigned in the order that the cards
  1026.   are found at boot. With the previous example, the user has forced the
  1027.   card at 0x300 to be eth0 and the card at 0x280 to be eth1.
  1028.  
  1029.   Note that if you are intending to use Linux as a gateway between two
  1030.   networks, you will have to re-compile a kernel with IP forwarding
  1031.   enabled. Usually using an old AT/286 with something like the `kbridge'
  1032.   software is a better solution.
  1033.  
  1034.   If you are viewing this while net-surfing, you may wish to look at a
  1035.   mini-howto Donald has on his WWW site. Check out Multiple Ethercards
  1036.   (http://cesdis.gsfc.nasa.gov/linux/misc/multicard.html).
  1037.  
  1038.  
  1039.   8.3.  Problems with NE1000 / NE2000 cards (and clones)
  1040.  
  1041.   Problem: Errors like DMA address mismatch
  1042.  
  1043.   Is the chip a real NatSemi 8390? (DP8390, DP83901, DP83902 or
  1044.   DP83905)?  If not, some clone chips don't correctly implement the
  1045.   transfer verification register. MS-DOS drivers never do error
  1046.   checking, so it doesn't matter to them.
  1047.  
  1048.   Are most of the messages off by a factor of 2?  If so:  Are you using
  1049.   the NE2000 in a 16 bit slot?  Is it jumpered to use only 8 bit
  1050.   transfers?
  1051.  
  1052.   The Linux driver expects a NE2000 to be in a 16 bit slot. A NE1000 can
  1053.   be in either size slot. This problem can also occur with some clones,
  1054.   notably D-Link 16 bit cards, that don't have the correct ID bytes in
  1055.   the station address PROM. (This should be fixed in pl12.)
  1056.  
  1057.   Are you running the bus faster than 8Mhz?  If you can change the speed
  1058.   (faster or slower), see if that makes a difference. Most NE2000 clones
  1059.   will run at 16MHz, but some may not. Changing speed can also mask a
  1060.   noisy bus.
  1061.  
  1062.   What other devices are on the bus?  If moving the devices around
  1063.   changes the reliability, then you have a bus noise problem -- just
  1064.   what that error message was designed to detect. Congratulations,
  1065.   you've probably found the source of other problems as well.
  1066.  
  1067.   Problem: The machine hangs during boot right after the `8390...'  or
  1068.   `WD....' message. Removing the NE2000 fixes the problem.
  1069.  
  1070.   Solution: Change your NE2000 base address to 0x360 (or 0x340 for pl12
  1071.   or later kernels.) Alternatively, you can use the new device registrar
  1072.   implemented in pl13
  1073.  
  1074.   Reason: Your NE2000 clone isn't a good enough clone. An active NE2000
  1075.   is a bottomless pit that will trap any driver autoprobing in its
  1076.   space. The other ethercard drivers take great pain to reset the NE2000
  1077.   so that it's safe, but some clones cannot be reset. Clone chips to
  1078.   watch out for: Winbond 83C901. Changing the NE2000 to a less-popular
  1079.   address will move it out of the way of other autoprobes, allowing your
  1080.   machine to boot.
  1081.  
  1082.  
  1083.   Problem: The machine hangs during the SCSI probe at boot.
  1084.  
  1085.   Reason: It's the same problem as above, change the ethercard's
  1086.   address, or use the device registrar.
  1087.  
  1088.   Problem: The machine hangs during the soundcard probe at boot.
  1089.  
  1090.   Reason: No, that's really during the silent SCSI probe, and it's the
  1091.   same problem as above.
  1092.  
  1093.   Problem: Errors like eth0: DMAing conflict in ne_block_input
  1094.  
  1095.   This bug came from timer-based packet retransmissions. If you got a
  1096.   timer tick _during_ a ethercard RX interrupt, and timer tick tried to
  1097.   retransmit a timed-out packet, you could get a conflict. Because of
  1098.   the design of the NE2000 you would have the machine hang (exactly the
  1099.   same the NE2000-clone boot hangs).
  1100.  
  1101.   Early versions of the driver disabled interrupts for a long time, and
  1102.   didn't have this problem. Later versions are fixed. (ie. kernels after
  1103.   0.99p9 should be OK.)
  1104.  
  1105.   Problem: NE2000 not detected at boot.
  1106.  
  1107.   Donald writes: `A few people have reported a problem with detecting
  1108.   the Accton NE2000.  This problem occurs only at boot-time, and the
  1109.   card is later detected at run-time by the identical code my (alpha-
  1110.   test) ne2k diagnostic program. Accton has been very responsive, but I
  1111.   still haven't tracked down what is going on. I've been unable to
  1112.   reproduce this problem with the Accton cards we purchased. If you are
  1113.   having this problem, please send me an immediate bug report. For that
  1114.   matter, if you have an Accton card send me a success report, including
  1115.   the type of the motherboard. I'm especially interested in finding out
  1116.   if this problem moves with the particular ethercard, or stays with the
  1117.   motherboard.'
  1118.  
  1119.   Here are some things to try, as they have fixed it for some people:
  1120.  
  1121.  
  1122.   o  Change the bus speed, or just move the card to a different slot.
  1123.  
  1124.   o  Change the `I/O recovery time' parameter in the BIOS chipset
  1125.      configuration.
  1126.  
  1127.   Problem: Network `goes away' every time I print something (NE2000)
  1128.  
  1129.   Reason: You have your NE2000 living at 0x360, and a NE2000 is 0x20
  1130.   ports wide, putting it to 0x380. Your parallel port is at 0x378 and is
  1131.   stepping on the NE2000 cards I/O space.  Jumper it to 0x300 or 0x340
  1132.   or something like that.
  1133.  
  1134.  
  1135.   8.4.  Problems with WD80*3 cards
  1136.  
  1137.  
  1138.   Problem: A WD80*3 is falsely detected. Removing the sound or MIDI card
  1139.   eliminates the `detected' message.
  1140.  
  1141.   Reason: Some MIDI ports happen to produce the same checksum as a WD
  1142.   ethercard.
  1143.  
  1144.   Solution: Update your ethercard driver: new versions include an
  1145.   additional sanity check. If it is the midi chip at 0x388 that is
  1146.   getting detected as a WD living at 0x380, then you could also use:
  1147.  
  1148.           LILO: linux reserve=0x380,8
  1149.  
  1150.  
  1151.   Problem: You get messages such as the following with your 80*3:
  1152.  
  1153.  
  1154.        eth0: bogus packet size, status = ........  kmalloc called with impos-
  1155.        sibly large argument (65400) eth0: Couldn't allocate sk_buff of size
  1156.        65400 eth0: receiver overrun
  1157.  
  1158.  
  1159.   Reason: There is a shared memory problem.
  1160.  
  1161.   Solution: If the problem is sporadic, you have hardware problems.
  1162.   Typical problems that are easy to fix are board conflicts, having
  1163.   cache or `shadow ROM' enabled for that region, or running your bus
  1164.   faster than 8Mhz. There are also a surprising number of memory
  1165.   failures on ethernet cards, so run a diagnostic program if you have
  1166.   one for your ethercard.
  1167.  
  1168.   If the problem is continual, and you have have to reboot to fix the
  1169.   problem, record the boot-time probe message and mail it to
  1170.   becker@cesdis.gsfc.nasa.gov - Take particular note of the shared
  1171.   memory location.
  1172.  
  1173.   Problem: WD80*3 will not get detected at boot.
  1174.  
  1175.   Reason: The Mitsumi CD-ROM (mcd) driver probe at 0x300 will succeed if
  1176.   just about *anything* is that I/O location.  This is bad news and
  1177.   needs to be a bit more robust. (pl15) Once another driver registers
  1178.   that it `owns' an I/O location, other drivers (incl. the wd80x3) are
  1179.   `locked out' and can not probe that addr for a card.
  1180.  
  1181.   Solution: Recompile a new kernel without any excess drivers that you
  1182.   aren't using, including the above mcd driver.  Or try moving your
  1183.   ethercard to a new I/O addr. Valid I/O addr. for all the cards are
  1184.   listed in ``Probed Addresses'' You can also point the mcd driver off
  1185.   in another direction by a boot-time parameter (via LILO) such as:
  1186.  
  1187.        mcd=0x200,12
  1188.  
  1189.  
  1190.  
  1191.   8.5.  Problems with 3Com cards
  1192.  
  1193.   Problem: The 3c503 picks IRQ n at boot, but this is needed for some
  1194.   other device which needs IRQ n. (eg. CD ROM driver, etc.)  Can this be
  1195.   fixed without compiling this into the kernel?
  1196.  
  1197.   Solution: The 3c503 driver probes for a free IRQ line in the order {5,
  1198.   9/2, 3, 4}, and it should pick a line which isn't being used. The pre-
  1199.   pl12 (SLS 1.02) driver picked the IRQ line at boot-time, and the
  1200.   current driver (pl12) chooses when the card is open()/ifconfig'ed.
  1201.  
  1202.   Alternately, you can fix the IRQ at boot by passing parameters via
  1203.   LILO. The following selects IRQ9, base location 0x300, <ignored
  1204.   value>, and if_port #1 (the external transceiver).
  1205.  
  1206.  
  1207.        LILO: linux ether=9,0x300,0,1,eth0
  1208.  
  1209.  
  1210.   The following selects IRQ3, probes for the base location, <ignored
  1211.   value>, and the default if_port #0 (the internal transceiver)
  1212.  
  1213.  
  1214.        LILO: linux ether=3,0,0,0,eth0
  1215.  
  1216.  
  1217.   Problem: 3c503: Configured interrupt number XX is out of range.
  1218.  
  1219.   Reason: Whoever built your kernel fixed the ethercard IRQ at XX.  The
  1220.   above is truly evil, and worse than that, it is not necessary. The
  1221.   3c503 will autoIRQ when it gets ifconfig'ed, and pick one of IRQ{5,
  1222.   2/9, 3, 4}.
  1223.  
  1224.   Solution: Use LILO as described above, or rebuild the kernel, enabling
  1225.   autoIRQ by not specifying the IRQ line.
  1226.  
  1227.   Problem: The supplied 3c503 drivers don't use the AUI (thicknet) port.
  1228.   How does one choose it over the default thinnet port?
  1229.  
  1230.   Solution: The 3c503 AUI port can be selected at boot-time with
  1231.   0.99pl12 and later. The selection is overloaded onto the low bit of
  1232.   the currently-unused dev->rmem_start variable, so a boot-time
  1233.   parameter of:
  1234.  
  1235.  
  1236.        LILO: linux ether=0,0,0,1,eth0
  1237.  
  1238.  
  1239.   should work. A boot line to force IRQ 5, port base 0x300, and use an
  1240.   external transceiver is:
  1241.  
  1242.  
  1243.        LILO: linux ether=5,0x300,0,1,eth0
  1244.  
  1245.  
  1246.   Also note that kernel revisions 1.00 to 1.03 had an interesting
  1247.   `feature'. They would switch to the AUI port when the internal
  1248.   transciever failed. This is a problem, as it will *never* switch back
  1249.   if for example you momentarily disconnect the cable. Kernel versions
  1250.   1.04 and newer only switch if the very first Tx attempt fails.
  1251.  
  1252.  
  1253.   8.6.  Problems with Hewlett Packard Cards
  1254.  
  1255.  
  1256.   Problem: HP Vectra using built in AMD LANCE chip gets IRQ and DMA
  1257.   wrong.
  1258.  
  1259.   Solution: The HP Vectra uses a different implementation to the
  1260.   standard HP-J2405A. The `lance.c' driver used to always use the value
  1261.   in the setup register of an HP Lance implementation.  In the Vectra
  1262.   case it's reading an invalid 0xff value. Kernel versions newer than
  1263.   about 1.1.50 now handle the Vectra in an appropriate fashion.
  1264.  
  1265.   Problem: HP Card is not detected at boot, even though kernel was
  1266.   compiled with `HP PCLAN support'.
  1267.  
  1268.   Solution: You probably have a HP PCLAN+  -- note the `plus'. Support
  1269.   for the PCLAN+ was added to final versions of 1.1, but some of them
  1270.   didn't have the entry in `config.in'. If you have the file hp-plus.c
  1271.   in  /linux/drivers/net/ but no entry in config.in, then add the
  1272.   following line under the `HP PCLAN support' line:
  1273.  
  1274.  
  1275.           bool 'HP PCLAN Plus support' CONFIG_HPLAN_PLUS n
  1276.  
  1277.  
  1278.  
  1279.   Kernels up tp 1.1.54 are missing the line in `config.in' still.  Do a
  1280.   `make mrproper;make config;make dep;make zlilo' and you should be in
  1281.   business.
  1282.  
  1283.   8.7.  FAQs Not Specific to Any Card.
  1284.  
  1285.  
  1286.  
  1287.  
  1288.   8.7.1.  Token Ring
  1289.  
  1290.   Is there token ring support for Linux?
  1291.  
  1292.   To support token ring requires more than only a writing a device
  1293.   driver, it also requires writing the source routing routines for token
  1294.   ring. It is the source routing that would be the most time comsuming
  1295.   to write.
  1296.  
  1297.   Alan Cox adds: `It will require (...) changes to the bottom socket
  1298.   layer to support 802.2 and 802.2 based TCP/IP. Don't expect anything
  1299.   soon.'
  1300.  
  1301.   Peter De Schrijver has been spending some time on Token Ring lately,
  1302.   and has patches that are available for IBM ISA and MCA token ring
  1303.   cards. Don't expect miracles here, as he has just started on this as
  1304.   of 1.1.42. You can get the patch from:
  1305.  
  1306.   aix13ps2.cc.kuleuven.ac.be:/pub/Linux/TokenRing.patch-1.1.49.gz
  1307.  
  1308.  
  1309.  
  1310.   8.7.2.  32 Bit / VLB / PCI Ethernet Cards
  1311.  
  1312.  
  1313.   What is the selection for 32 bit ethernet cards?
  1314.  
  1315.   There aren't many 32 bit ethercard device drivers because there aren't
  1316.   that many 32 bit ethercards.
  1317.  
  1318.   There aren't many 32 bit ethercards out there because a 10Mbs network
  1319.   doesn't justify spending the 5x price increment for the 32 bit
  1320.   interface.  See ``Programmed I/O vs. ...'' as to why having an
  1321.   ethercard on an 8MHz ISA bus is really not a bottleneck.
  1322.  
  1323.   This might change now that AMD has introduced the 32 bit PCnet-VLB and
  1324.   PCnet-PCI chips.  The street price of the Boca PCnet-VLB board should
  1325.   be under $70 from a place like CMO (see Computer Shopper).  See ``Boca
  1326.   PCI/VLB'' for info on these cards.
  1327.  
  1328.   See ``AMD PCnet-32'' for info on the 32 bit versions of the LANCE /
  1329.   PCnet-ISA chip.
  1330.  
  1331.   In the future, the DEC 21040 PCI chip will probably be supported as
  1332.   well, but don't hold your breath.
  1333.  
  1334.  
  1335.   8.7.3.  FDDI
  1336.  
  1337.   Is there FDDI support for Linux?
  1338.  
  1339.   Donald writes: `No, there is no Linux driver for any FDDI boards.  I
  1340.   come from a place with supercomputers, so an external observer might
  1341.   think FDDI would be high on my list. But FDDI never delivered end-to-
  1342.   end throughput that would justify its cost, and it seems to be a
  1343.   nearly abandoned technology now that 100base{X,Anynet} seems imminent.
  1344.   (And yes, I know you can now get FDDI boards for <$1K. That seems to
  1345.   be a last-ditch effort to get some return on the development
  1346.   investment. Where is the next generation of FDDI going to come from?)'
  1347.  
  1348.  
  1349.   8.7.4.  Linking 10BaseT without a Hub
  1350.  
  1351.  
  1352.   Can I link 10BaseT (RJ45) based systems together without a hub?
  1353.  
  1354.   You can link 2 machines easily, but no more than that, without extra
  1355.   devices/gizmos. See ``Twisted Pair'' -- it explains how to do it. And
  1356.   no, you can't hack together a hub just by crossing a few wires and
  1357.   stuff. It's pretty much impossible to do the collision signal right
  1358.   without duplicating a hub.
  1359.  
  1360.  
  1361.   8.7.5.  SIOCSFFLAGS: Try again
  1362.  
  1363.  
  1364.   I get `SIOCSFFLAGS: Try again' when I run `ifconfig' -- Huh?
  1365.  
  1366.   Some other device has taken the IRQ that your ethercard is trying to
  1367.   use, and so the ethercard can't use the IRQ.  You don't necessairly
  1368.   need to reboot to resolve this, as some devices only grab the IRQs
  1369.   when they need them and then release them when they are done. Examples
  1370.   are some sound cards, serial ports, floppy disk driver, etc. You can
  1371.   type cat /proc/interrupts to see which interrupts are presently in
  1372.   use. Those marked with a `+' are ones that are not taken on a
  1373.   permanent basis. Most of the Linux ethercard drivers only grab the IRQ
  1374.   when they are opened for use via `ifconfig'. If you can get the other
  1375.   device to `let go' of the required IRQ line, then you should be able
  1376.   to `Try again' with ifconfig.
  1377.  
  1378.  
  1379.   8.7.6.  Link UNSPEC and HW-addr of 00-00-00-00-00-00
  1380.  
  1381.  
  1382.   When I run ifconfig with no arguments, it reports that LINK is UNSPEC
  1383.   (instead of 10Mbs Ethernet) and it also says that my hardware address
  1384.   is all zeros.
  1385.  
  1386.   This is because people are running a newer version of the `ifconfig'
  1387.   program than their kernel version. This new version of ifconfig is not
  1388.   able to report these properties when used in conjunction with an older
  1389.   kernel. You can either upgrade your kernel, `downgrade' ifconfig, or
  1390.   simply ignore it. The kernel knows your hardware address, so it really
  1391.   doesn't matter if ifconfig can't read it.
  1392.  
  1393.  
  1394.   8.7.7.  Huge Number of RX and TX Errors
  1395.  
  1396.  
  1397.   When I run ifconfig with no arguments, it reports that I have a huge
  1398.   error count in both rec'd and transmitted packets. It all seems to
  1399.   work ok -- What is wrong?
  1400.  
  1401.   Look again. It says RX packets big number PAUSE errors 0 PAUSE dropped
  1402.   0 PAUSE overrun 0.  And the same for the TX column.  Hence the big
  1403.   numbers you are seeing are the total number of packets that your
  1404.   machine has rec'd and transmitted.  If you still find it confusing,
  1405.   try typing cat /proc/net/dev instead.
  1406.  
  1407.  
  1408.   8.7.8.  Entries in /dev/ for Ethercards
  1409.  
  1410.  
  1411.   I have /dev/eth0 as a link to /dev/xxx. Is this right?
  1412.  
  1413.   Contrary to what you have heard, the files in /dev/* are not used.
  1414.   You can delete any /dev/wd0, /dev/ne0 and similar entries.
  1415.   8.7.9.  Linux and ``trailers''
  1416.  
  1417.  
  1418.   Should I disable trailers when I `ifconfig' my ethercard?
  1419.  
  1420.   You can't disable trailers, and you shouldn't want to. `Trailers' are
  1421.   a hack to avoid data copying in the networking layers. The idea was to
  1422.   use a trivial fixed-size header of size `H', put the variable-size
  1423.   header info at the end of the packet, and allocate all packets packets
  1424.   `H' bytes before the start of a page. While it was a good idea, it
  1425.   turned out to not work well in practice.  If someone suggests the use
  1426.   of `-trailers', note that it is the equivalent of sacrificial goats
  1427.   blood. It won't do anything to solve the problem, but if problem fixes
  1428.   itself then someone can claim deep magical knowledge.
  1429.  
  1430.  
  1431.   9.  Miscellaneous.
  1432.  
  1433.  
  1434.   Any other associated stuff that didn't fit in anywhere else gets
  1435.   dumped here. It may not be relevant, and it may not be of general
  1436.   interest but it is here anyway.
  1437.  
  1438.  
  1439.   9.1.  Passing Ethernet Arguments to the Kernel via LILO
  1440.  
  1441.  
  1442.   Here are two generic kernel commands that would be typed after the
  1443.   name of your configuration in your lilo.conf file (usually `linux')
  1444.   For exmaple, if the command was `blah' and it expected 3 arguments
  1445.   (say 123, 456, and 789) then you would use:
  1446.  
  1447.   LILO: linux blah=123,456,789
  1448.  
  1449.  
  1450.   9.1.1.  The ether command
  1451.  
  1452.  
  1453.   In its most generic form, it looks something like this:
  1454.  
  1455.  
  1456.        ether=IRQ,BASE_ADDR,PARAM_1,PARAM_2,NAME
  1457.  
  1458.  
  1459.   All arguments are optional.  The first non-numeric argument is taken
  1460.   as the NAME.
  1461.  
  1462.   IRQ: Obvious.  An IRQ value of `0' (usually the default) means to
  1463.   autoIRQ.  It's a historical accident that the IRQ setting is first
  1464.   rather than the base_addr -- this will be fixed whenever something
  1465.   else changes.
  1466.  
  1467.   BASE_ADDR: Also obvious.  A value of `0' (usually the default) means
  1468.   to probe a card-type-specific address list for an ethercard.
  1469.  
  1470.   PARAM_1: It was orginally used as an override value for the memory
  1471.   start for a shared-memory ethercard, like the WD80*3.  Some drivers
  1472.   use the low four bits of this value to set the debug message level.  0
  1473.   -- default, 1-7 -- level 1..7, (7 is maximum verbosity)  8 -- level 0
  1474.   (no messages).
  1475.  
  1476.   PARAM_2: The 3c503 driver uses this select between the internal and
  1477.   external transceivers.  0 -- default/internal, 1 -- AUI external.
  1478.  
  1479.   NAME: Selects the network device the values refer to.  The standard
  1480.   kernel uses the names `eth0', `eth1', `eth2' and `eth3' for bus-
  1481.   attached ethercards, and `atp0/dl0' for parallel port `pocket'
  1482.   ethernet adaptors.  The default setting is for a single ethercard to
  1483.   be probed for as `eth0'.  Multiple cards can only be enabled by
  1484.   explicitly setting up their base address using these LILO parameters.
  1485.   The 1.0 kernel has LANCE-based ethercards as a special case.  LILO
  1486.   arguments are ignored, and LANCE cards are always assigned `eth<n>'
  1487.   names starting at `eth0'.  Additional non-LANCE ethercards must be
  1488.   explicitly assigned to `eth<n+1>', and the usual `eth0' probe disabled
  1489.   with something like  `ether=0,-1,eth0'.  ( Yes, this is bug. )
  1490.  
  1491.  
  1492.   9.1.2.  The reserve command
  1493.  
  1494.  
  1495.   This next lilo command is used just like `ether=' above, ie. it is
  1496.   appended to the name of the boot select specified in lilo.conf
  1497.  
  1498.  
  1499.        reserve=IO-base,extent{,IO-base,extent...}
  1500.  
  1501.  
  1502.   In some machines it may be necessary to prevent device drivers from
  1503.   checking for devices (auto-probing) in a specific region. This may be
  1504.   because of poorly designed hardware that causes the boot to freeze
  1505.   (such as some ethercards), hardware that is mistakenly identified,
  1506.   hardware whose state is changed by an earlier probe, or merely
  1507.   hardware you don't want the kernel to initialize.
  1508.  
  1509.   The reserve boot-time argument addresses this problem by specifying an
  1510.   I/O port region that shouldn't be probed. That region is reserved in
  1511.   the kernel's port registration table as if a device has already been
  1512.   found in that region. Note that this mechanism shouldn't be necessary
  1513.   on most machine, only when there is a problem or special case.
  1514.  
  1515.   The I/O ports in the specified region are protected against device
  1516.   probes. This was put in to be used when some driver was hanging on
  1517.   e.g. a NE2000, or misidentifying some other device as its own.  A
  1518.   correct device driver shouldn't probe a reserved region, unless
  1519.   another boot argument explicitly specifies that it do so.  This
  1520.   implies that reserve will most often be used with some other boot
  1521.   argument. Hence if you specify a reserve region to protect a specific
  1522.   device, you must generally specify an explicit probe for that device.
  1523.   Most drivers ignore the port registration table if they are given an
  1524.   explicit address.
  1525.  
  1526.   For example, the boot line
  1527.  
  1528.  
  1529.        LILO: linux  reserve=0x300,32  ether=0,0x300,eth0
  1530.  
  1531.  
  1532.   keeps all device drivers except the ethercard drivers from probing
  1533.   0x300-0x31f.
  1534.  
  1535.   As usual with boot-time specifiers there is an 11 parameter limit,
  1536.   thus you can only specify 5 reserved regions per reserve keyword.
  1537.   Multiple reserve specifiers will work if you have an usually
  1538.   complicated request.
  1539.  
  1540.  
  1541.   9.2.  Contributors
  1542.  
  1543.  
  1544.   Other people who have contributed (directly or indirectly) to the
  1545.   Ethernet-Howto are, in alphabetical order:
  1546.  
  1547.           Peter Bauer             <pbauer@rnivh.rni.sub.org>
  1548.           Ross Biro               <bir7@leland.Stanford.EDU>
  1549.           Alan Cox                <iiitac@pyr.swan.ac.uk>
  1550.           David C. Davies         <davies@wanton.enet.dec.com>
  1551.           Bjorn Ekwall            <bj0rn@blox.se>
  1552.           David Hinds             <dhinds@allegro.stanford.edu>
  1553.           Michael Hipp            <mhipp@student.uni-tuebingen.de>
  1554.           Mike Jagdis             <jaggy@purplet.demon.co.uk>
  1555.           Duke Kamstra            <kamstra@ccmail.west.smc.com>
  1556.           Russell Nelson          <nelson@crynwr.com>
  1557.           Cameron Spitzer         <camerons@NAD.3Com.com>
  1558.           Dave Roberts            <david.roberts@amd.com>
  1559.           Glenn Talbott           <gt@hprnd.rose.hp.com>
  1560.  
  1561.  
  1562.  
  1563.  
  1564.   Many thanks to the above people, and all the other unmentioned testers
  1565.   out there.
  1566.  
  1567.  
  1568.   9.3.  Closing
  1569.  
  1570.  
  1571.   If you have found any glaring typos, or outdated info in this
  1572.   document, please let one of us know. It's getting big, and it is easy
  1573.   to overlook stuff.
  1574.  
  1575.   Thanks,
  1576.  
  1577.   Paul Gortmaker, Paul.Gortmaker@anu.edu.au
  1578.  
  1579.   Donald J. Becker, becker@cesdis.gsfc.nasa.gov
  1580.  
  1581.