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 4960E41D73; Thu, 2 Mar 2023 12:51:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E93B340E2D; Thu, 2 Mar 2023 12:51:18 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by mails.dpdk.org (Postfix) with ESMTP id AC37A40E09 for ; Thu, 2 Mar 2023 12:51:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P2c4u2ms7ztFsOfmAy9uhP8cZqL/yVHW6rR4ZDyeM0/qsDre0yZMWBB/hxryKq9H+R2R1PMi+ZgdXKt+w0dFVzEN3biwnTT7xXTddno6eAWXPIjD5tZnf01pqQPUqqLDC26SFviFblHng9Z4f5m8niJTlqw3XeRUZm3rU8gGlbsMcwpL0iwAQacibCSRd9+dD7xTiq0Cg+t5gHqT7VJG3yHYrXjgpLw/c8ZOQZu/Wo+Ug0HVsCeENkpDjU6t2JwLc28VreCOs+8KDZCxM5U1zG+N1EJdQHk2X/ArKPwM8ZbNtxXBP2wX9W2ZVJ523OsmbqlCklYs0imSZarkqPaUdg== 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=uF5V1Fesap3Nh40tprhW2xbpdwxrlEXIyPdsQp5ChBk=; b=dLwqm3jwVNDzsHBh7mR18PxYCjmg4PFi2tf/a7zd2qY/LiBQVNWYA2JdKTvkU8CKk5s/V/QSSH9xMEdO5AcI9KWJ09K50wl5JDOVTc2yPuTtJu7wTUiprsAoo0zM2sn/0Lisax9HO0EO7ip+MAOaqstpN+vvBEQ0FvZC9j5OE9t6qhmWK7+zmKDdmUsMK8e9cct+acDjG1Qu6jOPExvGu6AU1tOZUA7IQqLH4jcqVGCVUrdp87cHBW8PYExLQpw3d7Ts6UXeZeLhsLh2j5Y8QZ+ixTQ+Rvo/vD5Grsb2IX9YxhAflr+JS/JLZWXZL4dIpU77ZVdY2Zna9ARES2yvgQ== 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=uF5V1Fesap3Nh40tprhW2xbpdwxrlEXIyPdsQp5ChBk=; b=oEVz3jXXZRqeZsHDGIOPCb8Hxz+GkCg8afkqcbb7ZcEP15tivk3gzB+k+LULUCHfBku+wrDurvvR0n3+GIhclJl1B8SSJ51gN6WFjilhkBoouiqW0EdMqNns4nACSkJaY+U+n4HB3irvZK6BurwaSSCgRRUZsHwYMzoQE940mk8= 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 SA0PR12MB4591.namprd12.prod.outlook.com (2603:10b6:806:9d::23) 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 11:51:15 +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 11:51:15 +0000 Message-ID: <3047d699-ece7-cd9a-da18-6fa55a362b22@amd.com> Date: Thu, 2 Mar 2023 11:51:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization Content-Language: en-US To: "Liu, Mingxia" , "dev@dpdk.org" , "Xing, Beilei" , "Zhang, Yuying" References: <20230216003010.3439881-1-mingxia.liu@intel.com> <20230302103527.931071-1-mingxia.liu@intel.com> <20230302103527.931071-2-mingxia.liu@intel.com> <767aff7a-a46d-5140-cce6-7379c4711c59@amd.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0072.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::23) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA0PR12MB4591:EE_ X-MS-Office365-Filtering-Correlation-Id: dd1630af-65d1-449d-573c-08db1b146da1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CW9J43pX1qnKTIOcSeaMa+/jRoaqd2vOOFXNRGTMXQRFf8Te4fRSok3c2a0/H9QyorR8vBAsvxZUHV1WAKst0IfRQUGwP3IVPzLW+aiWnIhDGXyi9vZU/75bwQfxsqfmY8l5dAzfDFwku0NSO6Itqn/IP/jZmsTEGS8xll/+R3agbd8MsW8MzEVKe+zIi38jH5J8USUEsfK8kK1ZoImQqwkArYH7tLGFDcGSX6Qm3xwv8CMDIfnRgUMG6egF85I8jfIObdsu6J8+rGhkvvLe3u/w87vQUj32nGh77gP1A6+vUYaJ8dNHyBJ64q8m3YIcYj26kpn/T99Q51EGmq8/bLkf2fF2LfV33ieH63wAYG2EvbRSocsZMTl15O8ty9/ObtbD598iQU8VRHKSOfBoFTQQVPQ8WRnVuXsQMjAVepyrJfySvfpix8BqMul3np2aYPjwCQmkHXfQmdTYqoTYKm8/sI4gr5Lgzi4BT+If+h+bwsXorOs1hoKboVfpd4yWSCPOupBNZ9fP83GYfVQcj2NKS2C8dkoCsO7CCsUrqYhy1mP/onda+ZAHkUMlHQu8eQ3X+uU9vPcmuEHqIiWxqpQNAzVVBHfoT3Uu2+OTcSckl0fBuSU2rjAELkGhZtshAeA3L0Nv4Y4zfy1o5X2PrIncrmV0+TjCSYsR+cyprIPWxzyKeT9jqoZf7BM/1NWLVruoBLSmn1flocYEHa1dNmKP5eDvNKOEe8F3/0aReO0= 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199018)(6486002)(66556008)(186003)(36756003)(6666004)(38100700002)(2906002)(110136005)(86362001)(478600001)(316002)(31696002)(6506007)(26005)(6512007)(8676002)(53546011)(66946007)(66476007)(8936002)(83380400001)(2616005)(31686004)(5660300002)(41300700001)(44832011)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QlhNZlZNK3ZqVVhXUG9IUXQvMUUzbjFxdE5Yc01FTFY1UWVoOVkyN0k3NWpO?= =?utf-8?B?cEp2TDY5eEk0bnYxQzFhUXhHK0VGZ203YThYbTNycEduNGNlN3RoQ3ovVDdx?= =?utf-8?B?WUhjdlZGRlNuUUdGMnV2WlFOMUpESXhFK1A4V0dtUUhaRDJtMkFoZys5djgr?= =?utf-8?B?Q01RR28zc2s3UnBaL1U5L0lGeGRkdVZvMi9wYy9IKzdrWkRFc0JQK0dPL3Rw?= =?utf-8?B?NTd3Q0tFZjhVdmVVcEdDc3dRbVlWSmNwT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VhUkxrdTk1am9SNE5ZWlhidWFSbkRzUndmem9kOSthSzlKaXN1S0pW?= =?utf-8?Q?uo6E5fe9/eJzs5QNr3pQFH2wp?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd1630af-65d1-449d-573c-08db1b146da1 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 11:51:15.7830 (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: sfAeupbitJCEalbE4dnCnDhxxrpg2avwy7Xw0nG19E7R5XuBQ7GPneEyFLTDOhDp X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4591 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 11:24 AM, Liu, Mingxia wrote: > > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Thursday, March 2, 2023 5:31 PM >> To: Liu, Mingxia ; dev@dpdk.org; Xing, Beilei >> ; Zhang, Yuying >> Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization >> >> 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? > [beileix] It's related to create vports at runtime, this feature will be implemented in the future, but now it doesn't suppor. is it possible to remove it now and add back when needed? This is confusing as it is.