xref: /netbsd-src/share/man/man9/mbuf.9 (revision aaf4ece63a859a04e37cf3a7229b5fab0157cc06)
1.\"	$NetBSD: mbuf.9,v 1.40 2005/08/23 09:34:11 yamt 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 August 23, 2005
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.
363It returns a pointer to the resulting mbuf chain on success.
364Otherwise, it returns
365.Dv NULL .
366In that case, the original mbuf
367.Fa m0
368will be freed.
369The
370.Fa how
371parameter is a choice of
372.Dv M_WAIT / M_DONTWAIT
373from the caller.
374Unlike
375.Fn m_copyback ,
376extending the mbuf chain isn't supported.
377It is an error to attempt to extend the mbuf chain using
378.Fn m_copyback_cow .
379.It Fn m_makewritable "struct mbuf **mp" "int off" "int len" "int how"
380Rearranges an mbuf chain so that
381.Fa len
382bytes from offset
383.Fa off
384are writable.
385When it meets read-only mbufs, it allocates new mbufs, adjusts the chain as
386.Fn m_copyback_cow
387does, and copies the original content into them.
388The
389.Fa how
390parameter is a choice of
391.Dv M_WAIT / M_DONTWAIT
392from the caller.
393.Fn m_makewritable
394preserves the contents of the mbuf chain even in the case of failure.
395It updates a pointer to the mbuf chain pointed to by
396.Fa mp .
397It returns 0 on success.
398Otherwise, it returns an error code, typically
399.Er ENOBUFS .
400.It Fn m_cat "struct mbuf *m" "struct mbuf *n"
401Concatenates mbuf chain
402.Fa n
403to
404.Fa m .
405Both chains must be of the same type; packet headers will
406.Em not
407be updated if present.
408.It Fn m_dup "struct mbuf *m" "int off0" "int len" "int wait"
409Similarly to
410.Fn m_copym ,
411the function creates a copy of an mbuf chain starting
412.Fa off0
413bytes from the beginning, continuing for
414.Fa len
415bytes.
416While
417.Fn m_copym
418tries to share external storage for mbufs with
419.Dv M_EXT
420flag,
421.Fn m_dup
422will deep-copy the whole data content into new mbuf chain
423and avoids shared external storage.
424.It Fn m_prepend "struct mbuf *m" "int len" "int how"
425Lesser-used path for
426.Fn M_PREPEND :
427allocates new mbuf
428.Fa m
429of size
430.Fa len
431to prepend to the chain, copying junk along.
432The
433.Fa how
434parameter is a choice of
435.Dv M_WAIT / M_DONTWAIT
436from caller.
437.It Fn m_pulldown "struct mbuf *m" "int off" "int len" "int *offp"
438Rearranges an mbuf chain so that
439.Fa len
440bytes from offset
441.Fa off
442are contiguous and in the data area of an mbuf.
443The return value points to an mbuf in the middle of the mbuf chain
444.Fa m .
445If we call the return value
446.Fa n ,
447the contiguous data region is available at
448.Li "mtod(n, caddr_t) + *offp" ,
449or
450.Li "mtod(n, caddr_t)"
451if
452.Fa offp
453is
454.Dv NULL .
455The top of the mbuf chain
456.Fa m ,
457and mbufs up to
458.Fa off ,
459will not be modified.
460On successful return, it is guaranteed that the mbuf pointed to by
461.Fa n
462does not have a shared external storage,
463therefore it is safe to update the contiguous region.
464Returns
465.Dv NULL
466and frees the mbuf chain on failure.
467.Fa len
468must be smaller or equal than
469.Dv MCLBYTES .
470.It Fn m_pullup "struct mbuf *m" "int len"
471Rearranges an mbuf chain so that
472.Fa len
473bytes are contiguous
474and in the data area of an mbuf (so that
475.Fn mtod
476will work for a structure of size
477.Fa len ) .
478Returns the resulting
479mbuf chain on success, frees it and returns
480.Dv NULL
481on failure.
482If there is room, it will add up to
483.Dv max_protohdr
484-
485.Fa len
486extra bytes to the
487contiguous region to possibly avoid being called again.
488.Fa len
489must be smaller or equal than
490.Dv MHLEN .
491.It Fn m_split "struct mbuf *m0" "int len0" "int wait"
492Partitions an mbuf chain in two pieces, returning the tail,
493which is all but the first
494.Fa len0
495bytes.
496In case of failure, it returns
497.Dv NULL
498and attempts to
499restore the chain to its original state.
500.It Fn m_adj "struct mbuf *mp" "int req_len"
501Shaves off
502.Fa req_len
503bytes from head or tail of the (valid) data area.
504If
505.Fa req_len
506is greater than zero, front bytes are being shaved off, if it's smaller,
507from the back (and if it is zero, the mbuf will stay bearded).
508This function does not move data in any way, but is used to manipulate the
509data area pointer and data length variable of the mbuf in a non-clobbering
510way.
511.It Fn m_apply "struct mbuf *m" "int off" "int len" "int (*f)(void *, caddr_t, unsigned int)" "void *arg"
512Apply function
513.Fa f
514to the data in an mbuf chain starting
515.Fa off
516bytes from the beginning, continuing for
517.Fa len
518bytes.
519Neither
520.Fa off
521nor
522.Fa len
523may be negative.
524.Fa arg
525will be supplied as first argument for
526.Fa f ,
527the second argument will be the pointer to the data buffer of a
528packet (starting after
529.Fa off
530bytes in the stream), and the third argument is the amount
531of data in bytes in this call.
532If
533.Fa f
534returns something not equal to zero
535.Fn m_apply
536will bail out, returning the return code of
537.Fa f .
538Upon successful completion it will return zero.
539.It Fn m_free "struct mbuf *m"
540Frees mbuf
541.Fa m .
542.It Fn m_freem "struct mbuf *m"
543Frees the mbuf chain beginning with
544.Fa m .
545This function contains the elementary sanity check for a
546.Dv NULL
547pointer.
548.It Fn mtod "struct mbuf *m" "datatype"
549Returns a pointer to the data contained in the specified mbuf
550.Fa m ,
551type-casted to the specified data type
552.Fa datatype .
553Implemented as a macro.
554.It Fn MGET "struct mbuf *m" "int how" "int type"
555Allocates mbuf
556.Fa m
557and initializes it to contain internal data.
558See
559.Fn m_get .
560Implemented as a macro.
561.It Fn MGETHDR "struct mbuf *m" "int how" "int type"
562Allocates mbuf
563.Fa m
564and initializes it to contain a packet header.
565See
566.Fn m_gethdr .
567Implemented as a macro.
568.It Fn MEXTMALLOC "struct mbuf *m" "int len" "int how"
569Allocates external storage of size
570.Fa len
571for mbuf
572.Fa m .
573The
574.Fa how
575parameter is a choice of
576.Dv M_WAIT / M_DONTWAIT
577from caller.
578The flag
579.Dv M_EXT
580is set upon success.
581Implemented as a macro.
582.It Fn MEXTADD "struct mbuf *m" "caddr_t buf" "int size" "int type" "void (*free)(struct mbuf *, caddr_t, size_t, void *)" "void *arg"
583Adds pre-allocated external storage
584.Fa buf
585to a normal mbuf
586.Fa m ;
587the parameters
588.Fa size ,
589.Fa type ,
590.Fa free
591and
592.Fa arg
593describe the external storage.
594.Fa size
595is the size of the storage,
596.Fa type
597describes its
598.Xr malloc 9
599type,
600.Fa free
601is a free routine (if not the usual one), and
602.Fa arg
603is a possible argument to the free routine.
604The flag
605.Dv M_EXT
606is set upon success.
607Implemented as a macro.
608If a free routine is specified, it will be called when the mbuf is freed or
609when MEXTREMOVE is called for the mbuf.
610In the case of former, the first argument for a free routine is the mbuf
611.Fa m
612and the routine is expected to free it in addition to the external storage
613pointed by second argument.
614In the case of latter, the first argument for the routine is NULL.
615.It Fn MCLGET "struct mbuf *m" "int how"
616Allocates and adds an mbuf cluster to a normal mbuf
617.Fa m .
618The
619.Fa how
620parameter is a choice of
621.Dv M_WAIT / M_DONTWAIT
622from caller.
623The flag
624.Dv M_EXT
625is set upon success.
626Implemented as a macro.
627.It Fn M_COPY_PKTHDR "struct mbuf *to" "struct mbuf *from"
628Copies the mbuf pkthdr from mbuf
629.Fa from
630to mbuf
631.Fa to .
632.Fa from
633must have the type flag
634.Dv M_PKTHDR
635set, and
636.Fa to
637must be empty.
638Implemented as a macro.
639.It Fn M_MOVE_PKTHDR "struct mbuf *to" "struct mbuf *from"
640Moves the mbuf pkthdr from mbuf
641.Fa from
642to mbuf
643.Fa to .
644.Fa from
645must have the type flag
646.Dv M_PKTHDR
647set, and
648.Fa to
649must be empty.
650The flag
651.Dv M_PKTHDR
652in mbuf
653.Fa from
654will be cleared.
655.It Fn M_ALIGN "struct mbuf *m" "int len"
656Sets the data pointer of a newly allocated mbuf
657.Fa m
658to
659.Fa len
660bytes from the end of the mbuf data area, so that
661.Fa len
662bytes of data written to the mbuf
663.Fa m ,
664starting at the data pointer, will be aligned to the end of the data area.
665Implemented as a macro.
666.It Fn MH_ALIGN "struct mbuf *m" "int len"
667Sets the data pointer of a newly allocated packetheader mbuf
668.Fa m
669to
670.Fa len
671bytes from the end of the mbuf data area, so that
672.Fa len
673bytes of data written to the mbuf
674.Fa m ,
675starting at the data pointer, will be aligned to the end of the data area.
676Implemented as a macro.
677.It Fn M_LEADINGSPACE "struct mbuf *m"
678Returns the amount of space available before the current start of valid
679data in mbuf
680.Fa m .
681Returns 0 if the mbuf data part is shared across multiple mbufs
682.Pq i.e. not writable .
683Implemented as a macro.
684.It Fn M_TRAILINGSPACE "struct mbuf *m"
685Returns the amount of space available after the current end of valid
686data in mbuf
687.Fa m .
688Returns 0 if the mbuf data part is shared across multiple mbufs
689.Pq i.e. not writable .
690Implemented as a macro.
691.It Fn M_PREPEND "struct mbuf *m" "int plen" "int how"
692Prepends space of size
693.Fa plen
694to mbuf
695.Fa m .
696If a new mbuf must be allocated,
697.Fa how
698specifies whether to wait.
699If
700.Fa how
701is
702.Dv M_DONTWAIT
703and allocation fails, the original mbuf chain is freed and
704.Fa m
705is set to
706.Dv NULL .
707Implemented as a macro.
708.It Fn MCHTYPE "struct mbuf *m" "int type"
709Change mbuf
710.Fa m
711to new type
712.Fa type .
713Implemented as a macro.
714.It Fn MEXTREMOVE "struct mbuf *m"
715Removes external storage from mbuf
716.Fa m .
717The flag
718.Dv M_EXT
719is removed.
720Implemented as a macro.
721.It Fn MFREE "struct mbuf *m" "struct mbuf *n"
722Frees a single mbuf
723.Fa m
724and places the successor, if any, in mbuf
725.Fa n .
726Implemented as a macro.
727.El
728.Sh FILES
729The
730.Nm
731management functions are implemented within the file
732.Pa sys/kern/uipc_mbuf.c .
733Function prototypes, and the functions implemented as macros
734are located in
735.Pa sys/sys/mbuf.h .
736Both pathnames are relative to the root of the
737.Nx
738source tree,
739.Pa /usr/src .
740.Sh SEE ALSO
741.Pa /usr/share/doc/smm/18.net ,
742.Xr netstat 1 ,
743.Xr m_tag 9 ,
744.Xr malloc 9
745.Rs
746.%A Jun-ichiro Hagino
747.%T "Mbuf issues in 4.4BSD IPv6/IPsec support (experiences from KAME IPv6/IPsec implementation)"
748.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
749.%D June 2000
750.Re
751.Sh AUTHORS
752.An -nosplit
753The original mbuf data structures were designed by Rob Gurwitz
754when he did the initial TCP/IP implementation at BBN.
755.br
756Further extensions and enhancements were made by Bill Joy, Sam Leffler,
757and Mike Karels at CSRG.
758.br
759Current implementation of external storage by
760.An Matt Thomas
761.Aq matt@3am-software.com
762and
763.An Jason R. Thorpe
764.Aq thorpej@NetBSD.org .
765