From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 50224A09DF;
	Thu, 12 Nov 2020 03:11:25 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 57ADC5937;
	Thu, 12 Nov 2020 03:11:23 +0100 (CET)
Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])
 by dpdk.org (Postfix) with ESMTP id 16FF12C16
 for <dev@dpdk.org>; Thu, 12 Nov 2020 03:11:20 +0100 (CET)
Received: from nkgeml709-chm.china.huawei.com (unknown [172.30.72.56])
 by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4CWlSq2Rjqz545v
 for <dev@dpdk.org>; Thu, 12 Nov 2020 10:11:07 +0800 (CST)
Received: from [10.174.61.166] (10.174.61.166) by
 nkgeml709-chm.china.huawei.com (10.98.57.40) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.1913.5; Thu, 12 Nov 2020 10:11:16 +0800
To: Qingqing Li <liqingqing3@huawei.com>, <dev@dpdk.org>,
 <zhouguoyang@huawei.com>, <ferruh.yigit@intel.com>
CC: Hushiyuan <hushiyuan@huawei.com>, <yin.yinshi@huawei.com>,
 <xuanziyang2@huawei.com>
References: <edf0958a-73e4-b4aa-5cfe-e051681d6e71@huawei.com>
 <836f40cb-57a9-7b02-adcc-dd302a93a722@huawei.com>
 <ad3c9e64-5817-731d-1426-8239980d668f@huawei.com>
From: "Wangxiaoyun (Cloud)" <cloud.wangxiaoyun@huawei.com>
Message-ID: <0a7d71fa-86f3-d8d0-3e77-1edfa6d5faf5@huawei.com>
Date: Thu, 12 Nov 2020 10:11:08 +0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
 Thunderbird/68.1.1
MIME-Version: 1.0
In-Reply-To: <ad3c9e64-5817-731d-1426-8239980d668f@huawei.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 8bit
X-Originating-IP: [10.174.61.166]
X-ClientProxiedBy: nkgeml707-chm.china.huawei.com (10.98.57.157) To
 nkgeml709-chm.china.huawei.com (10.98.57.40)
X-CFilter-Loop: Reflected
Subject: Re: [dpdk-dev] [v4]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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi Ferruh,

Align with Qingqing Li, this path will not apply to dpdk master now, some dev_ops may
casue fail when run in secondary proc, so need to modify it later and add tests for other
dev_ops.

Thanks

在 2020/10/31 18:10, Qingqing Li 写道:
> 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 <liqingqing3@huawei.com>
> ---
> v4: adapt to the latest version.
> ---
> v3: update the signed-off information.
> ---
> v2:  solve the coding style issue.
> Signed-off-by: liqingqing <liqingqing3@huawei.com>
> ---
>   drivers/net/hinic/hinic_pmd_ethdev.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
> 
> 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;
> 
>       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);
>   }
>