From owner-freebsd-net@FreeBSD.ORG Sun Nov 27 19:46:15 2005 Return-Path: X-Original-To: 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 2A45816A41F; Sun, 27 Nov 2005 19:46:15 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 035F143D55; Sun, 27 Nov 2005 19:46:13 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jARJkBG7089805; Sun, 27 Nov 2005 21:46:11 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 10420-06; Sun, 27 Nov 2005 21:46:10 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id jARJjn9r089791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 27 Nov 2005 21:45:49 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.4/8.13.4) id jARJjojQ076221; Sun, 27 Nov 2005 21:45:50 +0200 (EET) (envelope-from ru) Date: Sun, 27 Nov 2005 21:45:45 +0200 From: Ruslan Ermilov To: Gleb Smirnoff Message-ID: <20051127194545.GA76200@ip.net.ua> References: <20051127005943.GR25711@cell.sick.ru> <20051127135529.GF25711@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051127135529.GF25711@cell.sick.ru> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: Vsevolod Lobko , rwatson@FreeBSD.org, net@FreeBSD.org Subject: Re: parallelizing ipfw table 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, 27 Nov 2005 19:46:15 -0000 On Sun, Nov 27, 2005 at 04:55:29PM +0300, Gleb Smirnoff wrote: > On Sun, Nov 27, 2005 at 03:59:43AM +0300, Gleb Smirnoff wrote: > T> A patch displaying the idea is attached. Not tested yet, read > T> below. The patch moves the tables array into the ip_fw_chain > T> structure. This is not necessary now, but in future we can > T> have multiple independent chains in ipfw, that's why I try > T> to avoid usage of &layer3_chain in the functions that are > T> deeper in the call graph. I try to supply chain pointer > T> from the caller. > T> > T> The only problem is the caching in table lookup. This "hack" > T> makes the lookup function modify the table structure. We need > T> to remove caching to make the lookup_table() function fully > T> lockless and reenterable at the same time. The attached patch > T> doesn't removes caching, since it only displays the original > T> idea. > > Okay, I have made a working patch, that is now undergoing testing > on SMP. I have axed all the caching from ipfw tables, to make > lookup_table() lockless and reenterable. This axing simplified > things much. I believe that the caching gives a benefit only > when we serve a small number of clients, and is only additional > workload when we are routing hundreds and thousands of simultaneous > IP flows. > > The patch attached. I'm going to put it into production testing as > soon as I can reboot the prod box. > Nope, I need this caching. It's for looking up the same table several times in a row but with various values. For example, we use ipfw tables to route the traffic to the correct dummynet pipe, where value is the bandwidth, and this caching helps a lot. Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer