mbuf.h (254857) | mbuf.h (254973) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 |
31 * $FreeBSD: head/sys/sys/mbuf.h 254857 2013-08-25 13:30:37Z andre $ | 31 * $FreeBSD: head/sys/sys/mbuf.h 254973 2013-08-27 20:52:02Z andre $ |
32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 8 unchanged lines hidden (view full) --- 48 * Mbufs are of a single size, MSIZE (sys/param.h), which includes overhead. 49 * An mbuf may add a single "mbuf cluster" of size MCLBYTES (also in 50 * sys/param.h), which has no additional overhead and is used instead of the 51 * internal data area; this is done when at least MINCLSIZE of data must be 52 * stored. Additionally, it is possible to allocate a separate buffer 53 * externally and attach it to the mbuf in a way similar to that of mbuf 54 * clusters. 55 * | 32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 8 unchanged lines hidden (view full) --- 48 * Mbufs are of a single size, MSIZE (sys/param.h), which includes overhead. 49 * An mbuf may add a single "mbuf cluster" of size MCLBYTES (also in 50 * sys/param.h), which has no additional overhead and is used instead of the 51 * internal data area; this is done when at least MINCLSIZE of data must be 52 * stored. Additionally, it is possible to allocate a separate buffer 53 * externally and attach it to the mbuf in a way similar to that of mbuf 54 * clusters. 55 * |
56 * NB: These calculation do not take actual compiler-induced alignment and 57 * padding inside the complete struct mbuf into account. Appropriate 58 * attention is required when changing members of struct mbuf. 59 * |
|
56 * MLEN is data length in a normal mbuf. 57 * MHLEN is data length in an mbuf with pktheader. 58 * MINCLSIZE is a smallest amount of data that should be put into cluster. 59 */ 60#define MLEN ((int)(MSIZE - sizeof(struct m_hdr))) 61#define MHLEN ((int)(MLEN - sizeof(struct pkthdr))) 62#define MINCLSIZE (MHLEN + 1) 63 --- 15 unchanged lines hidden (view full) --- 79struct mb_args { 80 int flags; /* Flags for mbuf being allocated */ 81 short type; /* Type of mbuf being allocated */ 82}; 83#endif /* _KERNEL */ 84 85/* 86 * Header present at the beginning of every mbuf. | 60 * MLEN is data length in a normal mbuf. 61 * MHLEN is data length in an mbuf with pktheader. 62 * MINCLSIZE is a smallest amount of data that should be put into cluster. 63 */ 64#define MLEN ((int)(MSIZE - sizeof(struct m_hdr))) 65#define MHLEN ((int)(MLEN - sizeof(struct pkthdr))) 66#define MINCLSIZE (MHLEN + 1) 67 --- 15 unchanged lines hidden (view full) --- 83struct mb_args { 84 int flags; /* Flags for mbuf being allocated */ 85 short type; /* Type of mbuf being allocated */ 86}; 87#endif /* _KERNEL */ 88 89/* 90 * Header present at the beginning of every mbuf. |
87 * Size ILP32: 20 | 91 * Size ILP32: 24 |
88 * LP64: 32 89 */ 90struct m_hdr { 91 struct mbuf *mh_next; /* next buffer in chain */ 92 struct mbuf *mh_nextpkt; /* next chain in queue/record */ 93 caddr_t mh_data; /* location of data */ 94 int32_t mh_len; /* amount of data in this mbuf */ 95 uint32_t mh_type:8, /* type of data in this mbuf */ 96 mh_flags:24; /* flags; see below */ | 92 * LP64: 32 93 */ 94struct m_hdr { 95 struct mbuf *mh_next; /* next buffer in chain */ 96 struct mbuf *mh_nextpkt; /* next chain in queue/record */ 97 caddr_t mh_data; /* location of data */ 98 int32_t mh_len; /* amount of data in this mbuf */ 99 uint32_t mh_type:8, /* type of data in this mbuf */ 100 mh_flags:24; /* flags; see below */ |
101#if !defined(__LP64__) 102 uint32_t mh_pad; /* pad for 64bit alignment */ 103#endif |
|
97}; 98 99/* 100 * Packet tag structure (see below for details). 101 */ 102struct m_tag { 103 SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */ 104 u_int16_t m_tag_id; /* Tag ID */ --- 1040 unchanged lines hidden --- | 104}; 105 106/* 107 * Packet tag structure (see below for details). 108 */ 109struct m_tag { 110 SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */ 111 u_int16_t m_tag_id; /* Tag ID */ --- 1040 unchanged lines hidden --- |