summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_rss.c
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro <nelio.laranjeiro@6wind.com>2017-10-23 13:17:57 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2017-10-26 02:33:01 +0200
commit920b4e545efe05f33ca30ad3816220ad393de4c6 (patch)
treefe82bfc0c6573096abcee677db6a2f209c43f49a /drivers/net/mlx5/mlx5_rss.c
parentf3fb0e46251080aced4354afb41decb0dc8eae2d (diff)
downloaddpdk-next-eventdev-920b4e545efe05f33ca30ad3816220ad393de4c6.zip
dpdk-next-eventdev-920b4e545efe05f33ca30ad3816220ad393de4c6.tar.gz
dpdk-next-eventdev-920b4e545efe05f33ca30ad3816220ad393de4c6.tar.xz
net/mlx5: fix RSS hash update
Few bugs fixes in both configuration get and hash update where inputs are not handled as expected by the ethdev layer. RSS structure may not be totally usable, the PMD should try to take as most information from it has it can when it is an hash update or it should try to fill as most as possible in the configuration get. This means that in the RSS configuration structure, the memory space for the RSS hash key may not be present, but the PMD should consider the hash field valid and process/set it. Fixes: 29c1d8bb3e79 ("net/mlx5: handle a single RSS hash key for all protocols") Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_rss.c')
-rw-r--r--drivers/net/mlx5/mlx5_rss.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index ad6d9ab..f3de46d 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -72,14 +72,14 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev,
int ret = 0;
priv_lock(priv);
- if (rss_conf->rss_key_len) {
+ if (rss_conf->rss_key && rss_conf->rss_key_len) {
priv->rss_conf.rss_key = rte_realloc(priv->rss_conf.rss_key,
rss_conf->rss_key_len, 0);
if (!priv->rss_conf.rss_key) {
ret = -ENOMEM;
goto out;
}
- memcpy(&priv->rss_conf.rss_key, rss_conf->rss_key,
+ 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;
}
@@ -105,22 +105,19 @@ mlx5_rss_hash_conf_get(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf)
{
struct priv *priv = dev->data->dev_private;
- int ret = 0;
+ if (!rss_conf)
+ return -EINVAL;
priv_lock(priv);
- if (!rss_conf->rss_key) {
- ret = -ENOMEM;
- goto out;
- }
- if (rss_conf->rss_key_len < priv->rss_conf.rss_key_len) {
- ret = -EINVAL;
- goto out;
+ if (rss_conf->rss_key &&
+ (rss_conf->rss_key_len >= priv->rss_conf.rss_key_len)) {
+ memcpy(rss_conf->rss_key, priv->rss_conf.rss_key,
+ priv->rss_conf.rss_key_len);
}
- memcpy(rss_conf->rss_key, priv->rss_conf.rss_key,
- priv->rss_conf.rss_key_len);
-out:
+ rss_conf->rss_key_len = priv->rss_conf.rss_key_len;
+ rss_conf->rss_hf = priv->rss_conf.rss_hf;
priv_unlock(priv);
- return ret;
+ return 0;
}
/**