diff options
author | kmacy <kmacy@FreeBSD.org> | 2007-10-06 21:13:55 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2007-10-06 21:13:55 +0000 |
commit | c00108fd67397129aaed54bbec1d64b7b0cd4259 (patch) | |
tree | 6da28a59b2ccdc4d405f3729f74981d6b9c1a58e /sys/kern/kern_mbuf.c | |
parent | 880e2532778939d3d8a220a03a74a153264d0aa1 (diff) | |
download | FreeBSD-src-c00108fd67397129aaed54bbec1d64b7b0cd4259.zip FreeBSD-src-c00108fd67397129aaed54bbec1d64b7b0cd4259.tar.gz |
Allow drivers to free an mbuf without having the mbuf be touched if
the driver has already freed any attached tags
Approved by: re(gnn)
Diffstat (limited to 'sys/kern/kern_mbuf.c')
-rw-r--r-- | sys/kern/kern_mbuf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 8023920..a5e1348 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -339,9 +339,12 @@ static void mb_dtor_mbuf(void *mem, int size, void *arg) { struct mbuf *m; + unsigned long flags; m = (struct mbuf *)mem; - if ((m->m_flags & M_PKTHDR) != 0) + flags = (unsigned long)arg; + + if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0) m_tag_delete_chain(m, NULL); KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); #ifdef INVARIANTS @@ -527,7 +530,7 @@ mb_ctor_pack(void *mem, int size, void *arg, int how) m->m_len = 0; m->m_flags = (flags | M_EXT); m->m_type = type; - + if (flags & M_PKTHDR) { m->m_pkthdr.rcvif = NULL; m->m_pkthdr.len = 0; |