Date: Sat, 24 Apr 2004 16:22:45 -0700 From: Luigi Rizzo <luigi@FreeBSD.org> To: Ruslan Ermilov <ru@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/net if.c if_vlan.c Message-ID: <20040424162245.C69916@xorpc.icir.org> In-Reply-To: <20040424225155.GC35913@ip.net.ua>; from ru@FreeBSD.org on Sun, Apr 25, 2004 at 01:51:55AM %2B0300 References: <200404242224.i3OMOmpK033235@repoman.freebsd.org> <20040424225155.GC35913@ip.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 25, 2004 at 01:51:55AM +0300, Ruslan Ermilov wrote:
...
> > In this case also fix a difference in assumptions WRT the rest of
> > the net/ sources: it is not the 'struct *softc' that starts with a
> > 'struct arpcom', but a 'struct arpcom' that starts with a
> > 'struct ifnet'
> >
> Hmm, actually both statements are true. From if_var.h:
yes but apparently (though not 100% sure) only the arpcom-ifnet
layout is used by the majority of the code, whereas the softc-arpcom
layout restriction is only left in sys/dev/mii.c
Now, i _believe_ this can be removed as well because there are
device-specific methods which probably override the generic
miibus_attach() below, and they know the *_softc layout.
But we should ask the author of the MII code to see if this is true.
cheers
luigi
> /*
> * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with
> * one of these structures, typically held within an arpcom structure.
> *
> * struct <foo>_softc {
> * struct arpcom {
> * struct ifnet ac_if;
> * ...
> * } <arpcom> ;
> * ...
> * };
> *
> * The assumption is used in a number of places, including many
> * files in sys/net, device drivers, and sys/dev/mii.c:miibus_attach().
> *
> * Unfortunately devices' softc are opaque, so we depend on this layout
> * to locate the struct ifnet from the softc in the generic code.
> *
> */
>
> But I think your intention is to only leave the latter; in this
> case, please care to update this comment in if_var.h. It came
> very handy when I fixed the problem in sys/netgraph/ng_eiface.c,
> rev. 1.11, and I'll sure look here again next time I do something
> similar.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040424162245.C69916>
