Add new m_ext type for data for M_NOFREE mbufs, which doesn't actually do
anything except several assertions. This type is going to be used for temporary on stack mbufs, that point into data in receive ring of a NIC, that shall not be freed. Such mbuf can not be stored or reallocated, its life time is current context.
This commit is contained in:
parent
919e7b5359
commit
eec189c70b
@ -847,7 +847,8 @@ mb_free_ext(struct mbuf *m)
|
||||
*/
|
||||
if (m->m_flags & M_NOFREE) {
|
||||
freembuf = 0;
|
||||
KASSERT(m->m_ext.ext_type == EXT_EXTREF,
|
||||
KASSERT(m->m_ext.ext_type == EXT_EXTREF ||
|
||||
m->m_ext.ext_type == EXT_RXRING,
|
||||
("%s: no-free mbuf %p has wrong type", __func__, m));
|
||||
} else
|
||||
freembuf = 1;
|
||||
@ -891,6 +892,10 @@ mb_free_ext(struct mbuf *m)
|
||||
("%s: ext_free not set", __func__));
|
||||
m->m_ext.ext_free(m);
|
||||
break;
|
||||
case EXT_RXRING:
|
||||
KASSERT(m->m_ext.ext_free == NULL,
|
||||
("%s: ext_free is set", __func__));
|
||||
break;
|
||||
default:
|
||||
KASSERT(m->m_ext.ext_type == 0,
|
||||
("%s: unknown ext_type", __func__));
|
||||
|
@ -443,6 +443,7 @@ struct mbuf {
|
||||
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
|
||||
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
|
||||
#define EXT_MBUF 7 /* external mbuf reference */
|
||||
#define EXT_RXRING 8 /* data in NIC receive ring */
|
||||
|
||||
#define EXT_VENDOR1 224 /* for vendor-internal use */
|
||||
#define EXT_VENDOR2 225 /* for vendor-internal use */
|
||||
|
Loading…
Reference in New Issue
Block a user