summaryrefslogtreecommitdiff
path: root/drivers/net/ena
diff options
context:
space:
mode:
authorMichal Krawczyk <mk@semihalf.com>2019-01-25 09:10:25 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-01-27 23:38:37 +0100
commitfd9768905870856a2340266d25f8c0100dfccfff (patch)
treec4b6df6e82aa97c79a8db0dbfa84a275c4487a7b /drivers/net/ena
parent43d9610e4f072ffc321683be816d4746eae8d634 (diff)
downloaddpdk-next-eventdev-fd9768905870856a2340266d25f8c0100dfccfff.zip
dpdk-next-eventdev-fd9768905870856a2340266d25f8c0100dfccfff.tar.gz
dpdk-next-eventdev-fd9768905870856a2340266d25f8c0100dfccfff.tar.xz
net/ena: fix dev init with multi-process
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>
Diffstat (limited to 'drivers/net/ena')
-rw-r--r--drivers/net/ena/ena_ethdev.c11
1 files 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;