src/dpdk/lib/librte_mbuf/rte_mbuf.h
static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
{
	struct rte_mempool *mp = m->pool;
	uint32_t mbuf_size, buf_len;
	uint16_t priv_size;

	if (RTE_MBUF_HAS_EXTBUF(m)) {
		/*
		 * The mbuf has the external attached buffer,
		 * we should check the type of the memory pool where
		 * the mbuf was allocated from to detect the pinned
		 * external buffer.
		 */
		uint32_t flags = rte_pktmbuf_priv_flags(mp);

		if (flags & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) {
			/*
			 * The pinned external buffer should not be
			 * detached from its backing mbuf, just exit.
			 */
			return;
		}
		__rte_pktmbuf_free_extbuf(m);
	} else {
		__rte_pktmbuf_free_direct(m);
	}
	priv_size = rte_pktmbuf_priv_size(mp);
	mbuf_size = (uint32_t)(sizeof(struct rte_mbuf) + priv_size);
	buf_len = rte_pktmbuf_data_room_size(mp);

	m->priv_size = priv_size;
	m->buf_addr = (char *)m + mbuf_size;
	m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
	m->buf_len = (uint16_t)buf_len;
	rte_pktmbuf_reset_headroom(m);
	m->data_len = 0;
	m->ol_flags = 0;
}
/**
 * Detach a packet mbuf from external buffer or direct buffer.
 *
 *  - decrement refcnt and free the external/direct buffer if refcnt
 *    becomes zero.
 *  - restore original mbuf address and length values.
 *  - reset pktmbuf data and data_len to their default values.
 *
 * All other fields of the given packet mbuf will be left intact.
 *
 * If the packet mbuf was allocated from the pool with pinned
 * external buffers the rte_pktmbuf_detach does nothing with the
 * mbuf of this kind, because the pinned buffers are not supposed
 * to be detached.
 *
 * @param m
 *   The indirect attached packet mbuf.
 */
Detach a packet mbuf from external buffer or direct buffer.
- decrement refcnt and free the external/direct buffer if refcnt
becomes zero.
- restore original mbuf address and length values.
- reset pktmbuf data and data_len to their default values.

All other fields of the given packet mbuf will be left intact.

If the packet mbuf was allocated from the pool with pinned
external buffers the rte_pktmbuf_detach does nothing with the
mbuf of this kind, because the pinned buffers are not supposed
to be detached.

@param m
The indirect attached packet mbuf.
Detach a packet mbuf from external buffer or direct buffer . - decrement refcnt and free the external / direct buffer if refcnt becomes zero . - restore original mbuf address and length values . - reset pktmbuf data and data_len to their default values . All other fields of the given packet mbuf will be left intact . If the packet mbuf was allocated from the pool with pinned external buffers the rte_pktmbuf_detach does nothing with the mbuf of this kind because the pinned buffers are not supposed to be detached . @param m The indirect attached packet mbuf .
static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
{
	struct rte_mempool *mp = m->pool;
	uint32_t mbuf_size, buf_len;
	uint16_t priv_size;
	if (RTE_MBUF_HAS_EXTBUF(m)) {
		uint32_t flags = rte_pktmbuf_priv_flags(mp);
		if (flags & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) {
			return;
		}
		__rte_pktmbuf_free_extbuf(m);
	} else {
		__rte_pktmbuf_free_direct(m);
	}
	priv_size = rte_pktmbuf_priv_size(mp);
	mbuf_size = (uint32_t)(sizeof(struct rte_mbuf) + priv_size);
	buf_len = rte_pktmbuf_data_room_size(mp);
	m->priv_size = priv_size;
	m->buf_addr = (char *)m + mbuf_size;
	m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
	m->buf_len = (uint16_t)buf_len;
	rte_pktmbuf_reset_headroom(m);
	m->data_len = 0;
	m->ol_flags = 0;
}
static inline void rte_pktmbuf_detach ( struct rte_mbuf * m ) { struct rte_mempool * mp = m -> pool ; uint32_t mbuf_size , buf_len ; uint16_t priv_size ; if ( RTE_MBUF_HAS_EXTBUF ( m ) ) { uint32_t flags = rte_pktmbuf_priv_flags ( mp ) ; if ( flags & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF ) { return ; } __rte_pktmbuf_free_extbuf ( m ) ; } else { __rte_pktmbuf_free_direct ( m ) ; } priv_size = rte_pktmbuf_priv_size ( mp ) ; mbuf_size = ( uint32_t ) ( sizeof ( struct rte_mbuf ) + priv_size ) ; buf_len = rte_pktmbuf_data_room_size ( mp ) ; m -> priv_size = priv_size ; m -> buf_addr = ( char * ) m + mbuf_size ; m -> buf_iova = rte_mempool_virt2iova ( m ) + mbuf_size ; m -> buf_len = ( uint16_t ) buf_len ; rte_pktmbuf_reset_headroom ( m ) ; m -> data_len = 0 ; m -> ol_flags = 0 ; }
Detach a packet mbuf from external buffer or direct buffer.
Detach a packet mbuf from external buffer or direct buffer .
/*
		 * The mbuf has the external attached buffer,
		 * we should check the type of the memory pool where
		 * the mbuf was allocated from to detect the pinned
		 * external buffer.
		 */ /*
			 * The pinned external buffer should not be
			 * detached from its backing mbuf, just exit.
			 */