Skip to content

RFC Add argument manipulation library

Bruce Richardson dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3args: new library to allow easier manipulation of cmdline argsdoc/api/doxy-api-index.md doc/api/doxy-api.conf.in lib/args/args.c +4 more+406 -02 replies
2/3eal: allow export of the cmdline argument parsing optionslib/eal/common/eal_common_options.c lib/eal/include/rte_eal.h lib/eal/version.map+24 -00 replies
3/3args: add functions to check parameter validitylib/args/args.c lib/args/rte_args.h lib/args/version.map+181 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [24.03 RFC 0/3] Add argument manipulation library

DPDK has traditionally assumed that apps are written where argc/argv parameters are passed directly to rte_eal_init() and then app arguments are handled afterwards, as is done in the DPDK apps and examples.

However, based on other projects, like VPP and OVS, we know that this is often not the case. Instead, the apps build up argument lists internally themselves and pass those to the init function, and DPDK never directly accesses the real argc/argv values.

Therefore, let's make this mode of operation a little easier to use, by adding in an args library to allow an app to dynamically build up an args array and then pass that to EAL init. This library allows things like, for example, initializing a list from argv and then checking if a particular parameter is present, adding it if not. All the basics of such a library are included in patch 1, and I've found it of use myself when writing some simple apps internally using DPDK.

Patches 2 and 3 go a little further than this, and allow for a slightly different use-case, that where an app may want to allow mixing of EAL arguments in with app args. These patches allow the user to query if a particular argument is an EAL arg or not, or a valid app argument. The idea here would be, that an app could go through it's argument list, building up an argument list for EAL init by just picking out the EAL arguments from a full argument list. I'm less convinced of the value of this compared to the basics in patch 1, but I think the idea is interesting so seeking feedback on it.

Bruce Richardson (3):
args: new library to allow easier manipulation of cmdline args
eal: allow export of the cmdline argument parsing options
args: add functions to check parameter validity

 doc/api/doxy-api-index.md           |   1 +
 doc/api/doxy-api.conf.in            |   1 +
 lib/args/args.c                     | 301 ++++++++++++++++++++++++++++
 lib/args/meson.build                |   5 +
 lib/args/rte_args.h                 | 255 +++++++++++++++++++++++
 lib/args/version.map                |  22 ++
 lib/eal/common/eal_common_options.c |   9 +
 lib/eal/include/rte_eal.h           |  14 ++
 lib/eal/version.map                 |   1 +
 lib/meson.build                     |   2 +
 10 files changed, 611 insertions(+)
 create mode 100644 lib/args/args.c
 create mode 100644 lib/args/meson.build
 create mode 100644 lib/args/rte_args.h
 create mode 100644 lib/args/version.map

--
2.39.2