From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7B768A2EDB for ; Wed, 2 Oct 2019 19:20:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CBBA1BF6E; Wed, 2 Oct 2019 19:18:30 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 361831BF13; Wed, 2 Oct 2019 19:17:55 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id CED1630D351; Wed, 2 Oct 2019 10:16:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com CED1630D351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570036597; bh=zhL5RYF4l6uqLJtFGyhU6/mfJ/ClUx0qYM8lGN6Mm7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fvAy4FqDfXONavjGbJ3vAauOtApg1E4GsAfk86tg3SRabJG/88N/k0uRPeNqRY05h hAAhM3K0lzLHGallLNMoGSAYi8ky/8PpMcMI/sYJfvBg2MaqkfVj5scPev242BTYjW 2uUTaPs8jyeE+v/tl+XklP1FRLU/dUgnfksMRiSo= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 5910C140069; Wed, 2 Oct 2019 10:17:49 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Stephen Hemminger , stable@dpdk.org Date: Wed, 2 Oct 2019 10:17:43 -0700 Message-Id: <20191002171745.4504-15-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com> References: <20191002055423.99659-1-ajit.khaparde@broadcom.com> <20191002171745.4504-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process 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" From: Stephen Hemminger The secondary process should not modify device state when init is called. The pci device information pointed to by dev_private pointer is not correct in secondary process. Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 0159be3462..5985963bf7 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -521,6 +521,7 @@ static int bnxt_init_nic(struct bnxt *bp) static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info) { + struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device); struct bnxt *bp = eth_dev->data->dev_private; uint16_t max_vnics, i, j, vpool, vrxq; unsigned int max_rx_rings; @@ -536,7 +537,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, /* PF/VF specifics */ if (BNXT_PF(bp)) - dev_info->max_vfs = bp->pdev->max_vfs; + dev_info->max_vfs = pdev->max_vfs; + max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx); /* For the sake of symmetry, max_rx_queues = max_tx_queues */ dev_info->max_rx_queues = max_rx_rings; @@ -4488,12 +4490,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) if (version_printed++ == 0) PMD_DRV_LOG(INFO, "%s\n", bnxt_version); - rte_eth_copy_pci_info(eth_dev, pci_dev); - - bp = eth_dev->data->dev_private; - - bp->dev_stopped = 1; - eth_dev->dev_ops = &bnxt_dev_ops; eth_dev->rx_pkt_burst = &bnxt_recv_pkts; eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; @@ -4505,6 +4501,12 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + rte_eth_copy_pci_info(eth_dev, pci_dev); + + bp = eth_dev->data->dev_private; + + bp->dev_stopped = 1; + if (bnxt_vf_pciid(pci_dev->id.device_id)) bp->flags |= BNXT_FLAG_VF; -- 2.20.1 (Apple Git-117)