src/dpdk/drivers/net/mlx5/mlx5_rxq.c
static int
rxq_alloc_elts_mprq(struct mlx5_rxq_ctrl *rxq_ctrl)
{
	struct mlx5_rxq_data *rxq = &rxq_ctrl->rxq;
	unsigned int wqe_n = 1 << rxq->elts_n;
	unsigned int i;
	int err;

	/* Iterate on segments. */
	for (i = 0; i <= wqe_n; ++i) {
		struct mlx5_mprq_buf *buf;

		if (rte_mempool_get(rxq->mprq_mp, (void **)&buf) < 0) {
			DRV_LOG(ERR, "port %u empty mbuf pool", rxq->port_id);
			rte_errno = ENOMEM;
			goto error;
		}
		if (i < wqe_n)
			(*rxq->mprq_bufs)[i] = buf;
		else
			rxq->mprq_repl = buf;
	}
	DRV_LOG(DEBUG,
		"port %u MPRQ queue %u allocated and configured %u segments",
		rxq->port_id, rxq->idx, wqe_n);
	return 0;
error:
	err = rte_errno; /* Save rte_errno before cleanup. */
	wqe_n = i;
	for (i = 0; (i != wqe_n); ++i) {
		if ((*rxq->mprq_bufs)[i] != NULL)
			rte_mempool_put(rxq->mprq_mp,
					(*rxq->mprq_bufs)[i]);
		(*rxq->mprq_bufs)[i] = NULL;
	}
	DRV_LOG(DEBUG, "port %u MPRQ queue %u failed, freed everything",
		rxq->port_id, rxq->idx);
	rte_errno = err; /* Restore rte_errno. */
	return -rte_errno;
}
/**
 * Allocate RX queue elements for Multi-Packet RQ.
 *
 * @param rxq_ctrl
 *   Pointer to RX queue structure.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Allocate RX queue elements for Multi-Packet RQ.
@param rxq_ctrl
Pointer to RX queue structure.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Allocate RX queue elements for Multi - Packet RQ . @param rxq_ctrl Pointer to RX queue structure . @return 0 on success a negative errno value otherwise and rte_errno is set .
static int
rxq_alloc_elts_mprq(struct mlx5_rxq_ctrl *rxq_ctrl)
{
	struct mlx5_rxq_data *rxq = &rxq_ctrl->rxq;
	unsigned int wqe_n = 1 << rxq->elts_n;
	unsigned int i;
	int err;
	for (i = 0; i <= wqe_n; ++i) {
		struct mlx5_mprq_buf *buf;
		if (rte_mempool_get(rxq->mprq_mp, (void **)&buf) < 0) {
			DRV_LOG(ERR, "port %u empty mbuf pool", rxq->port_id);
			rte_errno = ENOMEM;
			goto error;
		}
		if (i < wqe_n)
			(*rxq->mprq_bufs)[i] = buf;
		else
			rxq->mprq_repl = buf;
	}
	DRV_LOG(DEBUG,
		"port %u MPRQ queue %u allocated and configured %u segments",
		rxq->port_id, rxq->idx, wqe_n);
	return 0;
error:
	err = rte_errno; 
	wqe_n = i;
	for (i = 0; (i != wqe_n); ++i) {
		if ((*rxq->mprq_bufs)[i] != NULL)
			rte_mempool_put(rxq->mprq_mp,
					(*rxq->mprq_bufs)[i]);
		(*rxq->mprq_bufs)[i] = NULL;
	}
	DRV_LOG(DEBUG, "port %u MPRQ queue %u failed, freed everything",
		rxq->port_id, rxq->idx);
	rte_errno = err; 
	return -rte_errno;
}
static int rxq_alloc_elts_mprq ( struct mlx5_rxq_ctrl * rxq_ctrl ) { struct mlx5_rxq_data * rxq = & rxq_ctrl -> rxq ; unsigned int wqe_n = 1 << rxq -> elts_n ; unsigned int i ; int err ; for ( i = 0 ; i <= wqe_n ; ++ i ) { struct mlx5_mprq_buf * buf ; if ( rte_mempool_get ( rxq -> mprq_mp , ( void * * ) & buf ) < 0 ) { DRV_LOG ( ERR , " " , rxq -> port_id ) ; rte_errno = ENOMEM ; goto error ; } if ( i < wqe_n ) ( * rxq -> mprq_bufs ) [ i ] = buf ; else rxq -> mprq_repl = buf ; } DRV_LOG ( DEBUG , " " , rxq -> port_id , rxq -> idx , wqe_n ) ; return 0 ; error : err = rte_errno ; wqe_n = i ; for ( i = 0 ; ( i != wqe_n ) ; ++ i ) { if ( ( * rxq -> mprq_bufs ) [ i ] != NULL ) rte_mempool_put ( rxq -> mprq_mp , ( * rxq -> mprq_bufs ) [ i ] ) ; ( * rxq -> mprq_bufs ) [ i ] = NULL ; } DRV_LOG ( DEBUG , " " , rxq -> port_id , rxq -> idx ) ; rte_errno = err ; return - rte_errno ; }
Allocate RX queue elements for Multi-Packet RQ.
Allocate RX queue elements for Multi - Packet RQ .
/* Iterate on segments. */ /* Save rte_errno before cleanup. */ /* Restore rte_errno. */