uipc_mbuf.c (282594) | uipc_mbuf.c (284961) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1991, 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 --- 16 unchanged lines hidden (view full) --- 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 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1991, 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 --- 16 unchanged lines hidden (view full) --- 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 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 282594 2015-05-07 18:35:01Z ae $"); | 33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 284961 2015-06-30 17:19:58Z np $"); |
34 35#include "opt_param.h" 36#include "opt_mbuf_stress_test.h" 37#include "opt_mbuf_profiling.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> --- 373 unchanged lines hidden (view full) --- 415 atomic_add_int(m->m_ext.ext_cnt, 1); 416 } 417 418 n->m_ext = m->m_ext; 419 n->m_flags |= M_EXT; 420 n->m_flags |= m->m_flags & M_RDONLY; 421} 422 | 34 35#include "opt_param.h" 36#include "opt_mbuf_stress_test.h" 37#include "opt_mbuf_profiling.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> --- 373 unchanged lines hidden (view full) --- 415 atomic_add_int(m->m_ext.ext_cnt, 1); 416 } 417 418 n->m_ext = m->m_ext; 419 n->m_flags |= M_EXT; 420 n->m_flags |= m->m_flags & M_RDONLY; 421} 422 |
423void 424m_demote_pkthdr(struct mbuf *m) 425{ 426 427 M_ASSERTPKTHDR(m); 428 429 m_tag_delete_chain(m, NULL); 430 m->m_flags &= ~M_PKTHDR; 431 bzero(&m->m_pkthdr, sizeof(struct pkthdr)); 432} 433 |
|
423/* 424 * Clean up mbuf (chain) from any tags and packet headers. 425 * If "all" is set then the first mbuf in the chain will be 426 * cleaned too. 427 */ 428void 429m_demote(struct mbuf *m0, int all, int flags) 430{ 431 struct mbuf *m; 432 433 for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) { 434 KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p", 435 __func__, m, m0)); | 434/* 435 * Clean up mbuf (chain) from any tags and packet headers. 436 * If "all" is set then the first mbuf in the chain will be 437 * cleaned too. 438 */ 439void 440m_demote(struct mbuf *m0, int all, int flags) 441{ 442 struct mbuf *m; 443 444 for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) { 445 KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p", 446 __func__, m, m0)); |
436 if (m->m_flags & M_PKTHDR) { 437 m_tag_delete_chain(m, NULL); 438 m->m_flags &= ~M_PKTHDR; 439 bzero(&m->m_pkthdr, sizeof(struct pkthdr)); 440 } | 447 if (m->m_flags & M_PKTHDR) 448 m_demote_pkthdr(m); |
441 m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | flags); 442 } 443} 444 445/* 446 * Sanity checks on mbuf (chain) for use in KASSERT() and general 447 * debugging. 448 * Returns 0 or panics when bad and 1 on all tests passed. --- 1603 unchanged lines hidden --- | 449 m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | flags); 450 } 451} 452 453/* 454 * Sanity checks on mbuf (chain) for use in KASSERT() and general 455 * debugging. 456 * Returns 0 or panics when bad and 1 on all tests passed. --- 1603 unchanged lines hidden --- |