ip_reass.c (155425) | ip_reass.c (157927) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 |
30 * $FreeBSD: head/sys/netinet/ip_input.c 155425 2006-02-07 11:48:10Z oleg $ | 30 * $FreeBSD: head/sys/netinet/ip_input.c 157927 2006-04-21 09:25:40Z ps $ |
31 */ 32 33#include "opt_bootp.h" 34#include "opt_ipfw.h" 35#include "opt_ipstealth.h" 36#include "opt_ipsec.h" 37#include "opt_mac.h" 38#include "opt_carp.h" --- 123 unchanged lines hidden (view full) --- 162static struct mtx ipqlock; 163 164#define IPQ_LOCK() mtx_lock(&ipqlock) 165#define IPQ_UNLOCK() mtx_unlock(&ipqlock) 166#define IPQ_LOCK_INIT() mtx_init(&ipqlock, "ipqlock", NULL, MTX_DEF) 167#define IPQ_LOCK_ASSERT() mtx_assert(&ipqlock, MA_OWNED) 168 169static void maxnipq_update(void); | 31 */ 32 33#include "opt_bootp.h" 34#include "opt_ipfw.h" 35#include "opt_ipstealth.h" 36#include "opt_ipsec.h" 37#include "opt_mac.h" 38#include "opt_carp.h" --- 123 unchanged lines hidden (view full) --- 162static struct mtx ipqlock; 163 164#define IPQ_LOCK() mtx_lock(&ipqlock) 165#define IPQ_UNLOCK() mtx_unlock(&ipqlock) 166#define IPQ_LOCK_INIT() mtx_init(&ipqlock, "ipqlock", NULL, MTX_DEF) 167#define IPQ_LOCK_ASSERT() mtx_assert(&ipqlock, MA_OWNED) 168 169static void maxnipq_update(void); |
170static void ipq_zone_change(void *); |
|
170 171static int maxnipq; /* Administrative limit on # reass queues. */ 172static int nipq = 0; /* Total # of reass queues */ 173SYSCTL_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, &nipq, 0, 174 "Current number of IPv4 fragment reassembly queue entries"); 175 176static int maxfragsperpacket; 177SYSCTL_INT(_net_inet_ip, OID_AUTO, maxfragsperpacket, CTLFLAG_RW, --- 73 unchanged lines hidden (view full) --- 251 NULL, UMA_ALIGN_PTR, 0); 252 maxnipq_update(); 253 254 /* Start ipport_tick. */ 255 callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); 256 ipport_tick(NULL); 257 EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL, 258 SHUTDOWN_PRI_DEFAULT); | 171 172static int maxnipq; /* Administrative limit on # reass queues. */ 173static int nipq = 0; /* Total # of reass queues */ 174SYSCTL_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD, &nipq, 0, 175 "Current number of IPv4 fragment reassembly queue entries"); 176 177static int maxfragsperpacket; 178SYSCTL_INT(_net_inet_ip, OID_AUTO, maxfragsperpacket, CTLFLAG_RW, --- 73 unchanged lines hidden (view full) --- 252 NULL, UMA_ALIGN_PTR, 0); 253 maxnipq_update(); 254 255 /* Start ipport_tick. */ 256 callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); 257 ipport_tick(NULL); 258 EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL, 259 SHUTDOWN_PRI_DEFAULT); |
260 EVENTHANDLER_REGISTER(nmbclusters_change, ipq_zone_change, 261 NULL, EVENTHANDLER_PRI_ANY); |
|
259 260 /* Initialize various other remaining things. */ 261 ip_id = time_second & 0xffff; 262 ipintrq.ifq_maxlen = ipqmaxlen; 263 mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); 264 netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE); 265} 266 --- 415 unchanged lines hidden (view full) --- 682 * Zero specifies no further fragment queue allocation -- set the 683 * bound very low, but rely on implementation elsewhere to actually 684 * prevent allocation and reclaim current queues. 685 */ 686 if (maxnipq == 0) 687 uma_zone_set_max(ipq_zone, 1); 688} 689 | 262 263 /* Initialize various other remaining things. */ 264 ip_id = time_second & 0xffff; 265 ipintrq.ifq_maxlen = ipqmaxlen; 266 mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); 267 netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE); 268} 269 --- 415 unchanged lines hidden (view full) --- 685 * Zero specifies no further fragment queue allocation -- set the 686 * bound very low, but rely on implementation elsewhere to actually 687 * prevent allocation and reclaim current queues. 688 */ 689 if (maxnipq == 0) 690 uma_zone_set_max(ipq_zone, 1); 691} 692 |
693static void 694ipq_zone_change(void *tag) 695{ 696 697 if (maxnipq > 0 && maxnipq < (nmbclusters / 32)) { 698 maxnipq = nmbclusters / 32; 699 maxnipq_update(); 700 } 701} 702 |
|
690static int 691sysctl_maxnipq(SYSCTL_HANDLER_ARGS) 692{ 693 int error, i; 694 695 i = maxnipq; 696 error = sysctl_handle_int(oidp, &i, 0, req); 697 if (error || !req->newptr) --- 889 unchanged lines hidden --- | 703static int 704sysctl_maxnipq(SYSCTL_HANDLER_ARGS) 705{ 706 int error, i; 707 708 i = maxnipq; 709 error = sysctl_handle_int(oidp, &i, 0, req); 710 if (error || !req->newptr) --- 889 unchanged lines hidden --- |