patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: gtzalik@amazon.com, mw@semihalf.com, matua@amazon.com
Cc: rk@semihalf.com, dev@dpdk.org, Michal Krawczyk <mk@semihalf.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH 2/5] net/ena: fix dev init for RTE_PROC_SECONDARY
Date: Fri, 25 Jan 2019 09:10:25 +0100	[thread overview]
Message-ID: <1548403828-31870-3-git-send-email-mk@semihalf.com> (raw)
In-Reply-To: <1548403828-31870-1-git-send-email-mk@semihalf.com>

The check for proc type in eth_ena_dev_init() should appear before
modyfing adapter structure.

Calling memset on ena_adapter from secondary process context, was
erasing all structure information, and it was causing the crash of the
main process.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index fde5fa7..747390b 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1715,19 +1715,20 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
 	static int adapters_found;
 	bool wd_state;
 
-	memset(adapter, 0, sizeof(struct ena_adapter));
-	ena_dev = &adapter->ena_dev;
-
 	eth_dev->dev_ops = &ena_dev_ops;
 	eth_dev->rx_pkt_burst = &eth_ena_recv_pkts;
 	eth_dev->tx_pkt_burst = &eth_ena_xmit_pkts;
 	eth_dev->tx_pkt_prepare = &eth_ena_prep_pkts;
-	adapter->rte_eth_dev_data = eth_dev->data;
-	adapter->rte_dev = eth_dev;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	memset(adapter, 0, sizeof(struct ena_adapter));
+	ena_dev = &adapter->ena_dev;
+
+	adapter->rte_eth_dev_data = eth_dev->data;
+	adapter->rte_dev = eth_dev;
+
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	adapter->pdev = pci_dev;
 
-- 
2.7.4

       reply	other threads:[~2019-01-25  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1548403828-31870-1-git-send-email-mk@semihalf.com>
2019-01-25  8:10 ` Michal Krawczyk [this message]
2019-01-25  8:10 ` [dpdk-stable] [PATCH 3/5] net/ena: fix setting rte_errno to negative value Michal Krawczyk

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=1548403828-31870-3-git-send-email-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=gtzalik@amazon.com \
    --cc=matua@amazon.com \
    --cc=mw@semihalf.com \
    --cc=rk@semihalf.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).