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 D569341D93; Tue, 28 Feb 2023 00:38:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B787340DD8; Tue, 28 Feb 2023 00:38:32 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id EE70C40141; Tue, 28 Feb 2023 00:38:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PiWh/IfoRa12OUIRwZ9YoFCOacrDvZC2ybECe2Bc/EZc27YVTTrjgqNsxjgGijpB9EJ0DIL+O+2Y8E7PVx9nToKfab4D8PSps4byyJrJtfnlwMIGXHRYjj8R6zZskWIA7AvR+erl0UO6PNpHbWkg6YcTA6EuiSlIP0Vx6gs5nXntERVyvrXXkFFu5X1CfvvE5UkfNqmgHyYpVMKfLdhcQsaPFQbtHcpFySLD5ealQWBevTv3e2uxMc5Kz3Zwt1MmU7ZTeoFsMDf+j0JZnmeeSvgGsu0uUCrL0N0NUndB2JLN8M7yQ0CWvM7+1MIhiAgzw0CkALYCVdVov1sBJrcc4g== 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=+EO4vJgBEfbMfj/OaMF6W+Kg/uXaV6VD6B8spe7Od34=; b=m61UIUecuWuv7hEweFbP0tO51ww3qQ7YPb1yNcvdFlPVFVmTtkp/brRtj4uDbs+xHmZhke2qlTpy72LEyDcjIZm1b5U/1xsYnv+YBaROnWRjduoeoj49UB4twMZEzke46QzxkTY/pSo7lE1DZNnb8T1sxLGiCqZuZbOtn3LyuvI3PrRlIBfLvZKGs1holwbIv8mz6dOeIsYrXKeDYl01uLJo7ZdWRuNWu6ldi8SPP0XDt8Qu2HK0fc1pIVySoWRTobPEYepEMzaD7e0gDoecrn4bv6N0hAxHZkkknmwDsPIDj0mPReSgKoscIt+bgCFouxu3sNJpYaIA+RKy4ayjVw== 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=+EO4vJgBEfbMfj/OaMF6W+Kg/uXaV6VD6B8spe7Od34=; b=QP6duy3Q7hbQ4YPMeNe+O1SZhbKeiShrR0itvsw/6pecFhzq1iP8eSGQinwEU9IVuKjl/c7oToJIsp9epLT7y2M9X1ViBesPSdF5GURPJWFuBC+izM76FZpHgBviZIkpr/ziHbr1nF4Zfdyu/Nww0Ee4muSThzWbbQBhFmWUlWc= 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 MN0PR12MB5932.namprd12.prod.outlook.com (2603:10b6:208:37f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Mon, 27 Feb 2023 23:38:28 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%7]) with mapi id 15.20.6134.030; Mon, 27 Feb 2023 23:38:28 +0000 Message-ID: Date: Mon, 27 Feb 2023 23:38:21 +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: Thomas Monjalon , Andrew Rybchenko , Jerin Jacob Kollanukkaran , Qi Z Zhang , David Marchand Cc: dev@dpdk.org, Mingxia Liu , yuying.zhang@intel.com, beilei.xing@intel.com, "techboard@dpdk.org" References: <20230213021956.2953088-1-mingxia.liu@intel.com> <20230216003010.3439881-2-mingxia.liu@intel.com> <1745700.4herOUoSWf@thomas> From: Ferruh Yigit Subject: Re: [PATCH v7 01/21] net/cpfl: support device initialization In-Reply-To: <1745700.4herOUoSWf@thomas> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0209.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::29) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MN0PR12MB5932:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f178286-0636-4680-6e86-08db191bb9e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NVBuoeQyckeBxLvRscRRiFpBdvWlPFQLZ7M+gfP1f9ZPmimLTNv9I+jgpptABmTAqzmOrNXR5qkflnagj5HWJ3GBQz6oZCEn5uVm7o0BfK6e9HEJxU+JRwyaxgNCLR4OlYSQ4EK9n2YEMmOOh98Nd0oP8LhrhfxLabCpbaOSVWuDinG5W5nBm8RpiW/bx53oKXpWh9+vW40Ghq7yXQSk6CiI9gypr6hyUoL656FMN4nnMm/dGtYqrlFHIXKE7ocH6TB+/z7U9ahbAI4/coGC/LC4QzHXSbPN9vEGrp3jGlUC8RPK4Y9BB3RG/fcQCV6yx5aKnrV4OOrK20MAO6y0qR9PvxilUKTwwvk7hicYlrDbAjYmINdhUMQwX33EPreCgLZOd5GTcYqb/TXAPi37si0RrLmdIQHn/rBv++uMEVjaQPyWMCithVNyT9YhH1DOPMdKonEAjN6aACDxd++YWqSjMixutSXFRZjDutXX6JmJn61W3KLpcS+yqmdSzL/IsflAKyNdpFsr/iG5jrHdaFMHB6GYZ7GXx5A1xSF7r1ehTbPTs3IsFGW0DH7ryf1jc+GUgbH74CvwFO1iyMNW30BqQjU7YQH1uIoqlqo/kswNALvQA1wodsz5vR2uhIeuUdit4RCLk5zyU3XzsAxiGiunYvGofnJAN+39hwsMyiOh0rYGu5d31/aLroVKigRuCIjEZNKSPckdUCjbbqOXDkr8h4JQyRTDSlfrgIq731o= 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)(366004)(396003)(136003)(346002)(39860400002)(451199018)(31686004)(316002)(110136005)(36756003)(54906003)(31696002)(86362001)(38100700002)(83380400001)(53546011)(6666004)(6506007)(6512007)(4326008)(26005)(186003)(2616005)(7416002)(2906002)(8936002)(5660300002)(478600001)(6486002)(66556008)(41300700001)(44832011)(8676002)(66476007)(66946007)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NUEvcnR3TzRGbnQzZTd5QnM1b1ZoeE9zQ3hpb0lJdVZWWVJpS2ZBMzJicnZh?= =?utf-8?B?OFUzTHk2ZGhTZExHL3RkN0U0cUdRdE5oaXlrV3NNRWxLM3htOUlrQ1ovWTJC?= =?utf-8?B?UEpVWVYxOWdCTjd4N1hReVY4MTVTVlpndXdtYkZvMnJWbFVVWmhTcXF3aFh2?= =?utf-8?B?c01KUHdncStxcjhMSHo0QW9Fc0FPdEordDdFUUZXM1hZL0NNS2pFZHl3V2lR?= =?utf-8?B?UVhlQW9FT1lxZllnWEhxMHVwMlda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sVE9PWTdlOVJEL2RhdFNVbENod1VpNk01ZStLUzZrWEUyejRjVHRG?= =?utf-8?Q?8PvEMJfdLE1sF5XhfbZ4c8tRb?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f178286-0636-4680-6e86-08db191bb9e1 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 23:38:28.0032 (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: jdUanOV36FlLedzY6xkb1OveZbFlSHE8ekvexpFOqZyaDyFKKHbkWsC4ZcKD22Ca X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5932 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 2/27/2023 3:45 PM, Thomas Monjalon wrote: > 27/02/2023 14:46, Ferruh Yigit: >> On 2/16/2023 12:29 AM, Mingxia Liu wrote: >>> +static int >>> +cpfl_dev_configure(struct rte_eth_dev *dev) >>> +{ >>> + struct rte_eth_conf *conf = &dev->data->dev_conf; >>> + >>> + if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) { >>> + PMD_INIT_LOG(ERR, "Setting link speed is not supported"); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) { >>> + PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported", >>> + conf->txmode.mq_mode); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->lpbk_mode != 0) { >>> + PMD_INIT_LOG(ERR, "Loopback operation mode %d is not supported", >>> + conf->lpbk_mode); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->dcb_capability_en != 0) { >>> + PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not supported"); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->intr_conf.lsc != 0) { >>> + PMD_INIT_LOG(ERR, "LSC interrupt is not supported"); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->intr_conf.rxq != 0) { >>> + PMD_INIT_LOG(ERR, "RXQ interrupt is not supported"); >>> + return -ENOTSUP; >>> + } >>> + >>> + if (conf->intr_conf.rmv != 0) { >>> + PMD_INIT_LOG(ERR, "RMV interrupt is not supported"); >>> + return -ENOTSUP; >>> + } >>> + >>> + return 0; >> >> This is '.dev_configure()' dev ops of a driver, there is nothing wrong >> with the function but it is a good example to highlight a point. >> >> >> 'rte_eth_dev_configure()' can fail from various reasons, what can an >> application do in this case? >> It is not clear why configuration failed, there is no way to figure out >> failed config option dynamically. > > There are some capabilities to read before calling "configure". > Yes, but there are some PMD specific cases as well, like above SPEED_FIXED is not supported. How an app can manage this? Mainly "struct rte_eth_dev_info" is used for capabilities (although it is a mixed bag), that is not symmetric with config/setup functions, I mean for a config/setup function there is no clear matching capability struct/function. >> Application developer can read the log and find out what caused the >> failure, but what can do next? Put a conditional check for the >> particular device, assuming application supports multiple devices, >> before configuration? > > Which failures cannot be guessed with capability flags? > At least for above sample as far as I can see some capabilities are missing: - txmode.mq_mode - rxmode.mq_mode - lpbk_mode - intr_conf.rxq We can go through all list to detect gaps if we plan to have an action. >> I think we need better error value, to help application detect what went >> wrong and adapt dynamically, perhaps a bitmask of errors one per each >> config option, what do you think? > > I am not sure we can change such an old API. > Yes that is hard, but if we keep the return value negative, that can still be backward compatible. Or API can keep the interface same but set a global 'reason' variable, similar to 'errno', so optionally new application code can get it with a new API and investigate it. >> And I think this is another reason why we should not make a single API >> too overloaded and complex. > > Right, and I would support a work to have some of those "configure" features > available as small functions. > If there is enough appetite we can put something to deprecation notice for next ABI release.