aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2007-07-12 20:50:06 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2007-07-12 20:50:06 +0000
commit67b109e5b831d70413de265e10a855741e8261c5 (patch)
tree8851330afbe5da6caa2aa557dce5e34d30d8b444 /sys/netinet
parent8d29990f70da715ddc4032a278270e9bb3f50ceb (diff)
Notes
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_hostcache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
index 7535d31fe9f5..8f0f3bee3ec3 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -142,6 +142,7 @@ struct tcp_hostcache {
u_int cache_count;
u_int cache_limit;
int expire;
+ int prune;
int purgeall;
};
static struct tcp_hostcache tcp_hostcache;
@@ -170,6 +171,9 @@ SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_RD,
SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_RW,
&tcp_hostcache.expire, 0, "Expire time of TCP hostcache entries");
+SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, prune, CTLFLAG_RW,
+ &tcp_hostcache.prune, 0, "Time between purge runs");
+
SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, purge, CTLFLAG_RW,
&tcp_hostcache.purgeall, 0, "Expire all entires on next purge run");
@@ -209,6 +213,7 @@ tcp_hc_init(void)
tcp_hostcache.cache_limit =
tcp_hostcache.hashsize * tcp_hostcache.bucket_limit;
tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE;
+ tcp_hostcache.prune = TCP_HOSTCACHE_PRUNE;
TUNABLE_INT_FETCH("net.inet.tcp.hostcache.hashsize",
&tcp_hostcache.hashsize);
@@ -218,7 +223,7 @@ tcp_hc_init(void)
&tcp_hostcache.bucket_limit);
if (!powerof2(tcp_hostcache.hashsize)) {
printf("WARNING: hostcache hash size is not a power of 2.\n");
- tcp_hostcache.hashsize = 512; /* safe default */
+ tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; /* default */
}
tcp_hostcache.hashmask = tcp_hostcache.hashsize - 1;
@@ -250,7 +255,7 @@ tcp_hc_init(void)
* Set up periodic cache cleanup.
*/
callout_init(&tcp_hc_callout, CALLOUT_MPSAFE);
- callout_reset(&tcp_hc_callout, TCP_HOSTCACHE_PRUNE * hz, tcp_hc_purge, 0);
+ callout_reset(&tcp_hc_callout, tcp_hostcache.prune * hz, tcp_hc_purge, 0);
}
/*
@@ -661,9 +666,9 @@ tcp_hc_purge(void *arg)
tcp_hostcache.hashbase[i].hch_length--;
tcp_hostcache.cache_count--;
} else
- hc_entry->rmx_expire -= TCP_HOSTCACHE_PRUNE;
+ hc_entry->rmx_expire -= tcp_hostcache.prune;
}
THC_UNLOCK(&tcp_hostcache.hashbase[i].hch_mtx);
}
- callout_reset(&tcp_hc_callout, TCP_HOSTCACHE_PRUNE * hz, tcp_hc_purge, 0);
+ callout_reset(&tcp_hc_callout, tcp_hostcache.prune * hz, tcp_hc_purge, 0);
}