DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Yongseok Koh <yskoh@mellanox.com>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH v3 3/3] net/mlx5: fix RSS hash update
Date: Mon, 23 Oct 2017 13:17:57 +0200	[thread overview]
Message-ID: <120a5c8345cac22559f0bc95f9f256dae4664b4b.1508757360.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1508757360.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1508757360.git.nelio.laranjeiro@6wind.com>

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>
---
 drivers/net/mlx5/mlx5_rss.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index ad6d9ab70..f3de46de0 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;
 }
 
 /**
-- 
2.11.0

  parent reply	other threads:[~2017-10-23 11:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 12:09 [dpdk-dev] [PATCH 1/2] net/mlx5: fix flow priority for queue action Nelio Laranjeiro
2017-10-13 12:09 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix RSS structure initialisation Nelio Laranjeiro
2017-10-20 19:46   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2017-10-23  9:44 ` [dpdk-dev] [PATCH 0/3] net/mlx5: bugfixes Nelio Laranjeiro
2017-10-23 11:17   ` [dpdk-dev] [PATCH v3 0/3] net/mlx5: bug fixes Nelio Laranjeiro
2017-10-23 21:30     ` Ferruh Yigit
2017-10-23 11:17   ` [dpdk-dev] [PATCH v3 1/3] net/mlx5: fix flow priority for queue action Nelio Laranjeiro
2017-10-23 11:17   ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: fix RSS structure initialisation Nelio Laranjeiro
2017-10-23 11:17   ` Nelio Laranjeiro [this message]
2017-10-23 18:54     ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: fix RSS hash update Yongseok Koh
2017-10-23  9:44 ` [dpdk-dev] [PATCH 1/3] net/mlx5: fix flow priority for queue action Nelio Laranjeiro
2017-10-23  9:45 ` [dpdk-dev] [PATCH 2/3] app/testpmd: fix RSS structure initialisation Nelio Laranjeiro
2017-10-23  9:45 ` [dpdk-dev] [PATCH 3/3] net/mlx5: fix RSS hash update Nelio Laranjeiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120a5c8345cac22559f0bc95f9f256dae4664b4b.1508757360.git.nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).