DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues
@ 2019-05-02  6:39 Dekel Peled
  2019-05-02  6:39 ` Dekel Peled
  2019-05-02 10:49 ` [dpdk-dev] [PATCH v2] " Dekel Peled
  0 siblings, 2 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-02  6:39 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch moves the call to mlx5_proc_priv_init() to location above
the check, to ensure process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: yskoh@mellanox.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 0845b02..160b307 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -423,6 +423,9 @@ struct ethtool_link_settings {
 			dev->data->port_id, priv->txqs_n, txqs_n);
 		priv->txqs_n = txqs_n;
 	}
+	ret = mlx5_proc_priv_init(dev);
+	if (ret)
+		return ret;
 	if (rxqs_n > priv->config.ind_table_max_size) {
 		DRV_LOG(ERR, "port %u cannot handle this many Rx queues (%u)",
 			dev->data->port_id, rxqs_n);
@@ -464,9 +467,6 @@ struct ethtool_link_settings {
 		if (++j == rxqs_n)
 			j = 0;
 	}
-	ret = mlx5_proc_priv_init(dev);
-	if (ret)
-		return ret;
 	return 0;
 }
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues
  2019-05-02  6:39 [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues Dekel Peled
@ 2019-05-02  6:39 ` Dekel Peled
  2019-05-02 10:49 ` [dpdk-dev] [PATCH v2] " Dekel Peled
  1 sibling, 0 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-02  6:39 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch moves the call to mlx5_proc_priv_init() to location above
the check, to ensure process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: yskoh@mellanox.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 0845b02..160b307 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -423,6 +423,9 @@ struct ethtool_link_settings {
 			dev->data->port_id, priv->txqs_n, txqs_n);
 		priv->txqs_n = txqs_n;
 	}
+	ret = mlx5_proc_priv_init(dev);
+	if (ret)
+		return ret;
 	if (rxqs_n > priv->config.ind_table_max_size) {
 		DRV_LOG(ERR, "port %u cannot handle this many Rx queues (%u)",
 			dev->data->port_id, rxqs_n);
@@ -464,9 +467,6 @@ struct ethtool_link_settings {
 		if (++j == rxqs_n)
 			j = 0;
 	}
-	ret = mlx5_proc_priv_init(dev);
-	if (ret)
-		return ret;
 	return 0;
 }
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] net/mlx5: fix init with zero Rx queues
  2019-05-02  6:39 [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues Dekel Peled
  2019-05-02  6:39 ` Dekel Peled
@ 2019-05-02 10:49 ` Dekel Peled
  2019-05-02 10:49   ` Dekel Peled
  2019-05-05 11:44   ` [dpdk-dev] [PATCH v3] " Dekel Peled
  1 sibling, 2 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-02 10:49 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch changes the check logic. The following code is executed
if (rxqs_n != priv->rxqs_n), and skipped otherwise.
Function mlx5_proc_priv_init() is always invoked, to ensure
process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: yskoh@mellanox.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>

---
v2: Update logic after code review.
---
---
 drivers/net/mlx5/mlx5_ethdev.c | 58 ++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 35d276d..e898c2c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -435,33 +435,37 @@ struct ethtool_link_settings {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-	if (rxqs_n == priv->rxqs_n)
-		return 0;
-	DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
-		dev->data->port_id, priv->rxqs_n, rxqs_n);
-	priv->rxqs_n = rxqs_n;
-	/*
-	 * WHen using LRO, MPRQ is implicitly enabled.
-	 * Adjust threshold value to ensure MPRQ can be enabled.
-	 */
-	if (lro_on && priv->config.mprq.min_rxqs_num > priv->rxqs_n)
-		priv->config.mprq.min_rxqs_num = priv->rxqs_n;
-	/* If the requested number of RX queues is not a power of two, use the
-	 * maximum indirection table size for better balancing.
-	 * The result is always rounded to the next power of two. */
-	reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
-				     priv->config.ind_table_max_size :
-				     rxqs_n));
-	ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
-	if (ret)
-		return ret;
-	/* When the number of RX queues is not a power of two, the remaining
-	 * table entries are padded with reused WQs and hashes are not spread
-	 * uniformly. */
-	for (i = 0, j = 0; (i != reta_idx_n); ++i) {
-		(*priv->reta_idx)[i] = j;
-		if (++j == rxqs_n)
-			j = 0;
+	if (rxqs_n != priv->rxqs_n) {
+		DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
+			dev->data->port_id, priv->rxqs_n, rxqs_n);
+		priv->rxqs_n = rxqs_n;
+		/*
+		 * WHen using LRO, MPRQ is implicitly enabled.
+		 * Adjust threshold value to ensure MPRQ can be enabled.
+		 */
+		if (lro_on && priv->config.mprq.min_rxqs_num > priv->rxqs_n)
+			priv->config.mprq.min_rxqs_num = priv->rxqs_n;
+		/*
+		 * If the requested number of RX queues is not a power of two,
+		 * use the maximum indirection table size for better balancing.
+		 * The result is always rounded to the next power of two.
+		 */
+		reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
+					     priv->config.ind_table_max_size :
+					     rxqs_n));
+		ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
+		if (ret)
+			return ret;
+		/*
+		 * When the number of RX queues is not a power of two, the
+		 * remaining table entries are padded with reused WQs and
+		 * hashes are not spread uniformly.
+		 */
+		for (i = 0, j = 0; (i != reta_idx_n); ++i) {
+			(*priv->reta_idx)[i] = j;
+			if (++j == rxqs_n)
+				j = 0;
+		}
 	}
 	ret = mlx5_proc_priv_init(dev);
 	if (ret)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] net/mlx5: fix init with zero Rx queues
  2019-05-02 10:49 ` [dpdk-dev] [PATCH v2] " Dekel Peled
@ 2019-05-02 10:49   ` Dekel Peled
  2019-05-05 11:44   ` [dpdk-dev] [PATCH v3] " Dekel Peled
  1 sibling, 0 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-02 10:49 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch changes the check logic. The following code is executed
if (rxqs_n != priv->rxqs_n), and skipped otherwise.
Function mlx5_proc_priv_init() is always invoked, to ensure
process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: yskoh@mellanox.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>

---
v2: Update logic after code review.
---
---
 drivers/net/mlx5/mlx5_ethdev.c | 58 ++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 35d276d..e898c2c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -435,33 +435,37 @@ struct ethtool_link_settings {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-	if (rxqs_n == priv->rxqs_n)
-		return 0;
-	DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
-		dev->data->port_id, priv->rxqs_n, rxqs_n);
-	priv->rxqs_n = rxqs_n;
-	/*
-	 * WHen using LRO, MPRQ is implicitly enabled.
-	 * Adjust threshold value to ensure MPRQ can be enabled.
-	 */
-	if (lro_on && priv->config.mprq.min_rxqs_num > priv->rxqs_n)
-		priv->config.mprq.min_rxqs_num = priv->rxqs_n;
-	/* If the requested number of RX queues is not a power of two, use the
-	 * maximum indirection table size for better balancing.
-	 * The result is always rounded to the next power of two. */
-	reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
-				     priv->config.ind_table_max_size :
-				     rxqs_n));
-	ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
-	if (ret)
-		return ret;
-	/* When the number of RX queues is not a power of two, the remaining
-	 * table entries are padded with reused WQs and hashes are not spread
-	 * uniformly. */
-	for (i = 0, j = 0; (i != reta_idx_n); ++i) {
-		(*priv->reta_idx)[i] = j;
-		if (++j == rxqs_n)
-			j = 0;
+	if (rxqs_n != priv->rxqs_n) {
+		DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
+			dev->data->port_id, priv->rxqs_n, rxqs_n);
+		priv->rxqs_n = rxqs_n;
+		/*
+		 * WHen using LRO, MPRQ is implicitly enabled.
+		 * Adjust threshold value to ensure MPRQ can be enabled.
+		 */
+		if (lro_on && priv->config.mprq.min_rxqs_num > priv->rxqs_n)
+			priv->config.mprq.min_rxqs_num = priv->rxqs_n;
+		/*
+		 * If the requested number of RX queues is not a power of two,
+		 * use the maximum indirection table size for better balancing.
+		 * The result is always rounded to the next power of two.
+		 */
+		reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
+					     priv->config.ind_table_max_size :
+					     rxqs_n));
+		ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
+		if (ret)
+			return ret;
+		/*
+		 * When the number of RX queues is not a power of two, the
+		 * remaining table entries are padded with reused WQs and
+		 * hashes are not spread uniformly.
+		 */
+		for (i = 0, j = 0; (i != reta_idx_n); ++i) {
+			(*priv->reta_idx)[i] = j;
+			if (++j == rxqs_n)
+				j = 0;
+		}
 	}
 	ret = mlx5_proc_priv_init(dev);
 	if (ret)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
  2019-05-02 10:49 ` [dpdk-dev] [PATCH v2] " Dekel Peled
  2019-05-02 10:49   ` Dekel Peled
@ 2019-05-05 11:44   ` Dekel Peled
  2019-05-05 11:44     ` Dekel Peled
  2019-05-08  4:44     ` Shahaf Shuler
  1 sibling, 2 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-05 11:44 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, stable

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch changes the check logic. The following code is executed
if (rxqs_n != priv->rxqs_n), and skipped otherwise.
Function mlx5_proc_priv_init() is always invoked, to ensure
process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>

---
v2: Update logic after code review.
v3: Remove unrelated code that was wrongly added in v2.
---
---
 drivers/net/mlx5/mlx5_ethdev.c | 46 +++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index d1a70fc..80ee98f 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -428,27 +428,31 @@ struct ethtool_link_settings {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-	if (rxqs_n == priv->rxqs_n)
-		return 0;
-	DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
-		dev->data->port_id, priv->rxqs_n, rxqs_n);
-	priv->rxqs_n = rxqs_n;
-	/* If the requested number of RX queues is not a power of two, use the
-	 * maximum indirection table size for better balancing.
-	 * The result is always rounded to the next power of two. */
-	reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
-				     priv->config.ind_table_max_size :
-				     rxqs_n));
-	ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
-	if (ret)
-		return ret;
-	/* When the number of RX queues is not a power of two, the remaining
-	 * table entries are padded with reused WQs and hashes are not spread
-	 * uniformly. */
-	for (i = 0, j = 0; (i != reta_idx_n); ++i) {
-		(*priv->reta_idx)[i] = j;
-		if (++j == rxqs_n)
-			j = 0;
+	if (rxqs_n != priv->rxqs_n) {
+		DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
+			dev->data->port_id, priv->rxqs_n, rxqs_n);
+		priv->rxqs_n = rxqs_n;
+		/*
+		 * If the requested number of RX queues is not a power of two,
+		 * use the maximum indirection table size for better balancing.
+		 * The result is always rounded to the next power of two.
+		 */
+		reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
+					     priv->config.ind_table_max_size :
+					     rxqs_n));
+		ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
+		if (ret)
+			return ret;
+		/*
+		 * When the number of RX queues is not a power of two,
+		 * the remaining table entries are padded with reused WQs
+		 * and hashes are not spread uniformly.
+		 */
+		for (i = 0, j = 0; (i != reta_idx_n); ++i) {
+			(*priv->reta_idx)[i] = j;
+			if (++j == rxqs_n)
+				j = 0;
+		}
 	}
 	ret = mlx5_proc_priv_init(dev);
 	if (ret)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
  2019-05-05 11:44   ` [dpdk-dev] [PATCH v3] " Dekel Peled
@ 2019-05-05 11:44     ` Dekel Peled
  2019-05-08  4:44     ` Shahaf Shuler
  1 sibling, 0 replies; 8+ messages in thread
From: Dekel Peled @ 2019-05-05 11:44 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, stable

Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
	if (rxqs_n == priv->rxqs_n)
		return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch changes the check logic. The following code is executed
if (rxqs_n != priv->rxqs_n), and skipped otherwise.
Function mlx5_proc_priv_init() is always invoked, to ensure
process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>

---
v2: Update logic after code review.
v3: Remove unrelated code that was wrongly added in v2.
---
---
 drivers/net/mlx5/mlx5_ethdev.c | 46 +++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index d1a70fc..80ee98f 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -428,27 +428,31 @@ struct ethtool_link_settings {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-	if (rxqs_n == priv->rxqs_n)
-		return 0;
-	DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
-		dev->data->port_id, priv->rxqs_n, rxqs_n);
-	priv->rxqs_n = rxqs_n;
-	/* If the requested number of RX queues is not a power of two, use the
-	 * maximum indirection table size for better balancing.
-	 * The result is always rounded to the next power of two. */
-	reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
-				     priv->config.ind_table_max_size :
-				     rxqs_n));
-	ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
-	if (ret)
-		return ret;
-	/* When the number of RX queues is not a power of two, the remaining
-	 * table entries are padded with reused WQs and hashes are not spread
-	 * uniformly. */
-	for (i = 0, j = 0; (i != reta_idx_n); ++i) {
-		(*priv->reta_idx)[i] = j;
-		if (++j == rxqs_n)
-			j = 0;
+	if (rxqs_n != priv->rxqs_n) {
+		DRV_LOG(INFO, "port %u Rx queues number update: %u -> %u",
+			dev->data->port_id, priv->rxqs_n, rxqs_n);
+		priv->rxqs_n = rxqs_n;
+		/*
+		 * If the requested number of RX queues is not a power of two,
+		 * use the maximum indirection table size for better balancing.
+		 * The result is always rounded to the next power of two.
+		 */
+		reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
+					     priv->config.ind_table_max_size :
+					     rxqs_n));
+		ret = mlx5_rss_reta_index_resize(dev, reta_idx_n);
+		if (ret)
+			return ret;
+		/*
+		 * When the number of RX queues is not a power of two,
+		 * the remaining table entries are padded with reused WQs
+		 * and hashes are not spread uniformly.
+		 */
+		for (i = 0, j = 0; (i != reta_idx_n); ++i) {
+			(*priv->reta_idx)[i] = j;
+			if (++j == rxqs_n)
+				j = 0;
+		}
 	}
 	ret = mlx5_proc_priv_init(dev);
 	if (ret)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
  2019-05-05 11:44   ` [dpdk-dev] [PATCH v3] " Dekel Peled
  2019-05-05 11:44     ` Dekel Peled
@ 2019-05-08  4:44     ` Shahaf Shuler
  2019-05-08  4:44       ` Shahaf Shuler
  1 sibling, 1 reply; 8+ messages in thread
From: Shahaf Shuler @ 2019-05-08  4:44 UTC (permalink / raw)
  To: Dekel Peled, Yongseok Koh; +Cc: dev, stable

Sunday, May 5, 2019 2:44 PM, Dekel Peled:
> Subject: [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
> 
> Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
> mlx5_proc_priv_init(), initializing process_private data of eth_dev.
> This call is not reached if PMD is started with zero Rx queues.
> In this case mlx5_dev_configure() returns earlier due to the check:
> 	if (rxqs_n == priv->rxqs_n)
> 		return 0;
> In such a scenario, later references to uninitialized process_private data will
> result in segmentation fault.
> For example see in function txq_uar_init().
> 
> This patch changes the check logic. The following code is executed if (rxqs_n
> != priv->rxqs_n), and skipped otherwise.
> Function mlx5_proc_priv_init() is always invoked, to ensure process_private
> data is initialized.
> 
> [1]
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> es.dpdk.org%2Fpatch%2F52629%2F&amp;data=02%7C01%7Cshahafs%40mel
> lanox.com%7C18b3d5bb065348a57ef408d6d14f6b26%7Ca652971c7d2e4d9ba
> 6a4d149256f461b%7C0%7C0%7C636926536374830910&amp;sdata=7KXyV1U7
> 9P%2Bhc4HtZ8W05m95ZYyhY0m0Yc3A9NECvwo%3D&amp;reserved=0
> 
> Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Applied to next-net-mlx, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
  2019-05-08  4:44     ` Shahaf Shuler
@ 2019-05-08  4:44       ` Shahaf Shuler
  0 siblings, 0 replies; 8+ messages in thread
From: Shahaf Shuler @ 2019-05-08  4:44 UTC (permalink / raw)
  To: Dekel Peled, Yongseok Koh; +Cc: dev, stable

Sunday, May 5, 2019 2:44 PM, Dekel Peled:
> Subject: [dpdk-dev] [PATCH v3] net/mlx5: fix init with zero Rx queues
> 
> Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
> mlx5_proc_priv_init(), initializing process_private data of eth_dev.
> This call is not reached if PMD is started with zero Rx queues.
> In this case mlx5_dev_configure() returns earlier due to the check:
> 	if (rxqs_n == priv->rxqs_n)
> 		return 0;
> In such a scenario, later references to uninitialized process_private data will
> result in segmentation fault.
> For example see in function txq_uar_init().
> 
> This patch changes the check logic. The following code is executed if (rxqs_n
> != priv->rxqs_n), and skipped otherwise.
> Function mlx5_proc_priv_init() is always invoked, to ensure process_private
> data is initialized.
> 
> [1]
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> es.dpdk.org%2Fpatch%2F52629%2F&amp;data=02%7C01%7Cshahafs%40mel
> lanox.com%7C18b3d5bb065348a57ef408d6d14f6b26%7Ca652971c7d2e4d9ba
> 6a4d149256f461b%7C0%7C0%7C636926536374830910&amp;sdata=7KXyV1U7
> 9P%2Bhc4HtZ8W05m95ZYyhY0m0Yc3A9NECvwo%3D&amp;reserved=0
> 
> Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Applied to next-net-mlx, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-08  4:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02  6:39 [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues Dekel Peled
2019-05-02  6:39 ` Dekel Peled
2019-05-02 10:49 ` [dpdk-dev] [PATCH v2] " Dekel Peled
2019-05-02 10:49   ` Dekel Peled
2019-05-05 11:44   ` [dpdk-dev] [PATCH v3] " Dekel Peled
2019-05-05 11:44     ` Dekel Peled
2019-05-08  4:44     ` Shahaf Shuler
2019-05-08  4:44       ` Shahaf Shuler

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).