From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B847A04E6; Sat, 31 Oct 2020 10:39:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ABD5CCA36; Sat, 31 Oct 2020 10:39:00 +0100 (CET) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id F0E9BCA1E for ; Sat, 31 Oct 2020 10:38:58 +0100 (CET) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CNYz34PwJzLrX9 for ; Sat, 31 Oct 2020 17:38:55 +0800 (CST) Received: from [10.174.178.215] (10.174.178.215) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Sat, 31 Oct 2020 17:38:47 +0800 To: , , CC: Hushiyuan From: Qingqing Li Message-ID: Date: Sat, 31 Oct 2020 17:38:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.215] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [v3]net/hinic: fix coredump when the scondary process using the hinic port. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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". Signed-off-by: Qingqing Li --- v3: update the signed-off information. --- v2: solve the coding style issue. --- drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 67e6afcf7..26c6098d3 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) int rc; 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; - } - nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev); memset(nic_dev, 0, sizeof(*nic_dev)); @@ -3206,6 +3197,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); } -- 2.19.1