From patchwork Mon Nov 2 14:48:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingqing Li X-Patchwork-Id: 83421 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E810A04E7; Mon, 2 Nov 2020 15:48:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99D83C904; Mon, 2 Nov 2020 15:48:56 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id B319FC8FE for ; Mon, 2 Nov 2020 15:48:54 +0100 (CET) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CPwlm5JmKzhf1y for ; Mon, 2 Nov 2020 22:48:52 +0800 (CST) Received: from [10.174.178.215] (10.174.178.215) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Mon, 2 Nov 2020 22:48:43 +0800 References: <2027a001-c422-6464-ccff-1d3d90039ecd@huawei.com> To: , , , , , Hushiyuan From: Qingqing Li X-Forwarded-Message-Id: <2027a001-c422-6464-ccff-1d3d90039ecd@huawei.com> Message-ID: <19384408-c7b8-8140-2f92-a4fcc071715f@huawei.com> Date: Mon, 2 Nov 2020 22:48:44 +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 In-Reply-To: <2027a001-c422-6464-ccff-1d3d90039ecd@huawei.com> Content-Language: en-US X-Originating-IP: [10.174.178.215] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH]net/hinic: fix coredump when secondary 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" the reason is that during the stage of secondary process port initialization, it lacks the initialization of "eth_dev->dev_ops". Signed-off-by: Qingqing Li --- drivers/net/hinic/hinic_pmd_ethdev.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index b694fd83c..786095e9d 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; nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev); @@ -3241,6 +3233,20 @@ 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); }