src/dpdk/drivers/net/mlx5/mlx5_trigger.c
static int
mlx5_rxq_start(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i;
	int ret = 0;

	/* Allocate/reuse/resize mempool for Multi-Packet RQ. */
	if (mlx5_mprq_alloc_mp(dev)) {
		/* Should not release Rx queues but return immediately. */
		return -rte_errno;
	}
	DRV_LOG(DEBUG, "Port %u device_attr.max_qp_wr is %d.",
		dev->data->port_id, priv->sh->device_attr.max_qp_wr);
	DRV_LOG(DEBUG, "Port %u device_attr.max_sge is %d.",
		dev->data->port_id, priv->sh->device_attr.max_sge);
	for (i = 0; i != priv->rxqs_n; ++i) {
		struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_get(dev, i);

		if (!rxq_ctrl)
			continue;
		if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD) {
			/* Pre-register Rx mempools. */
			if (mlx5_rxq_mprq_enabled(&rxq_ctrl->rxq)) {
				mlx5_mr_update_mp(dev, &rxq_ctrl->rxq.mr_ctrl,
						  rxq_ctrl->rxq.mprq_mp);
			} else {
				uint32_t s;

				for (s = 0; s < rxq_ctrl->rxq.rxseg_n; s++)
					mlx5_mr_update_mp
						(dev, &rxq_ctrl->rxq.mr_ctrl,
						rxq_ctrl->rxq.rxseg[s].mp);
			}
			ret = rxq_alloc_elts(rxq_ctrl);
			if (ret)
				goto error;
		}
		MLX5_ASSERT(!rxq_ctrl->obj);
		rxq_ctrl->obj = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
					    sizeof(*rxq_ctrl->obj), 0,
					    rxq_ctrl->socket);
		if (!rxq_ctrl->obj) {
			DRV_LOG(ERR,
				"Port %u Rx queue %u can't allocate resources.",
				dev->data->port_id, (*priv->rxqs)[i]->idx);
			rte_errno = ENOMEM;
			goto error;
		}
		ret = priv->obj_ops.rxq_obj_new(dev, i);
		if (ret) {
			mlx5_free(rxq_ctrl->obj);
			goto error;
		}
		DRV_LOG(DEBUG, "Port %u rxq %u updated with %p.",
			dev->data->port_id, i, (void *)&rxq_ctrl->obj);
		LIST_INSERT_HEAD(&priv->rxqsobj, rxq_ctrl->obj, next);
	}
	return 0;
error:
	ret = rte_errno; /* Save rte_errno before cleanup. */
	do {
		mlx5_rxq_release(dev, i);
	} while (i-- != 0);
	rte_errno = ret; /* Restore rte_errno. */
	return -rte_errno;
}
/**
 * Start traffic on Rx queues.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Start traffic on Rx queues.
@param dev
Pointer to Ethernet device structure.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Start traffic on Rx queues . @param dev Pointer to Ethernet device structure . @return 0 on success a negative errno value otherwise and rte_errno is set .
static int
mlx5_rxq_start(struct rte_eth_dev *dev)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i;
	int ret = 0;
	if (mlx5_mprq_alloc_mp(dev)) {
		return -rte_errno;
	}
	DRV_LOG(DEBUG, "Port %u device_attr.max_qp_wr is %d.",
		dev->data->port_id, priv->sh->device_attr.max_qp_wr);
	DRV_LOG(DEBUG, "Port %u device_attr.max_sge is %d.",
		dev->data->port_id, priv->sh->device_attr.max_sge);
	for (i = 0; i != priv->rxqs_n; ++i) {
		struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_get(dev, i);
		if (!rxq_ctrl)
			continue;
		if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD) {
			if (mlx5_rxq_mprq_enabled(&rxq_ctrl->rxq)) {
				mlx5_mr_update_mp(dev, &rxq_ctrl->rxq.mr_ctrl,
						  rxq_ctrl->rxq.mprq_mp);
			} else {
				uint32_t s;
				for (s = 0; s < rxq_ctrl->rxq.rxseg_n; s++)
					mlx5_mr_update_mp
						(dev, &rxq_ctrl->rxq.mr_ctrl,
						rxq_ctrl->rxq.rxseg[s].mp);
			}
			ret = rxq_alloc_elts(rxq_ctrl);
			if (ret)
				goto error;
		}
		MLX5_ASSERT(!rxq_ctrl->obj);
		rxq_ctrl->obj = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
					    sizeof(*rxq_ctrl->obj), 0,
					    rxq_ctrl->socket);
		if (!rxq_ctrl->obj) {
			DRV_LOG(ERR,
				"Port %u Rx queue %u can't allocate resources.",
				dev->data->port_id, (*priv->rxqs)[i]->idx);
			rte_errno = ENOMEM;
			goto error;
		}
		ret = priv->obj_ops.rxq_obj_new(dev, i);
		if (ret) {
			mlx5_free(rxq_ctrl->obj);
			goto error;
		}
		DRV_LOG(DEBUG, "Port %u rxq %u updated with %p.",
			dev->data->port_id, i, (void *)&rxq_ctrl->obj);
		LIST_INSERT_HEAD(&priv->rxqsobj, rxq_ctrl->obj, next);
	}
	return 0;
error:
	ret = rte_errno; 
	do {
		mlx5_rxq_release(dev, i);
	} while (i-- != 0);
	rte_errno = ret; 
	return -rte_errno;
}
static int mlx5_rxq_start ( struct rte_eth_dev * dev ) { struct mlx5_priv * priv = dev -> data -> dev_private ; unsigned int i ; int ret = 0 ; if ( mlx5_mprq_alloc_mp ( dev ) ) { return - rte_errno ; } DRV_LOG ( DEBUG , " " , dev -> data -> port_id , priv -> sh -> device_attr . max_qp_wr ) ; DRV_LOG ( DEBUG , " " , dev -> data -> port_id , priv -> sh -> device_attr . max_sge ) ; for ( i = 0 ; i != priv -> rxqs_n ; ++ i ) { struct mlx5_rxq_ctrl * rxq_ctrl = mlx5_rxq_get ( dev , i ) ; if ( ! rxq_ctrl ) continue ; if ( rxq_ctrl -> type == MLX5_RXQ_TYPE_STANDARD ) { if ( mlx5_rxq_mprq_enabled ( & rxq_ctrl -> rxq ) ) { mlx5_mr_update_mp ( dev , & rxq_ctrl -> rxq . mr_ctrl , rxq_ctrl -> rxq . mprq_mp ) ; } else { uint32_t s ; for ( s = 0 ; s < rxq_ctrl -> rxq . rxseg_n ; s ++ ) mlx5_mr_update_mp ( dev , & rxq_ctrl -> rxq . mr_ctrl , rxq_ctrl -> rxq . rxseg [ s ] . mp ) ; } ret = rxq_alloc_elts ( rxq_ctrl ) ; if ( ret ) goto error ; } MLX5_ASSERT ( ! rxq_ctrl -> obj ) ; rxq_ctrl -> obj = mlx5_malloc ( MLX5_MEM_RTE | MLX5_MEM_ZERO , sizeof ( * rxq_ctrl -> obj ) , 0 , rxq_ctrl -> socket ) ; if ( ! rxq_ctrl -> obj ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , ( * priv -> rxqs ) [ i ] -> idx ) ; rte_errno = ENOMEM ; goto error ; } ret = priv -> obj_ops . rxq_obj_new ( dev , i ) ; if ( ret ) { mlx5_free ( rxq_ctrl -> obj ) ; goto error ; } DRV_LOG ( DEBUG , " " , dev -> data -> port_id , i , ( void * ) & rxq_ctrl -> obj ) ; LIST_INSERT_HEAD ( & priv -> rxqsobj , rxq_ctrl -> obj , next ) ; } return 0 ; error : ret = rte_errno ; do { mlx5_rxq_release ( dev , i ) ; } while ( i -- != 0 ) ; rte_errno = ret ; return - rte_errno ; }
Start traffic on Rx queues.
Start traffic on Rx queues .
/* Allocate/reuse/resize mempool for Multi-Packet RQ. */ /* Should not release Rx queues but return immediately. */ /* Pre-register Rx mempools. */ /* Save rte_errno before cleanup. */ /* Restore rte_errno. */