From owner-cvs-src@FreeBSD.ORG Sat Apr 24 16:22:47 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EC8D16A4CE; Sat, 24 Apr 2004 16:22:47 -0700 (PDT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3636A43D58; Sat, 24 Apr 2004 16:22:47 -0700 (PDT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.9p1/8.12.8) with ESMTP id i3ONMjgd072833; Sat, 24 Apr 2004 16:22:45 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.9p1/8.12.3/Submit) id i3ONMjJD072832; Sat, 24 Apr 2004 16:22:45 -0700 (PDT) (envelope-from rizzo) Date: Sat, 24 Apr 2004 16:22:45 -0700 From: Luigi Rizzo To: Ruslan Ermilov Message-ID: <20040424162245.C69916@xorpc.icir.org> References: <200404242224.i3OMOmpK033235@repoman.freebsd.org> <20040424225155.GC35913@ip.net.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20040424225155.GC35913@ip.net.ua>; from ru@FreeBSD.org on Sun, Apr 25, 2004 at 01:51:55AM +0300 cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/net if.c if_vlan.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2004 23:22:47 -0000 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 _softc { > * struct arpcom { > * struct ifnet ac_if; > * ... > * } ; > * ... > * }; > * > * 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.