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 2E9DE41D3D; Thu, 2 Mar 2023 10:31:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EA4740E09; Thu, 2 Mar 2023 10:31:20 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2053.outbound.protection.outlook.com [40.107.100.53]) by mails.dpdk.org (Postfix) with ESMTP id 4181740DFB for ; Thu, 2 Mar 2023 10:31:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AvTB3mqYDfKYu6mNCdgUSHDiIxp4fi3I/k4rrZLulcwUdtnHfj5u6NA8M34LGeFleZythm5BIpI+SkQJWzYndgBBVwMdV2hvr7cUHQupPP6WRJgq1vrU9HWGG5GACOM3FQRslFCqbhswE+bgUUcNJzHNWdL0vPpZAZnpCnhPuOMkN0KDxxLQ4dEphnGlaHDxHOhRUQZDfEgCPl5x3O7XRV6OqQk/xxBddpYV38PN7tZMEoADvJu0lGHip2Jh77d08+jGGAFG0Sd7vPspCbf7FwxVQ2FiJkQcrapUqwrH/lThzuX0me7pT3n8cQ43UEkHZTCstaXzBbq+nMSZeF0jzQ== 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=ommiaVcc+walPAfCenImmw5dldgcgjjuCSaUJ6FYj/8=; b=YF1xdAV3vU0yWENIq/x5t83pTn0q2ejHwSRE4wTpIm4EvGkHFLmY9LfEwFYyaO7hd+JA3DEtTqGn4QEHZXSDuM4uV3/6+gKqX9B8HlQzYEcQwFBmlMEdAGgTXIfDN/VpO+ZTEztXVM9uh3wm7BkAHld5YD0susn0vIYYwYab34VqZGry+uCM54oQxY9NovuK7vjld/IiNyd8L0PqiO5cyen3HX1u5hqsG4UQ5SQPAatgZVLki524ESvR6tSiXjW5hkwszBWTxmznGrSEs3F1F/ds+Wzi/0ORRjOFO2o8m+TuLSp+GaCoDGZ+7I3Z9BWrhILBwWbljnc9HC54ct9RaA== 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=ommiaVcc+walPAfCenImmw5dldgcgjjuCSaUJ6FYj/8=; b=iyB9NYYti3lbBG7XXEiCU41UvNZVKse/O3gRlZDWE3fFdcSoLbUlOz0BmGZAqmJezE0zVSO1rMu8qKaKS9VVJoxia3+V1BbIINZcY7i/chehYGR9Nx/O8XQZMrI7GTiqXjXFXEK+DjD5MMYFcO5lWbO+VkM1f/Vku8Iqxtxoo5E= 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 SN7PR12MB6932.namprd12.prod.outlook.com (2603:10b6:806:260::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18; Thu, 2 Mar 2023 09:31:16 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%4]) with mapi id 15.20.6156.017; Thu, 2 Mar 2023 09:31:16 +0000 Message-ID: <767aff7a-a46d-5140-cce6-7379c4711c59@amd.com> Date: Thu, 2 Mar 2023 09:31:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Mingxia Liu , dev@dpdk.org, beilei.xing@intel.com, yuying.zhang@intel.com References: <20230216003010.3439881-1-mingxia.liu@intel.com> <20230302103527.931071-1-mingxia.liu@intel.com> <20230302103527.931071-2-mingxia.liu@intel.com> From: Ferruh Yigit Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization In-Reply-To: <20230302103527.931071-2-mingxia.liu@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0286.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::21) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SN7PR12MB6932:EE_ X-MS-Office365-Filtering-Correlation-Id: 630839d0-f1f3-4c50-db48-08db1b00df14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LtK373WvWQMAj7eb88Iw+5uC1bg21mFDsDeBfG8AeSVduDj1P5hM6MaYjw4hVbqKOHX9xCZ7BdvUgFWQ/WZhSYAzVepa7Q6rb5UWI6Bh8/lSzG4MDogg98HMDBqODVa4hHMp+Z4+Mhi1Aebjo4bD2dumIJsfrF5y3ziy1lO/OFpd0KIPNOwyOScswsTB3WzQa61qPJE5152F2JmF8XLbS8JB27SECbNyzr3BfcQOwvfxk4vgZQa09I7qwYz5TmWmZ6BaRrMl4Gvlygurtb5265yhHlhHmaS+moQPWkVIrhN6tohgd4P2L4n28xTba+RLjQc0sN3he2VlWhNEFt9saz4t2zMyYkoRt202U9HyjuqOs9RM8BBe9u5Ohxga+HPHqNRkU7wzSIAp710Xmmjv4Y9AdmE+QRk5qY3+9Id+tMM26BTRLWBJkkAG2eKViJY4mxyaPVSViyRdkkgetW6wSJ+GDmYcEpkYNMQK9lDhacJAaZoshIfi/79RJRsf/vGIcdrgBLvvmo6xBGsHhwzKDMEq89Ug+m6EMpO10qgz9Bxyvf5VYoyCRI2kWD1kCtFKf4Axk2hXRQPH3EfhXcKSWUq9TKFIdxP4xvBHx+E5w9vOLVklAEarowlO2vbIw34Hh09i4OoB+2zLuYx06C1bFUif9drR48IMo+N6yCuq/bZWugpyR77znEY2jNtG6jzfCoPE3Iza3775MgPSpJp88hIQ00ozaP+KGglsmHUQS78= 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:(13230025)(4636009)(136003)(366004)(376002)(396003)(346002)(39860400002)(451199018)(66556008)(316002)(31686004)(2906002)(44832011)(5660300002)(8936002)(36756003)(86362001)(31696002)(6512007)(8676002)(53546011)(66476007)(26005)(66946007)(186003)(6506007)(38100700002)(41300700001)(6666004)(83380400001)(2616005)(6486002)(478600001)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OXdXclRiUGNZUnNXRzJ5U2R2NEJ2bzd0WC9zbHVLV2hRT3NINXBkWi9FSFFD?= =?utf-8?B?NjZqWCszTVQ3bmZnb216dlB6blF6NngvczFLS2JldXN2eFBMVEt3S0wvRnZI?= =?utf-8?B?dEFyTFYzRjQyRTRHNU9yNzU0QjRkL1ZXK2JNMUdCTk95NVhUSXErUlAyOTQw?= =?utf-8?B?MldRSFl5T2NEVHd6eERNTU05Z1RwY0xYdnRrNEJuY1Y1SjFoK2JiaWZBUmVv?= =?utf-8?B?eWFVbWNnR1NxYlNocHZTaVNUSzd6NEhyUmFoTk5ETUFwSmtnUTlhUjFiMkRI?= =?utf-8?B?dHR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5NWWYrdUpqcHVtdmVjc1d1UjkrL0xvalNX?= =?utf-8?Q?hY+wayuJmdao8BTzPyYIV3Zl9?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 630839d0-f1f3-4c50-db48-08db1b00df14 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 09:31:16.1832 (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: 4YGkALnhQ75S/tRou3NY/ATi/C93OGQaF7JHuxvIPrGDCDVXGN7eh2zpc15anlli X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6932 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 3/2/2023 10:35 AM, Mingxia Liu wrote: > Support device init and add the following dev ops: > - dev_configure > - dev_close > - dev_infos_get > - link_update > - dev_supported_ptypes_get > > Signed-off-by: Mingxia Liu <...> > --- /dev/null > +++ b/doc/guides/nics/cpfl.rst > @@ -0,0 +1,85 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2022 Intel Corporation. > + s/2022/2023 <...> > +static int > +cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > + struct rte_pci_device *pci_dev) > +{ > + struct cpfl_vport_param vport_param; > + struct cpfl_adapter_ext *adapter; > + struct cpfl_devargs devargs; > + char name[RTE_ETH_NAME_MAX_LEN]; > + int i, retval; > + bool first_probe = false; > + > + if (!cpfl_adapter_list_init) { > + rte_spinlock_init(&cpfl_adapter_lock); > + TAILQ_INIT(&cpfl_adapter_list); > + cpfl_adapter_list_init = true; > + } > + > + adapter = cpfl_find_adapter_ext(pci_dev); > + if (adapter == NULL) { > + first_probe = true; > + adapter = rte_zmalloc("cpfl_adapter_ext", > + sizeof(struct cpfl_adapter_ext), 0); > + if (adapter == NULL) { > + PMD_INIT_LOG(ERR, "Failed to allocate adapter."); > + return -ENOMEM; > + } > + > + retval = cpfl_adapter_ext_init(pci_dev, adapter); > + if (retval != 0) { > + PMD_INIT_LOG(ERR, "Failed to init adapter."); > + return retval; > + } > + > + rte_spinlock_lock(&cpfl_adapter_lock); > + TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next); > + rte_spinlock_unlock(&cpfl_adapter_lock); > + } > + > + retval = cpfl_parse_devargs(pci_dev, adapter, &devargs); > + if (retval != 0) { > + PMD_INIT_LOG(ERR, "Failed to parse private devargs"); > + goto err; > + } > + > + if (devargs.req_vport_nb == 0) { > + /* If no vport devarg, create vport 0 by default. */ > + vport_param.adapter = adapter; > + vport_param.devarg_id = 0; > + vport_param.idx = cpfl_vport_idx_alloc(adapter); > + if (vport_param.idx == CPFL_INVALID_VPORT_IDX) { > + PMD_INIT_LOG(ERR, "No space for vport %u", vport_param.devarg_id); > + return 0; > + } > + snprintf(name, sizeof(name), "cpfl_%s_vport_0", > + pci_dev->device.name); > + retval = rte_eth_dev_create(&pci_dev->device, name, > + sizeof(struct idpf_vport), > + NULL, NULL, cpfl_dev_vport_init, > + &vport_param); > + if (retval != 0) > + PMD_DRV_LOG(ERR, "Failed to create default vport 0"); > + } else { > + for (i = 0; i < devargs.req_vport_nb; i++) { > + vport_param.adapter = adapter; > + vport_param.devarg_id = devargs.req_vports[i]; > + vport_param.idx = cpfl_vport_idx_alloc(adapter); > + if (vport_param.idx == CPFL_INVALID_VPORT_IDX) { > + PMD_INIT_LOG(ERR, "No space for vport %u", vport_param.devarg_id); > + break; > + } > + snprintf(name, sizeof(name), "cpfl_%s_vport_%d", > + pci_dev->device.name, > + devargs.req_vports[i]); > + retval = rte_eth_dev_create(&pci_dev->device, name, > + sizeof(struct idpf_vport), > + NULL, NULL, cpfl_dev_vport_init, > + &vport_param); > + if (retval != 0) > + PMD_DRV_LOG(ERR, "Failed to create vport %d", > + vport_param.devarg_id); > + } > + } > + > + return 0; > + > +err: > + if (first_probe) { > + rte_spinlock_lock(&cpfl_adapter_lock); > + TAILQ_REMOVE(&cpfl_adapter_list, adapter, next); > + rte_spinlock_unlock(&cpfl_adapter_lock); > + cpfl_adapter_ext_deinit(adapter); > + rte_free(adapter); > + } Is 'first_probe' left intentionally? If so, what is the reason to have this condition?