Subject: Re: Setting the default port on ethernet cards
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Eric Varsanyi <ewv@bsdi.com>
List: tech-net
Date: 04/23/1997 12:43:49
>I definitely think this is a good idea ... I don't really like the approach
>Linux has taken, which is "write a separate program for every type of
>ethernet driver that has this capability".  You have a device driver,
>use it :-)

Currently (in BSD/OS) the ef driver (3com 509, 59x) has ioctls that
let an external program set up the prom defaults (efsetup). This is
the only card that we support that uses its EE settings to init the
ASIC at powerup time so I did it as a seperate program. I like the idea
of making this a generic thing however.

>I would suggest the following:
>
>	- new ioctl SIOCSAVEIFMEDIA - Semantics are identical to
>	  SIOCSIFMEDIA, with the addition of saving the media type
>	  in the interface's non-volatile storage.  If the interface
>	  does not have non-volatile storage for this purpose,
>	  the ioctl should fail with EINVAL.
>
>	  Note that things like "auto" may be implemented entirely
>	  in software in a given device driver (this is the case
>	  in the Sun4m LANCE driver, for example).  So, setting
>	  a media type that is not directly supported by hardware
>	  should also fail with EINVAL.
>
>	- new "savemedia" keyword to ifconfig(8), that uses the
>	  SIOCSAVEIFMEDIA ioctl rather than SIOCSIFMEDIA.

I'd call the media ioctl something closer to 'set default', perhaps
SIOCSETDEFMEDIA or SIOCDEFMEDIA - 'save' implies other semantics (to me
anyway). It should also be clear that if a driver doesn't understand this
ioctl it will fail the call.

The only hesitation I have about this is the additional kernel code size
needed to support this feature for some cards (efsetup has to do
a fair amount of work to figure out what its talking to and do the
right thing for all flavors of 3com cards, thats a lot of code that
gets run once - which is another reason I put it in a user mode
program).

-Eric