From owner-freebsd-net@FreeBSD.ORG Sun Sep 2 21:22:32 2007 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 83D4B16A41B; Sun, 2 Sep 2007 21:22:32 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 8F4F413C46A; Sun, 2 Sep 2007 21:22:32 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id A38F41A4D87; Sun, 2 Sep 2007 14:19:45 -0700 (PDT) Date: Sun, 2 Sep 2007 14:19:45 -0700 From: Alfred Perlstein To: "Bruce M. Simpson" Message-ID: <20070902211945.GQ87451@elvis.mu.org> References: <20070821232956.GT87451@elvis.mu.org> <46CC45F0.3000105@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46CC45F0.3000105@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: Max Laier , net@freebsd.org Subject: Re: Allocating AF constants for vendors. 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: Sun, 02 Sep 2007 21:22:32 -0000 * Bruce M. Simpson [070822 07:33] wrote: > I second Max. If you are going to introduce a bunch of AF_* constants > into the tree you have to be very careful as AF_MAX is used to size > arrays and figure out how many radix trie heads to allocate. Ok, I'm not really sure what to do here. At Juniper we have approx 20 additional entries for AF_ constants. We also have theoretical but not practical "problems" with spareness and utility of this list, meaning we have plenty of arrays in our version of ifnets and route entries that are also "bloated" as well. We happen not to find it a problem. Perhaps if $BIG_ROUTER_COMPANY is not concerned about this then that might be convincing enough to let it go? Perhaps if I tossed in that it would be my intention to share code to dynamically allocate the data if we ever did it ourselves. Otherwise one other policy would be to specify an allocation policy such that new AF_ constants are allocated only for even numbers where odd numbers are left to vendors. This would slow the "bloat" and still provide vendors with something useful. How does that sound? -Alfred > > It could be argued this wastes a bunch of CPU time and memory, though I > speculate 'not much' at the moment; I am just a bit concerned that we > have ifnet->if_afdata which is also sized based on AF_MAX, 37, even > though most of the protocols in it are never attached to ifnets. > > The only domain I've seen which really uses if_afdata is PF_INET6. > PF_INET does not use it at all. In my opinion, there are structures > per-family per-ifnet which really belong hung-off ifnet on a 1:1 basis > and would simplify some of the lazy allocations we have further down in > the stack. > > If AF_MAX increases significantly so will wasted memory. If you are > going to make any significant changes here, please considering moving > this stuff to a more dynamic method of allocation. > > On the other hand, if you don't need to reference these constants in the > kernel at all, and they will all exist beyond AF_MAX, then you can > disregard what I've said and append them to the rest of the list. > > That is pretty much what happens for the libpcap/bpf DLT constants > (which are not an exact analogue of the AF constants - we don't allocate > other, larger kernel structures based on their value). > > regards, > BMS > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" -- - Alfred Perlstein