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 7736E43279; Fri, 3 Nov 2023 14:09:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F009E4027F; Fri, 3 Nov 2023 14:09:50 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2046.outbound.protection.outlook.com [40.107.237.46]) by mails.dpdk.org (Postfix) with ESMTP id 98F4240273 for ; Fri, 3 Nov 2023 14:09:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fBXGlkmj1jYdCg+Xfpzyhaznrvf2vRzMvgmj7EthW1MVB0N28KMECCUyvIPaG5riQW+5aPmxwkAno7yKGQMSBtIxeFb80D/qkfgzzRuCaFdtb08ORz7SABcjnEURausONRnvLauz0Xd9CYoJAMfWsln15rdqF98fqbNi0OcWAnHPFxZD+S7MrfcWS1HT7tkf5Sa3WFN3evB+xc5PQIHWTDp4ONuiDiM18wWeGV05ajDh0jAYc5e/KpfOg6kD6+X5BOoomLV76DtijMPsMvNety0vdOM0GG/WTkhXmjk5LNpj3qsNmD/actyzDMYTdeNFywE9/jTc02yPSHspMqV1sA== 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=VWyy9SU3uOJ15Y57OtGAF99oajmnL9Mv5M2SS/DapiI=; b=mGzIudDdgAtITND+Qty/q9U/yazn+JMd/toG/4CwUYA/IXFCrRUhtfZ/QV8SAyixF/OG4XGbrvQMOirbNmNnEGiKsXcqOgwpX7smNblrlDP1BJGIPXLhOFGWoaPO5XqGgXqmUxI5dOzLIowcMvKKnv4eFFiidzi+h+NUBAndtbpox0GZYdN2iMjWvTjL1kCyPDMeD4qxZQAR1iNsXclHFBOgHY3ta468daollvWPJcc8lP/pPbi9qmvSqqCmWN5JPkx6Tt/PZnVUTpCChntBXjDnPSLapbAvqDdmskE3pkvKRtzQZyMlqccPhpwpDG0jSoUkr3aZN8pteODqH5etEg== 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=VWyy9SU3uOJ15Y57OtGAF99oajmnL9Mv5M2SS/DapiI=; b=ZuA+OBIIVjM9QfOkYaZ0wLCflNYPqwfBnwvZAGYjnGiNH6dUccPd2xHaZcacNAv6SEYeGgmC8PtvA1YA90obmZHzsTqiprsJ0NxGm/Mt+4x9W7C0vYvSCUh/vw9VIVqWXmbcY5kg2j4JWXmvCBpIWHdya64TayCZoJkzjzUGdYk= 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 CYYPR12MB9016.namprd12.prod.outlook.com (2603:10b6:930:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:09:47 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::2569:edb2:670f:816f%6]) with mapi id 15.20.6954.019; Fri, 3 Nov 2023 13:09:47 +0000 Message-ID: <8d4cbdbf-64fb-4d87-bbb0-ee6b203f66a0@amd.com> Date: Fri, 3 Nov 2023 13:09:37 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/5] kvargs: add one new process API Content-Language: en-US To: Chengwen Feng , thomas@monjalon.net Cc: dev@dpdk.org, stephen@networkplumber.org References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231103073811.13196-1-fengchengwen@huawei.com> <20231103073811.13196-2-fengchengwen@huawei.com> From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRTPtCKKm/6BQJkd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IV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <20231103073811.13196-2-fengchengwen@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR2P281CA0129.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::16) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|CYYPR12MB9016:EE_ X-MS-Office365-Filtering-Correlation-Id: 41898bd7-c488-4db4-4d33-08dbdc6e2784 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0j96gXZ5ejRTAZwaaynahctxXsUMD8Z+69eDNZ4qDf3DSLjjsDdWtt8GpuKtUehL3vRyetvhC8GYOaC0R2VNNB1y6xeY6yFe6HfcLZsD3czJCSIFJVHtdzTtQqBGtmw4JfWd4cq9rj5JKGgk7A84tWMXhUsmHw5pTDWeIwM1fK8UjLZsdOCSTVeKhx7B6hYM9hld2Rxs54RM8b1X9MWBMD2uGi1CGFP4NlVijmflccMqKUQEnDhpBPLtezu0XSma3N+Awk6x8sv4ozbN1KCqnqNPEoTzQNwdc/ga/A559OTMYohG/1rY+IX0Ie0w2lA+eFvNpe8JZz1RY6pNBbhgNKe1mz5jVXZBI2rco9K6xPSKSaICepDV8SiFk19o7WUjyNVBvNg1HD2AzpTWCej3O3xHvnW1v7cl2o/03CYCOBS1QNSW8QO0FZCQqGfWs9MHCNfL5Vmb+xeGHjaG59gUcBeyK3RQSHWMKK7DXn5dVGTL2WdFEX/nFyc7lu9/TlhuCPBpc1kZJseTjSWzdvCxGXI0HzPRHbRdem2Iv/3yVAQrcUMDxZZ3FqXCIb71BWGbgjVEUPcZ9nC/wZlSZpqd5JRqv0fprAbybtU4kuD85ur43DtkWGCvT/PFWhZirPBGu7BZ8JK7Z4Z1S1E6G9YQ0lOCMsGrJBPevVSsTb0n5TXNYDCPPGhA9dFr3naprnA5 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)(136003)(376002)(396003)(39860400002)(346002)(366004)(230922051799003)(230173577357003)(230273577357003)(451199024)(1800799009)(186009)(64100799003)(41300700001)(31686004)(2906002)(5660300002)(44832011)(4326008)(8676002)(8936002)(6506007)(66476007)(6512007)(2616005)(316002)(66946007)(66556008)(6486002)(478600001)(966005)(6666004)(36756003)(26005)(83380400001)(31696002)(86362001)(38100700002)(53546011)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MGdIT2UzY2NhLzJhK3hlZkdFQjJpWXlPd3g3aHJCTms4L1dRZkZrc01nOEQ5?= =?utf-8?B?VXExbzdtTC9xYStDYXJZa0ZlSUtrUUtvSkordGtNb0xQRWx3cnJHZnUrT2VY?= =?utf-8?B?aWpiNlhCUWpoTVBxRjJ4bmhRWG5UdUxOeFNYaUREWVpYbTFXN3JzMWFaRndL?= =?utf-8?B?NEtHVFhBVERWcitLVkcyeThOQ0lDOVV2aWJCL0hPUGdsVC9OSnFtNExoLzM4?= =?utf-8?B?REl4dUNUYlFOdmwzaDBhWjFuWHhuWWFBdFVLaTZVQkozODd1WVI4bG1IdjV0?= =?utf-8?B?S280NnpPZlZSc0QvNW1BQ1hhTitFSGpSeUNYMU8rUnFaeU1FR1F0YjZ2WW5k?= =?utf-8?B?cVVUcHVURFBibE5weC9Hc0c1K1YwVU1lUlFuRnAvdFRYT1ZGaVBlZENrUlEy?= =?utf-8?B?MmZocGx5MTloQTFjbnZBRkZyTXIvbytieTZPUjVRdDIvN2NWQTdiNzlwOEt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YTEwayt4QUlib09Mems0?= =?utf-8?B?UlpSZzByc1UxZnFaclFqMjA1NEpJZ0plMkNmUnkwNEpzTFJKY3R5cStrL2FG?= =?utf-8?B?anpkemlRSEsxN3FoRkNEL0R5ZUIvbk80Q0p0aG1RWmNDb3VYVjFROU1WMjRt?= =?utf-8?B?a1dDNHg4dkk2SXUvKzdsZmNrMHpvbUI2c012eW5KM2dxNmJ4Rm5VU3A2ZmVJ?= =?utf-8?B?RGxXUE9kM2o5NWxuTE9rd2JnNW9SbUl0STh0TGYwNlIyMUZkdlBWZmNDNnE2?= =?utf-8?B?c2xwaFkvVFNMeWlveElOZnFuU0FzOUdNNit0Yy9JMGtiek95czFXaXBKRXlq?= =?utf-8?B?NWoxdjdqc0I4K2NoVkJRY2xJa2hEcGFCd2F4NGlmblNjQk1sbHMrQzNOOGtn?= =?utf-8?B?Ry9CdDE3SEFsOFIzcmR6b05uTWYwNVhCNEJTVC9pb28zSXNRTEVTdVk5VjlH?= =?utf-8?B?OVlMeldONmtDVHpWTW5MZkFVZFpSd29NOXhLNG9XSk90ckM2S0NVVDFra25J?= =?utf-8?B?WWg3MEVRSGZGMUxrMFg5Z0xhTTJWK3lFTERnZzEvU2wvcGQvWStoWDdGdVlr?= =?utf-8?B?bkJyaE10cEI1YnJwU0FVTkZYcjJqY1pyU250WmR6NlVIeDNkT2xiM1REdkFq?= =?utf-8?B?bXQwN3NXVE11aFdpTjRjMXJySllPRjc0cWhjSEVyekNMZ3pNMTExYkVCazJC?= =?utf-8?B?aGJKZHloL3F5eVdtZEJpRzZheU5NNVNaMFd5NEFqaloyd1BBQWpGZ09Gc2FM?= =?utf-8?Q?Ge+Rzr66cZZf7W1Je5K4QNqmH?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41898bd7-c488-4db4-4d33-08dbdc6e2784 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:09:47.3072 (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: CDO0/m8OZQimoJVdEMujRz4n4QtUSmlLYMD0xVNJ19I2kihjF1Zv4VTZ7SBm9MEl X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB9016 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 11/3/2023 7:38 AM, Chengwen Feng wrote: > The rte_kvargs_process() was used to parse key-value (e.g. socket_id=0), > it also supports to parse only-key (e.g. socket_id). But many drivers's > callback can only handle key-value, it will segment fault if handles > only-key. so the patchset [1] was introduced. > > Because the patchset [1] modified too much drivers, therefore: > 1) A new API rte_kvargs_process_opt() was introduced, it inherits the > function of rte_kvargs_process() which could parse both key-value and > only-key. > 2) Constraint the rte_kvargs_process() can only parse key-value. > Hi Chengwen, This works, but behavior change in 'rte_kvargs_process()' can hit some exiting users who handles both "key=value" and "key" cases. Other option is to keep 'rte_kvargs_process()' behavior same but add a new API like 'rte_kvargs_process_safe()' that checks "value == NULL" case, but this requires more existing code to change and in this option existing users doesn't get the benefit of the NULL check by default. Assuming number of the users that use 'rte_kvargs_process()' for "key=value" is majority, OK to continue with your change, but please document this in the release notes to highlight. > [1] https://patches.dpdk.org/project/dpdk/patch/20230320092110.37295-1-fengchengwen@huawei.com/ > > Signed-off-by: Chengwen Feng > --- > lib/kvargs/rte_kvargs.c | 29 ++++++++++++++++++++++++++++- > lib/kvargs/rte_kvargs.h | 28 ++++++++++++++++++++++++++++ > lib/kvargs/version.map | 3 +++ > 3 files changed, 59 insertions(+), 1 deletion(-) > > diff --git a/lib/kvargs/rte_kvargs.c b/lib/kvargs/rte_kvargs.c > index c77bb82feb..5ce8664238 100644 > --- a/lib/kvargs/rte_kvargs.c > +++ b/lib/kvargs/rte_kvargs.c > @@ -168,7 +168,7 @@ rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match) > } > > /* > - * For each matching key, call the given handler function. > + * For each matching key in key/value, call the given handler function. > */ > int > rte_kvargs_process(const struct rte_kvargs *kvlist, > @@ -179,6 +179,33 @@ rte_kvargs_process(const struct rte_kvargs *kvlist, > const struct rte_kvargs_pair *pair; > unsigned i; > > + if (kvlist == NULL) > + return 0; > + I think it should return error here, ignoring arg silently with success can cause trouble in the application. If error returned, at least application can know argument not provided as it should be (value is missing). > + for (i = 0; i < kvlist->count; i++) { > + pair = &kvlist->pairs[i]; > + if (pair->value == NULL) > + continue; > + if (key_match == NULL || strcmp(pair->key, key_match) == 0) { > + if ((*handler)(pair->key, pair->value, opaque_arg) < 0) > + return -1; > + } > + } > + return 0; > +} > + 'rte_kvargs_process()' & 'rte_kvargs_process_opt()' implementations are very similar, to reduce duplication what about create 'rte_kvargs_process_common()' static function and both use this common with different parameter? > +/* > + * For each matching key in key/value or only-key, call the given handler function. > + */ > +int > +rte_kvargs_process_opt(const struct rte_kvargs *kvlist, > + const char *key_match, > + arg_handler_t handler, > + void *opaque_arg) > +{ > + const struct rte_kvargs_pair *pair; > + unsigned int i; > + > if (kvlist == NULL) > return 0; > > diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h > index 4900b750bc..522e83f757 100644 > --- a/lib/kvargs/rte_kvargs.h > +++ b/lib/kvargs/rte_kvargs.h > @@ -195,6 +195,34 @@ const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist, > int rte_kvargs_process(const struct rte_kvargs *kvlist, > const char *key_match, arg_handler_t handler, void *opaque_arg); > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Call a handler function for each key/value or only-key matching the key > + * > In API documentation, the difference between 'rte_kvargs_process_opt()' & 'rte_kvargs_process()' is, 'rte_kvargs_process()' doesn't have "or only-key", this is easy to miss. Can you please add more not to 'rte_kvargs_process()' saying on "only-key" case it returns error? > + * For each key/value or only-key association that matches the given key, calls > + * the handler function with the for a given arg_name passing the value on the > + * dictionary for that key and a given extra argument. > + * > + * @param kvlist > + * The rte_kvargs structure. No error if NULL. > + * @param key_match > + * The key on which the handler should be called, or NULL to process handler > + * on all associations > + * @param handler > + * The function to call for each matching key > + * @param opaque_arg > + * A pointer passed unchanged to the handler > + * > + * @return > + * - 0 on success > + * - Negative on error > + */ > +__rte_experimental > +int rte_kvargs_process_opt(const struct rte_kvargs *kvlist, > + const char *key_match, arg_handler_t handler, void *opaque_arg); > + > I am not sure about the API name, 'rte_kvargs_process_opt()', what is 'opt' here, "optional"? What about 'rte_kvargs_process_unsafe()', not quite strong on this too but not able to come with better one, please feel free to try other alternatives. > /** > * Count the number of associations matching the given key > * > diff --git a/lib/kvargs/version.map b/lib/kvargs/version.map > index 387a94e725..15d482e9b3 100644 > --- a/lib/kvargs/version.map > +++ b/lib/kvargs/version.map > @@ -16,4 +16,7 @@ EXPERIMENTAL { > > # added in 21.11 > rte_kvargs_get_with_value; > + > + # added in 23.11 > + rte_kvargs_process_opt; > };