Subject: Implementing interface media type autodetection?
To: None <tech-net@NetBSD.ORG>
From: John Hawkinson <firstname.lastname@example.org>
Date: 06/08/1996 17:34:40
Having recently become a laptop-bearing fool, it would be nice to have
NetBSD autodectect which connector on my 3C589B to use.
I have code to check for the presence of link beat (for the ep(4)
driver), and it shouldn't be too hard to extend that into more general
autodetection code, but the question I have is where this should fit
in the API.
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 flags to appropriate state).
3. Add an ioctl() to have the driver perform autodetection
and return the media type (either as link 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 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