From owner-freebsd-arch@FreeBSD.ORG Tue Feb 19 17:43:53 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B712F16A468 for ; Tue, 19 Feb 2008 17:43:53 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 78A0813C455 for ; Tue, 19 Feb 2008 17:43:53 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id E98EC208C for ; Tue, 19 Feb 2008 18:43:46 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.3/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id DC1202084 for ; Tue, 19 Feb 2008 18:43:46 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id C151B84463; Tue, 19 Feb 2008 18:43:46 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: arch@freebsd.org Date: Tue, 19 Feb 2008 18:43:46 +0100 Message-ID: <86odacc04t.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: dev.* analogue for interfaces X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 17:43:53 -0000 Four years ago, I created the dev.* sysctl tree for device drivers. Every time a device is registered, a sysctl context is automatically created, and a node is created under dev (e.g. dev.cpu.0), with some standardized nodes under it (%driver, %parent, %desc etc.) plus any node the driver - or even another driver - wants to add. However, not everything in Unix is a device. Specifically, network interfaces aren't. Some network interfaces are also devices, so they have a sysctl node in dev.*: % sysctl dev.msk dev.msk.0.%desc: Marvell Technology Group Ltd. Yukon EC Ultra Id 0xb4 Rev 0= x02 dev.msk.0.%driver: msk dev.msk.0.%parent: mskc0 Others don't: bridge, faith, lo, pflog, vlan etc. What I propose is to add a similar sysctl tree for interfaces. It would look a little different. For instance, some interfaces (bridge, vlan) have parents or children, but most don't. Just as it is for devices, creation and destruction of the interface's sysctl node and context would be hidden inside if_{attach,detach}() and completely transparent to the driver, and there will be an API that drivers can use if they want to add their own nodes. Since interfaces don't all have parents, the API will include a function to specify one for those that do. This is *not* intended to replace ifconfig; it is intended for infor- mation which isn't available through ifconfig and which it wouldn't be natural to place there. For instance, every wlan interface already has a sysctl tree under net.wlan. Drivers that already have sysctl nodes will require less code to create them, and no code at all to destroy them, since if_detach() will take care of that (all nodes in the interface's context are automatically destroyed when the context is destroyed). I'm unsure whether this should go under net.if, or just if. I think I prefer the latter. I'm open to objections and suggestions... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no