From owner-svn-src-all@FreeBSD.ORG Mon May 10 21:31:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 285CB1065672; Mon, 10 May 2010 21:31:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 18ECF8FC0C; Mon, 10 May 2010 21:31:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4ALVK11074550; Mon, 10 May 2010 21:31:20 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4ALVKmg074548; Mon, 10 May 2010 21:31:20 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201005102131.o4ALVKmg074548@svn.freebsd.org> From: Kip Macy Date: Mon, 10 May 2010 21:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207902 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 21:31:21 -0000 Author: kmacy Date: Mon May 10 21:31:20 2010 New Revision: 207902 URL: http://svn.freebsd.org/changeset/base/207902 Log: boot time size the flowtable MFC after: 3 days Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon May 10 21:04:45 2010 (r207901) +++ head/sys/netinet6/ip6_input.c Mon May 10 21:31:20 2010 (r207902) @@ -177,9 +177,21 @@ ip6_init(void) frag6_init(); #ifdef FLOWTABLE - TUNABLE_INT_FETCH("net.inet6.ip6.output_flowtable_size", - &V_ip6_output_flowtable_size); - V_ip6_ft = flowtable_alloc("ipv6", V_ip6_output_flowtable_size, FL_PCPU); + if (TUNABLE_INT_FETCH("net.inet6.ip6.output_flowtable_size", + &V_ip6_output_flowtable_size)) { + if (V_ip6_output_flowtable_size < 256) + V_ip6_output_flowtable_size = 256; + if (!powerof2(V_ip6_output_flowtable_size)) { + printf("flowtable must be power of 2 size\n"); + V_ip6_output_flowtable_size = 2048; + } + } else { + /* + * round up to the next power of 2 + */ + V_ip6_output_flowtable_size = 1 << fls((1024 + maxusers * 64)-1); + } + V_ip6_ft = flowtable_alloc("ipv6", V_ip6_output_flowtable_size, FL_PCPU); #endif V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR;