From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 325E7A0548; Tue, 22 Jun 2021 15:59:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6C24003F; Tue, 22 Jun 2021 15:59:35 +0200 (CEST) Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2177.outbound.protection.outlook.com [40.92.62.177]) by mails.dpdk.org (Postfix) with ESMTP id EB4054003C for ; Tue, 22 Jun 2021 15:59:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nl0kOiaiAHHQSl38D9Po3olGXMZfQmBzkaVU/r7S3hWq9gBUIiDKh6Zii3mcOemIngosrOfT1NYRwAtJL+VHOnGjJu3/TOWxaGdfEzgHsFS+bHjCqrOzVJL1Ap6fKehcs8UOVFunEzvYw4ereOuJOyEFm0YU1VQ1P5VJ26u5SxkyCuuJaePq14WBrfTJlYl3cgDU9J6ZRhP5RYqjEfzLKxhnfi2IEPugb/Qt8bq2ZYAaEWcOu4n+/ybPQNzBcuZ3Ur/OBCdol6DhxFmQQ9wBz9c38RVtJVeY2H+jtalPc6kIo1Ir00HWcv5CENNy/5KOXWtAQwTFYFtYjUKD9i/lww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ja5HYAt9aWHvwmjbvQYBe1Zc4zZ4Vwdfa91Q5rDyUk=; b=eN8apW15iQZ9vK066u05TRA3bjH4V8EX3oj8TbIqD6xcQ4OhGkMiXQz7DCvdGmSIPfX24LYQpLLRmnn+OdDu5CuFRGLSruK69KwVeI0Ua0X5gNewwjhk934P7D0C6qISKJARHD4kBO6XCyZl6kboqCWnkBHKJVTTzELVLN3jMYzZ0SwXtRlE4RQfGcmP116eF19wckA2w0PeP0O1JfdcYlEI1iTA6u1LduE/ZGYpJDJFl3lNEoPx0AfATIlKIsPFRKzA0Z4q3VXlha4gnl+8TuDaEZ8R4hng/IJ9gEHJDPAPtdRoyJZsabN0o0tRMX2NhdP0zEBy1GUpbHhf4M7A3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ja5HYAt9aWHvwmjbvQYBe1Zc4zZ4Vwdfa91Q5rDyUk=; b=QdQ0hxMbLLxdXEtNUPzbW15p+ytga1II2TkZCRYGy+VoDJdie1oufHe1dgxlR1mhykpAQIrCqXDWW+mDaoB6XDMiDPazmK75TIp0WKzZknjGQzs8KovwqAedqE/S9YB7SQu1oUfrQ8ouvjl3HN/avurIsplfUVUnwltHUcCpoDN6f8S0C6UJfJXcV1onpIPU72jDEGnvU/xOKsk9fEQfxY7ptoGIU76i/l6+dxvnEUElUmb7EtmClgDg0EW6up7MBGkZDH/88DPVrBohpG7NdtIwMjkTV4kKVs2lMJF3Hgq455wOeLvJ7baVO5vXRtTJ/CnC3RluqGu2oZx4F/BGXw== Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:a5::11) by ME3P282MB2513.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:10f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16; Tue, 22 Jun 2021 13:59:30 +0000 Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::a5ea:6127:5368:d8b8]) by ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::a5ea:6127:5368:d8b8%7]) with mapi id 15.20.4242.024; Tue, 22 Jun 2021 13:59:30 +0000 To: "Wang, Haiyue" Cc: "dev@dpdk.org" , "Zhang, Qi Z" , "Lin, Xueqin" References: From: Tengfei Zhang Message-ID: Date: Tue, 22 Jun 2021 21:56:11 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: Content-Language: en-US X-TMN: [Igv3lfPoAhNbWs2X1DSrRkLDSmNoFWusy7msk7W1rTg=] X-ClientProxiedBy: HK2PR02CA0179.apcprd02.prod.outlook.com (2603:1096:201:21::15) To ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:a5::11) X-Microsoft-Original-Message-ID: <07f2ffea-de47-6735-172d-32ebe6718798@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.0.0.11] (180.102.249.191) by HK2PR02CA0179.apcprd02.prod.outlook.com (2603:1096:201:21::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Tue, 22 Jun 2021 13:59:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23e08038-ea0f-4d01-8f85-08d93585f3e8 X-MS-TrafficTypeDiagnostic: ME3P282MB2513: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2zlJZrxN+cxsb7cO67leEb1NCiluCbPRQyR1P0g3N43bNOmdO1oGEvpRvnruG+aLgIF9wWznsISwq79cBL4P7r4GnD6nNqfDuvpOQ4C/YA5otsB7/63qCL4sb8NEEe7083aj/mXFUflT5+DhfaS2fXT3yPbY618+jrvbjDbhKoAXAm+yQakiAw8NJDIdzYSpyIEbFIY0VFgLOQ4G8WK+0xDGFDKMDxR3gyK94WRJVqCLWJXazT7H5tmzhZdW23dlQOcF8/HaVcyNmi7Fae6L86GC+HEBVexegW1ED3153iHNk5t4BmlbnuDBaUMK2/RYD62QsNYZ4Ds7uM0IlqP/n1X44r/otwi9qpkNpQyzS/2oZYzU2MsxvKFXSADci7x4jq6MlbcRVJiS6C3QTUNIeA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cEqOSX8fc+XcVx4+GS+YaJOOpp78V3bEQhoh2j8OmIMNWVSLFEuq1d35/RGyyzEu/bgAoNE9h7cTaOAJ4o8dy7dc1M1rd0QKU+/YMzNG23EQLbSm4EMulECVXXeoVezCfE/QEdJx8LwNbXVThJTi8Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23e08038-ea0f-4d01-8f85-08d93585f3e8 X-MS-Exchange-CrossTenant-AuthSource: ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2021 13:59:30.4811 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: ME3P282MB2513 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH] net/e1000: fix nic ops function was no initialized in secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 2021/6/22 上午10:16, Wang, Haiyue wrote: > From: 张 杨 > Sent: Monday, June 21, 2021 16:35 > To: Wang, Haiyue > Cc: dev@dpdk.org; Zhang, Qi Z ; Lin, Xueqin > Subject: Re: [PATCH] net/e1000: fix nic ops function was no initialized in secondary process > > 发件人: Wang, Haiyue > 发送时间: 2021年6月21日星期一 15:31 > 收件人: Tengfei Zhang > 抄送: mailto:dev@dpdk.org; Zhang, Qi Z; Lin, Xueqin > 主题: RE: [PATCH] net/e1000: fix nic ops function was no initialized in secondary process > > >> -----Original Message----- >> From: Tengfei Zhang >> Sent: Saturday, June 19, 2021 01:27 >> To: Wang, Haiyue >> Cc: mailto:dev@dpdk.org; Tengfei Zhang >> Subject: [PATCH] net/e1000: fix nic ops function was no initialized in secondary process >> >> 'e1000_setup_init_funcs' was not called in secondary process, >> it initialize mac,phy,nvm ops. >> when secondary process get link status,it will coredump. >> Thanks, Tengfei. >> Since primary / secondary is so complicated, AFAIK, the control path is in >> primary, the secondary is mainly for rx/tx ops officially, like new Intel >> ice PMD: >>         if (rte_eal_process_type() != RTE_PROC_PRIMARY) { >>                 ice_set_rx_function(dev); >>                 ice_set_tx_function(dev); >>                 return 0; >>         } >> >> So you can keep your patch as private for special secondary usage. ;-) >> Signed-off-by: Tengfei Zhang >> --- >>   drivers/net/e1000/em_ethdev.c  | 1 + >>   drivers/net/e1000/igb_ethdev.c | 2 ++ >>   2 files changed, 3 insertions(+) >> >> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c >> index a0ca371b02..cd5faa4228 100644 >> --- a/drivers/net/e1000/em_ethdev.c >> +++ b/drivers/net/e1000/em_ethdev.c >> @@ -258,6 +258,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) >>          * has already done this work. Only check we don't need a different >>          * RX function */ >>         if (rte_eal_process_type() != RTE_PROC_PRIMARY){ >> +             e1000_setup_init_funcs(hw, TRUE); >>                 if (eth_dev->data->scattered_rx) >>                         eth_dev->rx_pkt_burst = >>                                 (eth_rx_burst_t)ð_em_recv_scattered_pkts; >> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c >> index 10ee0f3341..7d9d60497d 100644 >> --- a/drivers/net/e1000/igb_ethdev.c >> +++ b/drivers/net/e1000/igb_ethdev.c >> @@ -737,6 +737,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) >>          * has already done this work. Only check we don't need a different >>          * RX function */ >>         if (rte_eal_process_type() != RTE_PROC_PRIMARY){ >> +             e1000_setup_init_funcs(hw, TRUE); >>                 if (eth_dev->data->scattered_rx) >>                         eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts; >>                 return 0; >> @@ -931,6 +932,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) >>          * has already done this work. Only check we don't need a different >>          * RX function */ >>         if (rte_eal_process_type() != RTE_PROC_PRIMARY){ >> +             e1000_setup_init_funcs(hw, TRUE); >>                 if (eth_dev->data->scattered_rx) >>                         eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts; >>                 return 0; >> -- >> 2.26.2 > > > >> this issue does not appear in  ice, i40e, vmxnet3 PMD drivers. Only in e1000 , ixgbe drivers. >> Ice  pmd driver gets link status by read reg directly. > For making primary & secondary working well, these drivers try to avoid save > the global data and ops function in shared data at the design of beginning. > > >> I agree with what you said "primary, the secondary is mainly for rx/tx ops officially". >> My opinion is the "set actions" shouldn't called in secondary process, but "get actions" was very common operation, they shouldn't be banned. > It's not banned, just because e1000's design introduces the global data ops in the > shared data, which is not good for sharing and accessing, since the address of the > global data ops is changed in secondary process. > > As you can see in " e1000_setup_init_funcs", they not only set function pointers, > but also call them, not sure this will break other things or not. ;-) > >> Thanks for your reply > > I think "get" operation should not crash  in  any  process. and on different  nics ,  this operation  should  be consistent. Yes , "e1000_setup_init_funcs" not only set function pointers, this patch is not good enough,  just happens to  work. I look forward to   a better solution