src/dpdk/drivers/net/vmxnet3/vmxnet3_rxtx.c
static int
vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)
{
	int err = 0;
	uint32_t i = 0;
	struct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];

	while (vmxnet3_cmd_ring_desc_avail(ring) > 0) {
		struct rte_mbuf *mbuf;

		/* Allocate blank mbuf for the current Rx Descriptor */
		mbuf = rte_mbuf_raw_alloc(rxq->mp);
		if (unlikely(mbuf == NULL)) {
			PMD_RX_LOG(ERR, "Error allocating mbuf");
			rxq->stats.rx_buf_alloc_failure++;
			err = ENOMEM;
			break;
		}

		vmxnet3_renew_desc(rxq, ring_id, mbuf);
		i++;
	}

	/* Return error only if no buffers are posted at present */
	if (vmxnet3_cmd_ring_desc_avail(ring) >= (ring->size - 1))
		return -err;
	else
		return i;
}
/*
 *  Allocates mbufs and clusters. Post rx descriptors with buffer details
 *  so that device can receive packets in those buffers.
 *  Ring layout:
 *      Among the two rings, 1st ring contains buffers of type 0 and type 1.
 *      bufs_per_pkt is set such that for non-LRO cases all the buffers required
 *      by a frame will fit in 1st ring (1st buf of type0 and rest of type1).
 *      2nd ring contains buffers of type 1 alone. Second ring mostly be used
 *      only for LRO.
 */
Allocates mbufs and clusters. Post rx descriptors with buffer details
so that device can receive packets in those buffers.
Ring layout:
Among the two rings, 1st ring contains buffers of type 0 and type 1.
bufs_per_pkt is set such that for non-LRO cases all the buffers required
by a frame will fit in 1st ring (1st buf of type0 and rest of type1).
2nd ring contains buffers of type 1 alone. Second ring mostly be used
only for LRO.
Allocates mbufs and clusters . Post rx descriptors with buffer details so that device can receive packets in those buffers . Ring layout : Among the two rings 1st ring contains buffers of type 0 and type 1 . bufs_per_pkt is set such that for non - LRO cases all the buffers required by a frame will fit in 1st ring ( 1st buf of type0 and rest of type1 ) . 2nd ring contains buffers of type 1 alone . Second ring mostly be used only for LRO .
static int
vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)
{
	int err = 0;
	uint32_t i = 0;
	struct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];
	while (vmxnet3_cmd_ring_desc_avail(ring) > 0) {
		struct rte_mbuf *mbuf;
		mbuf = rte_mbuf_raw_alloc(rxq->mp);
		if (unlikely(mbuf == NULL)) {
			PMD_RX_LOG(ERR, "Error allocating mbuf");
			rxq->stats.rx_buf_alloc_failure++;
			err = ENOMEM;
			break;
		}
		vmxnet3_renew_desc(rxq, ring_id, mbuf);
		i++;
	}
	if (vmxnet3_cmd_ring_desc_avail(ring) >= (ring->size - 1))
		return -err;
	else
		return i;
}
static int vmxnet3_post_rx_bufs ( vmxnet3_rx_queue_t * rxq , uint8_t ring_id ) { int err = 0 ; uint32_t i = 0 ; struct vmxnet3_cmd_ring * ring = & rxq -> cmd_ring [ ring_id ] ; while ( vmxnet3_cmd_ring_desc_avail ( ring ) > 0 ) { struct rte_mbuf * mbuf ; mbuf = rte_mbuf_raw_alloc ( rxq -> mp ) ; if ( unlikely ( mbuf == NULL ) ) { PMD_RX_LOG ( ERR , " " ) ; rxq -> stats . rx_buf_alloc_failure ++ ; err = ENOMEM ; break ; } vmxnet3_renew_desc ( rxq , ring_id , mbuf ) ; i ++ ; } if ( vmxnet3_cmd_ring_desc_avail ( ring ) >= ( ring -> size - 1 ) ) return - err ; else return i ; }
Allocates mbufs and clusters.
Allocates mbufs and clusters .
/* Allocate blank mbuf for the current Rx Descriptor */ /* Return error only if no buffers are posted at present */