Init ipflow pool dynamically instead of using a linkset.

This commit is contained in:
pooka 2009-02-01 17:04:11 +00:00
parent 07a88e53a6
commit b660d07d87
3 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_proto.c,v 1.95 2008/11/25 18:28:05 pooka Exp $ */
/* $NetBSD: in_proto.c,v 1.96 2009/02/01 17:04:11 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.95 2008/11/25 18:28:05 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.96 2009/02/01 17:04:11 pooka Exp $");
#include "opt_mrouting.h"
#include "opt_eon.h" /* ISO CLNL over IP */
@ -258,6 +258,7 @@ const struct protosw inetsw[] = {
{ .pr_domain = &inetdomain,
.pr_protocol = IPPROTO_IP,
.pr_slowtimo = ipflow_slowtimo,
.pr_init = ipflow_poolinit,
},
#endif /* GATEWAY */
#ifdef IPSEC

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_flow.c,v 1.56 2008/04/28 20:24:09 martin Exp $ */
/* $NetBSD: ip_flow.c,v 1.57 2009/02/01 17:04:11 pooka Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.56 2008/04/28 20:24:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.57 2009/02/01 17:04:11 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -80,8 +80,7 @@ struct ipflow {
#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */
POOL_INIT(ipflow_pool, sizeof(struct ipflow), 0, 0, 0, "ipflowpl", NULL,
IPL_NET);
static struct pool ipflow_pool;
LIST_HEAD(ipflowhead, ipflow);
@ -141,6 +140,14 @@ ipflow_lookup(const struct ip *ip)
return ipf;
}
void
ipflow_poolinit()
{
pool_init(&ipflow_pool, sizeof(struct ipflow), 0, 0, 0, "ipflowpl",
NULL, IPL_NET);
}
int
ipflow_init(int table_size)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_var.h,v 1.90 2008/10/12 11:15:54 plunky Exp $ */
/* $NetBSD: ip_var.h,v 1.91 2009/02/01 17:04:11 pooka Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -236,6 +236,7 @@ int rip_output(struct mbuf *, ...);
int rip_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
int ipflow_init(int);
void ipflow_poolinit(void);
void ipflow_prune(void);
void ipflow_create(const struct route *, struct mbuf *);
void ipflow_slowtimo(void);