kern_mbuf.c (195649) | kern_mbuf.c (209390) |
---|---|
1/*- 2 * Copyright (c) 2004, 2005, 3 * Bosko Milekic <bmilekic@FreeBSD.org>. 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 --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004, 2005, 3 * Bosko Milekic <bmilekic@FreeBSD.org>. 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 --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 195649 2009-07-12 23:31:20Z alc $"); | 29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 209390 2010-06-21 09:55:56Z ed $"); |
30 31#include "opt_param.h" 32 33#include <sys/param.h> 34#include <sys/malloc.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> 37#include <sys/domain.h> --- 190 unchanged lines hidden (view full) --- 228static void mb_dtor_mbuf(void *, int, void *); 229static void mb_dtor_clust(void *, int, void *); 230static void mb_dtor_pack(void *, int, void *); 231static int mb_zinit_pack(void *, int, int); 232static void mb_zfini_pack(void *, int); 233 234static void mb_reclaim(void *); 235static void mbuf_init(void *); | 30 31#include "opt_param.h" 32 33#include <sys/param.h> 34#include <sys/malloc.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> 37#include <sys/domain.h> --- 190 unchanged lines hidden (view full) --- 228static void mb_dtor_mbuf(void *, int, void *); 229static void mb_dtor_clust(void *, int, void *); 230static void mb_dtor_pack(void *, int, void *); 231static int mb_zinit_pack(void *, int, int); 232static void mb_zfini_pack(void *, int); 233 234static void mb_reclaim(void *); 235static void mbuf_init(void *); |
236static void *mbuf_jumbo_alloc(uma_zone_t, int, u_int8_t *, int); | 236static void *mbuf_jumbo_alloc(uma_zone_t, int, uint8_t *, int); |
237 238/* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */ 239CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); 240 241/* 242 * Initialize FreeBSD Network buffer allocation. 243 */ 244SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL); --- 100 unchanged lines hidden (view full) --- 345 346/* 347 * UMA backend page allocator for the jumbo frame zones. 348 * 349 * Allocates kernel virtual memory that is backed by contiguous physical 350 * pages. 351 */ 352static void * | 237 238/* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */ 239CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); 240 241/* 242 * Initialize FreeBSD Network buffer allocation. 243 */ 244SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL); --- 100 unchanged lines hidden (view full) --- 345 346/* 347 * UMA backend page allocator for the jumbo frame zones. 348 * 349 * Allocates kernel virtual memory that is backed by contiguous physical 350 * pages. 351 */ 352static void * |
353mbuf_jumbo_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) | 353mbuf_jumbo_alloc(uma_zone_t zone, int bytes, uint8_t *flags, int wait) |
354{ 355 356 /* Inform UMA that this allocator uses kernel_map/object. */ 357 *flags = UMA_SLAB_KERNEL; 358 return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 359 (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT)); 360} 361 --- 333 unchanged lines hidden --- | 354{ 355 356 /* Inform UMA that this allocator uses kernel_map/object. */ 357 *flags = UMA_SLAB_KERNEL; 358 return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 359 (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT)); 360} 361 --- 333 unchanged lines hidden --- |