From patchwork Thu May 2 06:39:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 53202 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A71BA49; Thu, 2 May 2019 08:42:41 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6FE5A239 for ; Thu, 2 May 2019 08:42:39 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 May 2019 09:42:38 +0300 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x426gcg3029781; Thu, 2 May 2019 09:42:38 +0300 From: Dekel Peled To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org Date: Thu, 2 May 2019 09:39:53 +0300 Message-Id: X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix init with zero Rx queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 Acked-by: Yongseok Koh --- 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; }