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 B25E742503; Tue, 5 Sep 2023 17:36:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A822840FDE; Tue, 5 Sep 2023 17:36:15 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by mails.dpdk.org (Postfix) with ESMTP id 6519540E40 for ; Tue, 5 Sep 2023 17:36:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SqoXh7THeHML6P8aykMpDjQ7QqRsiwetJfoFWnvigHEVZAEWUI1D9L3JhLjCgNKCE0L+6qFpIZjSkxGyB7HWIPsx/pLJvPNg/GMEHcCKZkHaGqHhgvitYC11i7yFV62LvPLMedLGHNdJdVJqMzAmpcgjj8Lht8/xRFn4QSSwRnsa/0NtknD66kOKu+nqnrT8+4RK4ISU8N9sBOfg+6DxQgP6avXxFElBCQvccJQhOS3McAFZUnZAPcZlt2x2P1FitPZqBnmHvuOo2/8xD2DSjkm6ekegTRPP6yWxy+4s9HBvODDRDkP/ZSwm8MR4uHe/KuIuvgImqb5r2rXKAaBqMg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jetATWhcWrbFO7wmjh7Uoytcl4oOZDzkxNiEyeu6Rug=; b=HQWyEMZymZ6XqkltGR+ARhtNWemveAl8heAZ28adrOQaIE43ZIp6fOZvgLEFURxc+m7/2pEVNVviWPIo6ADrmmB60KSCGG0IRb3dWml7/V1br2t4hpM60xMVqc6Asje/2dA6Cbu/x/p4onANZVNn5BO8zllCJvfURK5FP/ix3hZs7Z1FonokWvXMYTc0XZuIN+XaYo+w4/xtkO91cuotneQlDzX4d25PmLSCfSbQUIIyWD1gFW47QPqbeenQFQUGLw/CzbYJAYqTiy7CliAgyj9G+ICTrWXM9In6lJe4RartMQ6Pnb07Y6uFxs/7MECidfN9l9XAvZTu+QLoEuOsvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jetATWhcWrbFO7wmjh7Uoytcl4oOZDzkxNiEyeu6Rug=; b=LKn5QwxF/Kk7gmdA+4+PQ7D/QeiBmifsojxGfBLVe5wUDF3qvr1G5DOMG669A7AHnCOvVik4G5a72Z7HyXH/O3+DiHwEMci/lxmjuVxD/b6+I4fU04jGsfEwgFxc/uT1Sl+vj0M5o29en/pg73vDXFFCZrsVSbjLHDf4O5NIT8U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BN9PR12MB5324.namprd12.prod.outlook.com (2603:10b6:408:105::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 15:36:12 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::49e9:2bf6:7f06:bbbd]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::49e9:2bf6:7f06:bbbd%3]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 15:36:12 +0000 Message-ID: <5b134eee-95f1-53f9-2f24-b6a2b0bea3af@amd.com> Date: Tue, 5 Sep 2023 16:36:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: Wenbo Cao , Anatoly Burakov Cc: dev@dpdk.org, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, yaojun@mucse.com References: <20230901023050.40893-1-caowenbo@mucse.com> <20230901023050.40893-3-caowenbo@mucse.com> From: Ferruh Yigit Subject: Re: [PATCH v6 2/8] net/rnp: add ethdev probe and remove In-Reply-To: <20230901023050.40893-3-caowenbo@mucse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0446.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::26) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BN9PR12MB5324:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c6c8789-7b1d-40be-6ace-08dbae25d58e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YZ4a0EwvVGx2drAl31+y3GrF/AXtumwX3tCSSAPNL5dTHc7XQTQh2BZ99VhcO5SyF62WYlZT4Mxst9S1Cjiz8kfAly57e9fUtUViqS8XFBa9A5zExMe1dqnBfLCALAgAIhsN1oTFuY7YLtbQpVYKrLyknwVJUzDXPxVB9Pv63dCIGqMn8r7jYkHlBe1CxuvpH66o0042P2vawb5LyXIKT42sZzxf8d+rHKKJzgejIwpcvnLDhxqPmdk5PuVvHIU7l+EH95YJ8ct/DQqHobtSTHt/pj1fIU8qxTO99+OQU9ZqXhc/PBuz6kCPJ7EQ9jMTus6R75eF7FFqZ1JX/hQxys9hCRIFIx76BaUxrov0nZ2Pywb+3UIA4BcZBozDMyFbpms4kPBKJ5lxubqMlsOJZo6raNNLZHgFo/lmLGVkfdby04UsCIumXVh7nSN3z2PB6Y+A0ND93kVWyYoNYT8a3OLOGvRrlOk/AeCwu/thEbf7NzAs7tykTquc05qqMCtjnxeNFJlciR42VxPe/w17MHLD6ijKeF7A0vJrVCibybI/qhFCcWLN9MW4zmZcMNXlTJ973sgu+Ds1dhdxSg1Fbit84xOkSDz6q1/Qa4hKo+IEry0PEwiBC2azRbZb2XFUG0n4x7jQbzCN/gJ9r3ZAsQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(376002)(39860400002)(1800799009)(451199024)(186009)(6666004)(31686004)(31696002)(86362001)(38100700002)(36756003)(53546011)(6512007)(6486002)(6506007)(26005)(2616005)(478600001)(66556008)(66476007)(4326008)(66946007)(8936002)(8676002)(41300700001)(2906002)(316002)(110136005)(66899024)(44832011)(5660300002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OC8rK2dmeUFyNjRrM2JLR0QrOTBlbURXa1ltdmJrNWlWaTFTUjZyajNEaVBi?= =?utf-8?B?bGx5aFNlT25EaU1CMGFoRjJ4Q2l0aG9scVdxY1EvTFIzelg3WDVtd0toeXps?= =?utf-8?B?cXVmbXR6S0c2Z1NzTSs0Q3BnUEYxVTBrbnY5TmVvKzBueG0rbURtSWx4UzhT?= =?utf-8?B?Mkg3Y0RxR0YxRWhpc2wvU1Z1MFFQQ3lydUthcm4vZFZ1Wk1uRzgyV3dxUUZ6?= =?utf-8?B?SXdhV0IrMDBKdEN4MHJxMkY3Z1BocGRhbW0ra3V4TWh4eHBHd0ZYTnkzMEor?= =?utf-8?B?aGF4ek8vQlZzaGQxcXhQQ05kVGZGdUMrNjF5Y1c4eGZ4cWZ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TrMFLXHVxx0BlJ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c6c8789-7b1d-40be-6ace-08dbae25d58e X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 15:36:12.5940 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rstTS97NcB2M6mb5oppev+MIMIC0dufnm4B1ru2QPPn5t73YIQoCckW6quATM4vN X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5324 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 On 9/1/2023 3:30 AM, Wenbo Cao wrote: > Add basic PCIe ethdev probe and remove. > > Signed-off-by: Wenbo Cao > --- > drivers/net/rnp/rnp.h | 13 ++++++ > drivers/net/rnp/rnp_ethdev.c | 83 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 96 insertions(+) > create mode 100644 drivers/net/rnp/rnp.h > > diff --git a/drivers/net/rnp/rnp.h b/drivers/net/rnp/rnp.h > new file mode 100644 > index 0000000000..76d281cc0a > --- /dev/null > +++ b/drivers/net/rnp/rnp.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Mucse IC Design Ltd. > + */ > +#ifndef __RNP_H__ > +#define __RNP_H__ > + > +#define PCI_VENDOR_ID_MUCSE (0x8848) > +#define RNP_DEV_ID_N10G (0x1000) > + > +struct rnp_eth_port { > +} __rte_cache_aligned; > + Is the struct needs to be cache aligned? > +#endif /* __RNP_H__ */ > diff --git a/drivers/net/rnp/rnp_ethdev.c b/drivers/net/rnp/rnp_ethdev.c > index 9ce3c0b497..390f2e7743 100644 > --- a/drivers/net/rnp/rnp_ethdev.c > +++ b/drivers/net/rnp/rnp_ethdev.c > @@ -1,3 +1,86 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright(C) 2023 Mucse IC Design Ltd. > */ > + > +#include > +#include > +#include > + > +#include "rnp.h" > + > +static int > +rnp_eth_dev_init(struct rte_eth_dev *eth_dev) > +{ > + RTE_SET_USED(eth_dev); > + > + return -ENODEV; > +} > + > +static int > +rnp_eth_dev_uninit(struct rte_eth_dev *eth_dev) > +{ > + RTE_SET_USED(eth_dev); > + > + return -ENODEV; > +} > + > +static int > +rnp_pci_remove(struct rte_pci_device *pci_dev) > +{ > + struct rte_eth_dev *eth_dev; > + int rc; > + > + eth_dev = rte_eth_dev_allocated(pci_dev->device.name); > + > + if (eth_dev) { > + /* Cleanup eth dev */ > + rc = rte_eth_dev_pci_generic_remove(pci_dev, > + rnp_eth_dev_uninit); > + if (rc) > + return rc; > + } > + /* Nothing to be done for secondary processes */ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + Primary also don't do anything after this stage, I suggest adding this code when primary & secondary diverges. > + return 0; > +} > + > +static int > +rnp_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > +{ > + int rc; > + > + RTE_SET_USED(pci_drv); > + > + rc = rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct rnp_eth_port), > + rnp_eth_dev_init); > + > + /* On error on secondary, recheck if port exists in primary or > + * in mid of detach state. > + */ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY && rc) > + if (!rte_eth_dev_allocated(pci_dev->device.name)) > + return 0; Why this additional secondary check is required? 'rte_eth_dev_pci_generic_probe()' should be dealing with primary/secondary process case.