src/dpdk/lib/librte_mbuf/rte_mbuf.h
static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
{
	RTE_ASSERT(RTE_MBUF_DIRECT(mi) &&
	    rte_mbuf_refcnt_read(mi) == 1);

	if (RTE_MBUF_HAS_EXTBUF(m)) {
		rte_mbuf_ext_refcnt_update(m->shinfo, 1);
		mi->ol_flags = m->ol_flags;
		mi->shinfo = m->shinfo;
	} else {
		/* if m is not direct, get the mbuf that embeds the data */
		rte_mbuf_refcnt_update(rte_mbuf_from_indirect(m), 1);
		mi->priv_size = m->priv_size;
		mi->ol_flags = m->ol_flags | IND_ATTACHED_MBUF;
	}

	__rte_pktmbuf_copy_hdr(mi, m);

	mi->data_off = m->data_off;
	mi->data_len = m->data_len;
	mi->buf_iova = m->buf_iova;
	mi->buf_addr = m->buf_addr;
	mi->buf_len = m->buf_len;

	mi->next = NULL;
	mi->pkt_len = mi->data_len;
	mi->nb_segs = 1;

	__rte_mbuf_sanity_check(mi, 1);
	__rte_mbuf_sanity_check(m, 0);
}
/**
 * Attach packet mbuf to another packet mbuf.
 *
 * If the mbuf we are attaching to isn't a direct buffer and is attached to
 * an external buffer, the mbuf being attached will be attached to the
 * external buffer instead of mbuf indirection.
 *
 * Otherwise, the mbuf will be indirectly attached. After attachment we
 * refer the mbuf we attached as 'indirect', while mbuf we attached to as
 * 'direct'.  The direct mbuf's reference counter is incremented.
 *
 * Right now, not supported:
 *  - attachment for already indirect mbuf (e.g. - mi has to be direct).
 *  - mbuf we trying to attach (mi) is used by someone else
 *    e.g. it's reference counter is greater then 1.
 *
 * @param mi
 *   The indirect packet mbuf.
 * @param m
 *   The packet mbuf we're attaching to.
 */
Attach packet mbuf to another packet mbuf.
If the mbuf we are attaching to isn't a direct buffer and is attached to
an external buffer, the mbuf being attached will be attached to the
external buffer instead of mbuf indirection.

Otherwise, the mbuf will be indirectly attached. After attachment we
refer the mbuf we attached as 'indirect', while mbuf we attached to as
'direct'.  The direct mbuf's reference counter is incremented.

Right now, not supported:
- attachment for already indirect mbuf .
- mbuf we trying to attach (mi) is used by someone else
e.g. it's reference counter is greater then 1.

@param mi
The indirect packet mbuf.
@param m
The packet mbuf we're attaching to.
Attach packet mbuf to another packet mbuf . If the mbuf we are attaching to isn ' t a direct buffer and is attached to an external buffer the mbuf being attached will be attached to the external buffer instead of mbuf indirection . Otherwise the mbuf will be indirectly attached . After attachment we refer the mbuf we attached as ' indirect ' while mbuf we attached to as ' direct ' . The direct mbuf ' s reference counter is incremented . Right now not supported : - attachment for already indirect mbuf . - mbuf we trying to attach ( mi ) is used by someone else e . g . it ' s reference counter is greater then 1 . @param mi The indirect packet mbuf . @param m The packet mbuf we ' re attaching to .
static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
{
	RTE_ASSERT(RTE_MBUF_DIRECT(mi) &&
	    rte_mbuf_refcnt_read(mi) == 1);
	if (RTE_MBUF_HAS_EXTBUF(m)) {
		rte_mbuf_ext_refcnt_update(m->shinfo, 1);
		mi->ol_flags = m->ol_flags;
		mi->shinfo = m->shinfo;
	} else {
		rte_mbuf_refcnt_update(rte_mbuf_from_indirect(m), 1);
		mi->priv_size = m->priv_size;
		mi->ol_flags = m->ol_flags | IND_ATTACHED_MBUF;
	}
	__rte_pktmbuf_copy_hdr(mi, m);
	mi->data_off = m->data_off;
	mi->data_len = m->data_len;
	mi->buf_iova = m->buf_iova;
	mi->buf_addr = m->buf_addr;
	mi->buf_len = m->buf_len;
	mi->next = NULL;
	mi->pkt_len = mi->data_len;
	mi->nb_segs = 1;
	__rte_mbuf_sanity_check(mi, 1);
	__rte_mbuf_sanity_check(m, 0);
}
static inline void rte_pktmbuf_attach ( struct rte_mbuf * mi , struct rte_mbuf * m ) { RTE_ASSERT ( RTE_MBUF_DIRECT ( mi ) && rte_mbuf_refcnt_read ( mi ) == 1 ) ; if ( RTE_MBUF_HAS_EXTBUF ( m ) ) { rte_mbuf_ext_refcnt_update ( m -> shinfo , 1 ) ; mi -> ol_flags = m -> ol_flags ; mi -> shinfo = m -> shinfo ; } else { rte_mbuf_refcnt_update ( rte_mbuf_from_indirect ( m ) , 1 ) ; mi -> priv_size = m -> priv_size ; mi -> ol_flags = m -> ol_flags | IND_ATTACHED_MBUF ; } __rte_pktmbuf_copy_hdr ( mi , m ) ; mi -> data_off = m -> data_off ; mi -> data_len = m -> data_len ; mi -> buf_iova = m -> buf_iova ; mi -> buf_addr = m -> buf_addr ; mi -> buf_len = m -> buf_len ; mi -> next = NULL ; mi -> pkt_len = mi -> data_len ; mi -> nb_segs = 1 ; __rte_mbuf_sanity_check ( mi , 1 ) ; __rte_mbuf_sanity_check ( m , 0 ) ; }
Attach packet mbuf to another packet mbuf.
Attach packet mbuf to another packet mbuf .
/* if m is not direct, get the mbuf that embeds the data */