From owner-freebsd-net@FreeBSD.ORG Tue Sep 30 10:14:39 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FED816A4B3 for ; Tue, 30 Sep 2003 10:14:39 -0700 (PDT) Received: from mail.speakeasy.net (mail7.speakeasy.net [216.254.0.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id E330C43FAF for ; Tue, 30 Sep 2003 10:14:37 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 5310 invoked from network); 30 Sep 2003 17:14:37 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 30 Sep 2003 17:14:37 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h8UHEX6Y058932; Tue, 30 Sep 2003 13:14:34 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <11374.1064934514@critter.freebsd.dk> Date: Tue, 30 Sep 2003 13:14:39 -0400 (EDT) From: John Baldwin To: Poul-Henning Kamp X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: arch@FreeBSD.org cc: net@FreeBSD.org Subject: Re: adding if_dev member to struct ifnet X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 17:14:39 -0000 On 30-Sep-2003 Poul-Henning Kamp wrote: > In message , John Baldwin writes: > >>>>Yes, if it helps to remove if_name/if_unit, it is a thing to do. Moreover it >>>>sounds a good idea to have the if_dev field into the ifnet structure. >>> >>> Somebody please explain how this would work for non-hardware >>> interfaces like if_loop, if_tun, if_tap etc ? >>> >>> device_t is what we use to hitch drivers to hardware. >>> >>> ifnet is what we use to hitch drivers to the netstack. >>> >>> They should not be tangled. >> >>You mean like dev_t and device_t shouldn't be tangled like we do >>with si_drv1? Oh, wait... > > I don't think any correctly written driver stores it's device_t in > a dev_t. It should store it's softc structure, which should contain > pointers to both. Even if there is a driver which does do that, > it happens inside the device driver, and it does not handicap the > remaining device drivers with its choice. Fair enough. I think that Brooks planned to use a NULL device_t for interfaces w/o a backing new-bus device. However, that means you still need if_name for all the non-newbus devices, so this seems somewhat pointless if if_name is the only reason. Another counterpoint is that the new-bus namespace and the netif namespace aren't the same anyway and that seemed to be the point of this linkage. The dev_t <> softc <> device_t linkages aren't about unifying namespaces. > There is nothing in the "data-model" of the kernel that says that > a network interface corresponds to exactly one hardware device > and more importantly: there shouldn't be either. Agreed. > If all you want is an extra field in "struct ifnet" to hang driver > information on, then by all means add that field. As long as you > give it type "void *" and make it private to the driver I have no > problem with that. Fair enough, though I don't think this is what Brooks was after. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/