From: Somnath Kotur <somnath.kotur@broadcom.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process
Date: Wed, 18 Mar 2020 11:25:10 +0530 [thread overview]
Message-ID: <20200318055513.21622-2-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200318055513.21622-1-somnath.kotur@broadcom.com>
From: Stephen Hemminger <stephen@networkplumber.org>
[ 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 <stephen@networkplumber.org>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 06dfbf3..878b9f5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -404,6 +404,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;
uint16_t max_vnics, i, j, vpool, vrxq;
unsigned int max_rx_rings;
@@ -414,7 +415,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;
@@ -3321,12 +3322,6 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
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;
@@ -3338,6 +3333,12 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
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;
--
1.8.3.1
next prev parent reply other threads:[~2020-03-18 5:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
2020-03-18 5:55 ` Somnath Kotur [this message]
2020-03-18 5:55 ` [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD Somnath Kotur
2020-03-18 22:59 ` Kevin Traynor
2020-03-18 5:55 ` [dpdk-stable] [PATCH 18.11 3/4] net/bnxt: fix IOVA mapping Somnath Kotur
2020-03-18 5:55 ` [dpdk-stable] [PATCH 18.11 4/4] net/bnxt: fix default timeout for getting FW version Somnath Kotur
2020-03-18 22:59 ` [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Kevin Traynor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318055513.21622-2-somnath.kotur@broadcom.com \
--to=somnath.kotur@broadcom.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).