Subject: Re: Setting the default port on ethernet cards
To: Bernd Ernesti <netbsd@arresum.inka.de>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-net
Date: 04/23/1997 11:14:44
On Wed, 23 Apr 1997 20:10:16 +0200 (MEST) 
 Bernd Ernesti <netbsd@arresum.inka.de> wrote:

 > some ethernet cards have a eeprom which contains the default media port.
 > I think of the driver for the 3com which reads this register from the
 > eeprom and use it as the default port.
 > It would be good to change the default port in the eeprom with a new
 > ifconfig keyword. That would remove the #ifdef EP_COAX_DEFAULT from
 > the ep driver and you don't need to use the DOS programm to set the
 > default port.
 > 
 > It shouldn't be changed with the existing media keyword, because that
 > would write it everytime you use it.
 > 
 > This means that we need to add a new ioctl to our ifmedia interface and
 > also talk with the bsdi guys so they can add this to there interface.
 > 
 > Any comments about that are welcome.

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 :-)

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.

In terms of the MI infrastructure, this is actually fairly trivial
to implement.

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