Subject: Re: Implementing interface media type autodetection?
To: John Hawkinson <jhawk@mit.edu>
From: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
List: tech-net
Date: 06/08/1996 20:00:07
> Options would seem to be:
>
> 1. Have the driver do autodetection at boot time, and assume
> that users who want to make use of autodetection won't explicitly
> modify the link flags. This certainly seems nondeterministic...
>
> 2. Since the link2 flag is currently unused, have the driver
> perform autodetection when epsetlink() is called with link2
> (and have it reset the link[01] flags to appropriate state).
>
> 3. Add an ioctl() to have the driver perform autodetection
> and return the media type (either as link[012] or as some
> opaque structure) without changing the current media type.
>
> 4. Add an ioctl() to have the driver perform autodection,
> set the current media type to the discovered type,
> and set the link[012] flags as appropriate.
>
>
> 1) and 2) seem pretty lame. 3) might be aesthetically pleasing, but
> since autodection may (at least for the ep cards) involve changing the
> state of the media type on the card, it's sort of misleading.
>
> I currently favor 4), and would call the ioctl SIOCIFAUTO. Does this
> seem reasonable?
(1) + (4) might be reasonable, but i don't particularly like them.
I think that a better option would be similar to what Matt Thomas (i
think it was him, anyway 8-) suggested, i.e. move the media type
completely out of the 'link' flags.
Consider SIOCSIFMEDIA and SIOCGIFMEDIA ioctls, which set and get the
media type of the device. You could then have media types like:
AUI
10base-2
10base-T
100base-TX
etc. and you could then easily add an 'autodetect' value, which, when
supplied with SIOCSIFMEDIA, would cause the driver to autodetect the
media type and switch to that.
For drivers which don't support a given media type (or autodetection),
they would return an appropriate error code from SIOCSIFMEDIA.
To initiate media autodetection at run time, you'd do something like
SIOCSIFMEDIA auto
and then to find out what it turned out as:
SIOCGIFMEDIA
Translated into 'ifconfig', that could be:
ifconfig if0 media auto
ifconfig if0
(ifconfig could print out the media type when displaying info for the
interface.)
Drivers which do autodetect could do it and set the appropriate value
at startup, and could be 'kicked' into doing it again later.
Use of the link flags for media type is ... unintuitive at best.
If you're going to suggest adding an ioctl and go to the trouble of
implementing that, I think that doing general media types in the way
outlined above is a much better use of effort.
chris