src/dpdk/drivers/net/mlx5/mlx5_rxq.c
int
mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
			  struct mlx5_ind_table_obj *ind_tbl,
			  uint16_t *queues, const uint32_t queues_n,
			  bool standalone)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i, j;
	int ret = 0, err;
	const unsigned int n = rte_is_power_of_2(queues_n) ?
			       log2above(queues_n) :
			       log2above(priv->config.ind_table_max_size);

	MLX5_ASSERT(standalone);
	RTE_SET_USED(standalone);
	if (__atomic_load_n(&ind_tbl->refcnt, __ATOMIC_RELAXED) > 1) {
		/*
		 * Modification of indirection ntables having more than 1
		 * reference unsupported. Intended for standalone indirection
		 * tables only.
		 */
		DEBUG("Port %u cannot modify indirection table (refcnt> 1).",
		      dev->data->port_id);
		rte_errno = EINVAL;
		return -rte_errno;
	}
	for (i = 0; i != queues_n; ++i) {
		if (!mlx5_rxq_get(dev, queues[i])) {
			ret = -rte_errno;
			goto error;
		}
	}
	MLX5_ASSERT(priv->obj_ops.ind_table_modify);
	ret = priv->obj_ops.ind_table_modify(dev, n, queues, queues_n, ind_tbl);
	if (ret)
		goto error;
	for (j = 0; j < ind_tbl->queues_n; j++)
		mlx5_rxq_release(dev, ind_tbl->queues[j]);
	ind_tbl->queues_n = queues_n;
	ind_tbl->queues = queues;
	return 0;
error:
	err = rte_errno;
	for (j = 0; j < i; j++)
		mlx5_rxq_release(dev, ind_tbl->queues[j]);
	rte_errno = err;
	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
	return ret;
}
/**
 * Modify an indirection table.
 *
 * @param dev
 *   Pointer to Ethernet device.
 * @param ind_table
 *   Indirection table to modify.
 * @param queues
 *   Queues replacement for the indirection table.
 * @param queues_n
 *   Number of queues in the array.
 * @param standalone
 *   Indirection table for Standalone queue.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Modify an indirection table.
@param dev
Pointer to Ethernet device.
@param ind_table
Indirection table to modify.
@param queues
Queues replacement for the indirection table.
@param queues_n
Number of queues in the array.
@param standalone
Indirection table for Standalone queue.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Modify an indirection table . @param dev Pointer to Ethernet device . @param ind_table Indirection table to modify . @param queues Queues replacement for the indirection table . @param queues_n Number of queues in the array . @param standalone Indirection table for Standalone queue . @return 0 on success a negative errno value otherwise and rte_errno is set .
int
mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
			  struct mlx5_ind_table_obj *ind_tbl,
			  uint16_t *queues, const uint32_t queues_n,
			  bool standalone)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i, j;
	int ret = 0, err;
	const unsigned int n = rte_is_power_of_2(queues_n) ?
			       log2above(queues_n) :
			       log2above(priv->config.ind_table_max_size);
	MLX5_ASSERT(standalone);
	RTE_SET_USED(standalone);
	if (__atomic_load_n(&ind_tbl->refcnt, __ATOMIC_RELAXED) > 1) {
		DEBUG("Port %u cannot modify indirection table (refcnt> 1).",
		      dev->data->port_id);
		rte_errno = EINVAL;
		return -rte_errno;
	}
	for (i = 0; i != queues_n; ++i) {
		if (!mlx5_rxq_get(dev, queues[i])) {
			ret = -rte_errno;
			goto error;
		}
	}
	MLX5_ASSERT(priv->obj_ops.ind_table_modify);
	ret = priv->obj_ops.ind_table_modify(dev, n, queues, queues_n, ind_tbl);
	if (ret)
		goto error;
	for (j = 0; j < ind_tbl->queues_n; j++)
		mlx5_rxq_release(dev, ind_tbl->queues[j]);
	ind_tbl->queues_n = queues_n;
	ind_tbl->queues = queues;
	return 0;
error:
	err = rte_errno;
	for (j = 0; j < i; j++)
		mlx5_rxq_release(dev, ind_tbl->queues[j]);
	rte_errno = err;
	DEBUG("Port %u cannot setup indirection table.", dev->data->port_id);
	return ret;
}
int mlx5_ind_table_obj_modify ( struct rte_eth_dev * dev , struct mlx5_ind_table_obj * ind_tbl , uint16_t * queues , const uint32_t queues_n , bool standalone ) { struct mlx5_priv * priv = dev -> data -> dev_private ; unsigned int i , j ; int ret = 0 , err ; const unsigned int n = rte_is_power_of_2 ( queues_n ) ? log2above ( queues_n ) : log2above ( priv -> config . ind_table_max_size ) ; MLX5_ASSERT ( standalone ) ; RTE_SET_USED ( standalone ) ; if ( __atomic_load_n ( & ind_tbl -> refcnt , __ATOMIC_RELAXED ) > 1 ) { DEBUG ( " " , dev -> data -> port_id ) ; rte_errno = EINVAL ; return - rte_errno ; } for ( i = 0 ; i != queues_n ; ++ i ) { if ( ! mlx5_rxq_get ( dev , queues [ i ] ) ) { ret = - rte_errno ; goto error ; } } MLX5_ASSERT ( priv -> obj_ops . ind_table_modify ) ; ret = priv -> obj_ops . ind_table_modify ( dev , n , queues , queues_n , ind_tbl ) ; if ( ret ) goto error ; for ( j = 0 ; j < ind_tbl -> queues_n ; j ++ ) mlx5_rxq_release ( dev , ind_tbl -> queues [ j ] ) ; ind_tbl -> queues_n = queues_n ; ind_tbl -> queues = queues ; return 0 ; error : err = rte_errno ; for ( j = 0 ; j < i ; j ++ ) mlx5_rxq_release ( dev , ind_tbl -> queues [ j ] ) ; rte_errno = err ; DEBUG ( " " , dev -> data -> port_id ) ; return ret ; }
Modify an indirection table.
Modify an indirection table .
/*
		 * Modification of indirection ntables having more than 1
		 * reference unsupported. Intended for standalone indirection
		 * tables only.
		 */