Sat Oct 4 00:09:34 2008 UTC ()
POOL_INIT -> pool_init


(pooka)
diff -r1.112 -r1.113 src/sys/net/route.c
diff -r1.274 -r1.275 src/sys/netinet/ip_input.c

cvs diff -r1.112 -r1.113 src/sys/net/route.c (expand / switch to unified diff)

--- src/sys/net/route.c 2008/05/13 20:49:33 1.112
+++ src/sys/net/route.c 2008/10/04 00:09:34 1.113
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: route.c,v 1.112 2008/05/13 20:49:33 dyoung Exp $ */ 1/* $NetBSD: route.c,v 1.113 2008/10/04 00:09:34 pooka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Kevin M. Lahey of the Numerical Aerospace Simulation Facility, 8 * by Kevin M. Lahey of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center. 9 * NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -83,27 +83,27 @@ @@ -83,27 +83,27 @@
83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
88 * SUCH DAMAGE. 88 * SUCH DAMAGE.
89 * 89 *
90 * @(#)route.c 8.3 (Berkeley) 1/9/95 90 * @(#)route.c 8.3 (Berkeley) 1/9/95
91 */ 91 */
92 92
93#include "opt_route.h" 93#include "opt_route.h"
94 94
95#include <sys/cdefs.h> 95#include <sys/cdefs.h>
96__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.112 2008/05/13 20:49:33 dyoung Exp $"); 96__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.113 2008/10/04 00:09:34 pooka Exp $");
97 97
98#include <sys/param.h> 98#include <sys/param.h>
99#include <sys/sysctl.h> 99#include <sys/sysctl.h>
100#include <sys/systm.h> 100#include <sys/systm.h>
101#include <sys/callout.h> 101#include <sys/callout.h>
102#include <sys/proc.h> 102#include <sys/proc.h>
103#include <sys/mbuf.h> 103#include <sys/mbuf.h>
104#include <sys/socket.h> 104#include <sys/socket.h>
105#include <sys/socketvar.h> 105#include <sys/socketvar.h>
106#include <sys/domain.h> 106#include <sys/domain.h>
107#include <sys/protosw.h> 107#include <sys/protosw.h>
108#include <sys/kernel.h> 108#include <sys/kernel.h>
109#include <sys/ioctl.h> 109#include <sys/ioctl.h>
@@ -118,30 +118,28 @@ __KERNEL_RCSID(0, "$NetBSD: route.c,v 1. @@ -118,30 +118,28 @@ __KERNEL_RCSID(0, "$NetBSD: route.c,v 1.
118 118
119#ifdef RTFLUSH_DEBUG 119#ifdef RTFLUSH_DEBUG
120#define rtcache_debug() __predict_false(_rtcache_debug) 120#define rtcache_debug() __predict_false(_rtcache_debug)
121#else /* RTFLUSH_DEBUG */ 121#else /* RTFLUSH_DEBUG */
122#define rtcache_debug() 0 122#define rtcache_debug() 0
123#endif /* RTFLUSH_DEBUG */ 123#endif /* RTFLUSH_DEBUG */
124 124
125struct route_cb route_cb; 125struct route_cb route_cb;
126struct rtstat rtstat; 126struct rtstat rtstat;
127struct radix_node_head *rt_tables[AF_MAX+1]; 127struct radix_node_head *rt_tables[AF_MAX+1];
128 128
129int rttrash; /* routes not in table but not freed */ 129int rttrash; /* routes not in table but not freed */
130 130
131POOL_INIT(rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentpl", NULL, 131struct pool rtentry_pool;
132 IPL_SOFTNET); 132struct pool rttimer_pool;
133POOL_INIT(rttimer_pool, sizeof(struct rttimer), 0, 0, 0, "rttmrpl", NULL, 
134 IPL_SOFTNET); 
135 133
136struct callout rt_timer_ch; /* callout for rt_timer_timer() */ 134struct callout rt_timer_ch; /* callout for rt_timer_timer() */
137 135
138#ifdef RTFLUSH_DEBUG 136#ifdef RTFLUSH_DEBUG
139static int _rtcache_debug = 0; 137static int _rtcache_debug = 0;
140#endif /* RTFLUSH_DEBUG */ 138#endif /* RTFLUSH_DEBUG */
141 139
142static int rtdeletemsg(struct rtentry *); 140static int rtdeletemsg(struct rtentry *);
143static int rtflushclone1(struct rtentry *, void *); 141static int rtflushclone1(struct rtentry *, void *);
144static void rtflushclone(sa_family_t family, struct rtentry *); 142static void rtflushclone(sa_family_t family, struct rtentry *);
145 143
146#ifdef RTFLUSH_DEBUG 144#ifdef RTFLUSH_DEBUG
147SYSCTL_SETUP(sysctl_net_rtcache_setup, "sysctl net.rtcache.debug setup") 145SYSCTL_SETUP(sysctl_net_rtcache_setup, "sysctl net.rtcache.debug setup")
@@ -212,26 +210,31 @@ void @@ -212,26 +210,31 @@ void
212rtable_init(void **table) 210rtable_init(void **table)
213{ 211{
214 struct domain *dom; 212 struct domain *dom;
215 DOMAIN_FOREACH(dom) 213 DOMAIN_FOREACH(dom)
216 if (dom->dom_rtattach) 214 if (dom->dom_rtattach)
217 dom->dom_rtattach(&table[dom->dom_family], 215 dom->dom_rtattach(&table[dom->dom_family],
218 dom->dom_rtoffset); 216 dom->dom_rtoffset);
219} 217}
220 218
221void 219void
222route_init(void) 220route_init(void)
223{ 221{
224 222
 223 pool_init(&rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentpl",
 224 NULL, IPL_SOFTNET);
 225 pool_init(&rttimer_pool, sizeof(struct rttimer), 0, 0, 0, "rttmrpl",
 226 NULL, IPL_SOFTNET);
 227
225 rt_init(); 228 rt_init();
226 rn_init(); /* initialize all zeroes, all ones, mask table */ 229 rn_init(); /* initialize all zeroes, all ones, mask table */
227 rtable_init((void **)rt_tables); 230 rtable_init((void **)rt_tables);
228} 231}
229 232
230void 233void
231rtflushall(int family) 234rtflushall(int family)
232{ 235{
233 struct domain *dom; 236 struct domain *dom;
234 237
235 if (rtcache_debug()) 238 if (rtcache_debug())
236 printf("%s: enter\n", __func__); 239 printf("%s: enter\n", __func__);
237 240

cvs diff -r1.274 -r1.275 src/sys/netinet/ip_input.c (expand / switch to unified diff)

--- src/sys/netinet/ip_input.c 2008/09/05 13:39:12 1.274
+++ src/sys/netinet/ip_input.c 2008/10/04 00:09:34 1.275
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ip_input.c,v 1.274 2008/09/05 13:39:12 seanb Exp $ */ 1/* $NetBSD: ip_input.c,v 1.275 2008/10/04 00:09:34 pooka Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -81,27 +81,27 @@ @@ -81,27 +81,27 @@
81 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 81 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
82 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 82 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
88 * SUCH DAMAGE. 88 * SUCH DAMAGE.
89 * 89 *
90 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 90 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94
91 */ 91 */
92 92
93#include <sys/cdefs.h> 93#include <sys/cdefs.h>
94__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.274 2008/09/05 13:39:12 seanb Exp $"); 94__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.275 2008/10/04 00:09:34 pooka Exp $");
95 95
96#include "opt_inet.h" 96#include "opt_inet.h"
97#include "opt_gateway.h" 97#include "opt_gateway.h"
98#include "opt_pfil_hooks.h" 98#include "opt_pfil_hooks.h"
99#include "opt_ipsec.h" 99#include "opt_ipsec.h"
100#include "opt_mrouting.h" 100#include "opt_mrouting.h"
101#include "opt_mbuftrace.h" 101#include "opt_mbuftrace.h"
102#include "opt_inet_csum.h" 102#include "opt_inet_csum.h"
103 103
104#include <sys/param.h> 104#include <sys/param.h>
105#include <sys/systm.h> 105#include <sys/systm.h>
106#include <sys/malloc.h> 106#include <sys/malloc.h>
107#include <sys/mbuf.h> 107#include <sys/mbuf.h>
@@ -320,30 +320,28 @@ do { \ @@ -320,30 +320,28 @@ do { \
320do { \ 320do { \
321 if (ipq_locked == 0) { \ 321 if (ipq_locked == 0) { \
322 printf("%s:%d: ipq lock not held\n", __FILE__, __LINE__); \ 322 printf("%s:%d: ipq lock not held\n", __FILE__, __LINE__); \
323 panic("ipq lock check"); \ 323 panic("ipq lock check"); \
324 } \ 324 } \
325} while (/*CONSTCOND*/ 0) 325} while (/*CONSTCOND*/ 0)
326#else 326#else
327#define IPQ_LOCK() (void) ipq_lock_try() 327#define IPQ_LOCK() (void) ipq_lock_try()
328#define IPQ_LOCK_CHECK() /* nothing */ 328#define IPQ_LOCK_CHECK() /* nothing */
329#endif 329#endif
330 330
331#define IPQ_UNLOCK() ipq_unlock() 331#define IPQ_UNLOCK() ipq_unlock()
332 332
333POOL_INIT(inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl", NULL, 333struct pool inmulti_pool;
334 IPL_SOFTNET); 334struct pool ipqent_pool;
335POOL_INIT(ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl", NULL, 
336 IPL_VM); 
337 335
338#ifdef INET_CSUM_COUNTERS 336#ifdef INET_CSUM_COUNTERS
339#include <sys/device.h> 337#include <sys/device.h>
340 338
341struct evcnt ip_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, 339struct evcnt ip_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
342 NULL, "inet", "hwcsum bad"); 340 NULL, "inet", "hwcsum bad");
343struct evcnt ip_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, 341struct evcnt ip_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
344 NULL, "inet", "hwcsum ok"); 342 NULL, "inet", "hwcsum ok");
345struct evcnt ip_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, 343struct evcnt ip_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
346 NULL, "inet", "swcsum"); 344 NULL, "inet", "swcsum");
347 345
348#define INET_CSUM_COUNTER_INCR(ev) (ev)->ev_count++ 346#define INET_CSUM_COUNTER_INCR(ev) (ev)->ev_count++
349 347
@@ -389,26 +387,31 @@ ip_nmbclusters_changed(void) @@ -389,26 +387,31 @@ ip_nmbclusters_changed(void)
389 ip_nmbclusters = nmbclusters; 387 ip_nmbclusters = nmbclusters;
390} 388}
391 389
392/* 390/*
393 * IP initialization: fill in IP protocol switch table. 391 * IP initialization: fill in IP protocol switch table.
394 * All protocols not implemented in kernel go to raw IP protocol handler. 392 * All protocols not implemented in kernel go to raw IP protocol handler.
395 */ 393 */
396void 394void
397ip_init(void) 395ip_init(void)
398{ 396{
399 const struct protosw *pr; 397 const struct protosw *pr;
400 int i; 398 int i;
401 399
 400 pool_init(&inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl",
 401 NULL, IPL_SOFTNET);
 402 pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl",
 403 NULL, IPL_VM);
 404
402 pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); 405 pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
403 if (pr == 0) 406 if (pr == 0)
404 panic("ip_init"); 407 panic("ip_init");
405 for (i = 0; i < IPPROTO_MAX; i++) 408 for (i = 0; i < IPPROTO_MAX; i++)
406 ip_protox[i] = pr - inetsw; 409 ip_protox[i] = pr - inetsw;
407 for (pr = inetdomain.dom_protosw; 410 for (pr = inetdomain.dom_protosw;
408 pr < inetdomain.dom_protoswNPROTOSW; pr++) 411 pr < inetdomain.dom_protoswNPROTOSW; pr++)
409 if (pr->pr_domain->dom_family == PF_INET && 412 if (pr->pr_domain->dom_family == PF_INET &&
410 pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) 413 pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW)
411 ip_protox[pr->pr_protocol] = pr - inetsw; 414 ip_protox[pr->pr_protocol] = pr - inetsw;
412 415
413 for (i = 0; i < IPREASS_NHASH; i++) 416 for (i = 0; i < IPREASS_NHASH; i++)
414 LIST_INIT(&ipq[i]); 417 LIST_INIT(&ipq[i]);