Deleted Added
full compact
uipc_mbuf.c (276910) uipc_mbuf.c (277203)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. 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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. 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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 276910 2015-01-10 10:41:23Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 277203 2015-01-14 23:44:00Z rwatson $");
34
35#include "opt_param.h"
36#include "opt_mbuf_stress_test.h"
37#include "opt_mbuf_profiling.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

--- 41 unchanged lines hidden (view full) ---

83SYSCTL_INT(_kern_ipc, OID_AUTO, m_defragrandomfailures, CTLFLAG_RW,
84 &m_defragrandomfailures, 0, "");
85#endif
86
87/*
88 * Ensure the correct size of various mbuf parameters. It could be off due
89 * to compiler-induced padding and alignment artifacts.
90 */
34
35#include "opt_param.h"
36#include "opt_mbuf_stress_test.h"
37#include "opt_mbuf_profiling.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

--- 41 unchanged lines hidden (view full) ---

83SYSCTL_INT(_kern_ipc, OID_AUTO, m_defragrandomfailures, CTLFLAG_RW,
84 &m_defragrandomfailures, 0, "");
85#endif
86
87/*
88 * Ensure the correct size of various mbuf parameters. It could be off due
89 * to compiler-induced padding and alignment artifacts.
90 */
91CTASSERT(sizeof(struct mbuf) == MSIZE);
92CTASSERT(MSIZE - offsetof(struct mbuf, m_dat) == MLEN);
93CTASSERT(MSIZE - offsetof(struct mbuf, m_pktdat) == MHLEN);
94
95/*
91CTASSERT(MSIZE - offsetof(struct mbuf, m_dat) == MLEN);
92CTASSERT(MSIZE - offsetof(struct mbuf, m_pktdat) == MHLEN);
93
94/*
95 * mbuf data storage should be 64-bit aligned regardless of architectural
96 * pointer size; check this is the case with and without a packet header.
97 */
98CTASSERT(offsetof(struct mbuf, m_dat) % 8 == 0);
99CTASSERT(offsetof(struct mbuf, m_pktdat) % 8 == 0);
100
101/*
102 * While the specific values here don't matter too much (i.e., +/- a few
103 * words), we do want to ensure that changes to these values are carefully
104 * reasoned about and properly documented. This is especially the case as
105 * network-protocol and device-driver modules encode these layouts, and must
106 * be recompiled if the structures change. Check these values at compile time
107 * against the ones documented in comments in mbuf.h.
108 *
109 * NB: Possibly they should be documented there via #define's and not just
110 * comments.
111 */
112#if defined(__LP64__)
113CTASSERT(offsetof(struct mbuf, m_dat) == 32);
114CTASSERT(sizeof(struct pkthdr) == 56);
115CTASSERT(sizeof(struct struct_m_ext) == 48);
116#else
117CTASSERT(offsetof(struct mbuf, m_dat) == 24);
118CTASSERT(sizeof(struct pkthdr) == 48);
119CTASSERT(sizeof(struct struct_m_ext) == 28);
120#endif
121
122/*
96 * m_get2() allocates minimum mbuf that would fit "size" argument.
97 */
98struct mbuf *
99m_get2(int size, int how, short type, int flags)
100{
101 struct mb_args args;
102 struct mbuf *m, *n;
103

--- 1908 unchanged lines hidden ---
123 * m_get2() allocates minimum mbuf that would fit "size" argument.
124 */
125struct mbuf *
126m_get2(int size, int how, short type, int flags)
127{
128 struct mb_args args;
129 struct mbuf *m, *n;
130

--- 1908 unchanged lines hidden ---