src/dpdk/drivers/net/mlx5/mlx5_txq.c
static int
mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc)
{
	struct mlx5_priv *priv = dev->data->dev_private;

	if (*desc <= MLX5_TX_COMP_THRESH) {
		DRV_LOG(WARNING,
			"port %u number of descriptors requested for Tx queue"
			" %u must be higher than MLX5_TX_COMP_THRESH, using %u"
			" instead of %u", dev->data->port_id, idx,
			MLX5_TX_COMP_THRESH + 1, *desc);
		*desc = MLX5_TX_COMP_THRESH + 1;
	}
	if (!rte_is_power_of_2(*desc)) {
		*desc = 1 << log2above(*desc);
		DRV_LOG(WARNING,
			"port %u increased number of descriptors in Tx queue"
			" %u to the next power of two (%d)",
			dev->data->port_id, idx, *desc);
	}
	DRV_LOG(DEBUG, "port %u configuring queue %u for %u descriptors",
		dev->data->port_id, idx, *desc);
	if (idx >= priv->txqs_n) {
		DRV_LOG(ERR, "port %u Tx queue index out of range (%u >= %u)",
			dev->data->port_id, idx, priv->txqs_n);
		rte_errno = EOVERFLOW;
		return -rte_errno;
	}
	if (!mlx5_txq_releasable(dev, idx)) {
		rte_errno = EBUSY;
		DRV_LOG(ERR, "port %u unable to release queue index %u",
			dev->data->port_id, idx);
		return -rte_errno;
	}
	mlx5_txq_release(dev, idx);
	return 0;
}
/**
 * Tx queue presetup checks.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 * @param idx
 *   Tx queue index.
 * @param desc
 *   Number of descriptors to configure in queue.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Tx queue presetup checks.
@param dev
Pointer to Ethernet device structure.
@param idx
Tx queue index.
@param desc
Number of descriptors to configure in queue.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Tx queue presetup checks . @param dev Pointer to Ethernet device structure . @param idx Tx queue index . @param desc Number of descriptors to configure in queue . @return 0 on success a negative errno value otherwise and rte_errno is set .
static int
mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	if (*desc <= MLX5_TX_COMP_THRESH) {
		DRV_LOG(WARNING,
			"port %u number of descriptors requested for Tx queue"
			" %u must be higher than MLX5_TX_COMP_THRESH, using %u"
			" instead of %u", dev->data->port_id, idx,
			MLX5_TX_COMP_THRESH + 1, *desc);
		*desc = MLX5_TX_COMP_THRESH + 1;
	}
	if (!rte_is_power_of_2(*desc)) {
		*desc = 1 << log2above(*desc);
		DRV_LOG(WARNING,
			"port %u increased number of descriptors in Tx queue"
			" %u to the next power of two (%d)",
			dev->data->port_id, idx, *desc);
	}
	DRV_LOG(DEBUG, "port %u configuring queue %u for %u descriptors",
		dev->data->port_id, idx, *desc);
	if (idx >= priv->txqs_n) {
		DRV_LOG(ERR, "port %u Tx queue index out of range (%u >= %u)",
			dev->data->port_id, idx, priv->txqs_n);
		rte_errno = EOVERFLOW;
		return -rte_errno;
	}
	if (!mlx5_txq_releasable(dev, idx)) {
		rte_errno = EBUSY;
		DRV_LOG(ERR, "port %u unable to release queue index %u",
			dev->data->port_id, idx);
		return -rte_errno;
	}
	mlx5_txq_release(dev, idx);
	return 0;
}
static int mlx5_tx_queue_pre_setup ( struct rte_eth_dev * dev , uint16_t idx , uint16_t * desc ) { struct mlx5_priv * priv = dev -> data -> dev_private ; if ( * desc <= MLX5_TX_COMP_THRESH ) { DRV_LOG ( WARNING , " " " " " " , dev -> data -> port_id , idx , MLX5_TX_COMP_THRESH + 1 , * desc ) ; * desc = MLX5_TX_COMP_THRESH + 1 ; } if ( ! rte_is_power_of_2 ( * desc ) ) { * desc = 1 << log2above ( * desc ) ; DRV_LOG ( WARNING , " " " " , dev -> data -> port_id , idx , * desc ) ; } DRV_LOG ( DEBUG , " " , dev -> data -> port_id , idx , * desc ) ; if ( idx >= priv -> txqs_n ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , idx , priv -> txqs_n ) ; rte_errno = EOVERFLOW ; return - rte_errno ; } if ( ! mlx5_txq_releasable ( dev , idx ) ) { rte_errno = EBUSY ; DRV_LOG ( ERR , " " , dev -> data -> port_id , idx ) ; return - rte_errno ; } mlx5_txq_release ( dev , idx ) ; return 0 ; }
Tx queue presetup checks.
Tx queue presetup checks .