diff mbox series

[v4] net/hinic: fix coredump when the scondary process using the hinic port.

Message ID 75f84103-ca98-e6b1-1013-c2720189c848@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series [v4] net/hinic: fix coredump when the scondary process using the hinic port. | expand

Checks

Context Check Description
ci/Intel-compilation fail apply issues

Commit Message

Qingqing Li Oct. 31, 2020, 10:23 a.m. UTC
fix coredump when secondary process using the hinic port. the
  reason is that during the stage of secondary process port 
initialization, it
  lack the initialization of "eth_dev->dev_ops".

---
v4: adapt to the latest version.
---
v3: update the signed-off information.
---
v2:  solve the coding style issue.
---

Signed-off-by: Qingqing Li <liqingqing3@huawei.com>
---
  drivers/net/hinic/hinic_pmd_ethdev.c | 20 ++++++++++++--------
  1 file changed, 12 insertions(+), 8 deletions(-)

  	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
@@ -3241,6 +3233,18 @@ static int hinic_dev_init(struct rte_eth_dev 
*eth_dev)
  	eth_dev->rx_pkt_burst = hinic_recv_pkts;
  	eth_dev->tx_pkt_burst = hinic_xmit_pkts;

+	/* EAL is SECONDARY and eth_dev is already created */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		PMD_DRV_LOG(INFO, "Initialize %s in secondary process", 
eth_dev->data->name);
+
+		struct hinic_nic_dev *nic_dev = 
HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+		if (HINIC_IS_VF(nic_dev->hwdev))
+			eth_dev->dev_ops = &hinic_pmd_vf_ops;
+		else
+			eth_dev->dev_ops = &hinic_pmd_ops;
+		return 0;
+	}
+
  	return hinic_func_init(eth_dev);
  }
diff mbox series

Patch

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c 
b/drivers/net/hinic/hinic_pmd_ethdev.c
index b694fd83c..526dafdad 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -3100,14 +3100,6 @@  static int hinic_func_init(struct rte_eth_dev 
*eth_dev)

  	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);

-	/* EAL is SECONDARY and eth_dev is already created */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-			    eth_dev->data->name);
-
-		return 0;
-	}
-
  	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;