FreeBSD kernel kern code
uipc_mbuf.c File Reference
#include <sys/cdefs.h>
#include "opt_param.h"
#include "opt_mbuf_stress_test.h"
#include "opt_mbuf_profiling.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/sysctl.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/uio.h>
Include dependency graph for uipc_mbuf.c:

Go to the source code of this file.

Macros

#define M_SANITY_ACTION(s)   printf("mbuf %p: " s, m)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
 SYSCTL_INT (_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RD,&max_linkhdr, 0,"Size of largest link layer header")
 
 SYSCTL_INT (_kern_ipc, KIPC_MAX_PROTOHDR, max_protohdr, CTLFLAG_RD,&max_protohdr, 0,"Size of largest protocol layer header")
 
 SYSCTL_INT (_kern_ipc, KIPC_MAX_HDR, max_hdr, CTLFLAG_RD,&max_hdr, 0,"Size of largest link plus protocol header")
 
 SYSCTL_INT (_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RD,&max_datalen, 0,"Minimum space left in mbuf after max_hdr")
 
struct mbuf * m_getm2 (struct mbuf *m, int len, int how, short type, int flags)
 
void m_freem (struct mbuf *mb)
 
void m_extadd (struct mbuf *mb, caddr_t buf, u_int size, void(*freef)(void *, void *), void *arg1, void *arg2, int flags, int type)
 
void mb_free_ext (struct mbuf *m)
 
static void mb_dupcl (struct mbuf *n, struct mbuf *m)
 
void m_demote (struct mbuf *m0, int all)
 
int m_sanity (struct mbuf *m0, int sanitize)
 
void m_move_pkthdr (struct mbuf *to, struct mbuf *from)
 
int m_dup_pkthdr (struct mbuf *to, struct mbuf *from, int how)
 
struct mbuf * m_prepend (struct mbuf *m, int len, int how)
 
struct mbuf * m_copym (struct mbuf *m, int off0, int len, int wait)
 
static int m_bcopyxxx (void *s, void *t, u_int len)
 
struct mbuf * m_copymdata (struct mbuf *m, struct mbuf *n, int off, int len, int prep, int how)
 
struct mbuf * m_copypacket (struct mbuf *m, int how)
 
void m_copydata (const struct mbuf *m, int off, int len, caddr_t cp)
 
struct mbuf * m_dup (struct mbuf *m, int how)
 
void m_cat (struct mbuf *m, struct mbuf *n)
 
void m_adj (struct mbuf *mp, int req_len)
 
struct mbuf * m_pullup (struct mbuf *n, int len)
 
struct mbuf * m_copyup (struct mbuf *n, int len, int dstoff)
 
struct mbuf * m_split (struct mbuf *m0, int len0, int wait)
 
struct mbuf * m_devget (char *buf, int totlen, int off, struct ifnet *ifp, void(*copy)(char *from, caddr_t to, u_int len))
 
void m_copyback (struct mbuf *m0, int off, int len, c_caddr_t cp)
 
int m_append (struct mbuf *m0, int len, c_caddr_t cp)
 
int m_apply (struct mbuf *m, int off, int len, int(*f)(void *, void *, u_int), void *arg)
 
struct mbuf * m_getptr (struct mbuf *m, int loc, int *off)
 
void m_print (const struct mbuf *m, int maxlen)
 
u_int m_fixhdr (struct mbuf *m0)
 
u_int m_length (struct mbuf *m0, struct mbuf **last)
 
struct mbuf * m_defrag (struct mbuf *m0, int how)
 
struct mbuf * m_collapse (struct mbuf *m0, int how, int maxfrags)
 
struct mbuf * m_uiotombuf (struct uio *uio, int how, int len, int align, int flags)
 
int m_mbuftouio (struct uio *uio, struct mbuf *m, int len)
 
void m_align (struct mbuf *m, int len)
 
struct mbuf * m_unshare (struct mbuf *m0, int how)
 

Variables

int max_linkhdr
 
int max_protohdr
 
int max_hdr
 
int max_datalen
 
int MSFail
 

Macro Definition Documentation

#define M_SANITY_ACTION (   s)    printf("mbuf %p: " s, m)

Referenced by m_sanity().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
void m_adj ( struct mbuf *  mp,
int  req_len 
)

Definition at line 930 of file uipc_mbuf.c.

References count, and m_freem().

Referenced by m_pulldown().

Here is the call graph for this function:

Here is the caller graph for this function:

void m_align ( struct mbuf *  m,
int  len 
)

Definition at line 1813 of file uipc_mbuf.c.

int m_append ( struct mbuf *  m0,
int  len,
c_caddr_t  cp 
)

Definition at line 1308 of file uipc_mbuf.c.

int m_apply ( struct mbuf *  m,
int  off,
int  len,
int(*)(void *, void *, u_int)  f,
void *  arg 
)

Definition at line 1351 of file uipc_mbuf.c.

References count.

Referenced by m_copymdata().

Here is the caller graph for this function:

static int m_bcopyxxx ( void *  s,
void *  t,
u_int  len 
)
static

Definition at line 606 of file uipc_mbuf.c.

Referenced by m_copymdata().

Here is the caller graph for this function:

void m_cat ( struct mbuf *  m,
struct mbuf *  n 
)

Definition at line 910 of file uipc_mbuf.c.

Referenced by m_defrag(), and soreceive_stream().

Here is the caller graph for this function:

struct mbuf* m_collapse ( struct mbuf *  m0,
int  how,
int  maxfrags 
)

Definition at line 1565 of file uipc_mbuf.c.

void m_copyback ( struct mbuf *  m0,
int  off,
int  len,
c_caddr_t  cp 
)

Definition at line 1252 of file uipc_mbuf.c.

void m_copydata ( const struct mbuf *  m,
int  off,
int  len,
caddr_t  cp 
)

Definition at line 804 of file uipc_mbuf.c.

References count.

Referenced by m_defrag(), m_dup1(), and m_pulldown().

Here is the caller graph for this function:

struct mbuf* m_copym ( struct mbuf *  m,
int  off0,
int  len,
int  wait 
)

Definition at line 528 of file uipc_mbuf.c.

References m_dup_pkthdr(), m_freem(), mb_dupcl(), and mbstat.

Referenced by md_get_mbuf(), soreceive_generic(), and soreceive_stream().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mbuf* m_copymdata ( struct mbuf *  m,
struct mbuf *  n,
int  off,
int  len,
int  prep,
int  how 
)

Definition at line 613 of file uipc_mbuf.c.

References m_apply(), m_bcopyxxx(), and m_move_pkthdr().

Here is the call graph for this function:

struct mbuf* m_copypacket ( struct mbuf *  m,
int  how 
)

Definition at line 752 of file uipc_mbuf.c.

References m_dup_pkthdr(), m_freem(), mb_dupcl(), and mbstat.

Here is the call graph for this function:

struct mbuf* m_copyup ( struct mbuf *  n,
int  len,
int  dstoff 
)

Definition at line 1073 of file uipc_mbuf.c.

References count, m_freem(), and max_protohdr.

Here is the call graph for this function:

struct mbuf* m_defrag ( struct mbuf *  m0,
int  how 
)

Definition at line 1482 of file uipc_mbuf.c.

References m_cat(), m_copydata(), m_dup_pkthdr(), m_fixhdr(), and m_freem().

Here is the call graph for this function:

void m_demote ( struct mbuf *  m0,
int  all 
)

Definition at line 314 of file uipc_mbuf.c.

References m_freem(), and m_tag_delete_chain().

Here is the call graph for this function:

struct mbuf* m_devget ( char *  buf,
int  totlen,
int  off,
struct ifnet *  ifp,
void(*)(char *from, caddr_t to, u_int len)  copy 
)

Definition at line 1186 of file uipc_mbuf.c.

References m_freem(), and max_linkhdr.

Here is the call graph for this function:

struct mbuf* m_dup ( struct mbuf *  m,
int  how 
)

Definition at line 834 of file uipc_mbuf.c.

References m_dup_pkthdr(), m_freem(), and mbstat.

Here is the call graph for this function:

int m_dup_pkthdr ( struct mbuf *  to,
struct mbuf *  from,
int  how 
)

Definition at line 459 of file uipc_mbuf.c.

References m_tag_copy_chain(), and m_tag_delete_chain().

Referenced by m_copym(), m_copypacket(), m_defrag(), m_dup(), and m_dup1().

Here is the call graph for this function:

Here is the caller graph for this function:

void m_extadd ( struct mbuf *  mb,
caddr_t  buf,
u_int  size,
void(*)(void *, void *)  freef,
void *  arg1,
void *  arg2,
int  flags,
int  type 
)

Definition at line 186 of file uipc_mbuf.c.

References buf, type, and zone_ext_refcnt.

u_int m_fixhdr ( struct mbuf *  m0)

Definition at line 1444 of file uipc_mbuf.c.

References m_length().

Referenced by m_defrag(), and mb_fixhdr().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mbuf* m_getm2 ( struct mbuf *  m,
int  len,
int  how,
short  type,
int  flags 
)

Definition at line 95 of file uipc_mbuf.c.

References m_freem().

Referenced by m_uiotombuf().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mbuf* m_getptr ( struct mbuf *  m,
int  loc,
int *  off 
)

Definition at line 1383 of file uipc_mbuf.c.

u_int m_length ( struct mbuf *  m0,
struct mbuf **  last 
)

Definition at line 1454 of file uipc_mbuf.c.

Referenced by kern_sendfile(), m_fixhdr(), sbappendaddr_locked(), and sbappendcontrol_locked().

Here is the caller graph for this function:

int m_mbuftouio ( struct uio *  uio,
struct mbuf *  m,
int  len 
)

Definition at line 1783 of file uipc_mbuf.c.

References uiomove().

Referenced by soreceive_stream().

Here is the call graph for this function:

Here is the caller graph for this function:

void m_move_pkthdr ( struct mbuf *  to,
struct mbuf *  from 
)

Definition at line 428 of file uipc_mbuf.c.

References m_tag_delete_chain().

Referenced by m_copymdata().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mbuf* m_prepend ( struct mbuf *  m,
int  len,
int  how 
)

Definition at line 493 of file uipc_mbuf.c.

References m_freem().

Here is the call graph for this function:

void m_print ( const struct mbuf *  m,
int  maxlen 
)

Definition at line 1408 of file uipc_mbuf.c.

References printf().

Here is the call graph for this function:

struct mbuf* m_pullup ( struct mbuf *  n,
int  len 
)

Definition at line 1011 of file uipc_mbuf.c.

References count, m_freem(), max_protohdr, and mbstat.

Here is the call graph for this function:

int m_sanity ( struct mbuf *  m0,
int  sanitize 
)

Definition at line 342 of file uipc_mbuf.c.

References m_freem(), M_SANITY_ACTION, and m_tag_delete_chain().

Here is the call graph for this function:

struct mbuf* m_split ( struct mbuf *  m0,
int  len0,
int  wait 
)

Definition at line 1124 of file uipc_mbuf.c.

References mb_dupcl().

Here is the call graph for this function:

struct mbuf* m_uiotombuf ( struct uio *  uio,
int  how,
int  len,
int  align,
int  flags 
)

Definition at line 1727 of file uipc_mbuf.c.

References m_freem(), m_getm2(), and uiomove().

Referenced by kern_sendfile(), sosend_dgram(), and sosend_generic().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mbuf* m_unshare ( struct mbuf *  m0,
int  how 
)

Definition at line 1836 of file uipc_mbuf.c.

References m_freem().

Here is the call graph for this function:

static void mb_dupcl ( struct mbuf *  n,
struct mbuf *  m 
)
static

Definition at line 287 of file uipc_mbuf.c.

Referenced by m_copym(), m_copypacket(), and m_split().

Here is the caller graph for this function:

void mb_free_ext ( struct mbuf *  m)
SYSCTL_INT ( _kern_ipc  ,
KIPC_MAX_LINKHDR  ,
max_linkhdr  ,
CTLFLAG_RD  ,
max_linkhdr,
,
"Size of largest link layer header"   
)
SYSCTL_INT ( _kern_ipc  ,
KIPC_MAX_PROTOHDR  ,
max_protohdr  ,
CTLFLAG_RD  ,
max_protohdr,
,
"Size of largest protocol layer header"   
)
SYSCTL_INT ( _kern_ipc  ,
KIPC_MAX_HDR  ,
max_hdr  ,
CTLFLAG_RD  ,
max_hdr,
,
"Size of largest link plus protocol header"   
)
SYSCTL_INT ( _kern_ipc  ,
KIPC_MAX_DATALEN  ,
max_datalen  ,
CTLFLAG_RD  ,
max_datalen,
,
"Minimum space left in mbuf after max_hdr  
)

Variable Documentation

int max_datalen

Definition at line 54 of file uipc_mbuf.c.

Referenced by domain_init().

int max_hdr

Definition at line 53 of file uipc_mbuf.c.

Referenced by domain_init(), sosend_dgram(), and sosend_generic().

int max_linkhdr

Definition at line 51 of file uipc_mbuf.c.

Referenced by domain_init(), domaininit(), and m_devget().

int max_protohdr

Definition at line 52 of file uipc_mbuf.c.

Referenced by domain_init(), m_copyup(), and m_pullup().

int MSFail

Definition at line 1070 of file uipc_mbuf.c.