From owner-freebsd-net@FreeBSD.ORG Thu Oct 20 08:52:48 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 A44AA16A41F; Thu, 20 Oct 2005 08:52:48 +0000 (GMT) (envelope-from raglon@packetfront.com) Received: from mail.packetfront.com (mail.packetfront.com [212.247.6.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2AED043D62; Thu, 20 Oct 2005 08:52:47 +0000 (GMT) (envelope-from raglon@packetfront.com) Received: from localhost (localhost [127.0.0.1]) by mail.packetfront.com (Postfix) with ESMTP id C9E46A3F82; Thu, 20 Oct 2005 10:52:45 +0200 (CEST) Received: from mail.packetfront.com ([127.0.0.1]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14707-08; Thu, 20 Oct 2005 10:52:45 +0200 (CEST) Received: from [192.168.1.159] (unknown [192.168.1.159]) by mail.packetfront.com (Postfix) with ESMTP id 92A94A3F81; Thu, 20 Oct 2005 10:52:45 +0200 (CEST) Message-ID: <43575A74.6090004@packetfront.com> Date: Thu, 20 Oct 2005 10:51:00 +0200 From: Ragnar Lonn User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gleb Smirnoff References: <20051019102559.GA45909@heff.fud.org.nz> <20051020070054.GZ59364@cell.sick.ru> In-Reply-To: <20051020070054.GZ59364@cell.sick.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at packetfront.com Cc: freebsd-net@FreeBSD.org, yar@FreeBSD.org, 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 08:52:48 -0000 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 :-) /Ragnar