src/dpdk/drivers/net/mlx5/mlx5_rss.c
int
mlx5_rss_hash_update(struct rte_eth_dev *dev,
		     struct rte_eth_rss_conf *rss_conf)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i;
	unsigned int idx;

	if (rss_conf->rss_hf & MLX5_RSS_HF_MASK) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	if (rss_conf->rss_key && rss_conf->rss_key_len) {
		if (rss_conf->rss_key_len != MLX5_RSS_HASH_KEY_LEN) {
			DRV_LOG(ERR,
				"port %u RSS key len must be %s Bytes long",
				dev->data->port_id,
				RTE_STR(MLX5_RSS_HASH_KEY_LEN));
			rte_errno = EINVAL;
			return -rte_errno;
		}
		priv->rss_conf.rss_key = mlx5_realloc(priv->rss_conf.rss_key,
						      MLX5_MEM_RTE,
						      rss_conf->rss_key_len,
						      0, SOCKET_ID_ANY);
		if (!priv->rss_conf.rss_key) {
			rte_errno = ENOMEM;
			return -rte_errno;
		}
		memcpy(priv->rss_conf.rss_key, rss_conf->rss_key,
		       rss_conf->rss_key_len);
		priv->rss_conf.rss_key_len = rss_conf->rss_key_len;
	}
	priv->rss_conf.rss_hf = rss_conf->rss_hf;
	/* Enable the RSS hash in all Rx queues. */
	for (i = 0, idx = 0; idx != priv->rxqs_n; ++i) {
		if (!(*priv->rxqs)[i])
			continue;
		(*priv->rxqs)[i]->rss_hash = !!rss_conf->rss_hf &&
			!!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS);
		++idx;
	}
	return 0;
}
/**
 * DPDK callback to update the RSS hash configuration.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 * @param[in] rss_conf
 *   RSS configuration data.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
DPDK callback to update the RSS hash configuration.
@param dev
Pointer to Ethernet device structure.
@param[in] rss_conf
RSS configuration data.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
DPDK callback to update the RSS hash configuration . @param dev Pointer to Ethernet device structure . @param [ in ] rss_conf RSS configuration data . @return 0 on success a negative errno value otherwise and rte_errno is set .
int
mlx5_rss_hash_update(struct rte_eth_dev *dev,
		     struct rte_eth_rss_conf *rss_conf)
{
	struct mlx5_priv *priv = dev->data->dev_private;
	unsigned int i;
	unsigned int idx;
	if (rss_conf->rss_hf & MLX5_RSS_HF_MASK) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	if (rss_conf->rss_key && rss_conf->rss_key_len) {
		if (rss_conf->rss_key_len != MLX5_RSS_HASH_KEY_LEN) {
			DRV_LOG(ERR,
				"port %u RSS key len must be %s Bytes long",
				dev->data->port_id,
				RTE_STR(MLX5_RSS_HASH_KEY_LEN));
			rte_errno = EINVAL;
			return -rte_errno;
		}
		priv->rss_conf.rss_key = mlx5_realloc(priv->rss_conf.rss_key,
						      MLX5_MEM_RTE,
						      rss_conf->rss_key_len,
						      0, SOCKET_ID_ANY);
		if (!priv->rss_conf.rss_key) {
			rte_errno = ENOMEM;
			return -rte_errno;
		}
		memcpy(priv->rss_conf.rss_key, rss_conf->rss_key,
		       rss_conf->rss_key_len);
		priv->rss_conf.rss_key_len = rss_conf->rss_key_len;
	}
	priv->rss_conf.rss_hf = rss_conf->rss_hf;
	for (i = 0, idx = 0; idx != priv->rxqs_n; ++i) {
		if (!(*priv->rxqs)[i])
			continue;
		(*priv->rxqs)[i]->rss_hash = !!rss_conf->rss_hf &&
			!!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS);
		++idx;
	}
	return 0;
}
int mlx5_rss_hash_update ( struct rte_eth_dev * dev , struct rte_eth_rss_conf * rss_conf ) { struct mlx5_priv * priv = dev -> data -> dev_private ; unsigned int i ; unsigned int idx ; if ( rss_conf -> rss_hf & MLX5_RSS_HF_MASK ) { rte_errno = EINVAL ; return - rte_errno ; } if ( rss_conf -> rss_key && rss_conf -> rss_key_len ) { if ( rss_conf -> rss_key_len != MLX5_RSS_HASH_KEY_LEN ) { DRV_LOG ( ERR , " " , dev -> data -> port_id , RTE_STR ( MLX5_RSS_HASH_KEY_LEN ) ) ; rte_errno = EINVAL ; return - rte_errno ; } priv -> rss_conf . rss_key = mlx5_realloc ( priv -> rss_conf . rss_key , MLX5_MEM_RTE , rss_conf -> rss_key_len , 0 , SOCKET_ID_ANY ) ; if ( ! priv -> rss_conf . rss_key ) { rte_errno = ENOMEM ; return - rte_errno ; } memcpy ( priv -> rss_conf . rss_key , rss_conf -> rss_key , rss_conf -> rss_key_len ) ; priv -> rss_conf . rss_key_len = rss_conf -> rss_key_len ; } priv -> rss_conf . rss_hf = rss_conf -> rss_hf ; for ( i = 0 , idx = 0 ; idx != priv -> rxqs_n ; ++ i ) { if ( ! ( * priv -> rxqs ) [ i ] ) continue ; ( * priv -> rxqs ) [ i ] -> rss_hash = ! ! rss_conf -> rss_hf && ! ! ( dev -> data -> dev_conf . rxmode . mq_mode & ETH_MQ_RX_RSS ) ; ++ idx ; } return 0 ; }
DPDK callback to update the RSS hash configuration.
DPDK callback to update the RSS hash configuration .
/* Enable the RSS hash in all Rx queues. */