From owner-freebsd-net@FreeBSD.ORG Tue Sep 30 00:10:59 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 3D19816A4B3; Tue, 30 Sep 2003 00:10:59 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA96043FA3; Tue, 30 Sep 2003 00:10:57 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.9/8.12.9) with ESMTP id h8U7AsOP008476; Tue, 30 Sep 2003 09:10:54 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Vincent Jardin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 30 Sep 2003 10:45:15 +0200." <200309301045.15776.vjardin@wanadoo.fr> Date: Tue, 30 Sep 2003 09:10:54 +0200 Message-ID: <8475.1064905854@critter.freebsd.dk> 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 07:10:59 -0000 In message <200309301045.15776.vjardin@wanadoo.fr>, Vincent Jardin writes: >Le Mardi 30 Septembre 2003 03:03, Brooks Davis a écrit : >> [Previously posted to -net in another form.] >> >> I propose to add an if_dev member to struct ifnet. It would be of type >> device_t and be defined to point to the device for the interface or NULL >> if there is no device (or if there was not an easy way to get access to >> one). >> >> This change would codify the the relationship between an interface and >> the underlying physical device. It also would get rid of the existing >> abuses of if_name to look up the driver associated with an interface >> and simplify a number of messy cases in the conversion from if_unit and >> if_name to if_xname. >> >> Does this seem like a reasonable thing to do? > >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. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.