On Sun, 5 Nov 2023 05:45:35 +0000 Chengwen Feng <fengcheng...@huawei.com> wrote:
> +* **Updated kvargs process API.** > + > + * Introduced rte_kvargs_process_opt() API, which inherits the function > + of rte_kvargs_process() and could handle both key=value and only-key > + cases. > + > + * Constraint rte_kvargs_process() API can only handle key=value cases, > + it will return -1 when handle only-key case (that is the matched key's > + value is NULL). > + Looks good but may I suggest some alternatives. Since this is an API and ABI change as was not announced, maybe a little late in the process for this release. And since unlikely to go in 23.11 need to do something better in 24.03. What about changing the args to rte_kvargs_process() to add an additional default value. Most callers don't have a default (use key-value) but the ones that take only-key would pass the default value. Then use ABI versioning to add the new arg and you would not have to introduce a new function. And add a legacy API version that does what current code does. All the drivers in DPDK would get the new API/ABI but any customer apps using rte_kvargs_process() would get the old version.