src/dpdk/drivers/net/mlx5/mlx5_rxq.c
int
mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx,
		 const uint8_t *rss_key, uint32_t rss_key_len,
		 uint64_t hash_fields,
		 const uint16_t *queues, uint32_t queues_n)
{
	int err;
	struct mlx5_ind_table_obj *ind_tbl = NULL;
	struct mlx5_priv *priv = dev->data->dev_private;
	struct mlx5_hrxq *hrxq =
		mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq_idx);
	int ret;

	if (!hrxq) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	/* validations */
	if (hrxq->rss_key_len != rss_key_len) {
		/* rss_key_len is fixed size 40 byte & not supposed to change */
		rte_errno = EINVAL;
		return -rte_errno;
	}
	queues_n = hash_fields ? queues_n : 1;
	if (mlx5_ind_table_obj_match_queues(hrxq->ind_table,
					    queues, queues_n)) {
		ind_tbl = hrxq->ind_table;
	} else {
		if (hrxq->standalone) {
			/*
			 * Replacement of indirection table unsupported for
			 * stanalone hrxq objects (used by shared RSS).
			 */
			rte_errno = ENOTSUP;
			return -rte_errno;
		}
		ind_tbl = mlx5_ind_table_obj_get(dev, queues, queues_n);
		if (!ind_tbl)
			ind_tbl = mlx5_ind_table_obj_new(dev, queues, queues_n,
							 hrxq->standalone);
	}
	if (!ind_tbl) {
		rte_errno = ENOMEM;
		return -rte_errno;
	}
	MLX5_ASSERT(priv->obj_ops.hrxq_modify);
	ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key,
					hash_fields, ind_tbl);
	if (ret) {
		rte_errno = errno;
		goto error;
	}
	if (ind_tbl != hrxq->ind_table) {
		MLX5_ASSERT(!hrxq->standalone);
		mlx5_ind_table_obj_release(dev, hrxq->ind_table,
					   hrxq->standalone);
		hrxq->ind_table = ind_tbl;
	}
	hrxq->hash_fields = hash_fields;
	memcpy(hrxq->rss_key, rss_key, rss_key_len);
	return 0;
error:
	err = rte_errno;
	if (ind_tbl != hrxq->ind_table) {
		MLX5_ASSERT(!hrxq->standalone);
		mlx5_ind_table_obj_release(dev, ind_tbl, hrxq->standalone);
	}
	rte_errno = err;
	return -rte_errno;
}
/**
 * Modify an Rx Hash queue configuration.
 *
 * @param dev
 *   Pointer to Ethernet device.
 * @param hrxq
 *   Index to Hash Rx queue to modify.
 * @param rss_key
 *   RSS key for the Rx hash queue.
 * @param rss_key_len
 *   RSS key length.
 * @param hash_fields
 *   Verbs protocol hash field to make the RSS on.
 * @param queues
 *   Queues entering in hash queue. In case of empty hash_fields only the
 *   first queue index will be taken for the indirection table.
 * @param queues_n
 *   Number of queues.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Modify an Rx Hash queue configuration.
@param dev
Pointer to Ethernet device.
@param hrxq
Index to Hash Rx queue to modify.
@param rss_key
RSS key for the Rx hash queue.
@param rss_key_len
RSS key length.
@param hash_fields
Verbs protocol hash field to make the RSS on.
@param queues
Queues entering in hash queue. In case of empty hash_fields only the
first queue index will be taken for the indirection table.
@param queues_n
Number of queues.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Modify an Rx Hash queue configuration . @param dev Pointer to Ethernet device . @param hrxq Index to Hash Rx queue to modify . @param rss_key RSS key for the Rx hash queue . @param rss_key_len RSS key length . @param hash_fields Verbs protocol hash field to make the RSS on . @param queues Queues entering in hash queue . In case of empty hash_fields only the first queue index will be taken for the indirection table . @param queues_n Number of queues . @return 0 on success a negative errno value otherwise and rte_errno is set .
int
mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx,
		 const uint8_t *rss_key, uint32_t rss_key_len,
		 uint64_t hash_fields,
		 const uint16_t *queues, uint32_t queues_n)
{
	int err;
	struct mlx5_ind_table_obj *ind_tbl = NULL;
	struct mlx5_priv *priv = dev->data->dev_private;
	struct mlx5_hrxq *hrxq =
		mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq_idx);
	int ret;
	if (!hrxq) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	if (hrxq->rss_key_len != rss_key_len) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	queues_n = hash_fields ? queues_n : 1;
	if (mlx5_ind_table_obj_match_queues(hrxq->ind_table,
					    queues, queues_n)) {
		ind_tbl = hrxq->ind_table;
	} else {
		if (hrxq->standalone) {
			rte_errno = ENOTSUP;
			return -rte_errno;
		}
		ind_tbl = mlx5_ind_table_obj_get(dev, queues, queues_n);
		if (!ind_tbl)
			ind_tbl = mlx5_ind_table_obj_new(dev, queues, queues_n,
							 hrxq->standalone);
	}
	if (!ind_tbl) {
		rte_errno = ENOMEM;
		return -rte_errno;
	}
	MLX5_ASSERT(priv->obj_ops.hrxq_modify);
	ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key,
					hash_fields, ind_tbl);
	if (ret) {
		rte_errno = errno;
		goto error;
	}
	if (ind_tbl != hrxq->ind_table) {
		MLX5_ASSERT(!hrxq->standalone);
		mlx5_ind_table_obj_release(dev, hrxq->ind_table,
					   hrxq->standalone);
		hrxq->ind_table = ind_tbl;
	}
	hrxq->hash_fields = hash_fields;
	memcpy(hrxq->rss_key, rss_key, rss_key_len);
	return 0;
error:
	err = rte_errno;
	if (ind_tbl != hrxq->ind_table) {
		MLX5_ASSERT(!hrxq->standalone);
		mlx5_ind_table_obj_release(dev, ind_tbl, hrxq->standalone);
	}
	rte_errno = err;
	return -rte_errno;
}
int mlx5_hrxq_modify ( struct rte_eth_dev * dev , uint32_t hrxq_idx , const uint8_t * rss_key , uint32_t rss_key_len , uint64_t hash_fields , const uint16_t * queues , uint32_t queues_n ) { int err ; struct mlx5_ind_table_obj * ind_tbl = NULL ; struct mlx5_priv * priv = dev -> data -> dev_private ; struct mlx5_hrxq * hrxq = mlx5_ipool_get ( priv -> sh -> ipool [ MLX5_IPOOL_HRXQ ] , hrxq_idx ) ; int ret ; if ( ! hrxq ) { rte_errno = EINVAL ; return - rte_errno ; } if ( hrxq -> rss_key_len != rss_key_len ) { rte_errno = EINVAL ; return - rte_errno ; } queues_n = hash_fields ? queues_n : 1 ; if ( mlx5_ind_table_obj_match_queues ( hrxq -> ind_table , queues , queues_n ) ) { ind_tbl = hrxq -> ind_table ; } else { if ( hrxq -> standalone ) { rte_errno = ENOTSUP ; return - rte_errno ; } ind_tbl = mlx5_ind_table_obj_get ( dev , queues , queues_n ) ; if ( ! ind_tbl ) ind_tbl = mlx5_ind_table_obj_new ( dev , queues , queues_n , hrxq -> standalone ) ; } if ( ! ind_tbl ) { rte_errno = ENOMEM ; return - rte_errno ; } MLX5_ASSERT ( priv -> obj_ops . hrxq_modify ) ; ret = priv -> obj_ops . hrxq_modify ( dev , hrxq , rss_key , hash_fields , ind_tbl ) ; if ( ret ) { rte_errno = errno ; goto error ; } if ( ind_tbl != hrxq -> ind_table ) { MLX5_ASSERT ( ! hrxq -> standalone ) ; mlx5_ind_table_obj_release ( dev , hrxq -> ind_table , hrxq -> standalone ) ; hrxq -> ind_table = ind_tbl ; } hrxq -> hash_fields = hash_fields ; memcpy ( hrxq -> rss_key , rss_key , rss_key_len ) ; return 0 ; error : err = rte_errno ; if ( ind_tbl != hrxq -> ind_table ) { MLX5_ASSERT ( ! hrxq -> standalone ) ; mlx5_ind_table_obj_release ( dev , ind_tbl , hrxq -> standalone ) ; } rte_errno = err ; return - rte_errno ; }
Modify an Rx Hash queue configuration.
Modify an Rx Hash queue configuration .
/* validations */ /* rss_key_len is fixed size 40 byte & not supposed to change */ /*
			 * Replacement of indirection table unsupported for
			 * stanalone hrxq objects (used by shared RSS).
			 */