forked from amzn/amzn-drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0013-net-ena-fix-dev-init-with-multi-process.patch
56 lines (45 loc) · 1.71 KB
/
0013-net-ena-fix-dev-init-with-multi-process.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 1278928ed5362188fa9003da082dfa97aa5b5678 Mon Sep 17 00:00:00 2001
From: Michal Krawczyk <[email protected]>
Date: Fri, 25 Jan 2019 09:10:25 +0100
Subject: [PATCH 13/27] net/ena: fix dev init with multi-process
[ upstream commit fd9768905870856a2340266d25f8c0100dfccfff ]
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")
Change-Id: Iff9f6ffbaec9dc55408788f62a43d690534048ed
Signed-off-by: Michal Krawczyk <[email protected]>
---
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 813e95e95e..a96ec69753 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1531,19 +1531,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 = ð_ena_recv_pkts;
eth_dev->tx_pkt_burst = ð_ena_xmit_pkts;
eth_dev->tx_pkt_prepare = ð_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.20.1