From owner-freebsd-net@FreeBSD.ORG Fri Oct 21 05:30:55 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 2376516A420; Fri, 21 Oct 2005 05:30:55 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34B6443D45; Fri, 21 Oct 2005 05:30:53 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id j9L5UdL5014797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Oct 2005 09:30:39 +0400 (MSD) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id j9L5UXfH014796; Fri, 21 Oct 2005 09:30:33 +0400 (MSD) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 21 Oct 2005 09:30:33 +0400 From: Gleb Smirnoff To: Yar Tikhiy Message-ID: <20051021053033.GW59364@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , Yar Tikhiy , freebsd-net@freebsd.org, ru@freebsd.org, Andrew Thompson References: <20051019102559.GA45909@heff.fud.org.nz> <20051020070054.GZ59364@cell.sick.ru> <20051020085721.GC27114@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20051020085721.GC27114@comp.chem.msu.su> User-Agent: Mutt/1.5.6i Cc: freebsd-net@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: Fri, 21 Oct 2005 05:30:55 -0000 On Thu, Oct 20, 2005 at 12:57:21PM +0400, Yar Tikhiy wrote: Y> The hash code consists of literally a couple of #define's. And the Y> difference between ng_vlan(4) and vlan(4) is that each ng_vlan node Y> gets its own instance of the hash table. OTOH, in vlan(4) we need Y> to decide if the hash table will be per parent interface or a single Y> global instance. In the latter case we could hash by a combination Y> of the VLAN tag and parent's ifindex. Perhaps this approach will Y> yield more CPU cache hits during hash table lookups. In addition, Y> it will be thriftier in using memory. Locking the global hash table Y> should not be an issue as we can use an sx lock in this case for Y> optimal read access. The sx lock is slow. We'd better use per interface hash, and thus get locking instantly, with per-vlan lock. In other case, we will acquire per-vlan lock + the sx lock on every packet. The sx lock actually means mtx_lock+mtx_unlock, thus we will make 3 mutex operations instead of one. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE