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 A1AB245C59; Sun, 3 Nov 2024 03:17:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3ABEE402A5; Sun, 3 Nov 2024 03:17:40 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by mails.dpdk.org (Postfix) with ESMTP id 744284026B for ; Sun, 3 Nov 2024 03:17:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EIEHlzcoyF6Ze/jnFWjrZqWdHU2L1xhzvmhFuwpJt9QmiRYlgd6AB89VG8n9pKJ8jL+6h9MmJMOpQi1CswEWyRJIu1vpv8dxCumuA9ttVUNW+QYil7ZJN0KLiAyPVtZHcr4fcelJtEwSWsfe1N4UXfk43Zsn/ZNfZixaNq43GQ/D3RSG/jxbFIZPpR99QTO6QVmE8v6cWRUcIxJtqJjg+VKY5HumkHnsjLBHWmrkFUkBuhG63VAaxXaTFCrPFCaoaGmlh3gLA6xOf4szU1cJcwiuAii/And9bQVB5Tg3ApEhQY+2ZEXijTGtEPJH2pi1Jbh0mR+U4eIzmPA7BYSxsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=KGBov/inejIS51QASRVQCBnX6A2AKUxX+4f9zQwQVXg=; b=I4qXK3wPUbt7sVt7JDWCj2B4Ugw58o6HcaB0pdkfbS9g1vB1SyHbGTdmiymqsycu5c0tTCIhvRNcyipLajQlcAHAgQmiAQODHakjCgFl49/AiRUz8K/rUt1qkp9ddgRmyzij0Jc/UY8dWXpokiJpGbPVWvJCwMdo2FKw3r8G/8YeMyw9I2z3FbJexitS7t+8BCJhXko6WLboCFGFWfgH6/QjiWG1r+mGQF+Dn+baLsO35fS8AhdSOszeuZvK5+trIdjnOJsne2ZHZV0A2sfaTqNc0BZ/HYTPXIOkAVEDbW3n3Se8oTiKgUxHQLyKK2JTFanntynwvzs+AVQEQMfkMw== 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=KGBov/inejIS51QASRVQCBnX6A2AKUxX+4f9zQwQVXg=; b=a4+jA2AsZEtVDV+zqx3Jn4xKPZbC8imxcnZXwaTXdYq2rU+4OhXge7lxsYdD8b/PzNbQ6mURB3qhXPEpX22qiNCrgXFADKa3shlHxRBhbH2Sdtopw/l3OnxW4IrpKAA/eFnGsCme5eI9y4ao53IvNwhIXEimf5OY4j4CLgGAqbw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) by SJ2PR12MB8925.namprd12.prod.outlook.com (2603:10b6:a03:542::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29; Sun, 3 Nov 2024 02:17:34 +0000 Received: from SJ2PR12MB8830.namprd12.prod.outlook.com ([fe80::c3eb:df02:eaa9:2055]) by SJ2PR12MB8830.namprd12.prod.outlook.com ([fe80::c3eb:df02:eaa9:2055%4]) with mapi id 15.20.8114.015; Sun, 3 Nov 2024 02:17:33 +0000 Message-ID: Date: Sun, 3 Nov 2024 02:17:27 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 01/18] net/r8169: add PMD driver skeleton To: Howard Wang , dev@dpdk.org Cc: pro_nic_dpdk@realtek.com References: <20241028073112.107535-1-howard_wang@realsil.com.cn> <20241028073112.107535-2-howard_wang@realsil.com.cn> Content-Language: en-US From: Ferruh Yigit In-Reply-To: <20241028073112.107535-2-howard_wang@realsil.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0303.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:391::14) To SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR12MB8830:EE_|SJ2PR12MB8925:EE_ X-MS-Office365-Filtering-Correlation-Id: 99243967-4860-45fb-935d-08dcfbadad02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?enR0VURnaXIyWklyd1Y0dXJUNFNJTzZMK1E4MUo4S0RUMHM5U3lZU2RsOHNV?= =?utf-8?B?VEpGR09DWVludDZGdUxaa2Nnay9rMkpaYU5oY2xUcmJEL2xNT0RjdUlnamxt?= =?utf-8?B?VWJnYWRmbU11dHRLclRRZVE4cDZPUFRuaXVFVjhOb2NRMjA4N21mV1hzWlVx?= =?utf-8?B?N2xPcE84L2FOb0d6anNENEhvQ0lhSlA4am9La2U4Zk5yRWJ3QWk3ajZubXNs?= =?utf-8?B?Z0sxbUVXUUtmdlA5WHdPQmwyNzJZTFBWT1JkdWNjZC9Rbm0yR3JQRHU1cTJW?= =?utf-8?B?VFpBaEFuZXdvVG1PdU5pTXJiVldwb09GVUQ1cmpKVm9hMExYRHBWbVZWbE54?= =?utf-8?B?M29INTliK2F3VVZxU1N6MXh6SkxUTnV1aW1FakZVN3ZWb0hH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NMTF2RWUwTU44bVJLT2lnOFJuMnpt?= =?utf-8?B?d2g1UXdGeUFaUUZCY2p3ZFRWdlJWYzI2NTNLbis4a0FHSmVnUzNyNlpBWVls?= =?utf-8?B?YTFDalQ4Qjh6bUIxbzNMM1B5SEpWUVVidDBkR0hjdUdYcUtmdzBsNUZrbDg2?= =?utf-8?B?MEtpQ3piSm1JNDJaT29lMTUvOVdkOXp6cmFzMjh3dEJFVXBGRTRSbGVKSWhZ?= =?utf-8?B?MElvalpwTUNNUmNXSXFhSzRMaktHbUtSbW11QWpqbU1zN3FhWGhzeHozUmlF?= =?utf-8?B?SW42R1B1bE9vczV6Q3lKWlovY0cyOFptcDQ5Tll6YzkrcWdXbWFqa2RtVmFT?= =?utf-8?B?dVQ0OUpWL2grUFcwaTZnMWRwL2dnMy9vTllTREpTZ3g5TDBsNS9KM0YzVEgx?= =?utf-8?B?TE9IUkxtQm5Melo1aG9tdzZRakJMdlQxQ3lON3BCZnYvQWk2UnJvaVV5MCtX?= =?utf-8?Q?t7TqnBgslifhMfq6AzpqtIwJ328mtl3NI73bP85?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR12MB8830.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?S1JHMUV0cVUvaWRnWXJUbEppR2U5VU1aM2VudkdqaHZKNEFSQUJTNG1JLzF5?= =?utf-8?B?dTcyUGdIOVRITExiZWJuT1pzaEc2Z2lYRFhuN0dZTUcrNEVkOFdhUDlnbFZY?= =?utf-8?B?QXdBcDgrTDdUdU9oZWdKaWlocTUwL21ZbEQrRkhndHBkTDVUZmxvaUYybjVM?= =?utf-8?B?ajl1SWc4cUpyTi8vNDhZN3NBUkdnMVc0UDVtYklobVNHN29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?cnJOaDF1SENOZ0k5bENpcFBSaDRPMUpGdUNiaDhmM2cwVkpIeU1IVW5YMDl1?= =?utf-8?B?VlUvQks3bVRCNjNjeTFIODFia1czU01vcFFUWVBVNnVCZ0laTU1UcVlETFNq?= =?utf-8?Q?t7/ImwTzyCsmmq3q+TGU0tFtr?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99243967-4860-45fb-935d-08dcfbadad02 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR12MB8830.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2024 02:17:33.3220 (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: OFH9FzBSw9dLIjUi0KPa5ew/wITsZ6tR+Qdq0vD3dKy23/6kqrfI2Vz+1kb4d4nW X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8925 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 10/28/2024 7:30 AM, Howard Wang wrote: > Meson build infrastructure, r8169_ethdev minimal skeleton, > header with Realtek NIC device and vendor IDs. > > Signed-off-by: Howard Wang > --- > MAINTAINERS | 7 ++ > drivers/net/meson.build | 1 + > drivers/net/r8169/meson.build | 6 ++ > drivers/net/r8169/r8169_base.h | 15 +++ > drivers/net/r8169/r8169_ethdev.c | 178 +++++++++++++++++++++++++++++++ > drivers/net/r8169/r8169_ethdev.h | 40 +++++++ > 6 files changed, 247 insertions(+) > create mode 100644 drivers/net/r8169/meson.build > create mode 100644 drivers/net/r8169/r8169_base.h > create mode 100644 drivers/net/r8169/r8169_ethdev.c > create mode 100644 drivers/net/r8169/r8169_ethdev.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index c5a703b5c0..5f9eccc43f 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1076,6 +1076,13 @@ F: drivers/net/memif/ > F: doc/guides/nics/memif.rst > F: doc/guides/nics/features/memif.ini > > +Realtek r8169 > +M: Howard Wang > +M: ChunHao Lin > +M: Xing Wang > +M: Realtek NIC SW > We prefer authors as maintainer, instead of group/alias, and as you already provide names, can this be removed? > +F: drivers/net/r8169 > + > Please sort alphabetically for 'Realtek' Can you also add driver documentation and update release notes in this patch? > > Crypto Drivers > -------------- > diff --git a/drivers/net/meson.build b/drivers/net/meson.build > index fb6d34b782..fddcf39655 100644 > --- a/drivers/net/meson.build > +++ b/drivers/net/meson.build > @@ -53,6 +53,7 @@ drivers = [ > 'pfe', > 'qede', > 'ring', > + 'r8169', > 'sfc', > 'softnic', > 'tap', > diff --git a/drivers/net/r8169/meson.build b/drivers/net/r8169/meson.build > new file mode 100644 > index 0000000000..f14d4ae8fb > --- /dev/null > +++ b/drivers/net/r8169/meson.build > @@ -0,0 +1,6 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2024 Realtek Corporation. All rights reserved > + > +sources = files( > + 'r8169_ethdev.c', > +) > diff --git a/drivers/net/r8169/r8169_base.h b/drivers/net/r8169/r8169_base.h > new file mode 100644 > index 0000000000..6fc84592a6 > --- /dev/null > +++ b/drivers/net/r8169/r8169_base.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2024 Realtek Corporation. All rights reserved > + */ > + > +#ifndef _R8169_BASE_H_ > +#define _R8169_BASE_H_ > + > +typedef uint8_t u8; > +typedef uint16_t u16; > +typedef uint32_t u32; > +typedef uint64_t u64; > most of the drivers has 'compat.h' or '_compat.h' (r8169_compat.h) as compatibility layer for DPDK and define above like structures there. If there is no specific reason to have this file name, you can create a compat.h for compatibility. > + > +#define PCI_VENDOR_ID_REALTEK 0x10EC > + > +#endif > diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c > new file mode 100644 > index 0000000000..1f90a142c5 > --- /dev/null > +++ b/drivers/net/r8169/r8169_ethdev.c > @@ -0,0 +1,178 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2024 Realtek Corporation. All rights reserved > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > Do you really need all these headers here? Please only include necessary ones and add them when you need them. > + > +#include "r8169_ethdev.h" > +#include "r8169_base.h" > + > +static int rtl_dev_configure(struct rte_eth_dev *dev __rte_unused); > No need to have '__rte_unused' attribute for function decleration. > +static int rtl_dev_start(struct rte_eth_dev *dev); > +static int rtl_dev_stop(struct rte_eth_dev *dev); > +static int rtl_dev_reset(struct rte_eth_dev *dev); > +static int rtl_dev_close(struct rte_eth_dev *dev); > + > +/* > + * The set of PCI devices this driver supports > + */ > +static const struct rte_pci_id pci_id_r8169_map[] = { > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) }, > + { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) }, > + {.vendor_id = 0, /* sentinel */ }, > +}; > + > +static const struct eth_dev_ops rtl_eth_dev_ops = { > + .dev_configure = rtl_dev_configure, > + .dev_start = rtl_dev_start, > + .dev_stop = rtl_dev_stop, > + .dev_close = rtl_dev_close, > + .dev_reset = rtl_dev_reset, > +}; > + > +static int > +rtl_dev_configure(struct rte_eth_dev *dev __rte_unused) > +{ > + return 0; > +} > + > +/* > + * Configure device link speed and setup link. > + * It returns 0 on success. > + */ > +static int > +rtl_dev_start(struct rte_eth_dev *dev) > +{ > + struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev); > + struct rtl_hw *hw = &adapter->hw; > + > + hw->adapter_stopped = 0; > + > + return 0; > +} > + > +/* > + * Stop device: disable RX and TX functions to allow for reconfiguring. > + */ > +static int > +rtl_dev_stop(struct rte_eth_dev *dev) > +{ > + struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev); > + struct rtl_hw *hw = &adapter->hw; > + > + if (hw->adapter_stopped) > + return 0; > There is 'dev->data->dev_started' variable for exact same reason, and it is checked in 'rte_eth_dev_stop()' level, do you need this driver version of same flag? > + > + hw->adapter_stopped = 1; > + dev->data->dev_started = 0; > This flag is set in ethdev layer level, no need to set it here. > + > + return 0; > +} > + > +/* > + * Reset and stop device. > + */ > +static int > +rtl_dev_close(struct rte_eth_dev *dev) > +{ > + int ret_stp; > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + > + ret_stp = rtl_dev_stop(dev); > + > + return ret_stp; > +} > + > +static int > +rtl_dev_init(struct rte_eth_dev *dev) > +{ > + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); > + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; > 'intr_handle' not used yet, please add it when used. > + struct rtl_adapter *adapter = RTL_DEV_PRIVATE(dev); > + struct rtl_hw *hw = &adapter->hw; > + > + dev->dev_ops = &rtl_eth_dev_ops; > + > + /* For secondary processes, the primary process has done all the work */ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + > + rte_eth_copy_pci_info(dev, pci_dev); > This is already done as part of 'rte_eth_dev_pci_generic_probe()', shouldn't need to do here. Can you please double check? > + > + return 0; > +} > + > +static int > +rtl_dev_uninit(struct rte_eth_dev *dev) > +{ > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return -EPERM; > + > + rtl_dev_close(dev); > + > + return 0; > +} > + > +static int > +rtl_dev_reset(struct rte_eth_dev *dev) > +{ > + int ret; > + > + ret = rtl_dev_uninit(dev); > + if (ret) > + return ret; > + > + ret = rtl_dev_init(dev); > + > + return ret; > +} > + > +static int > +rtl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > + struct rte_pci_device *pci_dev) > +{ > + return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct rtl_adapter), > + rtl_dev_init); > +} > + > +static int > +rtl_pci_remove(struct rte_pci_device *pci_dev) > +{ > + return rte_eth_dev_pci_generic_remove(pci_dev, rtl_dev_uninit); > +} > + > +static struct rte_pci_driver rte_r8169_pmd = { > + .id_table = pci_id_r8169_map, > + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, > + .probe = rtl_pci_probe, > + .remove = rtl_pci_remove, > +}; > + > +RTE_PMD_REGISTER_PCI(net_r8169, rte_r8169_pmd); > +RTE_PMD_REGISTER_PCI_TABLE(net_r8169, pci_id_r8169_map); > +RTE_PMD_REGISTER_KMOD_DEP(net_r8169, "* igb_uio | uio_pci_generic | vfio-pci"); > diff --git a/drivers/net/r8169/r8169_ethdev.h b/drivers/net/r8169/r8169_ethdev.h > new file mode 100644 > index 0000000000..e37f05c153 > --- /dev/null > +++ b/drivers/net/r8169/r8169_ethdev.h > @@ -0,0 +1,40 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2024 Realtek Corporation. All rights reserved > + */ > + > +#ifndef _R8169_ETHDEV_H_ > +#define _R8169_ETHDEV_H_ > + > +#include > +#include > + > +#include > +#include > + > +#include "r8169_base.h" > + > +struct rtl_hw { > + u8 adapter_stopped; > +}; > + > +struct rtl_sw_stats { > + u64 tx_packets; > + u64 tx_bytes; > + u64 tx_errors; > + u64 rx_packets; > + u64 rx_bytes; > + u64 rx_errors; > +}; > + > +struct rtl_adapter { > + struct rtl_hw hw; > + struct rtl_sw_stats sw_stats; > +}; > + > +#define RTL_DEV_PRIVATE(eth_dev) \ > + ((struct rtl_adapter *)((eth_dev)->data->dev_private)) > + > +uint16_t rtl_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); > +uint16_t rtl_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); > These functions don't exists yet, please add the declarations when functions added. > + > +#endif