Skip to contentSkip to conversation

net/mlx5: fix flow priority for queue action

PATCH In review Nelio Laranjeiro 3 participants 13 messages Oct 13, 2017 – Oct 23, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/mlx5: fix flow priority for queue action

Priority is wrongly configured when the action is queue, using the Ethernet layer priority instead of the most specific layer found.

Fixes 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
---
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +11 -1
index 2b6380fb9..440bda9a1 100644
@@ -1172,8 +1172,18 @@ priv_flow_convert(struct priv *priv,
 	 * Last step. Complete missing specification to reach the RSS
 	 * configuration.
 	 */
-	if (parser->queues_n > 1)
+	if (parser->queues_n > 1) {
 		priv_flow_convert_finalise(priv, parser);
+	} else if (!parser->drop) {
+		/*
+		 * Action queue have their priority overridden with
+		 * Ethernet priority, this priority needs to be adjusted to
+		 * their most specific layer priority.
+		 */
+		parser->queue[HASH_RXQ_ETH].ibv_attr->priority =
+			attr->priority +
+			hash_rxq_init[parser->layer].flow_priority;
+	}
 exit_free:
 	/* Only verification is expected, all resources should be released. */
 	if (!parser->create) {
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 app/testpmd: fix RSS structure initialisation

Struct rss_conf.rss_key_len is not initialised forcing the user to verify the rss_conf.rss_key pointer to know if the key is present or not. rss_conf.rss_key_len should have a valid length according to the size of the rss_key pointed.

Fixes 560e02ee5237 ("app/testpmd: configure RSS without restart")
---
 app/test-pmd/cmdline.c      | 2 +-
 drivers/net/mlx5/mlx5_rss.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +1 -1
index 120460452..abbe52ad6 100644
@@ -1750,7 +1750,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_rss *res = parsed_result;
-	struct rte_eth_rss_conf rss_conf;
+	struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, };
 	int diag;
 	uint8_t i;
 
drivers/net/mlx5/mlx5_rss.c +1 -1
index ad6d9ab70..dd9ddf2e0 100644
@@ -72,7 +72,7 @@ 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) {
Signature · 1 line
2.11.0
#2 lore raw

Re: [dpdk-stable] [PATCH 2/2] app/testpmd: fix RSS structure initialisation

Quoted 9 lines · Nelio Laranjeiro

Struct rss_conf.rss_key_len is not initialised forcing the user to verify the rss_conf.rss_key pointer to know if the key is present or not. rss_conf.rss_key_len should have a valid length according to the size of the rss_key pointed.

Fixes 560e02ee5237 ("app/testpmd: configure RSS without restart")
Quoted 5 lines
---
 app/test-pmd/cmdline.c      | 2 +-
 drivers/net/mlx5/mlx5_rss.c | 2 +-

Hi Nelio,

Can you please separate test-pmd and driver patch please?

Thanks,
ferruh

#3 lore raw

cover net/mlx5: bugfixes

In reply to Nelio Laranjeiro

Changes in v2:

* Split last second commit in two, one for testpmd the second one for the PMD
* Re-work "net/mlx5: fix RSS hash update" to also fix a bug introduced in the hash_get() blocking the update.

Nelio Laranjeiro (3):
net/mlx5: fix flow priority for queue action
app/testpmd: fix RSS structure initialisation
net/mlx5: fix RSS hash update

 app/test-pmd/cmdline.c       |  2 +-
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++-
 drivers/net/mlx5/mlx5_rss.c  | 25 +++++++++++--------------
 3 files changed, 23 insertions(+), 16 deletions(-)
Signature · 1 line
2.11.0
#4 lore raw

PATCH 1/3 net/mlx5: fix flow priority for queue action

Priority is wrongly configured when the action is queue, using the Ethernet layer priority instead of the most specific layer found.

Fixes 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
---
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +11 -1
index 2b6380fb9..440bda9a1 100644
@@ -1172,8 +1172,18 @@ priv_flow_convert(struct priv *priv,
 	 * Last step. Complete missing specification to reach the RSS
 	 * configuration.
 	 */
-	if (parser->queues_n > 1)
+	if (parser->queues_n > 1) {
 		priv_flow_convert_finalise(priv, parser);
+	} else if (!parser->drop) {
+		/*
+		 * Action queue have their priority overridden with
+		 * Ethernet priority, this priority needs to be adjusted to
+		 * their most specific layer priority.
+		 */
+		parser->queue[HASH_RXQ_ETH].ibv_attr->priority =
+			attr->priority +
+			hash_rxq_init[parser->layer].flow_priority;
+	}
 exit_free:
 	/* Only verification is expected, all resources should be released. */
 	if (!parser->create) {
Signature · 1 line
2.11.0
#5 lore raw

PATCH 2/3 app/testpmd: fix RSS structure initialisation

In reply to Nelio Laranjeiro

Struct rss_conf.rss_key_len is not initialised forcing the user to verify the rss_conf.rss_key pointer to know if the key is present or not. rss_conf.rss_key_len should have a valid length according to the size of the rss_key pointed.

Fixes 560e02ee5237 ("app/testpmd: configure RSS without restart")
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline.c +1 -1
index bb01e989a..7002ff2c1 100644
@@ -1750,7 +1750,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_rss *res = parsed_result;
-	struct rte_eth_rss_conf rss_conf;
+	struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, };
 	int diag;
 	uint8_t i;
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH 3/3 net/mlx5: fix RSS hash update

In reply to Nelio Laranjeiro

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.

---
 drivers/net/mlx5/mlx5_rss.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/mlx5/mlx5_rss.c +11 -14
index ad6d9ab70..f3de46de0 100644
@@ -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;
 }
 
 /**
Signature · 1 line
2.11.0
#7 lore raw

v3 cover net/mlx5: bug fixes

In reply to Nelio Laranjeiro

Changes in v3:

* Add missing "fixes" tag in the last commit.

Changes in v2:

* Split last second commit in two, one for testpmd the second one for the PMD
* Re-work "net/mlx5: fix RSS hash update" to also fix a bug introduced in the hash_get() blocking the update.

Nelio Laranjeiro (3):
net/mlx5: fix flow priority for queue action
app/testpmd: fix RSS structure initialisation
net/mlx5: fix RSS hash update

 app/test-pmd/cmdline.c       |  2 +-
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++-
 drivers/net/mlx5/mlx5_rss.c  | 25 +++++++++++--------------
 3 files changed, 23 insertions(+), 16 deletions(-)
Signature · 1 line
2.11.0
#8 lore raw

PATCH v3 1/3 net/mlx5: fix flow priority for queue action

Priority is wrongly configured when the action is queue, using the Ethernet layer priority instead of the most specific layer found.

Fixes 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
---
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +11 -1
index 2b6380fb9..440bda9a1 100644
@@ -1172,8 +1172,18 @@ priv_flow_convert(struct priv *priv,
 	 * Last step. Complete missing specification to reach the RSS
 	 * configuration.
 	 */
-	if (parser->queues_n > 1)
+	if (parser->queues_n > 1) {
 		priv_flow_convert_finalise(priv, parser);
+	} else if (!parser->drop) {
+		/*
+		 * Action queue have their priority overridden with
+		 * Ethernet priority, this priority needs to be adjusted to
+		 * their most specific layer priority.
+		 */
+		parser->queue[HASH_RXQ_ETH].ibv_attr->priority =
+			attr->priority +
+			hash_rxq_init[parser->layer].flow_priority;
+	}
 exit_free:
 	/* Only verification is expected, all resources should be released. */
 	if (!parser->create) {
Signature · 1 line
2.11.0
#9 lore raw

PATCH v3 2/3 app/testpmd: fix RSS structure initialisation

In reply to Nelio Laranjeiro

Struct rss_conf.rss_key_len is not initialised forcing the user to verify the rss_conf.rss_key pointer to know if the key is present or not. rss_conf.rss_key_len should have a valid length according to the size of the rss_key pointed.

Fixes 560e02ee5237 ("app/testpmd: configure RSS without restart")
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline.c +1 -1
index bb01e989a..7002ff2c1 100644
@@ -1750,7 +1750,7 @@ cmd_config_rss_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_rss *res = parsed_result;
-	struct rte_eth_rss_conf rss_conf;
+	struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, };
 	int diag;
 	uint8_t i;
 
Signature · 1 line
2.11.0
#10 lore raw

PATCH v3 3/3 net/mlx5: fix RSS hash update

In reply to Nelio Laranjeiro

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")
---
 drivers/net/mlx5/mlx5_rss.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/mlx5/mlx5_rss.c +11 -14
index ad6d9ab70..f3de46de0 100644
@@ -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;
 }
 
 /**
Signature · 1 line
2.11.0
Acked-by on v3 3/3
#11 lore raw

Re: [PATCH v3 3/3] net/mlx5: fix RSS hash update

Quoted 13 lines · Nelio Laranjeiro

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.

Quoted 4 lines
Fixes 29c1d8bb3e79 ("net/mlx5: handle a single RSS hash key for all protocols")

---

Thanks

#12 lore raw

Re: [PATCH v3 0/3] net/mlx5: bug fixes

In reply to Nelio Laranjeiro
Quoted 6 lines · Nelio Laranjeiro

Changes in v3:

* Add missing "fixes" tag in the last commit.

Changes in v2:

Quoted 8 lines

* Split last second commit in two, one for testpmd the second one for the PMD
* Re-work "net/mlx5: fix RSS hash update" to also fix a bug introduced in the hash_get() blocking the update.

Nelio Laranjeiro (3):
net/mlx5: fix flow priority for queue action
app/testpmd: fix RSS structure initialisation
net/mlx5: fix RSS hash update

Series applied to dpdk-next-net/master, thanks.