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 7026F424F4; Tue, 5 Sep 2023 17:44:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A66640E40; Tue, 5 Sep 2023 17:44:20 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2087.outbound.protection.outlook.com [40.107.237.87]) by mails.dpdk.org (Postfix) with ESMTP id 016FA40279 for ; Tue, 5 Sep 2023 17:44:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m5Cz+PJrphZBbH04INm4BH3hkNnEZYEqut1gci1JjtRWhGXK6Nu2ujUQGiuulhkR1/DvPCeB8VE4Oq8nq3OHymidDIgi/a6A3y9RU9IEIbVZWJSBeMxTz5lwdkHM7S1wThWxPk69fMQ9kx75/tg3LS3sHz1vaqul5yfS6/9mdmteON+e5pl9EFToB8eSjjzEcKpcrciqYC6SDjj8KJXRTOHM/qiXONUfTB4nlMpDeyukspKfcEO9HDP1FgMCYBdXuGQV/EBcO1IoCgFHcMoj3X+nK5dK7tL0U+D3gpWMpssAwinW0AqAmTNk9R0xn/Rp3WEI61WR46U+ITC5Tn8gEQ== 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=SHGGCDhLgdlZ+ZpqbMfgFVmed6yZtW3rHOyCPW0kdxg=; b=el5xrhvBBgOWxaqrZW40Q7tOlYx7OY4IyHeKw8yYAvYTcqOOcd/ryvs36hUFgctZMq2eNYVCXUJvEISJs746t2oY7q3sWhea+WCpuIRwa8fFx8ixLHGuFXf8Ksu11RQF7emPvyVcPQdsiwTn4ELydY2GW43ssjy3f0CcqGV6c3qgnNwaLkm9cb+dtekwEmtVmU8pZLasHlm1uIPRtn6BQgd/twhHJpakmdTSBCs8cHJfRBnKrsAMQIOaty2Koz98Q7rCl72VWeO+6MEhZbVzUM6KrHBh+pJq6k3+sbOjQZgT85XumL5lkuqg897NYJyvLXQqs7xQFfLZpz4GOW7ilw== 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=SHGGCDhLgdlZ+ZpqbMfgFVmed6yZtW3rHOyCPW0kdxg=; b=skzjzb9BfSRcKRDb9nAOTGjsSwEDYfnKeTUbHgA9EAktQgJpKFQz2XLMbDsmCjdWO52cyAIOPZNOu5tc27qahgi62UINEhSoys2tn5anp1syQRenJDrlaafrsoFlPhbY9IsUuovchQDJxXbk8UJO577jpTxqMS7nYY+TDu8lGbg= 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 SJ0PR12MB6967.namprd12.prod.outlook.com (2603:10b6:a03:44b::6) 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:44:14 +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:44:14 +0000 Message-ID: <566b2003-cdde-0f3a-9568-184f64777038@amd.com> Date: Tue, 5 Sep 2023 16:44:08 +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-4-caowenbo@mucse.com> From: Ferruh Yigit Subject: Re: [PATCH v6 3/8] net/rnp: add device init and uninit In-Reply-To: <20230901023050.40893-4-caowenbo@mucse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0124.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2c6::14) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SJ0PR12MB6967:EE_ X-MS-Office365-Filtering-Correlation-Id: 23274fc0-8a12-4ffc-c3dc-08dbae26f4d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wKjg1xW0gXySUWpgazHR0w83ZPD/2I+FjhkNghy1lsglmhfqkcOW4gIF/sBs7RxWPGOG3FbgqXcuX8P7drL0YqctvNn7MszaYviwzW7JrHEo0arZOkslM4l302H6hqee4oJxT6CgVNkEskpHnaLxKiE48pAvsvTnt1/cUqbDtv5qMjZJ1kmwH+yjWRC1xfW5FCwACV8STT6eE0VfNFddzTQtIUMbzkxeh/G34nEUhm2LYNjHZSnaAacwzk/jc/xWUJgyl7p+9apZhIMWTbc2HLfQNJriyNseoVZYvNX6mfUoIdKIt3lUvkFyOJ7yXiCZVEkz0foN93nPnUT7B37bPZ7PYw+g1X29vKJTOmFj/JgYZxPmineg7ViirVWT1aYyUJet2j/LRT8X2x1auQkadVF62y9MGdKclRtsxMZcE6C8NU4/CEDMNggumtLKjQZhCpSMeSQKtMUgM+0RUtoNs+wXsifmdfjn287V4JWMfb9NNUSTfiKuBbdCjKRCtqHQFZYTdR8EDxe6y9ujmNaGWMP2b3CNaLGao6StwWBbMHl402dRHVrC92/JTCJ5hdfgQLoNNM4yyIFOoO3U9vXpTo/gFqU4qw93LX4XKmnfJGduGpwN5ABMwdFJmx6G1mzq0rHrLrBc9lFnGuW0cOjbsQ== 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)(376002)(39860400002)(136003)(346002)(366004)(396003)(1800799009)(186009)(451199024)(478600001)(6512007)(31686004)(38100700002)(36756003)(41300700001)(83380400001)(6486002)(6506007)(53546011)(26005)(66556008)(2616005)(66946007)(66476007)(316002)(6666004)(110136005)(5660300002)(44832011)(8936002)(4326008)(8676002)(2906002)(31696002)(86362001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TTVOTFRXQkxkTkkyMmN6eDl6RC9GWnhGazJFdy9PY3cxUVdpR2g5a0xJMmk0?= =?utf-8?B?aXhVcm1MN0NnZWhHTk9YNFNYSkExaTFLbzZ6eWR6U1JrMVF0SVJJeUFXaWZQ?= =?utf-8?B?NkNSSVpWTm55bWw2QlJYS2xsRmRDRzBORlE3Ym1Mb1RyY0MzUXFhVHVqSDVO?= =?utf-8?B?ZUNXYW9oV3Y3VUZ3QXJtK1FyTlZIUDlIemQwc1VRWjE3bzBNV2ZZMHFDVmdi?= =?utf-8?B?ZERzZWg3RFN3OFdINjFjZkdWZFFXTDhHa2w4aE1FZzJkMEkwOEVkMzlIWUlM?= =?utf-8?B?Y2JNN3RYcDM0UitmSDlkdEJzMXZHTXl5V1htMFRKL1dyS1VUWFp3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ETBfLfgf+aZMAOLxq6wH9y?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23274fc0-8a12-4ffc-c3dc-08dbae26f4d5 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:44:14.7508 (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: nqjoqWsVozksIOZgRDQRFjel1SVzQV1LTNv6f4S33KKLlFSjJsogDcezzC1DrOTy X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6967 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 init and uninit function > > Signed-off-by: Wenbo Cao > --- > drivers/net/rnp/base/rnp_hw.h | 19 ++++ > drivers/net/rnp/meson.build | 1 + > drivers/net/rnp/rnp.h | 25 +++++ > drivers/net/rnp/rnp_ethdev.c | 196 +++++++++++++++++++++++++++++++++- > drivers/net/rnp/rnp_logs.h | 34 ++++++ > drivers/net/rnp/rnp_osdep.h | 30 ++++++ > 6 files changed, 300 insertions(+), 5 deletions(-) > create mode 100644 drivers/net/rnp/base/rnp_hw.h > create mode 100644 drivers/net/rnp/rnp_logs.h > create mode 100644 drivers/net/rnp/rnp_osdep.h > 'rnp_osdep.h' not used at all in the patch, can you move it where it is used? > diff --git a/drivers/net/rnp/base/rnp_hw.h b/drivers/net/rnp/base/rnp_hw.h > new file mode 100644 > index 0000000000..d80d23f4b4 > --- /dev/null > +++ b/drivers/net/rnp/base/rnp_hw.h > @@ -0,0 +1,19 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Mucse IC Design Ltd. > + */ > +#ifndef __RNP_HW_H__ > +#define __RNP_HW_H__ > + > +struct rnp_eth_adapter; > +struct rnp_hw { > + struct rnp_eth_adapter *back; > + void *iobar0; > + uint32_t iobar0_len; > + void *iobar4; > + uint32_t iobar4_len; > + > + uint16_t device_id; > + uint16_t vendor_id; > +} __rte_cache_aligned; > + All structs seems alligned to the cache, although it may not hurt, it is better to align ones that is necessary for performance. <...> > + > +static struct rte_eth_dev * > +rnp_alloc_eth_port(struct rte_pci_device *primary_pci, char *name) Why variable name is 'primary_pci', are there different pci device types? > +{ > + struct rnp_eth_port *port; > + struct rte_eth_dev *eth_dev; > + > + eth_dev = rte_eth_dev_allocate(name); > + if (!eth_dev) { > + RNP_PMD_DRV_LOG(ERR, "Could not allocate " > + "eth_dev for %s\n", name); Please don't split the log message, instead can do: RNP_PMD_DRV_LOG(ERR, "Could not allocate eth_dev for %s\n", name); Same for all log messages. > + return NULL; > + } > + port = rte_zmalloc_socket(name, > + sizeof(*port), > + RTE_CACHE_LINE_SIZE, > + primary_pci->device.numa_node); > + if (!port) { > + RNP_PMD_DRV_LOG(ERR, "Could not allocate " > + "rnp_eth_port for %s\n", name); > + return NULL; Should 'eth_dev' released here? > + } > + eth_dev->data->dev_private = port; > + eth_dev->process_private = calloc(1, sizeof(struct rnp_share_ops)); > + if (!eth_dev->process_private) { > + RNP_PMD_DRV_LOG(ERR, "Could not calloc " > + "for Process_priv\n"); > + goto fail_calloc; > + } > + return eth_dev; > +fail_calloc: > + rte_free(port); > + rte_eth_dev_release_port(eth_dev); > + > + return NULL; > +} > + > +static int > +rnp_eth_dev_init(struct rte_eth_dev *dev) > +{ > + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); > + struct rnp_eth_adapter *adapter = NULL; > + char name[RTE_ETH_NAME_MAX_LEN] = " "; > + struct rnp_eth_port *port = NULL; > + struct rte_eth_dev *eth_dev; > + struct rnp_hw *hw = NULL; > + int32_t p_id; > + int ret; > + > + PMD_INIT_FUNC_TRACE(); > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + memset(name, 0, sizeof(name)); > + snprintf(name, sizeof(name), "rnp_adapter_%d", dev->data->port_id); > + adapter = rte_zmalloc(name, sizeof(struct rnp_eth_adapter), 0); > + if (!adapter) { > + RNP_PMD_DRV_LOG(ERR, "zmalloc for adapter failed\n"); > + return -ENOMEM; > + } > + hw = &adapter->hw; > + adapter->pdev = pci_dev; > + adapter->eth_dev = dev; > + adapter->num_ports = 1; This is hardcoded value, so no need the loop below but perhaps it is for future. > + hw->back = adapter; > + hw->iobar4 = pci_dev->mem_resource[RNP_CFG_BAR].addr; > + hw->iobar0 = pci_dev->mem_resource[RNP_PF_INFO_BAR].addr; > + hw->iobar4_len = pci_dev->mem_resource[RNP_CFG_BAR].len; > + hw->iobar0_len = pci_dev->mem_resource[RNP_PF_INFO_BAR].len; > + hw->device_id = pci_dev->id.device_id; > + hw->vendor_id = pci_dev->id.vendor_id; > + hw->device_id = pci_dev->id.device_id; > + for (p_id = 0; p_id < adapter->num_ports; p_id++) { > + /* port 0 resource has been allocated When Probe */ Why 'When' & 'Probe' starts with uppercase, similar usage exists many places, although that is not an issue, just catches eye, can you please fix them if there is no specific reason. > + if (!p_id) { > + eth_dev = dev; > + } else { > + snprintf(name, sizeof(name), "%s_%d", > + adapter->pdev->device.name, > + p_id); > + eth_dev = rnp_alloc_eth_port(pci_dev, name); > + if (eth_dev) > + rte_memcpy(eth_dev->process_private, > + adapter->share_priv, > + sizeof(*adapter->share_priv)); > + if (!eth_dev) { This can be 'else' leg of above branch. > + ret = -ENOMEM; > + goto eth_alloc_error; > + } > + } > + ret = rnp_init_port_resource(adapter, eth_dev, name, p_id); > + if (ret) > + goto eth_alloc_error; 'rnp_init_port_resource()' can't return error but perhaps this check is for future. > + > + rnp_mac_rx_disable(eth_dev); > + rnp_mac_tx_disable(eth_dev); > + } > + > + return 0; > +eth_alloc_error: > + for (p_id = 0; p_id < adapter->num_ports; p_id++) { > + port = adapter->ports[p_id]; > + if (!port) > + continue; > + if (port->eth_dev) { > + rnp_dev_close(port->eth_dev); > + rte_eth_dev_release_port(port->eth_dev); > + if (port->eth_dev->process_private) This should crash, because 'port' is 'dev_private' and 'rte_eth_dev_release_port()' frees the dev_private, so can't access 'port->' here. Also 'process_private' set to NULL in the 'rte_eth_dev_release_port()', it should be freed in 'rnp_dev_close()', not here. > + free(port->eth_dev->process_private); > + } > + rte_free(port); > + } > + rte_free(adapter); > + > + return 0; > } > > static int > rnp_eth_dev_uninit(struct rte_eth_dev *eth_dev) > { > - RTE_SET_USED(eth_dev); > + struct rnp_eth_adapter *adapter = RNP_DEV_TO_ADAPTER(eth_dev); > + struct rnp_eth_port *port = NULL; > + uint8_t p_id; > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > > - return -ENODEV; > + if (adapter->eth_dev != eth_dev) { > + RNP_PMD_DRV_LOG(ERR, "Input Argument ethdev " > + "Isn't Primary Ethdev\n"); > + return -EINVAL; > + } > + for (p_id = 0; p_id < adapter->num_ports; p_id++) { > + port = adapter->ports[p_id]; > + if (!port) > + continue; > + if (port->eth_dev) { > + rnp_dev_close(port->eth_dev); > + /* Just Release Not Primary Port Allocated By PMD */ > + if (p_id) > + rte_eth_dev_release_port(port->eth_dev); > + } > + } > + > + return 0; > } > > static int > @@ -84,3 +259,14 @@ static struct rte_pci_driver rte_rnp_pmd = { > RTE_PMD_REGISTER_PCI(net_rnp, rte_rnp_pmd); > RTE_PMD_REGISTER_PCI_TABLE(net_rnp, pci_id_rnp_map); > RTE_PMD_REGISTER_KMOD_DEP(net_rnp, "igb_uio | uio_pci_generic | vfio-pci"); > + > +RTE_LOG_REGISTER_SUFFIX(rnp_init_logtype, init, NOTICE); > +RTE_LOG_REGISTER_SUFFIX(rnp_drv_logtype, driver, NOTICE); > + Do you really need two different log types? What about reducing it to one? <...> > diff --git a/drivers/net/rnp/rnp_osdep.h b/drivers/net/rnp/rnp_osdep.h > new file mode 100644 > index 0000000000..5685dd2404 > --- /dev/null > +++ b/drivers/net/rnp/rnp_osdep.h > @@ -0,0 +1,30 @@ > +#ifndef __RNP_OSDEP_H__ > +#define __RNP_OSDEP_H__ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Mucse IC Design Ltd. > + */ > +#include > + > +#include > + > +#define __iomem > +#define _RING_(off) ((off) + 0x000000) > +#define _DMA_(off) ((off)) > +#define _GLB_(off) ((off) + 0x000000) > +#define _NIC_(off) ((off) + 0x000000) > +#define _ETH_(off) ((off)) > +#define _MAC_(off) ((off)) > +#define BIT(n) (1UL << (n)) > +#define BIT64(n) (1ULL << (n)) DPDK has RTE_BIT64 / RTE_BIT32 macros that can be reused. > +#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) > +#define GENMASK(h, l) \ > + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) > + > +typedef uint8_t u8; > +typedef uint16_t u16; > +typedef uint32_t u32; > +typedef uint64_t u64; > +typedef int32_t s32; > +typedef int16_t s16; > +typedef int8_t s8; > +#endif /* __RNP_OSDEP_H__ */