platform/linux-dpdk/odp_pool.c
static void
odp_dpdk_mbuf_ctor(struct rte_mempool *mp,
		   void *opaque_arg,
		   void *raw_mbuf,
		   unsigned i)
{
	struct mbuf_ctor_arg *mb_ctor_arg;
	struct rte_mbuf *mb = raw_mbuf;
	struct odp_buffer_hdr_t *buf_hdr;
	struct mbuf_pool_ctor_arg *mbp_ctor_arg = rte_mempool_get_priv(mp);

	/* The rte_mbuf is at the begninning in all cases */
	mb_ctor_arg = (struct mbuf_ctor_arg *)opaque_arg;
	mb = (struct rte_mbuf *)raw_mbuf;

	RTE_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf));

	memset(mb, 0, mp->elt_size);

	/* Start of buffer is just after the ODP type specific header
	 * which contains in the very beginning the rte_mbuf struct */
	mb->buf_addr     = (char *)mb + mb_ctor_arg->seg_buf_offset;
	mb->buf_physaddr = rte_mempool_virt2phy(mp, mb) +
			mb_ctor_arg->seg_buf_offset;
	mb->buf_len      = mb_ctor_arg->seg_buf_size;
	mb->priv_size = rte_pktmbuf_priv_size(mp);

	/* keep some headroom between start of buffer and data */
	if (mb_ctor_arg->type == ODP_POOL_PACKET) {
		odp_packet_hdr_t *pkt_hdr;
		mb->data_off = RTE_PKTMBUF_HEADROOM;
		mb->nb_segs = 1;
		mb->port = 0xff;
		mb->vlan_tci = 0;
		pkt_hdr = (odp_packet_hdr_t *)raw_mbuf;
		pkt_hdr->uarea_size = mb_ctor_arg->pkt_uarea_size;
	} else {
		mb->data_off = 0;
	}

	/* init some constant fields */
	mb->pool         = mp;
	mb->ol_flags     = 0;

	/* Save index, might be useful for debugging purposes */
	buf_hdr = (struct odp_buffer_hdr_t *)raw_mbuf;
	buf_hdr->index = i;
	buf_hdr->handle.handle = (odp_buffer_t)buf_hdr;
	buf_hdr->pool_hdl = mbp_ctor_arg->pool_hdl;
	buf_hdr->type = mb_ctor_arg->type;
	buf_hdr->event_type = mb_ctor_arg->type;
}
/* ODP DPDK mbuf constructor.
 * This is a combination of rte_pktmbuf_init in rte_mbuf.c
 * and testpmd_mbuf_ctor in testpmd.c
 */
ODP DPDK mbuf constructor.
This is a combination of rte_pktmbuf_init in rte_mbuf.c
and testpmd_mbuf_ctor in testpmd.c
ODP DPDK mbuf constructor . This is a combination of rte_pktmbuf_init in rte_mbuf . c and testpmd_mbuf_ctor in testpmd . c
static void
odp_dpdk_mbuf_ctor(struct rte_mempool *mp,
		   void *opaque_arg,
		   void *raw_mbuf,
		   unsigned i)
{
	struct mbuf_ctor_arg *mb_ctor_arg;
	struct rte_mbuf *mb = raw_mbuf;
	struct odp_buffer_hdr_t *buf_hdr;
	struct mbuf_pool_ctor_arg *mbp_ctor_arg = rte_mempool_get_priv(mp);
	mb_ctor_arg = (struct mbuf_ctor_arg *)opaque_arg;
	mb = (struct rte_mbuf *)raw_mbuf;
	RTE_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf));
	memset(mb, 0, mp->elt_size);
	mb->buf_addr     = (char *)mb + mb_ctor_arg->seg_buf_offset;
	mb->buf_physaddr = rte_mempool_virt2phy(mp, mb) +
			mb_ctor_arg->seg_buf_offset;
	mb->buf_len      = mb_ctor_arg->seg_buf_size;
	mb->priv_size = rte_pktmbuf_priv_size(mp);
	if (mb_ctor_arg->type == ODP_POOL_PACKET) {
		odp_packet_hdr_t *pkt_hdr;
		mb->data_off = RTE_PKTMBUF_HEADROOM;
		mb->nb_segs = 1;
		mb->port = 0xff;
		mb->vlan_tci = 0;
		pkt_hdr = (odp_packet_hdr_t *)raw_mbuf;
		pkt_hdr->uarea_size = mb_ctor_arg->pkt_uarea_size;
	} else {
		mb->data_off = 0;
	}
	mb->pool         = mp;
	mb->ol_flags     = 0;
	buf_hdr = (struct odp_buffer_hdr_t *)raw_mbuf;
	buf_hdr->index = i;
	buf_hdr->handle.handle = (odp_buffer_t)buf_hdr;
	buf_hdr->pool_hdl = mbp_ctor_arg->pool_hdl;
	buf_hdr->type = mb_ctor_arg->type;
	buf_hdr->event_type = mb_ctor_arg->type;
}
static void odp_dpdk_mbuf_ctor ( struct rte_mempool * mp , void * opaque_arg , void * raw_mbuf , unsigned i ) { struct mbuf_ctor_arg * mb_ctor_arg ; struct rte_mbuf * mb = raw_mbuf ; struct odp_buffer_hdr_t * buf_hdr ; struct mbuf_pool_ctor_arg * mbp_ctor_arg = rte_mempool_get_priv ( mp ) ; mb_ctor_arg = ( struct mbuf_ctor_arg * ) opaque_arg ; mb = ( struct rte_mbuf * ) raw_mbuf ; RTE_ASSERT ( mp -> elt_size >= sizeof ( struct rte_mbuf ) ) ; memset ( mb , 0 , mp -> elt_size ) ; mb -> buf_addr = ( char * ) mb + mb_ctor_arg -> seg_buf_offset ; mb -> buf_physaddr = rte_mempool_virt2phy ( mp , mb ) + mb_ctor_arg -> seg_buf_offset ; mb -> buf_len = mb_ctor_arg -> seg_buf_size ; mb -> priv_size = rte_pktmbuf_priv_size ( mp ) ; if ( mb_ctor_arg -> type == ODP_POOL_PACKET ) { odp_packet_hdr_t * pkt_hdr ; mb -> data_off = RTE_PKTMBUF_HEADROOM ; mb -> nb_segs = 1 ; mb -> port = 0xff ; mb -> vlan_tci = 0 ; pkt_hdr = ( odp_packet_hdr_t * ) raw_mbuf ; pkt_hdr -> uarea_size = mb_ctor_arg -> pkt_uarea_size ; } else { mb -> data_off = 0 ; } mb -> pool = mp ; mb -> ol_flags = 0 ; buf_hdr = ( struct odp_buffer_hdr_t * ) raw_mbuf ; buf_hdr -> index = i ; buf_hdr -> handle . handle = ( odp_buffer_t ) buf_hdr ; buf_hdr -> pool_hdl = mbp_ctor_arg -> pool_hdl ; buf_hdr -> type = mb_ctor_arg -> type ; buf_hdr -> event_type = mb_ctor_arg -> type ; }
ODP DPDK mbuf constructor.
ODP DPDK mbuf constructor .
/* The rte_mbuf is at the begninning in all cases */ /* Start of buffer is just after the ODP type specific header
	 * which contains in the very beginning the rte_mbuf struct */ /* keep some headroom between start of buffer and data */ /* init some constant fields */ /* Save index, might be useful for debugging purposes */