From owner-freebsd-net@FreeBSD.ORG Tue Feb 21 02:47:51 2012 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C11106564A for ; Tue, 21 Feb 2012 02:47:51 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id D055C8FC19 for ; Tue, 21 Feb 2012 02:47:50 +0000 (UTC) Received: by werm13 with SMTP id m13so5666033wer.13 for ; Mon, 20 Feb 2012 18:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of juli@clockworksquid.com designates 10.180.78.233 as permitted sender) client-ip=10.180.78.233; Authentication-Results: mr.google.com; spf=pass (google.com: domain of juli@clockworksquid.com designates 10.180.78.233 as permitted sender) smtp.mail=juli@clockworksquid.com Received: from mr.google.com ([10.180.78.233]) by 10.180.78.233 with SMTP id e9mr22911225wix.0.1329792469913 (num_hops = 1); Mon, 20 Feb 2012 18:47:49 -0800 (PST) Received: by 10.180.78.233 with SMTP id e9mr19087113wix.0.1329790914229; Mon, 20 Feb 2012 18:21:54 -0800 (PST) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.227.209.78 with HTTP; Mon, 20 Feb 2012 18:21:34 -0800 (PST) In-Reply-To: References: <338757D1-6B1E-49CF-983F-5D5851066FD3@xcllnt.net> <20120220231601.GA51310@lor.one-eyed-alien.net> <20120221001552.GA60050@onelab2.iet.unipi.it> From: Juli Mallett Date: Mon, 20 Feb 2012 18:21:34 -0800 X-Google-Sender-Auth: mNG9R8rR4X28RuTfz6wCFlFHbKE Message-ID: To: Adrian Chadd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkvLR71bGXixVhB/2M4ZzjzTl7JCF27rd4sjV6gE66MJcJJ3jHzr3e/IBTqVLpZP8FyOta3 Cc: net@freebsd.org, Brooks Davis , Luigi Rizzo , Marcel Moolenaar Subject: Re: Abstracting struct ifnet X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 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, 21 Feb 2012 02:47:51 -0000 On Mon, Feb 20, 2012 at 16:37, Adrian Chadd wrote: > On 20 February 2012 16:15, Luigi Rizzo wrote: > >>> The concept seems fine to me and I like that it might simplify future >>> API changes. =C2=A0Have you verified that if_get_*() accessors don't ad= d >>> significant overhead? >> >> the vast majority of these fields are only accessed in the control path, >> not on each packet, so there isn't really a performance issue. Besides >> they can be trivially implemted as macros or inline functions. > > I doubt Juniper need _binary_ level compatibility. So we could get > away with inline methods. > > This sort of thing just makes source level compatibility a lot easier. It's not just about Juniper, though, it's about us, and how much this buys us. Using inlines buys us some source compatibility and the ability to add some invariants, but is no different to macros in terms of KBI within a version of FreeBSD, or between versions. We can't make ifnet opaque with inlines. Adding a member to ifnet which is opaque[*] and which has the fields most likely to change in size, order, existence, etc., and leaving a few that are needed in the fast path and will be used by macros/inlines is probably where we should end up. *: Obviously ifnet should be a value member of the opaque type, and the ifnet should include a pointer to the opaque type, or something like that, since you can't make an opaque struct a value member, which is probably obvious, but I wanted to be clearish.