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

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