Subject: Why was if_init from struct ifnet in ?
To: None <tech-net@NetBSD.ORG>
From: Matt Thomas <matt@lkg.dec.com>
List: tech-net
Date: 08/20/1995 16:29:34
I noticed that NetBSD doesn't have a if_init member in it's
ifnet structure.  (where as BSD/OS and FreeBSD do have one).

If you look at most of the Ethernet drivers, you'll find they
have just about identical code for dealing with the SIOCSIFADDR
ioctl.   Actually, most of the ifioctl routine is common.  Which
means one could do:

int
xxx_ifioctl(
	struct ifnet *ifp,
	ioctl_cmd_t cmd,
	caddr_t data)
{
	int error = 0;
	int s = splinp();

	switch (cmd) {
	case SIOCADDRMULTI:
	case SIOCDELMULTI:
		...
		break;
	case SIOCWHATEVER:
		break;
	default:
		error = ether_ifioctl(ifp, cmd, data);
		break;
	}

	splx(s);
	return error;
}

and move most of the current cruft to a common routine (ether_ifioctl)
in if_ethersubr.c.

However, most/all ifioctl routines needs to be able re-init the interface
and that's usually done by calling the init routine either directly
or indirectly (via if_init which doesn't exit anymore).  Having if_init
readd-ed would make this much easier.

And if if_init does get readded, please pass the ifp instead of the unit
number.  In fact, if if_reset and if_watchdog could also be redefined to
take the ifp instead of the unit number, then all if_* routines would be
consistent with themselves.

Oh well, that's enough for this Sunday sermon. :-)
Cheers,

Matt Thomas               Internet:   matt@lkg.dec.com
3am Software Foundry      WWW URL:    <currently homeless>
Westford, MA              Disclaimer: Digital disavows all knowledge
                                      of this message