/**************************************************************************//**
*
* pktgen_pcap_mbuf_ctor - Callback routine to construct PCAP packets.
*
* DESCRIPTION
* Callback routine to construct a set of PCAP packet buffers.
*
* RETURNS: N/A
*
* SEE ALSO:
*/
static void
pktgen_pcap_mbuf_ctor(struct rte_mempool *mp, void *opaque_arg, void *_m, unsigned i)
{
	struct rte_mbuf *m = _m;
	uint32_t buf_len = mp->elt_size - sizeof(struct rte_mbuf);
	pcaprec_hdr_t hdr;
	ssize_t len = -1;
	char buffer[2048];
	pcap_info_t *pcap = (pcap_info_t *)opaque_arg;

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

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

	/* start of buffer is just after mbuf structure */
	m->buf_addr     = (char *)m + sizeof(struct rte_mbuf);
	m->buf_physaddr = rte_mempool_virt2phy(mp, m->buf_addr);
	m->buf_len      = (uint16_t)buf_len;

	/* keep some headroom between start of buffer and data */
	m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);

	/* init some constant fields */
	m->pool         = mp;
	m->nb_segs      = 1;
	m->port         = 0xff;
	m->ol_flags     = 0;

	for (;; ) {
		if ( (i & 0x3ff) == 0) {
			rte_printf_status("%c\b", "-\\|/"[(i >> 10) & 3]);
			i++;
		}

		if (unlikely(wr_pcap_read(pcap, &hdr, buffer, sizeof(buffer)) <= 0) ) {
			wr_pcap_rewind(pcap);
			continue;
		}

		len = hdr.incl_len;

		/* Adjust the packet length if not a valid size. */
		if (len < (ETHER_MIN_LEN - 4) )
			len = (ETHER_MIN_LEN - 4);
		else if (len > (ETHER_MAX_LEN - 4) )
			len = (ETHER_MAX_LEN - 4);

		m->data_len = len;
		m->pkt_len  = len;

		rte_memcpy((uint8_t *)m->buf_addr + m->data_off, buffer, len);
		break;
	}
 * ctrlmbuf constructor, given as a callback function to
 * rte_mempool_create()
 */
void
rte_ctrlmbuf_init(struct rte_mempool *mp,
		  __attribute__((unused)) void *opaque_arg,
		  void *_m,
		  __attribute__((unused)) unsigned i)
{
	struct rte_mbuf *m = _m;

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

	/* start of buffer is just after mbuf structure */
	m->buf_addr = (char *)m + sizeof(struct rte_mbuf);
	m->buf_physaddr = rte_mempool_virt2phy(mp, m) +
			sizeof(struct rte_mbuf);
	m->buf_len = (uint16_t) (mp->elt_size - sizeof(struct rte_mbuf));

	/* init some constant fields */
	m->type = RTE_MBUF_CTRL;
	m->ctrl.data = (char *)m->buf_addr;
	m->pool = (struct rte_mempool *)mp;
}

/*
 * pktmbuf pool constructor, given as a callback function to
 * rte_mempool_create()
 */
void
rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg)