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-fengcheng...@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-fengcheng...@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 > > > > . >