From owner-freebsd-net@FreeBSD.ORG Thu Oct 20 12:22:03 2005 Return-Path: X-Original-To: freebsd-net@FreeBSD.org 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 03B8E16A41F; Thu, 20 Oct 2005 12:22:03 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CFC243D66; Thu, 20 Oct 2005 12:22:00 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id j9KCLtCf048214; Thu, 20 Oct 2005 16:21:55 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id j9KCLqEe048213; Thu, 20 Oct 2005 16:21:52 +0400 (MSD) (envelope-from yar) Date: Thu, 20 Oct 2005 16:21:52 +0400 From: Yar Tikhiy To: Ragnar Lonn Message-ID: <20051020122151.GB47217@comp.chem.msu.su> References: <20051019102559.GA45909@heff.fud.org.nz> <20051020070054.GZ59364@cell.sick.ru> <43575A74.6090004@packetfront.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43575A74.6090004@packetfront.com> User-Agent: Mutt/1.5.9i Cc: freebsd-net@FreeBSD.org, Gleb Smirnoff , ru@FreeBSD.org, Andrew Thompson Subject: Re: vlan patch 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: Thu, 20 Oct 2005 12:22:03 -0000 On Thu, Oct 20, 2005 at 10:51:00AM +0200, Ragnar Lonn wrote: > Gleb Smirnoff wrote: > > >Although the memory overhead is not noticable on modern i386 and amd64 > >PCs I don't think that we should waste so much memory. We should keep > >in mind the existence of embedded architectures with little memory. > > > >In most cases people use 10 - 30 VLANs. I suggest to use a hash, like it > >is already done in ng_vlan(4). This hash makes every sixteenth VLAN to fall > >into same slot. Since most people allocate VLAN ids contiguously the hash > >distribution should be good. > > > >Moreover, I suggest Yar and Ruslan to work together and make the hash code > >shared between vlan(4) and ng_vlan(4), not copy-and-pasted. > > It looks as if ng_vlan implements a standard hash. Wouldn't a hashtree > be a good > compromise between speed and memory usage? Of course, a 16-slot hash is > a lot > better than no hash at all :-) The only problem with the hash currently used in ng_vlan is that it is fixed-width. I think it will be easy to teach it how to cope with variable bit-width of hash using the same xor-folding technique. I hope I'll have free time this week-end to test the performance of the approaches discussed since implementing them is no problem at all. -- Yar