cvs commit: src/sys/net if.c if_vlan.c

Ruslan Ermilov ru at
Sat Apr 24 15:51:50 PDT 2004

On Sat, Apr 24, 2004 at 03:24:48PM -0700, Luigi Rizzo wrote:
> luigi       2004/04/24 15:24:48 PDT
>   FreeBSD src repository
>   Modified files:
>     sys/net              if.c if_vlan.c 
>   Log:
>   arpcom untangling:
>   consistently with the rest of the code, use IFP2AC(ifp) to access
>   the arpcom structure given the ifp.
>   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:

 * 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

Ruslan Ermilov
ru at
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the cvs-src mailing list