diff options
author | kmacy <kmacy@FreeBSD.org> | 2010-05-10 21:31:20 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2010-05-10 21:31:20 +0000 |
commit | c4a8bb5da4b48347306be397d222043f8221596e (patch) | |
tree | 52fcc4e417ce8f1456dbaf26aafaefa9d5fc3230 /sys/netinet6 | |
parent | d757a4d375931afee96ef8b2ceb871e12572f062 (diff) | |
download | FreeBSD-src-c4a8bb5da4b48347306be397d222043f8221596e.zip FreeBSD-src-c4a8bb5da4b48347306be397d222043f8221596e.tar.gz |
boot time size the flowtable
MFC after: 3 days
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_input.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 088e6fa..d1d7c0c 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -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; |