From owner-freebsd-net@FreeBSD.ORG Sun Nov 27 20:35:02 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 4D99116A41F; Sun, 27 Nov 2005 20:35:02 +0000 (GMT) (envelope-from julian@elischer.org) Received: from delight.idiom.com (outbound.idiom.com [216.240.47.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F28F43D68; Sun, 27 Nov 2005 20:34:51 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id 6C28622737C; Sun, 27 Nov 2005 12:34:51 -0800 (PST) Received: from [192.168.2.5] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id jARKYlhq028069; Sun, 27 Nov 2005 12:34:48 -0800 (PST) (envelope-from julian@elischer.org) Message-ID: <438A1867.1030009@elischer.org> Date: Sun, 27 Nov 2005 12:34:47 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gleb Smirnoff References: <20051127005943.GR25711@cell.sick.ru> <20051127135529.GF25711@cell.sick.ru> In-Reply-To: <20051127135529.GF25711@cell.sick.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: rwatson@freebsd.org, Vsevolod Lobko , 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 20:35:02 -0000 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. > > > would caching help when there are two successive packets of the same flow? That is not that uncommon, even though larger groupings are less common.