#include <sys/mbuf.h>

sys/mbuf.h

22 macros · 4 structs · 2 typedefs · 1 enum

macroMT_FREE

mbuf types
#define MT_FREE 0
should be on free list

macroMT_DATA

#define MT_DATA 1
dynamic (data) allocation

macroMT_HEADER

#define MT_HEADER 2
packet header

macroMT_SOCKET

#define MT_SOCKET 3
socket structure

macroMT_PCB

#define MT_PCB 4
protocol control block

macroMT_RTABLE

#define MT_RTABLE 5
routing tables

macroMT_HTABLE

#define MT_HTABLE 6
IMP host tables

macroMT_ATABLE

#define MT_ATABLE 7
address resolution tables

macroMT_SONAME

#define MT_SONAME 8
socket name

macroMT_SOOPTS

#define MT_SOOPTS 10
socket options

macroMT_FTABLE

#define MT_FTABLE 11
fragment reassembly header

macroMT_RIGHTS

#define MT_RIGHTS 12
access rights

macroMT_IFADDR

#define MT_IFADDR 13
interface address

macroMT_CONTROL

#define MT_CONTROL 14
extra-data protocol message

macroMT_OOBDATA

#define MT_OOBDATA 15
expedited data

macroMT_TAG

#define MT_TAG 16
volatile metadata associated to pkts

macroMT_MAX

#define MT_MAX 32
enough?

enum(anonymous)

underlying type unsigned int
MTF_FREE1
MTF_DATA2
MTF_HEADER4
MTF_SOCKET8
MTF_PCB16
MTF_RTABLE32
MTF_HTABLE64
MTF_ATABLE128
MTF_SONAME256
MTF_SOOPTS1024
MTF_FTABLE2048
MTF_RIGHTS4096
MTF_IFADDR8192
MTF_CONTROL16384
MTF_OOBDATA32768
MTF_TAG65536

structmbstat

Mbuf statistics (legacy).
size 584, align 4
u_int32_tm_mbufsmbufs obtained from page pool
u_int32_tm_clustersclusters obtained from page pool
u_int32_tm_sparespare field
u_int32_tm_clfreefree clusters
u_int32_tm_dropstimes failed to find space
u_int32_tm_waittimes waited for space
u_int32_tm_draintimes drained protocols for space
u_short[256]m_mtypestype specific mbuf allocations
u_int32_tm_mcfailtimes m_copym failed
u_int32_tm_mpfailtimes m_pullup failed
u_int32_tm_msizelength of an mbuf
u_int32_tm_mclbyteslength of an mbuf cluster
u_int32_tm_minclsizemin length of data to allocate a cluster
u_int32_tm_mlenlength of data in an mbuf
u_int32_tm_mhlenlength of data in a header mbuf
u_int32_tm_bigclustersclusters obtained from page pool
u_int32_tm_bigclfreefree clusters
u_int32_tm_bigmclbyteslength of an mbuf cluster
u_int32_tm_forcedefuncttimes we force defunct'ed an app's sockets

structombstat

Compatibillity with 10.3
size 568, align 4
u_int32_tm_mbufsmbufs obtained from page pool
u_int32_tm_clustersclusters obtained from page pool
u_int32_tm_sparespare field
u_int32_tm_clfreefree clusters
u_int32_tm_dropstimes failed to find space
u_int32_tm_waittimes waited for space
u_int32_tm_draintimes drained protocols for space
u_short[256]m_mtypestype specific mbuf allocations
u_int32_tm_mcfailtimes m_copym failed
u_int32_tm_mpfailtimes m_pullup failed
u_int32_tm_msizelength of an mbuf
u_int32_tm_mclbyteslength of an mbuf cluster
u_int32_tm_minclsizemin length of data to allocate a cluster
u_int32_tm_mlenlength of data in an mbuf
u_int32_tm_mhlenlength of data in a header mbuf

macroMAX_MBUF_CNAME

mbuf class statistics.
#define MAX_MBUF_CNAME 15

structmb_class_stat

size 136, align 8
char[16]mbcl_cnameclass name
u_int32_tmbcl_sizebuffer size
u_int32_tmbcl_total# of buffers created
u_int32_tmbcl_active# of active buffers
u_int32_tmbcl_infree# of available buffers
u_int32_tmbcl_slab_cnt# of available slabs
u_int32_tmbcl_padpadding
u_int64_tmbcl_alloc_cnt# of times alloc is called
u_int64_tmbcl_free_cnt# of times free is called
u_int64_tmbcl_notified# of notified wakeups
u_int64_tmbcl_purge_cnt# of purges so far
u_int64_tmbcl_fail_cnt# of allocation failures
u_int32_tmbcl_ctotaltotal only for this class
u_int32_tmbcl_release_cntamount of memory returned
u_int32_tmbcl_mc_stateCache layer statistics cache state (see below)
u_int32_tmbcl_mc_cached# of cached buffers
u_int32_tmbcl_mc_waiter_cnt# waiters on the cache
u_int32_tmbcl_mc_wretry_cnt# of wait retries
u_int32_tmbcl_mc_nwretry_cnt# of no-wait retry attempts
u_int32_t[7]mbcl_reservedfor future use

typedefmb_class_stat_t

typedef struct mb_class_stat mb_class_stat_t;

macroMCS_DISABLED

#define MCS_DISABLED 0
cache is permanently disabled

macroMCS_ONLINE

#define MCS_ONLINE 1
cache is online

macroMCS_PURGING

#define MCS_PURGING 2
cache is being purged

macroMCS_OFFLINE

#define MCS_OFFLINE 3
cache is offline (resizing)

structmb_stat

size 144, align 8
u_int32_tmbs_cntnumber of classes
u_int32_tmbs_padpadding
mb_class_stat_t[1]mbs_classclass array

typedefmb_stat_t

typedef struct mb_stat mb_stat_t;