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 A96EDA04F3 for ; Thu, 19 Dec 2019 15:36:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C84D330; Thu, 19 Dec 2019 15:36:54 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 47EFA1BF80 for ; Thu, 19 Dec 2019 15:36:53 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id p17so5874069wmb.0 for ; Thu, 19 Dec 2019 06:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=POyPm4wZkzg8PpiOq3gxuThkK7Vtv7NZ5hueU9Mh2Uo=; b=EgEPoU1G+KEv0+vrvZ9YrC4FF+lFZj3QkygV3N2jW9FDKar2aJkxE+GIaT24snzJKN 44SEiojzr/0OBvaE3yNQA/JU+/H4xZmDELr7pPt0NW5Vld+U/Byr9S9K0epZk27/RKOY 3zAZWmWd++EdvaeQey1YqxtwOlpkO2KRCq1D+UWzYy/wSRoZPPR3tUlhQbnGX+4RY5TA ilD4HwXiNkK0YJ7o8l1Q23AmwxBE3AF1dJcwg1qvaAZZGqesrPvR8uWzO2JwBoHDFz4s 2GaRqCEka3tAeDK/wvySk75CS5zUdMzd32NT7fkISvnge59OlSY2BaS+lYaWNYZRagNB Nqlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=POyPm4wZkzg8PpiOq3gxuThkK7Vtv7NZ5hueU9Mh2Uo=; b=MXPGfQBQ1XFFf5xuxr96zKBjehBPe43iSmSfjygoLDSQG3xJnCLGtgSHE44uWsK59+ Fll7sGpui8pCp4/CZ484wF9X8MfRKwxCNe943mtVr5TcUWbFDpjylzFeO62+zsxLh7LU WQf3oAOLsJMnjbsvkkaoEK4mIIQbLz8VS19m+kGhQaufoWmBQ86jLgjqSiHtY1NCEz6f +YKzda3AebvFZA2OJMA3yjbyI8chGnFEACTiH6KRsy0aDMxMl4rQGIojYwyA0rFy1DZW 2pFgYRwnKwcjF9xg/B8mKSD4z3GtsuDKWsD9KCIaGa+ibs/Hj71pXhg4FdDg8lHEHIbv M7OQ== X-Gm-Message-State: APjAAAWu2yMnjgdY38j/83ZUAyVZh8KrDce5hq3my566gVaGnPcyBcze DzIRlEl+Z1nFIby/ytF5BEk= X-Google-Smtp-Source: APXvYqzK7Rgar7XIFuTd+9f+qQWTO461yhwIgVDejwF4wlOZMypQB21p9WvY9jnQWjFssWMJrjXiCA== X-Received: by 2002:a1c:7e0b:: with SMTP id z11mr9775645wmc.88.1576766212990; Thu, 19 Dec 2019 06:36:52 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id j12sm6635022wrt.55.2019.12.19.06.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:36:52 -0800 (PST) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: Ajit Khaparde , dpdk stable Date: Thu, 19 Dec 2019 14:33:11 +0000 Message-Id: <20191219143447.21506-44-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix crash in secondary process' has been queued to LTS release 17.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 6b7c2b045a9553727ee0a0066d72592500591311 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 2 Oct 2019 10:17:43 -0700 Subject: [PATCH] net/bnxt: fix crash in secondary process [ upstream commit f35eaaca5f5f09b48f5d96adbaccc4484aa6e058 ] 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") Signed-off-by: Stephen Hemminger Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index c699d29b8d..ef49f98833 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -433,6 +433,7 @@ static int bnxt_init_nic(struct bnxt *bp) static void 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 = (struct bnxt *)eth_dev->data->dev_private; uint16_t max_vnics, i, j, vpool, vrxq; unsigned int max_rx_rings; @@ -445,7 +446,7 @@ static void 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_vnics, RTE_MIN(bp->max_l2_ctx, RTE_MIN(bp->max_rsscos_ctx, bp->max_stat_ctx))); @@ -2845,6 +2846,13 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) if (version_printed++ == 0) RTE_LOG(INFO, PMD, "%s\n", bnxt_version); + eth_dev->dev_ops = &bnxt_dev_ops; + eth_dev->rx_pkt_burst = &bnxt_recv_pkts; + eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; + + 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; @@ -2852,9 +2860,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) rte_atomic64_init(&bp->rx_mbuf_alloc_fail); bp->dev_stopped = 1; - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - goto skip_init; - if (bnxt_vf_pciid(pci_dev->id.device_id)) bp->flags |= BNXT_FLAG_VF; @@ -2864,12 +2869,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) "Board initialization failed rc: %x\n", rc); goto error; } -skip_init: - eth_dev->dev_ops = &bnxt_dev_ops; - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - eth_dev->rx_pkt_burst = &bnxt_recv_pkts; - eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) { snprintf(mz_name, RTE_MEMZONE_NAMESIZE, -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:28.093639795 +0000 +++ 0044-net-bnxt-fix-crash-in-secondary-process.patch 2019-12-19 14:32:25.949294732 +0000 @@ -1,69 +1,80 @@ -From f35eaaca5f5f09b48f5d96adbaccc4484aa6e058 Mon Sep 17 00:00:00 2001 +From 6b7c2b045a9553727ee0a0066d72592500591311 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 2 Oct 2019 10:17:43 -0700 Subject: [PATCH] net/bnxt: fix crash in secondary process +[ upstream commit f35eaaca5f5f09b48f5d96adbaccc4484aa6e058 ] + 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(-) + drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c -index 0159be3462..5985963bf7 100644 +index c699d29b8d..ef49f98833 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) +@@ -433,6 +433,7 @@ static int bnxt_init_nic(struct bnxt *bp) + static void 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; + struct bnxt *bp = (struct bnxt *)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, +@@ -445,7 +446,7 @@ static void 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) + max_rx_rings = RTE_MIN(bp->max_vnics, RTE_MIN(bp->max_l2_ctx, + RTE_MIN(bp->max_rsscos_ctx, + bp->max_stat_ctx))); +@@ -2845,6 +2846,13 @@ 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_LOG(INFO, PMD, "%s\n", bnxt_version); -+ rte_eth_copy_pci_info(eth_dev, pci_dev); ++ eth_dev->dev_ops = &bnxt_dev_ops; ++ eth_dev->rx_pkt_burst = &bnxt_recv_pkts; ++ eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; + -+ bp = eth_dev->data->dev_private; -+ -+ bp->dev_stopped = 1; ++ 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; +@@ -2852,9 +2860,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) + rte_atomic64_init(&bp->rx_mbuf_alloc_fail); + bp->dev_stopped = 1; + +- if (rte_eal_process_type() != RTE_PROC_PRIMARY) +- goto skip_init; +- if (bnxt_vf_pciid(pci_dev->id.device_id)) bp->flags |= BNXT_FLAG_VF; +@@ -2864,12 +2869,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) + "Board initialization failed rc: %x\n", rc); + goto error; + } +-skip_init: +- eth_dev->dev_ops = &bnxt_dev_ops; +- if (rte_eal_process_type() != RTE_PROC_PRIMARY) +- return 0; +- eth_dev->rx_pkt_burst = &bnxt_recv_pkts; +- eth_dev->tx_pkt_burst = &bnxt_xmit_pkts; + + if (BNXT_PF(bp) && pci_dev->id.device_id != BROADCOM_DEV_ID_NS2) { + snprintf(mz_name, RTE_MEMZONE_NAMESIZE, -- 2.20.1