Subject: Re: 3c509 driver
To: None <salvet@muni.cz>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-i386
Date: 08/06/1996 10:22:17
On Tue, 6 Aug 1996 11:06:28 +0200 (MET DST) 
 Zdenek Salvet <salvet@horn.ics.muni.cz> wrote:

 > > Aug  6 00:20:45 ... : ep0 at isa0 port 0x300-0x30f irq 3: 3Com 3C509 Ethernet
 > > Aug  6 00:20:45 ... : ep0: aui/bnc/utp address 00:a0:24:0f:12:05
 > > Aug  6 00:20:45 ... : ep1 at isa0 port 0x310-0x31f irq 10: 3Com 3C509 Ethernet
 > > Aug  6 00:20:46 ... : ep1: aui/bnc/utp address 00:20:af:bf:be:a9
 > > ------------------------------------------------------------------------------
 > > Aug  6 00:28:11 ... : ep0 at isa0 port 0x310-0x31f irq 10: 3Com 3C509 Ethernet
 > > Aug  6 00:28:11 ... : ep0: aui/bnc/utp address 00:20:af:bf:be:a9
 > > Aug  6 00:28:11 ... : ep1 at isa0 port 0x300-0x30f irq 3: 3Com 3C509 Ethernet
 > > Aug  6 00:28:11 ... : ep1: aui/bnc/utp address 00:a0:24:0f:12:05
 > > 
 > > This switch usually happens after I've run the DOS config utility (3c5x9cfg).

This is somewhat interesting ... Note the following comment in if_ep_isa.c:

/*
 * 3c509 cards on the ISA bus are probed in ethernet address order.
 * The probe sequence requires careful orchestration, and we'd like
 * like to allow the irq and base address to be wildcarded. So, we
 * probe all the cards the first time epprobe() is called. On subsequent
 * calls we look for matching cards.
 */      

... this implies that the cards are supposed to do this by themselves, 
and that reading the ELINK_ID_PORT will just DTRT... however, there's 
another comment just after the probe loop:

        /* XXX should we sort by ethernet address? */

Given the behavior you're seeing, it looks almost as though we _should_ :-)
Acually, it might be more reasonable to sort by port (iobase), since that's 
what most people might expect ...

 > Have you turned off "Plug and Pray" in config utility ?

The ep driver will complain if PnP is enabled on the card.

 > My solution is to distinguish the cards by MAC address in netstart,
 > "ifconfig -a" will tell you "who is who".
 > It's useful with multiple PCI cards too.

That's still pretty crufty... The Right Thing should just happen ... i.e. 
the ordering of the cards should not change across reboots.  I would 
definitely classify the observed behavior as a bug.

In the mean time, a work-around would be to nail down the port numbers of 
the cards... i.e.:

ep0	at isa? port 0x300 irq ?
ep1	at isa? port 0x310 irq ?

...rather than wildcarding the port ...

If anyone wants to volunteer to sort the cards in the probe routine, 
please do.  :-)

 -- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ -- 
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939