Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Oct 2005 09:30:33 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Yar Tikhiy <yar@comp.chem.msu.su>
Cc:        freebsd-net@FreeBSD.org, ru@FreeBSD.org, Andrew Thompson <thompsa@FreeBSD.org>
Subject:   Re: vlan patch
Message-ID:  <20051021053033.GW59364@cell.sick.ru>
In-Reply-To: <20051020085721.GC27114@comp.chem.msu.su>
References:  <20051019102559.GA45909@heff.fud.org.nz> <20051020070054.GZ59364@cell.sick.ru> <20051020085721.GC27114@comp.chem.msu.su>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051021053033.GW59364>