mbuf.h (129832) | mbuf.h (129906) |
---|---|
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. | 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 * 4. Neither the name of the University nor the names of its contributors | 13 * 3. Neither the name of the University nor the names of its contributors |
14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 | 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 |
30 * $FreeBSD: head/sys/sys/mbuf.h 129832 2004-05-29 05:36:43Z maxim $ | 30 * $FreeBSD: head/sys/sys/mbuf.h 129906 2004-05-31 21:46:06Z bmilekic $ |
31 */ 32 33#ifndef _SYS_MBUF_H_ 34#define _SYS_MBUF_H_ 35 | 31 */ 32 33#ifndef _SYS_MBUF_H_ 34#define _SYS_MBUF_H_ 35 |
36/* XXX: These includes suck. Sorry! */ |
|
36#include <sys/queue.h> | 37#include <sys/queue.h> |
38#ifdef _KERNEL 39#include <sys/systm.h> 40#include <vm/uma.h> 41#endif |
|
37 38/* 39 * Mbufs are of a single size, MSIZE (sys/param.h), which 40 * includes overhead. An mbuf may add a single "mbuf cluster" of size 41 * MCLBYTES (also in sys/param.h), which has no additional overhead 42 * and is used instead of the internal data area; this is done when 43 * at least MINCLSIZE of data must be stored. Additionally, it is possible 44 * to allocate a separate buffer externally and attach it to the mbuf in --- 7 unchanged lines hidden (view full) --- 52#ifdef _KERNEL 53/*- 54 * Macros for type conversion: 55 * mtod(m, t) -- Convert mbuf pointer to data pointer of correct type. 56 * dtom(x) -- Convert data pointer within mbuf to mbuf pointer (XXX). 57 */ 58#define mtod(m, t) ((t)((m)->m_data)) 59#define dtom(x) ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1))) | 42 43/* 44 * Mbufs are of a single size, MSIZE (sys/param.h), which 45 * includes overhead. An mbuf may add a single "mbuf cluster" of size 46 * MCLBYTES (also in sys/param.h), which has no additional overhead 47 * and is used instead of the internal data area; this is done when 48 * at least MINCLSIZE of data must be stored. Additionally, it is possible 49 * to allocate a separate buffer externally and attach it to the mbuf in --- 7 unchanged lines hidden (view full) --- 57#ifdef _KERNEL 58/*- 59 * Macros for type conversion: 60 * mtod(m, t) -- Convert mbuf pointer to data pointer of correct type. 61 * dtom(x) -- Convert data pointer within mbuf to mbuf pointer (XXX). 62 */ 63#define mtod(m, t) ((t)((m)->m_data)) 64#define dtom(x) ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1))) |
65 66/* 67 * Argument structure passed to UMA routines during mbuf and packet 68 * allocations. 69 */ 70struct mb_args { 71 int flags; /* Flags for mbuf being allocated */ 72 int how; /* How to allocate: M_WAITOK or M_DONTWAIT */ 73 short type; /* Type of mbuf being allocated */ 74}; |
|
60#endif /* _KERNEL */ 61 62/* 63 * Header present at the beginning of every mbuf. 64 */ 65struct m_hdr { 66 struct mbuf *mh_next; /* next buffer in chain */ 67 struct mbuf *mh_nextpkt; /* next chain in queue/record */ --- 94 unchanged lines hidden (view full) --- 162#define M_FIRSTFRAG 0x1000 /* packet is first fragment */ 163#define M_LASTFRAG 0x2000 /* packet is last fragment */ 164 165/* 166 * External buffer types: identify ext_buf type. 167 */ 168#define EXT_CLUSTER 1 /* mbuf cluster */ 169#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ | 75#endif /* _KERNEL */ 76 77/* 78 * Header present at the beginning of every mbuf. 79 */ 80struct m_hdr { 81 struct mbuf *mh_next; /* next buffer in chain */ 82 struct mbuf *mh_nextpkt; /* next chain in queue/record */ --- 94 unchanged lines hidden (view full) --- 177#define M_FIRSTFRAG 0x1000 /* packet is first fragment */ 178#define M_LASTFRAG 0x2000 /* packet is last fragment */ 179 180/* 181 * External buffer types: identify ext_buf type. 182 */ 183#define EXT_CLUSTER 1 /* mbuf cluster */ 184#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ |
185#define EXT_PACKET 3 /* came out of Packet zone */ |
|
170#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */ 171#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */ 172#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */ 173#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */ 174 175/* 176 * Flags copied when copying m_pkthdr. 177 */ --- 40 unchanged lines hidden (view full) --- 218#define MT_RIGHTS 12 /* access rights */ 219#define MT_IFADDR 13 /* interface address */ 220#endif 221#define MT_CONTROL 14 /* extra-data protocol message */ 222#define MT_OOBDATA 15 /* expedited data */ 223#define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */ 224 225/* | 186#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */ 187#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */ 188#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */ 189#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */ 190 191/* 192 * Flags copied when copying m_pkthdr. 193 */ --- 40 unchanged lines hidden (view full) --- 234#define MT_RIGHTS 12 /* access rights */ 235#define MT_IFADDR 13 /* interface address */ 236#endif 237#define MT_CONTROL 14 /* extra-data protocol message */ 238#define MT_OOBDATA 15 /* expedited data */ 239#define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */ 240 241/* |
226 * Mbuf and cluster allocation statistics PCPU structure. 227 */ 228struct mbpstat { 229 u_long mb_mbfree; 230 u_long mb_mbbucks; 231 u_long mb_clfree; 232 u_long mb_clbucks; 233 long mb_mbtypes[MT_NTYPES]; 234 short mb_active; 235}; 236 237/* | |
238 * General mbuf allocator statistics structure. | 242 * General mbuf allocator statistics structure. |
239 * XXX: Modifications of these are not protected by any mutex locks nor by 240 * any atomic() manipulations. As a result, we may occasionally lose 241 * a count or two. Luckily, not all of these fields are modified at all 242 * and remain static, and those that are manipulated are only manipulated 243 * in failure situations, which do not occur (hopefully) very often. | |
244 */ 245struct mbstat { | 243 */ 244struct mbstat { |
246 u_long m_drops; /* times failed to allocate */ 247 u_long m_wait; /* times succesfully returned from wait */ | 245 u_long m_mbufs; /* XXX */ 246 u_long m_mclusts; /* XXX */ 247 |
248 u_long m_drain; /* times drained protocols for space */ 249 u_long m_mcfail; /* XXX: times m_copym failed */ 250 u_long m_mpfail; /* XXX: times m_pullup failed */ 251 u_long m_msize; /* length of an mbuf */ 252 u_long m_mclbytes; /* length of an mbuf cluster */ 253 u_long m_minclsize; /* min length of data to allocate a cluster */ 254 u_long m_mlen; /* length of data in an mbuf */ 255 u_long m_mhlen; /* length of data in a header mbuf */ | 248 u_long m_drain; /* times drained protocols for space */ 249 u_long m_mcfail; /* XXX: times m_copym failed */ 250 u_long m_mpfail; /* XXX: times m_pullup failed */ 251 u_long m_msize; /* length of an mbuf */ 252 u_long m_mclbytes; /* length of an mbuf cluster */ 253 u_long m_minclsize; /* min length of data to allocate a cluster */ 254 u_long m_mlen; /* length of data in an mbuf */ 255 u_long m_mhlen; /* length of data in a header mbuf */ |
256 u_int m_mbperbuck; /* number of mbufs per "bucket" */ 257 u_int m_clperbuck; /* number of clusters per "bucket" */ 258 /* Number of mbtypes (gives # elems in mbpstat's mb_mbtypes[] array: */ | 256 257 /* Number of mbtypes (gives # elems in mbtypes[] array: */ |
259 short m_numtypes; | 258 short m_numtypes; |
259 |
|
260 /* XXX: Sendfile stats should eventually move to their own struct */ 261 u_long sf_iocnt; /* times sendfile had to do disk I/O */ 262 u_long sf_allocfail; /* times sfbuf allocation failed */ 263 u_long sf_allocwait; /* times sfbuf allocation had to wait */ 264}; 265 266/* 267 * Flags specifying how an allocation should be made. | 260 /* XXX: Sendfile stats should eventually move to their own struct */ 261 u_long sf_iocnt; /* times sendfile had to do disk I/O */ 262 u_long sf_allocfail; /* times sfbuf allocation failed */ 263 u_long sf_allocwait; /* times sfbuf allocation had to wait */ 264}; 265 266/* 267 * Flags specifying how an allocation should be made. |
268 * M_DONTWAIT means "don't block if nothing is available" whereas 269 * M_TRYWAIT means "block for mbuf_wait ticks at most if nothing is 270 * available." | 268 * 269 * The flag to use is as follows: 270 * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation. 271 * - M_WAIT or M_WAITOK or M_TRYWAIT from wherever it is safe to block. 272 * 273 * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly 274 * and if we cannot allocate immediately we may return NULL, 275 * whereas M_WAIT/M_WAITOK/M_TRYWAIT means that if we cannot allocate 276 * resources we will block until they are available, and thus never 277 * return NULL. 278 * 279 * XXX Eventually just phase this out to use M_WAITOK/M_NOWAIT. |
271 */ | 280 */ |
272#define M_DONTWAIT 0x4 /* don't conflict with M_NOWAIT */ 273#define M_TRYWAIT 0x8 /* or M_WAITOK */ 274#define M_WAIT M_TRYWAIT /* XXX: deprecated */ 275#define MBTOM(how) ((how) & M_TRYWAIT ? M_WAITOK : M_NOWAIT) | 281#define MBTOM(how) (how) 282#define M_DONTWAIT M_NOWAIT 283#define M_TRYWAIT M_WAITOK 284#define M_WAIT M_WAITOK |
276 277#ifdef _KERNEL 278/*- 279 * mbuf external reference count management macros. 280 * 281 * MEXT_IS_REF(m): true if (m) is not the only mbuf referencing 282 * the external buffer ext_buf. 283 * --- 7 unchanged lines hidden (view full) --- 291#define MEXT_REM_REF(m) do { \ 292 KASSERT(*((m)->m_ext.ref_cnt) > 0, ("m_ext refcnt < 0")); \ 293 atomic_subtract_int((m)->m_ext.ref_cnt, 1); \ 294} while(0) 295 296#define MEXT_ADD_REF(m) atomic_add_int((m)->m_ext.ref_cnt, 1) 297 298/* | 285 286#ifdef _KERNEL 287/*- 288 * mbuf external reference count management macros. 289 * 290 * MEXT_IS_REF(m): true if (m) is not the only mbuf referencing 291 * the external buffer ext_buf. 292 * --- 7 unchanged lines hidden (view full) --- 300#define MEXT_REM_REF(m) do { \ 301 KASSERT(*((m)->m_ext.ref_cnt) > 0, ("m_ext refcnt < 0")); \ 302 atomic_subtract_int((m)->m_ext.ref_cnt, 1); \ 303} while(0) 304 305#define MEXT_ADD_REF(m) atomic_add_int((m)->m_ext.ref_cnt, 1) 306 307/* |
308 * Network buffer allocation API 309 * 310 * The rest of it is defined in kern/subr_mbuf.c 311 */ 312 313extern uma_zone_t zone_mbuf; 314extern uma_zone_t zone_clust; 315extern uma_zone_t zone_pack; 316 317static __inline struct mbuf *m_get(int how, short type); 318static __inline struct mbuf *m_gethdr(int how, short type); 319static __inline struct mbuf *m_getcl(int how, short type, int flags); 320static __inline struct mbuf *m_getclr(int how, short type); /* XXX */ 321static __inline struct mbuf *m_free(struct mbuf *m); 322static __inline void m_clget(struct mbuf *m, int how); 323static __inline void m_chtype(struct mbuf *m, short new_type); 324void mb_free_ext(struct mbuf *); 325 326static __inline 327struct mbuf * 328m_get(int how, short type) 329{ 330 struct mb_args args; 331 332 args.flags = 0; 333 args.how = how; 334 args.type = type; 335 return (uma_zalloc_arg(zone_mbuf, &args, how)); 336} 337 338/* XXX This should be depracated, very little use */ 339static __inline 340struct mbuf * 341m_getclr(int how, short type) 342{ 343 struct mbuf *m; 344 struct mb_args args; 345 346 args.flags = 0; 347 args.how = how; 348 args.type = type; 349 m = uma_zalloc_arg(zone_mbuf, &args, how); 350 if (m != NULL) 351 bzero(m->m_data, MLEN); 352 return m; 353} 354 355static __inline 356struct mbuf * 357m_gethdr(int how, short type) 358{ 359 struct mb_args args; 360 361 args.flags = M_PKTHDR; 362 args.how = how; 363 args.type = type; 364 return (uma_zalloc_arg(zone_mbuf, &args, how)); 365} 366 367static __inline 368struct mbuf * 369m_getcl(int how, short type, int flags) 370{ 371 struct mb_args args; 372 373 args.flags = flags; 374 args.how = how; 375 args.type = type; 376 return (uma_zalloc_arg(zone_pack, &args, how)); 377} 378 379static __inline 380struct mbuf * 381m_free(struct mbuf *m) 382{ 383 struct mbuf *n = m->m_next; 384 385#ifdef INVARIANTS 386 m->m_flags |= M_FREELIST; 387#endif 388 if (m->m_flags & M_EXT) 389 mb_free_ext(m); 390 else 391 uma_zfree(zone_mbuf, m); 392 return n; 393} 394 395static __inline 396void 397m_clget(struct mbuf *m, int how) 398{ 399 m->m_ext.ext_buf = NULL; 400 uma_zalloc_arg(zone_clust, m, how); 401} 402 403static __inline 404void 405m_chtype(struct mbuf *m, short new_type) 406{ 407 m->m_type = new_type; 408} 409 410/* |
|
299 * mbuf, cluster, and external object allocation macros 300 * (for compatibility purposes). 301 */ 302/* NB: M_COPY_PKTHDR is deprecated. Use M_MOVE_PKTHDR or m_dup_pktdr. */ 303#define M_MOVE_PKTHDR(to, from) m_move_pkthdr((to), (from)) | 411 * mbuf, cluster, and external object allocation macros 412 * (for compatibility purposes). 413 */ 414/* NB: M_COPY_PKTHDR is deprecated. Use M_MOVE_PKTHDR or m_dup_pktdr. */ 415#define M_MOVE_PKTHDR(to, from) m_move_pkthdr((to), (from)) |
304#define m_getclr(how, type) m_get_clrd((how), (type)) | |
305#define MGET(m, how, type) ((m) = m_get((how), (type))) 306#define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type))) 307#define MCLGET(m, how) m_clget((m), (how)) 308#define MEXTADD(m, buf, size, free, args, flags, type) \ 309 m_extadd((m), (caddr_t)(buf), (size), (free), (args), (flags), (type)) 310 311/* | 416#define MGET(m, how, type) ((m) = m_get((how), (type))) 417#define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type))) 418#define MCLGET(m, how) m_clget((m), (how)) 419#define MEXTADD(m, buf, size, free, args, flags, type) \ 420 m_extadd((m), (caddr_t)(buf), (size), (free), (args), (flags), (type)) 421 422/* |
312 * MEXTFREE(m): disassociate (and possibly free) an external object from (m). 313 * 314 * If the atomic_cmpset_int() returns 0, then we effectively do nothing 315 * in terms of "cleaning up" (freeing the ext buf and ref. counter) as 316 * this means that either there are still references, or another thread 317 * is taking care of the clean-up. 318 */ 319#define MEXTFREE(m) do { \ 320 struct mbuf *_mb = (m); \ 321 \ 322 MEXT_REM_REF(_mb); \ 323 if (atomic_cmpset_int(_mb->m_ext.ref_cnt, 0, 1)) \ 324 _mext_free(_mb); \ 325 _mb->m_flags &= ~M_EXT; \ 326} while (0) 327 328/* | |
329 * Evaluate TRUE if it's safe to write to the mbuf m's data region (this 330 * can be both the local data payload, or an external buffer area, 331 * depending on whether M_EXT is set). 332 */ 333#define M_WRITABLE(m) (!((m)->m_flags & M_RDONLY) && (!((m)->m_flags \ 334 & M_EXT) || !MEXT_IS_REF(m))) 335 336/* Check if the supplied mbuf has a packet header, or else panic. */ --- 83 unchanged lines hidden (view full) --- 420#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) 421 422extern int max_datalen; /* MHLEN - max_hdr */ 423extern int max_hdr; /* Largest link + protocol header */ 424extern int max_linkhdr; /* Largest link-level header */ 425extern int max_protohdr; /* Largest protocol header */ 426extern struct mbstat mbstat; /* General mbuf stats/infos */ 427extern int nmbclusters; /* Maximum number of clusters */ | 423 * Evaluate TRUE if it's safe to write to the mbuf m's data region (this 424 * can be both the local data payload, or an external buffer area, 425 * depending on whether M_EXT is set). 426 */ 427#define M_WRITABLE(m) (!((m)->m_flags & M_RDONLY) && (!((m)->m_flags \ 428 & M_EXT) || !MEXT_IS_REF(m))) 429 430/* Check if the supplied mbuf has a packet header, or else panic. */ --- 83 unchanged lines hidden (view full) --- 514#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) 515 516extern int max_datalen; /* MHLEN - max_hdr */ 517extern int max_hdr; /* Largest link + protocol header */ 518extern int max_linkhdr; /* Largest link-level header */ 519extern int max_protohdr; /* Largest protocol header */ 520extern struct mbstat mbstat; /* General mbuf stats/infos */ 521extern int nmbclusters; /* Maximum number of clusters */ |
428extern int nmbcnt; /* Scale kmem_map for counter space */ 429extern int nmbufs; /* Maximum number of mbufs */ | |
430 431struct uio; 432 | 522 523struct uio; 524 |
433void _mext_free(struct mbuf *); | |
434void m_adj(struct mbuf *, int); 435int m_apply(struct mbuf *, int, int, 436 int (*)(void *, void *, u_int), void *); 437void m_cat(struct mbuf *, struct mbuf *); | 525void m_adj(struct mbuf *, int); 526int m_apply(struct mbuf *, int, int, 527 int (*)(void *, void *, u_int), void *); 528void m_cat(struct mbuf *, struct mbuf *); |
438void m_chtype(struct mbuf *, short); 439void m_clget(struct mbuf *, int); | |
440void m_extadd(struct mbuf *, caddr_t, u_int, 441 void (*)(void *, void *), void *, int, int); 442void m_copyback(struct mbuf *, int, int, c_caddr_t); 443void m_copydata(const struct mbuf *, int, int, caddr_t); 444struct mbuf *m_copym(struct mbuf *, int, int, int); 445struct mbuf *m_copypacket(struct mbuf *, int); 446void m_copy_pkthdr(struct mbuf *, struct mbuf *); 447struct mbuf *m_defrag(struct mbuf *, int); 448struct mbuf *m_devget(char *, int, int, struct ifnet *, 449 void (*)(char *, caddr_t, u_int)); 450struct mbuf *m_dup(struct mbuf *, int); 451int m_dup_pkthdr(struct mbuf *, struct mbuf *, int); 452u_int m_fixhdr(struct mbuf *); 453struct mbuf *m_fragment(struct mbuf *, int, int); | 529void m_extadd(struct mbuf *, caddr_t, u_int, 530 void (*)(void *, void *), void *, int, int); 531void m_copyback(struct mbuf *, int, int, c_caddr_t); 532void m_copydata(const struct mbuf *, int, int, caddr_t); 533struct mbuf *m_copym(struct mbuf *, int, int, int); 534struct mbuf *m_copypacket(struct mbuf *, int); 535void m_copy_pkthdr(struct mbuf *, struct mbuf *); 536struct mbuf *m_defrag(struct mbuf *, int); 537struct mbuf *m_devget(char *, int, int, struct ifnet *, 538 void (*)(char *, caddr_t, u_int)); 539struct mbuf *m_dup(struct mbuf *, int); 540int m_dup_pkthdr(struct mbuf *, struct mbuf *, int); 541u_int m_fixhdr(struct mbuf *); 542struct mbuf *m_fragment(struct mbuf *, int, int); |
454struct mbuf *m_free(struct mbuf *); | |
455void m_freem(struct mbuf *); | 543void m_freem(struct mbuf *); |
456struct mbuf *m_get(int, short); 457struct mbuf *m_get_clrd(int, short); 458struct mbuf *m_getcl(int, short, int); 459struct mbuf *m_gethdr(int, short); 460struct mbuf *m_gethdr_clrd(int, short); | |
461struct mbuf *m_getm(struct mbuf *, int, int, short); 462struct mbuf *m_getptr(struct mbuf *, int, int *); 463u_int m_length(struct mbuf *, struct mbuf **); 464void m_move_pkthdr(struct mbuf *, struct mbuf *); 465struct mbuf *m_prepend(struct mbuf *, int, int); 466void m_print(const struct mbuf *); 467struct mbuf *m_pulldown(struct mbuf *, int, int, int *); 468struct mbuf *m_pullup(struct mbuf *, int); 469struct mbuf *m_split(struct mbuf *, int, int); 470struct mbuf *m_uiotombuf(struct uio *, int, int); 471 472/*- | 544struct mbuf *m_getm(struct mbuf *, int, int, short); 545struct mbuf *m_getptr(struct mbuf *, int, int *); 546u_int m_length(struct mbuf *, struct mbuf **); 547void m_move_pkthdr(struct mbuf *, struct mbuf *); 548struct mbuf *m_prepend(struct mbuf *, int, int); 549void m_print(const struct mbuf *); 550struct mbuf *m_pulldown(struct mbuf *, int, int, int *); 551struct mbuf *m_pullup(struct mbuf *, int); 552struct mbuf *m_split(struct mbuf *, int, int); 553struct mbuf *m_uiotombuf(struct uio *, int, int); 554 555/*- |
473 * Packets may have annotations attached by affixing a list | 556 * Network packets may have annotations attached by affixing a list |
474 * of "packet tags" to the pkthdr structure. Packet tags are 475 * dynamically allocated semi-opaque data structures that have 476 * a fixed header (struct m_tag) that specifies the size of the 477 * memory block and a <cookie,type> pair that identifies it. 478 * The cookie is a 32-bit unique unsigned value used to identify 479 * a module or ABI. By convention this value is chose as the 480 * date+time that the module is created, expressed as the number of 481 * seconds since the epoch (e.g., using date -u +'%s'). The type value --- 182 unchanged lines hidden --- | 557 * of "packet tags" to the pkthdr structure. Packet tags are 558 * dynamically allocated semi-opaque data structures that have 559 * a fixed header (struct m_tag) that specifies the size of the 560 * memory block and a <cookie,type> pair that identifies it. 561 * The cookie is a 32-bit unique unsigned value used to identify 562 * a module or ABI. By convention this value is chose as the 563 * date+time that the module is created, expressed as the number of 564 * seconds since the epoch (e.g., using date -u +'%s'). The type value --- 182 unchanged lines hidden --- |