jumbo, jumbo_vm_init, jumbo_pg_alloc, jumbo_pg_free, jumbo_freem,
jumbo_pg_steal, jumbo_phys_to_kva -- kernel interface for allocating and
freeing page-sized disposable buffers
#include <sys/jumbo.h>
int
jumbo_vm_init(void);
vm_page_t
jumbo_pg_alloc(void);
void
jumbo_pg_free(vm_offset_t addr);
void
jumbo_freem(caddr_t addr, void *args);
void
jumbo_pg_steal(vm_page_t pg);
caddr_t
jumbo_phys_to_kva(vm_offset_t pa);
The jumbo buffer facility is designed for allocating disposable pagesized
buffers. Buffers allocated via this facility can either be
returned or not. This facility is primarily intended for use with network
adapters that have MTUs of a page or greater size. The buffers will
normally be disposed of by the zero_copy(9) receive code.
jumbo_vm_init() initializes the pool of KVA the jumbo code needs to operate
and does some other initialization to prepare the subsystem for operation.
This routine only needs to be called once. Calling it multiple
times will have no effect. It is recommended that this initialization
routine be called in a device driver attach routine, so that resources
are not allocated if the jumbo subsystem will not end up being used.
jumbo_vm_init() returns 1 upon successful completion, and 0 upon failure.
jumbo_pg_alloc() allocates a physical page and assigns a piece of KVA
from the jumbo KVA pool. It returns the allocated page if successful,
and NULL in the case of failure.
jumbo_pg_free() frees a page allocated by jumbo_pg_alloc(). It takes the
address of the memory in question as an argument. This routine will normally
be used in cases where the allocated jumbo page cannot be used for
some reason. The normal free path is via jumbo_freem().
jumbo_freem() is the routine that should be given as the external free
routine when an external mbuf is allocated using pages from the jumbo
allocator. It takes the virtual address of the page in question, and
ignores the second argument.
jumbo_pg_steal() ``steals'' a page and recycles its KVA space.
jumbo_phys_to_kva() translates the physical address of a jumbo allocated
page to the proper kernel virtual address.
ti(4), zero_copy(9)
The jumbo allocator is primarily based on a page allocator system originally
written by Andrew Gallatin <[email protected]> as part of a set
of zero copy patches for the ti(4) driver. The allocator was taken out
of the ti(4) driver, cleaned up and ported to the new mutex(9) interface
by Kenneth Merry <[email protected]>.
The jumbo allocator first appeared in FreeBSD 5.0, and has existed in
patch form since at least 1999.
Andrew Gallatin <[email protected]>
Kenneth Merry <[email protected]>
There is currently a static number of KVA pages allocated by the jumbo
allocator, with no real provision for increasing the number of pages
allocated should demand exceed supply.
The jumbo_pg_steal() function is not currently used anywhere.
FreeBSD 5.2.1 June 23, 2002 FreeBSD 5.2.1 [ Back ] |