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 6BBCB439BA; Thu, 25 Jan 2024 04:44:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F1F934029B; Thu, 25 Jan 2024 04:44:29 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 6CA734027B for ; Thu, 25 Jan 2024 04:44:28 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TL69x4cttz1xmhH; Thu, 25 Jan 2024 11:43:33 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id D3FF41A016E; Thu, 25 Jan 2024 11:44:11 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 25 Jan 2024 11:44:03 +0800 Subject: Re: [PATCH 02/12] argparse: add argparse library To: Thomas Monjalon CC: , , , References: <20231121122651.7078-1-fengchengwen@huawei.com> <20240122035802.31491-1-fengchengwen@huawei.com> <20240122035802.31491-3-fengchengwen@huawei.com> <2358816.n0HT0TaD9V@thomas> From: fengchengwen Message-ID: Date: Thu, 25 Jan 2024 11:44:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <2358816.n0HT0TaD9V@thomas> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) 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 Hi Thomas, On 2024/1/24 21:24, Thomas Monjalon wrote: > 22/01/2024 04:57, Chengwen Feng: >> Introduce argparse library (which was inspired by the thread [1]). This >> commit provides public API and doc. >> >> [1] https://patchwork.dpdk.org/project/dpdk/patch/20231105054539.22303-2-fengchengwen@huawei.com/ > > I'm not sure how this helps with the initial problem > when using kvargs with key-only. > I think you should continue fixing kvargs API and usage. This argparse couldn't direct help to fix kvargs with key-only. I propose a patchset [1] to fix kvargs with key-only, waiting for more discussion. [1] https://patchwork.dpdk.org/project/dpdk/cover/20231106073125.55280-1-fengchengwen@huawei.com/ > > About a generic argparse library, I imagine it could simplify DPDK internal parsing. > I have doubts about making it a public library as it is not really a DPDK goal. > The DMA example looks better with argparse so I imagine we want it. > > I think this library would have a bigger value In addition to service [argc, argv] parsing, This library also provide API which parse specific type. For example, user could invoke: int value, ret; ret = rte_argparse_parse_type(str, RTE_ARGPARSE_ARG_VALUE_INT, &value); to parse int from a input str. This API then could used by other library/drivers. > if we integrate some specific syntax parsing > like coremask/corelist as done in another patchset: > https://patches.dpdk.org/project/dpdk/list/?series=30582 Yes, I think it could integrate syntax parsing which providing from above patchset, just: Define two arg-value type and specify their value storage type requirements: /** The argument's value is uint16_t xxx[RTE_MAX_LCORE] type. */ RTE_ARGPARSE_ARG_VALUE_COREMASK, /** The argument's value is uint16_t xxx[RTE_MAX_LCORE] type. */ RTE_ARGPARSE_ARG_VALUE_CORELIST, Other library/driver could then invoke: uint16_t lcores[RTE_MAX_LCORE]; int ret; ret = rte_argparse_parse_type(str, RTE_ARGPARSE_ARG_VALUE_COREMASK, lcores); or ret = rte_argparse_parse_type(str, RTE_ARGPARSE_ARG_VALUE_CORELIST, lcores) Thanks > > > > . >