xref: /freebsd/sys/sys/mbuf.h (revision 56ca39961bd1c9946a505c41c3fc634ef63fdd42)
1 /*
2  * Copyright (c) 1982, 1986, 1988, 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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95
34  * $FreeBSD$
35  */
36 
37 #ifndef _SYS_MBUF_H_
38 #define	_SYS_MBUF_H_
39 
40 /*
41  * Mbufs are of a single size, MSIZE (machine/param.h), which
42  * includes overhead.  An mbuf may add a single "mbuf cluster" of size
43  * MCLBYTES (also in machine/param.h), which has no additional overhead
44  * and is used instead of the internal data area; this is done when
45  * at least MINCLSIZE of data must be stored.
46  */
47 
48 #define	MLEN		(MSIZE - sizeof(struct m_hdr))	/* normal data len */
49 #define	MHLEN		(MLEN - sizeof(struct pkthdr))	/* data len w/pkthdr */
50 
51 #define	MINCLSIZE	(MHLEN + 1)	/* smallest amount to put in cluster */
52 #define	M_MAXCOMPRESS	(MHLEN / 2)	/* max amount to copy for compression */
53 
54 /*
55  * Macros for type conversion
56  * mtod(m, t) -	convert mbuf pointer to data pointer of correct type
57  * dtom(x) -	convert data pointer within mbuf to mbuf pointer (XXX)
58  * mtocl(x) -	convert pointer within cluster to cluster index #
59  * cltom(x) -	convert cluster # to ptr to beginning of cluster
60  */
61 #define	mtod(m, t)	((t)((m)->m_data))
62 #define	dtom(x)		((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))
63 #define	mtocl(x)	(((uintptr_t)(x) - (uintptr_t)mbutl) >> MCLSHIFT)
64 #define	cltom(x)	((caddr_t)((uintptr_t)mbutl + \
65 			    ((uintptr_t)(x) << MCLSHIFT)))
66 
67 /* header at beginning of each mbuf: */
68 struct m_hdr {
69 	struct	mbuf *mh_next;		/* next buffer in chain */
70 	struct	mbuf *mh_nextpkt;	/* next chain in queue/record */
71 	caddr_t	mh_data;		/* location of data */
72 	int	mh_len;			/* amount of data in this mbuf */
73 	short	mh_type;		/* type of data in this mbuf */
74 	short	mh_flags;		/* flags; see below */
75 };
76 
77 /* record/packet header in first mbuf of chain; valid if M_PKTHDR set */
78 struct pkthdr {
79 	struct	ifnet *rcvif;		/* rcv interface */
80 	int	len;			/* total packet length */
81 	/* variables for ip and tcp reassembly */
82 	caddr_t	header;			/* pointer to packet header */
83 	/* variables for hardware checksum */
84 	int	csum_flags;		/* flags regarding checksum */
85 	int	csum_data;		/* data field used by csum routines */
86 };
87 
88 /* description of external storage mapped into mbuf, valid if M_EXT set */
89 struct m_ext {
90 	caddr_t	ext_buf;		/* start of buffer */
91 	void	(*ext_free)		/* free routine if not the usual */
92 		__P((caddr_t, u_int));
93 	u_int	ext_size;		/* size of buffer, for ext_free */
94 	void	(*ext_ref)		/* add a reference to the ext object */
95 		__P((caddr_t, u_int));
96 };
97 
98 struct mbuf {
99 	struct	m_hdr m_hdr;
100 	union {
101 		struct {
102 			struct	pkthdr MH_pkthdr;	/* M_PKTHDR set */
103 			union {
104 				struct	m_ext MH_ext;	/* M_EXT set */
105 				char	MH_databuf[MHLEN];
106 			} MH_dat;
107 		} MH;
108 		char	M_databuf[MLEN];		/* !M_PKTHDR, !M_EXT */
109 	} M_dat;
110 };
111 #define	m_next		m_hdr.mh_next
112 #define	m_len		m_hdr.mh_len
113 #define	m_data		m_hdr.mh_data
114 #define	m_type		m_hdr.mh_type
115 #define	m_flags		m_hdr.mh_flags
116 #define	m_nextpkt	m_hdr.mh_nextpkt
117 #define	m_act		m_nextpkt
118 #define	m_pkthdr	M_dat.MH.MH_pkthdr
119 #define	m_ext		M_dat.MH.MH_dat.MH_ext
120 #define	m_pktdat	M_dat.MH.MH_dat.MH_databuf
121 #define	m_dat		M_dat.M_databuf
122 
123 /* mbuf flags */
124 #define	M_EXT		0x0001	/* has associated external storage */
125 #define	M_PKTHDR	0x0002	/* start of record */
126 #define	M_EOR		0x0004	/* end of record */
127 #define	M_PROTO1	0x0008	/* protocol-specific */
128 #define	M_PROTO2	0x0010	/* protocol-specific */
129 #define	M_PROTO3	0x0020	/* protocol-specific */
130 #define	M_PROTO4	0x0040	/* protocol-specific */
131 #define	M_PROTO5	0x0080	/* protocol-specific */
132 
133 /* mbuf pkthdr flags, also in m_flags */
134 #define	M_BCAST		0x0100	/* send/received as link-level broadcast */
135 #define	M_MCAST		0x0200	/* send/received as link-level multicast */
136 #define	M_FRAG		0x0400	/* packet is a fragment of a larger packet */
137 #define	M_FIRSTFRAG	0x0800	/* packet is first fragment */
138 #define	M_LASTFRAG	0x1000	/* packet is last fragment */
139 
140 /* flags copied when copying m_pkthdr */
141 #define	M_COPYFLAGS	(M_PKTHDR|M_EOR|M_PROTO1|M_PROTO1|M_PROTO2|M_PROTO3 | \
142 			    M_PROTO4|M_PROTO5|M_BCAST|M_MCAST|M_FRAG)
143 
144 /* flags indicating hw checksum support and sw checksum requirements */
145 #define CSUM_IP			0x0001		/* will csum IP */
146 #define CSUM_TCP		0x0002		/* will csum TCP */
147 #define CSUM_UDP		0x0004		/* will csum UDP */
148 #define CSUM_IP_FRAGS		0x0008		/* will csum IP fragments */
149 #define CSUM_FRAGMENT		0x0010		/* will do IP fragmentation */
150 
151 #define CSUM_IP_CHECKED		0x0100		/* did csum IP */
152 #define CSUM_IP_VALID		0x0200		/*   ... the csum is valid */
153 #define CSUM_DATA_VALID		0x0400		/* csum_data field is valid */
154 #define CSUM_PSEUDO_HDR		0x0800		/* csum_data has pseudo hdr */
155 
156 #define CSUM_DELAY_DATA		(CSUM_TCP | CSUM_UDP)
157 #define CSUM_DELAY_IP		(CSUM_IP)	/* XXX add ipv6 here too? */
158 
159 /* mbuf types */
160 #define	MT_FREE		0	/* should be on free list */
161 #define	MT_DATA		1	/* dynamic (data) allocation */
162 #define	MT_HEADER	2	/* packet header */
163 #if 0
164 #define	MT_SOCKET	3	/* socket structure */
165 #define	MT_PCB		4	/* protocol control block */
166 #define	MT_RTABLE	5	/* routing tables */
167 #define	MT_HTABLE	6	/* IMP host tables */
168 #define	MT_ATABLE	7	/* address resolution tables */
169 #endif
170 #define	MT_SONAME	8	/* socket name */
171 #if 0
172 #define	MT_SOOPTS	10	/* socket options */
173 #endif
174 #define	MT_FTABLE	11	/* fragment reassembly header */
175 #if 0
176 #define	MT_RIGHTS	12	/* access rights */
177 #define	MT_IFADDR	13	/* interface address */
178 #endif
179 #define	MT_CONTROL	14	/* extra-data protocol message */
180 #define	MT_OOBDATA	15	/* expedited data  */
181 
182 /*
183  * mbuf statistics
184  */
185 struct mbstat {
186 	u_long	m_mbufs;	/* mbufs obtained from page pool */
187 	u_long	m_clusters;	/* clusters obtained from page pool */
188 	u_long	m_spare;	/* spare field */
189 	u_long	m_clfree;	/* free clusters */
190 	u_long	m_drops;	/* times failed to find space */
191 	u_long	m_wait;		/* times waited for space */
192 	u_long	m_drain;	/* times drained protocols for space */
193 	u_short	m_mtypes[256];	/* type specific mbuf allocations */
194 	u_long	m_mcfail;	/* times m_copym failed */
195 	u_long	m_mpfail;	/* times m_pullup failed */
196 	u_long	m_msize;	/* length of an mbuf */
197 	u_long	m_mclbytes;	/* length of an mbuf cluster */
198 	u_long	m_minclsize;	/* min length of data to allocate a cluster */
199 	u_long	m_mlen;		/* length of data in an mbuf */
200 	u_long	m_mhlen;	/* length of data in a header mbuf */
201 };
202 
203 /* flags to m_get/MGET */
204 #define	M_DONTWAIT	1
205 #define	M_WAIT		0
206 
207 /* Freelists:
208  *
209  * Normal mbuf clusters are normally treated as character arrays
210  * after allocation, but use the first word of the buffer as a free list
211  * pointer while on the free list.
212  */
213 union mcluster {
214 	union	mcluster *mcl_next;
215 	char	mcl_buf[MCLBYTES];
216 };
217 
218 
219 /*
220  * These are identifying numbers passed to the m_mballoc_wait function,
221  * allowing us to determine whether the call came from an MGETHDR or
222  * an MGET.
223  */
224 #define	MGETHDR_C      1
225 #define	MGET_C         2
226 
227 /*
228  * Wake up the next instance (if any) of m_mballoc_wait() which is
229  * waiting for an mbuf to be freed.  This should be called at splimp().
230  *
231  * XXX: If there is another free mbuf, this routine will be called [again]
232  * from the m_mballoc_wait routine in order to wake another sleep instance.
233  */
234 #define	MMBWAKEUP() do {						\
235 	if (m_mballoc_wid) {						\
236 		m_mballoc_wid--;					\
237 		wakeup_one(&m_mballoc_wid); 				\
238 	}								\
239 } while (0)
240 
241 /*
242  * Same as above, but for mbuf cluster(s).
243  */
244 #define	MCLWAKEUP() do {						\
245 	if (m_clalloc_wid) {						\
246 		m_clalloc_wid--;					\
247 		wakeup_one(&m_clalloc_wid);				\
248 	}								\
249 } while (0)
250 
251 /*
252  * mbuf utility macros:
253  *
254  *	MBUFLOCK(code)
255  * prevents a section of code from from being interrupted by network
256  * drivers.
257  */
258 #define	MBUFLOCK(code) do {						\
259 	int _ms = splimp();						\
260 									\
261 	{ code }							\
262 	splx(_ms);							\
263 } while (0)
264 
265 /*
266  * mbuf allocation/deallocation macros:
267  *
268  *	MGET(struct mbuf *m, int how, int type)
269  * allocates an mbuf and initializes it to contain internal data.
270  *
271  *	MGETHDR(struct mbuf *m, int how, int type)
272  * allocates an mbuf and initializes it to contain a packet header
273  * and internal data.
274  */
275 #define	MGET(m, how, type) do {						\
276 	struct mbuf *_mm;						\
277 	int _mhow = (how);						\
278 	int _mtype = (type);						\
279 	int _ms = splimp();						\
280 									\
281 	if (mmbfree == NULL)						\
282 		(void)m_mballoc(1, _mhow);				\
283 	_mm = mmbfree;							\
284 	if (_mm != NULL) {						\
285 		mmbfree = _mm->m_next;					\
286 		mbstat.m_mtypes[MT_FREE]--;				\
287 		_mm->m_type = _mtype;					\
288 		mbstat.m_mtypes[_mtype]++;				\
289 		_mm->m_next = NULL;					\
290 		_mm->m_nextpkt = NULL;					\
291 		_mm->m_data = _mm->m_dat;				\
292 		_mm->m_flags = 0;					\
293 		(m) = _mm;						\
294 		splx(_ms);						\
295 	} else {							\
296 		splx(_ms);						\
297 		_mm = m_retry(_mhow, _mtype);				\
298 		if (_mm == NULL && _mhow == M_WAIT)			\
299 			(m) = m_mballoc_wait(MGET_C, _mtype);		\
300 		else							\
301 			(m) = _mm;					\
302 	}								\
303 } while (0)
304 
305 #define	MGETHDR(m, how, type) do {					\
306 	struct mbuf *_mm;						\
307 	int _mhow = (how);						\
308 	int _mtype = (type);						\
309 	int _ms = splimp();						\
310 									\
311 	if (mmbfree == NULL)						\
312 		(void)m_mballoc(1, _mhow);				\
313 	_mm = mmbfree;							\
314 	if (_mm != NULL) {						\
315 		mmbfree = _mm->m_next;					\
316 		mbstat.m_mtypes[MT_FREE]--;				\
317 		_mm->m_type = _mtype;					\
318 		mbstat.m_mtypes[_mtype]++;				\
319 		_mm->m_next = NULL;					\
320 		_mm->m_nextpkt = NULL;					\
321 		_mm->m_data = _mm->m_pktdat;				\
322 		_mm->m_flags = M_PKTHDR;				\
323 		_mm->m_pkthdr.rcvif = NULL;				\
324 		_mm->m_pkthdr.csum_flags = 0;				\
325 		(m) = _mm;						\
326 		splx(_ms);						\
327 	} else {							\
328 		splx(_ms);						\
329 		_mm = m_retryhdr(_mhow, _mtype);			\
330 		if (_mm == NULL && _mhow == M_WAIT)			\
331 			(m) = m_mballoc_wait(MGETHDR_C, _mtype);	\
332 		else							\
333 			(m) = _mm;					\
334 	}								\
335 } while (0)
336 
337 /*
338  * Mbuf cluster macros.
339  * MCLALLOC(caddr_t p, int how) allocates an mbuf cluster.
340  * MCLGET adds such clusters to a normal mbuf;
341  * the flag M_EXT is set upon success.
342  * MCLFREE releases a reference to a cluster allocated by MCLALLOC,
343  * freeing the cluster if the reference count has reached 0.
344  */
345 #define	MCLALLOC(p, how) do {						\
346 	caddr_t _mp;							\
347 	int _mhow = (how);						\
348 	int _ms = splimp();						\
349 									\
350 	if (mclfree == NULL)						\
351 		(void)m_clalloc(1, _mhow);				\
352 	_mp = (caddr_t)mclfree;						\
353 	if (_mp != NULL) {						\
354 		mclrefcnt[mtocl(_mp)]++;				\
355 		mbstat.m_clfree--;					\
356 		mclfree = ((union mcluster *)_mp)->mcl_next;		\
357 		(p) = _mp;						\
358 		splx(_ms);						\
359 	} else {							\
360 		splx(_ms);						\
361 		if (_mhow == M_WAIT)					\
362 			(p) = m_clalloc_wait();				\
363 		else							\
364 			(p) = NULL;					\
365 	}								\
366 } while (0)
367 
368 #define	MCLGET(m, how) do {						\
369 	struct mbuf *_mm = (m);						\
370 									\
371 	MCLALLOC(_mm->m_ext.ext_buf, (how));				\
372 	if (_mm->m_ext.ext_buf != NULL) {				\
373 		_mm->m_data = _mm->m_ext.ext_buf;			\
374 		_mm->m_flags |= M_EXT;					\
375 		_mm->m_ext.ext_free = NULL;				\
376 		_mm->m_ext.ext_ref = NULL;				\
377 		_mm->m_ext.ext_size = MCLBYTES;				\
378 	}								\
379 } while (0)
380 
381 #define	MCLFREE1(p) do {						\
382 	union mcluster *_mp = (union mcluster *)(p);			\
383 									\
384 	if (--mclrefcnt[mtocl(_mp)] == 0) {				\
385 		_mp->mcl_next = mclfree;				\
386 		mclfree = _mp;						\
387 		mbstat.m_clfree++;					\
388 		MCLWAKEUP();						\
389 	}								\
390 } while (0)
391 
392 #define	MCLFREE(p) MBUFLOCK(						\
393 	MCLFREE1(p);							\
394 )
395 
396 #define	MEXTFREE1(m) do {						\
397 		struct mbuf *_mm = (m);					\
398 									\
399 		if (_mm->m_ext.ext_free != NULL)			\
400 			(*_mm->m_ext.ext_free)(_mm->m_ext.ext_buf,	\
401 		    	    _mm->m_ext.ext_size);			\
402 		else							\
403 			MCLFREE1(_mm->m_ext.ext_buf);			\
404 } while (0)
405 
406 #define	MEXTFREE(m) MBUFLOCK(						\
407 	MEXTFREE1(m);							\
408 )
409 
410 /*
411  * MFREE(struct mbuf *m, struct mbuf *n)
412  * Free a single mbuf and associated external storage.
413  * Place the successor, if any, in n.
414  */
415 #define	MFREE(m, n) MBUFLOCK(						\
416 	struct mbuf *_mm = (m);						\
417 									\
418 	mbstat.m_mtypes[_mm->m_type]--;					\
419 	if (_mm->m_flags & M_EXT)					\
420 		MEXTFREE1(m);						\
421 	(n) = _mm->m_next;						\
422 	_mm->m_type = MT_FREE;						\
423 	mbstat.m_mtypes[MT_FREE]++;					\
424 	_mm->m_next = mmbfree;						\
425 	mmbfree = _mm;							\
426 	MMBWAKEUP();							\
427 )
428 
429 /*
430  * Copy mbuf pkthdr from "from" to "to".
431  * from must have M_PKTHDR set, and to must be empty.
432  */
433 #define	M_COPY_PKTHDR(to, from) do {					\
434 	struct mbuf *_mfrom = (from);					\
435 	struct mbuf *_mto = (to);					\
436 									\
437 	_mto->m_data = _mto->m_pktdat;					\
438 	_mto->m_flags = _mfrom->m_flags & M_COPYFLAGS;			\
439 	_mto->m_pkthdr = _mfrom->m_pkthdr;				\
440 } while (0)
441 
442 /*
443  * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
444  * an object of the specified size at the end of the mbuf, longword aligned.
445  */
446 #define	M_ALIGN(m, len) do {						\
447 	(m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1);		\
448 } while (0)
449 
450 /*
451  * As above, for mbufs allocated with m_gethdr/MGETHDR
452  * or initialized by M_COPY_PKTHDR.
453  */
454 #define	MH_ALIGN(m, len) do {						\
455 	(m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1);		\
456 } while (0)
457 
458 /*
459  * Compute the amount of space available
460  * before the current start of data in an mbuf.
461  */
462 #define	M_LEADINGSPACE(m)						\
463 	((m)->m_flags & M_EXT ?						\
464 	    /* (m)->m_data - (m)->m_ext.ext_buf */ 0 :			\
465 	    (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat :	\
466 	    (m)->m_data - (m)->m_dat)
467 
468 /*
469  * Compute the amount of space available
470  * after the end of data in an mbuf.
471  */
472 #define	M_TRAILINGSPACE(m)						\
473 	((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf +			\
474 	    (m)->m_ext.ext_size - ((m)->m_data + (m)->m_len) :		\
475 	    &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
476 
477 /*
478  * Arrange to prepend space of size plen to mbuf m.
479  * If a new mbuf must be allocated, how specifies whether to wait.
480  * If how is M_DONTWAIT and allocation fails, the original mbuf chain
481  * is freed and m is set to NULL.
482  */
483 #define	M_PREPEND(m, plen, how) do {					\
484 	struct mbuf **_mmp = &(m);					\
485 	struct mbuf *_mm = *_mmp;					\
486 	int _mplen = (plen);						\
487 	int __mhow = (how);						\
488 									\
489 	if (M_LEADINGSPACE(_mm) >= _mplen) {				\
490 		_mm->m_data -= _mplen;					\
491 		_mm->m_len += _mplen;					\
492 	} else								\
493 		_mm = m_prepend(_mm, _mplen, __mhow);			\
494 	if (_mm != NULL && _mm->m_flags & M_PKTHDR)			\
495 		_mm->m_pkthdr.len += _mplen;				\
496 	*_mmp = _mm;							\
497 } while (0)
498 
499 /* change mbuf to new type */
500 #define	MCHTYPE(m, t) do {						\
501 	struct mbuf *_mm = (m);						\
502 	int _mt = (t);							\
503 	int _ms = splimp();						\
504 									\
505 	mbstat.m_mtypes[_mm->m_type]--;					\
506 	mbstat.m_mtypes[_mt]++;						\
507 	splx(_ms);							\
508 	_mm->m_type = (_mt);						\
509 } while (0)
510 
511 /* length to m_copy to copy all */
512 #define	M_COPYALL	1000000000
513 
514 /* compatibility with 4.3 */
515 #define	m_copy(m, o, l)	m_copym((m), (o), (l), M_DONTWAIT)
516 
517 #ifdef _KERNEL
518 extern	u_int		 m_clalloc_wid;	/* mbuf cluster wait count */
519 extern	u_int		 m_mballoc_wid;	/* mbuf wait count */
520 extern	int		 max_linkhdr;	/* largest link-level header */
521 extern	int		 max_protohdr;	/* largest protocol header */
522 extern	int		 max_hdr;	/* largest link+protocol header */
523 extern	int		 max_datalen;	/* MHLEN - max_hdr */
524 extern	struct mbstat	 mbstat;
525 extern	int		 mbuf_wait;	/* mbuf sleep time */
526 extern	struct mbuf	*mbutl;		/* virtual address of mclusters */
527 extern	char		*mclrefcnt;	/* cluster reference counts */
528 extern	union mcluster	*mclfree;
529 extern	struct mbuf	*mmbfree;
530 extern	int		 nmbclusters;
531 extern	int		 nmbufs;
532 extern	int		 nsfbufs;
533 
534 void	m_adj __P((struct mbuf *, int));
535 void	m_cat __P((struct mbuf *,struct mbuf *));
536 int	m_clalloc __P((int, int));
537 caddr_t	m_clalloc_wait __P((void));
538 void	m_copyback __P((struct mbuf *, int, int, caddr_t));
539 void	m_copydata __P((struct mbuf *,int,int,caddr_t));
540 struct	mbuf *m_copym __P((struct mbuf *, int, int, int));
541 struct	mbuf *m_copypacket __P((struct mbuf *, int));
542 struct	mbuf *m_devget __P((char *, int, int, struct ifnet *,
543     void (*copy)(char *, caddr_t, u_int)));
544 struct	mbuf *m_dup __P((struct mbuf *, int));
545 struct	mbuf *m_free __P((struct mbuf *));
546 void	m_freem __P((struct mbuf *));
547 struct	mbuf *m_get __P((int, int));
548 struct	mbuf *m_getclr __P((int, int));
549 struct	mbuf *m_gethdr __P((int, int));
550 int	m_mballoc __P((int, int));
551 struct	mbuf *m_mballoc_wait __P((int, int));
552 struct	mbuf *m_prepend __P((struct mbuf *,int,int));
553 void	m_print __P((const struct mbuf *m));
554 struct	mbuf *m_pullup __P((struct mbuf *, int));
555 struct	mbuf *m_retry __P((int, int));
556 struct	mbuf *m_retryhdr __P((int, int));
557 struct	mbuf *m_split __P((struct mbuf *,int,int));
558 #endif /* _KERNEL */
559 
560 #endif /* !_SYS_MBUF_H_ */
561