| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mbuf.h,v 1.149 2012/04/29 16:36:54 dsl Exp $ */ | | 1 | /* $NetBSD: mbuf.h,v 1.150 2012/12/27 14:41:10 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center and Matt Thomas of 3am Software Foundry. | | 9 | * NASA Ames Research Center and Matt Thomas of 3am Software Foundry. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -498,27 +498,27 @@ do { \ | | | @@ -498,27 +498,27 @@ do { \ |
498 | /* ext_paddr initialized above */ \ | | 498 | /* ext_paddr initialized above */ \ |
499 | mowner_ref((m), M_EXT|M_CLUSTER); \ | | 499 | mowner_ref((m), M_EXT|M_CLUSTER); \ |
500 | } \ | | 500 | } \ |
501 | } while (/* CONSTCOND */ 0) | | 501 | } while (/* CONSTCOND */ 0) |
502 | | | 502 | |
503 | /* | | 503 | /* |
504 | * The standard mbuf cluster pool. | | 504 | * The standard mbuf cluster pool. |
505 | */ | | 505 | */ |
506 | #define MCLGET(m, how) _MCLGET((m), mcl_cache, MCLBYTES, (how)) | | 506 | #define MCLGET(m, how) _MCLGET((m), mcl_cache, MCLBYTES, (how)) |
507 | | | 507 | |
508 | #define MEXTMALLOC(m, size, how) \ | | 508 | #define MEXTMALLOC(m, size, how) \ |
509 | do { \ | | 509 | do { \ |
510 | (m)->m_ext_storage.ext_buf = \ | | 510 | (m)->m_ext_storage.ext_buf = \ |
511 | (void *)malloc((size), mbtypes[(m)->m_type], (how)); \ | | 511 | malloc((size), mbtypes[(m)->m_type], (how)); \ |
512 | if ((m)->m_ext_storage.ext_buf != NULL) { \ | | 512 | if ((m)->m_ext_storage.ext_buf != NULL) { \ |
513 | MCLINITREFERENCE(m); \ | | 513 | MCLINITREFERENCE(m); \ |
514 | (m)->m_data = (m)->m_ext.ext_buf; \ | | 514 | (m)->m_data = (m)->m_ext.ext_buf; \ |
515 | (m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | \ | | 515 | (m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) | \ |
516 | M_EXT|M_EXT_RW; \ | | 516 | M_EXT|M_EXT_RW; \ |
517 | (m)->m_ext.ext_flags = 0; \ | | 517 | (m)->m_ext.ext_flags = 0; \ |
518 | (m)->m_ext.ext_size = (size); \ | | 518 | (m)->m_ext.ext_size = (size); \ |
519 | (m)->m_ext.ext_free = NULL; \ | | 519 | (m)->m_ext.ext_free = NULL; \ |
520 | (m)->m_ext.ext_arg = NULL; \ | | 520 | (m)->m_ext.ext_arg = NULL; \ |
521 | mowner_ref((m), M_EXT); \ | | 521 | mowner_ref((m), M_EXT); \ |
522 | } \ | | 522 | } \ |
523 | } while (/* CONSTCOND */ 0) | | 523 | } while (/* CONSTCOND */ 0) |
524 | | | 524 | |
| @@ -549,30 +549,30 @@ do { \ | | | @@ -549,30 +549,30 @@ do { \ |
549 | | | 549 | |
550 | /* | | 550 | /* |
551 | * MFREE(struct mbuf *m, struct mbuf *n) | | 551 | * MFREE(struct mbuf *m, struct mbuf *n) |
552 | * Free a single mbuf and associated external storage. | | 552 | * Free a single mbuf and associated external storage. |
553 | * Place the successor, if any, in n. | | 553 | * Place the successor, if any, in n. |
554 | */ | | 554 | */ |
555 | #define MFREE(m, n) \ | | 555 | #define MFREE(m, n) \ |
556 | mowner_revoke((m), 1, (m)->m_flags); \ | | 556 | mowner_revoke((m), 1, (m)->m_flags); \ |
557 | mbstat_type_add((m)->m_type, -1); \ | | 557 | mbstat_type_add((m)->m_type, -1); \ |
558 | if ((m)->m_flags & M_PKTHDR) \ | | 558 | if ((m)->m_flags & M_PKTHDR) \ |
559 | m_tag_delete_chain((m), NULL); \ | | 559 | m_tag_delete_chain((m), NULL); \ |
560 | (n) = (m)->m_next; \ | | 560 | (n) = (m)->m_next; \ |
561 | if ((m)->m_flags & M_EXT) { \ | | 561 | if ((m)->m_flags & M_EXT) { \ |
562 | m_ext_free(m); \ | | 562 | m_ext_free((m)); \ |
563 | } else { \ | | 563 | } else { \ |
564 | KASSERT(m->m_type != MT_FREE); \ | | 564 | KASSERT((m)->m_type != MT_FREE); \ |
565 | m->m_type = MT_FREE; \ | | 565 | (m)->m_type = MT_FREE; \ |
566 | pool_cache_put(mb_cache, (m)); \ | | 566 | pool_cache_put(mb_cache, (m)); \ |
567 | } \ | | 567 | } \ |
568 | | | 568 | |
569 | /* | | 569 | /* |
570 | * Copy mbuf pkthdr from `from' to `to'. | | 570 | * Copy mbuf pkthdr from `from' to `to'. |
571 | * `from' must have M_PKTHDR set, and `to' must be empty. | | 571 | * `from' must have M_PKTHDR set, and `to' must be empty. |
572 | */ | | 572 | */ |
573 | #define M_COPY_PKTHDR(to, from) \ | | 573 | #define M_COPY_PKTHDR(to, from) \ |
574 | do { \ | | 574 | do { \ |
575 | (to)->m_pkthdr = (from)->m_pkthdr; \ | | 575 | (to)->m_pkthdr = (from)->m_pkthdr; \ |
576 | (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \ | | 576 | (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \ |
577 | SLIST_INIT(&(to)->m_pkthdr.tags); \ | | 577 | SLIST_INIT(&(to)->m_pkthdr.tags); \ |
578 | m_tag_copy_chain((to), (from)); \ | | 578 | m_tag_copy_chain((to), (from)); \ |