xref: /netbsd-src/share/man/man9/mbuf.9 (revision fad4c9f71477ae11cea2ee75ec82151ac770a534)
1.\"	$NetBSD: mbuf.9,v 1.41 2006/03/29 19:36:55 riz Exp $
2.\"
3.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This documentation is derived from text contributed to The NetBSD Foundation
7.\" by S.P.Zeidler (aka stargazer).
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd March 29, 2006
38.Dt MBUF 9
39.Os
40.Sh NAME
41.Nm mbuf ,
42.Nm m_get ,
43.Nm m_getclr ,
44.Nm m_gethdr ,
45.Nm m_devget ,
46.Nm m_copym ,
47.Nm m_copypacket ,
48.Nm m_copydata ,
49.Nm m_copyback ,
50.Nm m_copyback_cow ,
51.Nm m_cat ,
52.Nm m_dup ,
53.Nm m_makewritable ,
54.Nm m_prepend ,
55.Nm m_pulldown ,
56.Nm m_pullup ,
57.Nm m_split ,
58.Nm m_adj ,
59.Nm m_apply ,
60.Nm m_free ,
61.Nm m_freem ,
62.Nm mtod ,
63.Nm MGET ,
64.Nm MGETHDR ,
65.Nm MEXTMALLOC ,
66.Nm MEXTADD ,
67.Nm MCLGET ,
68.Nm M_COPY_PKTHDR ,
69.Nm M_MOVE_PKTHDR ,
70.Nm M_ALIGN ,
71.Nm MH_ALIGN ,
72.Nm M_LEADINGSPACE ,
73.Nm M_TRAILINGSPACE ,
74.Nm M_PREPEND ,
75.Nm MCHTYPE ,
76.Nm MEXTREMOVE ,
77.Nm MFREE ,
78.Nd "functions and macros for managing memory used by networking code"
79.Sh SYNOPSIS
80.In sys/mbuf.h
81.Ft struct mbuf *
82.Fn m_get "int nowait" "int type"
83.Ft struct mbuf *
84.Fn m_getclr "int nowait" "int type"
85.Ft struct mbuf *
86.Fn m_gethdr "int nowait" "int type"
87.Ft struct mbuf *
88.Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" "void (*copy)(const void *, void *, size_t)"
89.Ft struct mbuf *
90.Fn m_copym "struct mbuf *m" "int off0" "int len" "int wait"
91.Ft struct mbuf *
92.Fn m_copypacket "struct mbuf *m" "int how"
93.Ft void
94.Fn m_copydata "struct mbuf *m" "int off" "int len" "caddr_t cp"
95.Ft void
96.Fn m_copyback "struct mbuf *m0" "int off" "int len" "caddr_t cp"
97.Ft struct mbuf *
98.Fn m_copyback_cow "struct mbuf *m0" "int off" "int len" "caddr_t cp" "int how"
99.Ft int
100.Fn m_makewritable "struct mbuf **mp" "int off" "int len" "int how"
101.Ft void
102.Fn m_cat "struct mbuf *m" "struct mbuf *n"
103.Ft struct mbuf *
104.Fn m_dup "struct mbuf *m" "int off0" "int len" "int wait"
105.Ft struct mbuf *
106.Fn m_prepend "struct mbuf *m" "int len" "int how"
107.Ft struct mbuf *
108.Fn m_pulldown "struct mbuf *m" "int off" "int len" "int *offp"
109.Ft struct mbuf *
110.Fn m_pullup "struct mbuf *n" "int len"
111.Ft struct mbuf *
112.Fn m_split "struct mbuf *m0" "int len0" "int wait"
113.Ft void
114.Fn m_adj "struct mbuf *mp" "int req_len"
115.Ft int
116.Fn m_apply "struct mbuf *m" "int off" "int len" "int *f(void *, caddr_t, unsigned int)" "void *arg"
117.Ft struct mbuf *
118.Fn m_free "struct mbuf *m"
119.Ft void
120.Fn m_freem "struct mbuf *m"
121.Ft datatype
122.Fn mtod "struct mbuf *m" "datatype"
123.Ft void
124.Fn MGET "struct mbuf *m" "int how" "int type"
125.Ft void
126.Fn MGETHDR "struct mbuf *m" "int how" "int type"
127.Ft void
128.Fn MEXTMALLOC "struct mbuf *m" "int len" "int how"
129.Ft void
130.Fn MEXTADD "struct mbuf *m" "caddr_t buf" "int size" "int type" "void (*free)(struct mbuf *, caddr_t, size_t, void *)" "void *arg"
131.Ft void
132.Fn MCLGET "struct mbuf *m" "int how"
133.Ft void
134.Fn M_COPY_PKTHDR "struct mbuf *to" "struct mbuf *from"
135.Ft void
136.Fn M_MOVE_PKTHDR "struct mbuf *to" "struct mbuf *from"
137.Ft void
138.Fn M_ALIGN "struct mbuf *m" "int len"
139.Ft void
140.Fn MH_ALIGN "struct mbuf *m" "int len"
141.Ft int
142.Fn M_LEADINGSPACE "struct mbuf *m"
143.Ft int
144.Fn M_TRAILINGSPACE "struct mbuf *m"
145.Ft void
146.Fn M_PREPEND "struct mbuf *m" "int plen" "int how"
147.Ft void
148.Fn MCHTYPE "struct mbuf *m" "int type"
149.Ft void
150.Fn MEXTREMOVE "struct mbuf *m"
151.Ft void
152.Fn MFREE "struct mbuf *m" "struct mbuf *n"
153.Sh DESCRIPTION
154The
155.Nm
156functions and macros provide an easy and consistent way to handle
157a networking stack's memory management needs.
158An
159.Nm
160consists of a header and a data area.
161It is of a fixed size,
162.Dv MSIZE
163.Pq defined in Aq Pa machine/param.h ,
164which includes overhead.
165The header contains a pointer to the next
166.Nm
167in the
168.Sq "mbuf chain" ,
169a pointer to the next
170.Sq "mbuf chain" ,
171a pointer to the data area, the amount of data in this mbuf, its type
172and a
173.Dv flags
174field.
175.Pp
176The
177.Dv type
178variable can signify:
179.Bl -tag -compact -offset indent -width "XXXXXXXXXXX"
180.It Dv MT_FREE
181the mbuf should be on the ``free'' list
182.It Dv MT_DATA
183data was dynamically allocated
184.It Dv MT_HEADER
185data is a packet header
186.It Dv MT_SONAME
187data is a socket name
188.It Dv MT_SOOPTS
189data is socket options
190.It Dv MT_FTABLE
191data is the fragment reassembly header
192.It Dv MT_CONTROL
193mbuf contains ancillary \&(protocol control\&) data
194.It Dv MT_OOBDATA
195mbuf contains out-of-band data.
196.El
197.Pp
198The
199.Dv flags
200variable contains information describing the
201.Nm ,
202notably:
203.Bl -tag -compact -offset indent -width "XXXXXXXXXXX"
204.It Dv M_EXT
205has external storage
206.It Dv M_PKTHDR
207is start of record
208.It Dv M_EOR
209is end of record
210.It Dv M_CLUSTER
211external storage is a cluster.
212.El
213.Pp
214If an
215.Nm
216designates the start of a record
217.Pq Dv M_PKTHDR ,
218its
219.Dv flags
220field may contain additional information describing the content of
221the record:
222.Bl -tag -compact -offset indent -width "XXXXXXXXXXX"
223.It Dv M_BCAST
224sent/received as link-level broadcast
225.It Dv M_MCAST
226sent/received as link-level multicast
227.It Dv M_LINK0 ,
228.It Dv M_LINK1 ,
229.It Dv M_LINK2
230three link-level specific flags.
231.El
232.Pp
233An
234.Nm
235may add a single
236.Sq "mbuf cluster"
237of
238.Dv MCLBYTES
239bytes
240.Pq also defined in Aq Pa machine/param.h ,
241which has no additional overhead
242and is used instead of the internal data area; this is done when at least
243.Dv MINCLSIZE
244bytes of data must be stored.
245.Pp
246When the
247.Dv M_EXT
248flag is raised for an mbuf,
249the external storage area could be shared among multiple mbufs.
250Be careful when you attempt to overwrite the data content of the mbuf.
251.Bl -tag -width compact
252.It Fn m_get "int nowait" "int type"
253Allocates an mbuf and initializes it to contain internal data.
254The
255.Fa nowait
256parameter is a choice of
257.Dv M_WAIT / M_DONTWAIT
258from caller.
259.Dv M_WAIT
260means the call cannot fail, but may take forever.
261The
262.Fa type
263parameter is an mbuf type.
264.It Fn m_getclr "int nowait" "int type"
265Allocates an mbuf and initializes it to contain internal data, then
266zeros the data area.
267The
268.Fa nowait
269parameter is a choice of
270.Dv M_WAIT / M_DONTWAIT
271from caller.
272The
273.Fa type
274parameter is an mbuf type.
275.It Fn m_gethdr "int nowait" "int type"
276Allocates an mbuf and initializes it to contain a packet header and internal
277data.
278The
279.Fa nowait
280parameter is a choice of
281.Dv M_WAIT / M_DONTWAIT
282from caller.
283The
284.Fa type
285parameter is an mbuf type.
286.It Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" "void (*copy)(const void *, void *, size_t)"
287Copies
288.Fa len
289bytes from device local memory into mbufs using copy routine
290.Fa copy .
291If parameter
292.Fa off
293is non-zero, the packet is supposed to be trailer-encapsulated and
294.Fa off
295bytes plus the type and length fields will be skipped before copying.
296Returns the top of the mbuf chain it created.
297.It Fn m_copym "struct mbuf *m" "int off0" "int len" "int wait"
298Creates a copy of an mbuf chain starting
299.Fa off0
300bytes from the beginning, continuing for
301.Fa len
302bytes.
303If the
304.Fa len
305requested is
306.Dv M_COPYALL ,
307the complete mbuf chain will be copied.
308The
309.Fa wait
310parameter is a choice of
311.Dv M_WAIT / M_DONTWAIT
312from caller.
313.It Fn m_copypacket "struct mbuf *m" "int how"
314Copies an entire packet, including header (which must be present).
315This function is an optimization of the common case
316.Li m_copym(m, 0, Dv M_COPYALL, Fa how ) .
317.It Fn m_copydata "struct mbuf *m" "int off" "int len" "caddr_t cp"
318Copies
319.Fa len
320bytes data from mbuf chain
321.Fa m
322into the buffer
323.Fa cp ,
324starting
325.Fa off
326bytes from the beginning.
327.It Fn m_copyback "struct mbuf *m0" "int off" "int len" "caddr_t cp"
328Copies
329.Fa len
330bytes data from buffer
331.Fa cp
332back into the mbuf chain
333.Fa m0 ,
334starting
335.Fa off
336bytes from the beginning of the chain, extending the mbuf chain if necessary.
337.Fn m_copyback
338can only fail when extending the chain.
339The caller should check for this kind of failure
340by checking the resulting length of the chain in that case.
341It is an error to use
342.Fn m_copyback
343on read-only mbufs.
344.It Fn m_copyback_cow "struct mbuf *m0" "int off" "int len" "caddr_t cp" \
345"int how"
346Copies
347.Fa len
348bytes data from buffer
349.Fa cp
350back into the mbuf chain
351.Fa m0
352as
353.Fn m_copyback
354does.
355Unlike
356.Fn m_copyback ,
357it is safe to use
358.Fn m_copyback_cow
359on read-only mbufs.
360If needed,
361.Fn m_copyback_cow
362automatically allocates new mbufs and adjusts the chain.
363On success, it returns a pointer to the resulting mbuf chain,
364and frees the original mbuf
365.Fa m0 .
366Otherwise, it returns
367.Dv NULL .
368The
369.Fa how
370parameter is a choice of
371.Dv M_WAIT / M_DONTWAIT
372from the caller.
373Unlike
374.Fn m_copyback ,
375extending the mbuf chain isn't supported.
376It is an error to attempt to extend the mbuf chain using
377.Fn m_copyback_cow .
378.It Fn m_makewritable "struct mbuf **mp" "int off" "int len" "int how"
379Rearranges an mbuf chain so that
380.Fa len
381bytes from offset
382.Fa off
383are writable.
384When it meets read-only mbufs, it allocates new mbufs, adjusts the chain as
385.Fn m_copyback_cow
386does, and copies the original content into them.
387The
388.Fa how
389parameter is a choice of
390.Dv M_WAIT / M_DONTWAIT
391from the caller.
392.Fn m_makewritable
393preserves the contents of the mbuf chain even in the case of failure.
394It updates a pointer to the mbuf chain pointed to by
395.Fa mp .
396It returns 0 on success.
397Otherwise, it returns an error code, typically
398.Er ENOBUFS .
399.It Fn m_cat "struct mbuf *m" "struct mbuf *n"
400Concatenates mbuf chain
401.Fa n
402to
403.Fa m .
404Both chains must be of the same type; packet headers will
405.Em not
406be updated if present.
407.It Fn m_dup "struct mbuf *m" "int off0" "int len" "int wait"
408Similarly to
409.Fn m_copym ,
410the function creates a copy of an mbuf chain starting
411.Fa off0
412bytes from the beginning, continuing for
413.Fa len
414bytes.
415While
416.Fn m_copym
417tries to share external storage for mbufs with
418.Dv M_EXT
419flag,
420.Fn m_dup
421will deep-copy the whole data content into new mbuf chain
422and avoids shared external storage.
423.It Fn m_prepend "struct mbuf *m" "int len" "int how"
424Lesser-used path for
425.Fn M_PREPEND :
426allocates new mbuf
427.Fa m
428of size
429.Fa len
430to prepend to the chain, copying junk along.
431The
432.Fa how
433parameter is a choice of
434.Dv M_WAIT / M_DONTWAIT
435from caller.
436.It Fn m_pulldown "struct mbuf *m" "int off" "int len" "int *offp"
437Rearranges an mbuf chain so that
438.Fa len
439bytes from offset
440.Fa off
441are contiguous and in the data area of an mbuf.
442The return value points to an mbuf in the middle of the mbuf chain
443.Fa m .
444If we call the return value
445.Fa n ,
446the contiguous data region is available at
447.Li "mtod(n, caddr_t) + *offp" ,
448or
449.Li "mtod(n, caddr_t)"
450if
451.Fa offp
452is
453.Dv NULL .
454The top of the mbuf chain
455.Fa m ,
456and mbufs up to
457.Fa off ,
458will not be modified.
459On successful return, it is guaranteed that the mbuf pointed to by
460.Fa n
461does not have a shared external storage,
462therefore it is safe to update the contiguous region.
463Returns
464.Dv NULL
465and frees the mbuf chain on failure.
466.Fa len
467must be smaller or equal than
468.Dv MCLBYTES .
469.It Fn m_pullup "struct mbuf *m" "int len"
470Rearranges an mbuf chain so that
471.Fa len
472bytes are contiguous
473and in the data area of an mbuf (so that
474.Fn mtod
475will work for a structure of size
476.Fa len ) .
477Returns the resulting
478mbuf chain on success, frees it and returns
479.Dv NULL
480on failure.
481If there is room, it will add up to
482.Dv max_protohdr
483-
484.Fa len
485extra bytes to the
486contiguous region to possibly avoid being called again.
487.Fa len
488must be smaller or equal than
489.Dv MHLEN .
490.It Fn m_split "struct mbuf *m0" "int len0" "int wait"
491Partitions an mbuf chain in two pieces, returning the tail,
492which is all but the first
493.Fa len0
494bytes.
495In case of failure, it returns
496.Dv NULL
497and attempts to
498restore the chain to its original state.
499.It Fn m_adj "struct mbuf *mp" "int req_len"
500Shaves off
501.Fa req_len
502bytes from head or tail of the (valid) data area.
503If
504.Fa req_len
505is greater than zero, front bytes are being shaved off, if it's smaller,
506from the back (and if it is zero, the mbuf will stay bearded).
507This function does not move data in any way, but is used to manipulate the
508data area pointer and data length variable of the mbuf in a non-clobbering
509way.
510.It Fn m_apply "struct mbuf *m" "int off" "int len" "int (*f)(void *, caddr_t, unsigned int)" "void *arg"
511Apply function
512.Fa f
513to the data in an mbuf chain starting
514.Fa off
515bytes from the beginning, continuing for
516.Fa len
517bytes.
518Neither
519.Fa off
520nor
521.Fa len
522may be negative.
523.Fa arg
524will be supplied as first argument for
525.Fa f ,
526the second argument will be the pointer to the data buffer of a
527packet (starting after
528.Fa off
529bytes in the stream), and the third argument is the amount
530of data in bytes in this call.
531If
532.Fa f
533returns something not equal to zero
534.Fn m_apply
535will bail out, returning the return code of
536.Fa f .
537Upon successful completion it will return zero.
538.It Fn m_free "struct mbuf *m"
539Frees mbuf
540.Fa m .
541.It Fn m_freem "struct mbuf *m"
542Frees the mbuf chain beginning with
543.Fa m .
544This function contains the elementary sanity check for a
545.Dv NULL
546pointer.
547.It Fn mtod "struct mbuf *m" "datatype"
548Returns a pointer to the data contained in the specified mbuf
549.Fa m ,
550type-casted to the specified data type
551.Fa datatype .
552Implemented as a macro.
553.It Fn MGET "struct mbuf *m" "int how" "int type"
554Allocates mbuf
555.Fa m
556and initializes it to contain internal data.
557See
558.Fn m_get .
559Implemented as a macro.
560.It Fn MGETHDR "struct mbuf *m" "int how" "int type"
561Allocates mbuf
562.Fa m
563and initializes it to contain a packet header.
564See
565.Fn m_gethdr .
566Implemented as a macro.
567.It Fn MEXTMALLOC "struct mbuf *m" "int len" "int how"
568Allocates external storage of size
569.Fa len
570for mbuf
571.Fa m .
572The
573.Fa how
574parameter is a choice of
575.Dv M_WAIT / M_DONTWAIT
576from caller.
577The flag
578.Dv M_EXT
579is set upon success.
580Implemented as a macro.
581.It Fn MEXTADD "struct mbuf *m" "caddr_t buf" "int size" "int type" "void (*free)(struct mbuf *, caddr_t, size_t, void *)" "void *arg"
582Adds pre-allocated external storage
583.Fa buf
584to a normal mbuf
585.Fa m ;
586the parameters
587.Fa size ,
588.Fa type ,
589.Fa free
590and
591.Fa arg
592describe the external storage.
593.Fa size
594is the size of the storage,
595.Fa type
596describes its
597.Xr malloc 9
598type,
599.Fa free
600is a free routine (if not the usual one), and
601.Fa arg
602is a possible argument to the free routine.
603The flag
604.Dv M_EXT
605is set upon success.
606Implemented as a macro.
607If a free routine is specified, it will be called when the mbuf is freed or
608when MEXTREMOVE is called for the mbuf.
609In the case of former, the first argument for a free routine is the mbuf
610.Fa m
611and the routine is expected to free it in addition to the external storage
612pointed by second argument.
613In the case of latter, the first argument for the routine is NULL.
614.It Fn MCLGET "struct mbuf *m" "int how"
615Allocates and adds an mbuf cluster to a normal mbuf
616.Fa m .
617The
618.Fa how
619parameter is a choice of
620.Dv M_WAIT / M_DONTWAIT
621from caller.
622The flag
623.Dv M_EXT
624is set upon success.
625Implemented as a macro.
626.It Fn M_COPY_PKTHDR "struct mbuf *to" "struct mbuf *from"
627Copies the mbuf pkthdr from mbuf
628.Fa from
629to mbuf
630.Fa to .
631.Fa from
632must have the type flag
633.Dv M_PKTHDR
634set, and
635.Fa to
636must be empty.
637Implemented as a macro.
638.It Fn M_MOVE_PKTHDR "struct mbuf *to" "struct mbuf *from"
639Moves the mbuf pkthdr from mbuf
640.Fa from
641to mbuf
642.Fa to .
643.Fa from
644must have the type flag
645.Dv M_PKTHDR
646set, and
647.Fa to
648must be empty.
649The flag
650.Dv M_PKTHDR
651in mbuf
652.Fa from
653will be cleared.
654.It Fn M_ALIGN "struct mbuf *m" "int len"
655Sets the data pointer of a newly allocated mbuf
656.Fa m
657to
658.Fa len
659bytes from the end of the mbuf data area, so that
660.Fa len
661bytes of data written to the mbuf
662.Fa m ,
663starting at the data pointer, will be aligned to the end of the data area.
664Implemented as a macro.
665.It Fn MH_ALIGN "struct mbuf *m" "int len"
666Sets the data pointer of a newly allocated packetheader mbuf
667.Fa m
668to
669.Fa len
670bytes from the end of the mbuf data area, so that
671.Fa len
672bytes of data written to the mbuf
673.Fa m ,
674starting at the data pointer, will be aligned to the end of the data area.
675Implemented as a macro.
676.It Fn M_LEADINGSPACE "struct mbuf *m"
677Returns the amount of space available before the current start of valid
678data in mbuf
679.Fa m .
680Returns 0 if the mbuf data part is shared across multiple mbufs
681.Pq i.e. not writable .
682Implemented as a macro.
683.It Fn M_TRAILINGSPACE "struct mbuf *m"
684Returns the amount of space available after the current end of valid
685data in mbuf
686.Fa m .
687Returns 0 if the mbuf data part is shared across multiple mbufs
688.Pq i.e. not writable .
689Implemented as a macro.
690.It Fn M_PREPEND "struct mbuf *m" "int plen" "int how"
691Prepends space of size
692.Fa plen
693to mbuf
694.Fa m .
695If a new mbuf must be allocated,
696.Fa how
697specifies whether to wait.
698If
699.Fa how
700is
701.Dv M_DONTWAIT
702and allocation fails, the original mbuf chain is freed and
703.Fa m
704is set to
705.Dv NULL .
706Implemented as a macro.
707.It Fn MCHTYPE "struct mbuf *m" "int type"
708Change mbuf
709.Fa m
710to new type
711.Fa type .
712Implemented as a macro.
713.It Fn MEXTREMOVE "struct mbuf *m"
714Removes external storage from mbuf
715.Fa m .
716The flag
717.Dv M_EXT
718is removed.
719Implemented as a macro.
720.It Fn MFREE "struct mbuf *m" "struct mbuf *n"
721Frees a single mbuf
722.Fa m
723and places the successor, if any, in mbuf
724.Fa n .
725Implemented as a macro.
726.El
727.Sh FILES
728The
729.Nm
730management functions are implemented within the file
731.Pa sys/kern/uipc_mbuf.c .
732Function prototypes, and the functions implemented as macros
733are located in
734.Pa sys/sys/mbuf.h .
735Both pathnames are relative to the root of the
736.Nx
737source tree,
738.Pa /usr/src .
739.Sh SEE ALSO
740.Pa /usr/share/doc/smm/18.net ,
741.Xr netstat 1 ,
742.Xr m_tag 9 ,
743.Xr malloc 9
744.Rs
745.%A Jun-ichiro Hagino
746.%T "Mbuf issues in 4.4BSD IPv6/IPsec support (experiences from KAME IPv6/IPsec implementation)"
747.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
748.%D June 2000
749.Re
750.Sh AUTHORS
751.An -nosplit
752The original mbuf data structures were designed by Rob Gurwitz
753when he did the initial TCP/IP implementation at BBN.
754.br
755Further extensions and enhancements were made by Bill Joy, Sam Leffler,
756and Mike Karels at CSRG.
757.br
758Current implementation of external storage by
759.An Matt Thomas
760.Aq matt@3am-software.com
761and
762.An Jason R. Thorpe
763.Aq thorpej@NetBSD.org .
764