Skip to content

RFC use script to simplify use of cmdline lib

Bruce Richardson dpdk-dev 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest5 patches 0 repliesNew
  2. v1 RFC1 patch 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5buildtools/dpdk-cmdline-gen: generate boilerplate for simple cmdsbuildtools/dpdk-cmdline-gen.py buildtools/meson.build+153 -00 replies
2/5examples/simple_mp: auto-generate cmdline boilerplateexamples/multi_process/simple_mp/Makefile examples/multi_process/simple_mp/meson.build examples/multi_process/simple_mp/mp_commands.c +2 more+29 -1130 replies
3/5examples/hotplug_mp: auto-generate cmdline boilerplateexamples/multi_process/hotplug_mp/Makefile examples/multi_process/hotplug_mp/commands.c examples/multi_process/hotplug_mp/commands.h +2 more+34 -1470 replies
4/5buildtools/dpdk-cmdline-gen: add IP address supportbuildtools/dpdk-cmdline-gen.py+5 -00 replies
5/5examples/bond: auto-generate cmdline boilerplateexamples/bond/Makefile examples/bond/commands.list examples/bond/main.c +2 more+36 -1590 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [RFC PATCH v2 0/5] use script to simplify use of cmdline lib

The DPDK commandline library is widely used by apps and examples within DPDK, but requires a lot of boilerplate code definitions in order to used. We can improve this situation by creating a simple python script to automatically generate the boilerplate from a list of commands.

This RFC v2 contains the (slightly enhanced from v1) script, as well as a set of three patches showing its use, by converting three examples to use the script instead of having the hard-coded boilerplate. Once the script is used, adding a new command becomes as simple as adding the desired command to the .list file, and then writing the required function which will be called for that command. No other boilerplate coding is necessary.

Script obviously does not cover the full range of capabilities of the commandline lib, but does cover the most used parts - with one
exception: it does not yet support defining the help text for a command (hence the fact this is another RFC). If there is a general acceptance that this is worthwhile, that gap can be closed, making the shortened boiler-plate-free examples fully equivalent to the original code.

V2-RFC:
* Add support for IP addresses in commands
* Move to buildtools directory and make installable
* Convert 3 examples to use script, and eliminate their boilerplate

Bruce Richardson (5):
buildtools/dpdk-cmdline-gen: generate boilerplate for simple cmds examples/simple_mp: convert to use cmdline script examples/hotplug_mp: auto-generate cmdline boilerplate buildtools/dpdk-cmdline-gen: add IP address support examples/bond: auto-generate cmdline boilerplate

 buildtools/dpdk-cmdline-gen.py                | 151 ++++++++++++++++
 buildtools/meson.build                        |   7 +
 examples/bond/Makefile                        |  10 +-
 examples/bond/commands.list                   |   6 +
 examples/bond/main.c                          | 161 ++----------------
 examples/bond/main.h                          |  10 --
 examples/bond/meson.build                     |   8 +
 examples/multi_process/hotplug_mp/Makefile    |  10 +-
 examples/multi_process/hotplug_mp/commands.c  | 147 ++--------------
 examples/multi_process/hotplug_mp/commands.h  |  10 --
 .../multi_process/hotplug_mp/commands.list    |   5 +
 examples/multi_process/hotplug_mp/meson.build |   9 +
 examples/multi_process/simple_mp/Makefile     |  10 +-
 examples/multi_process/simple_mp/meson.build  |   9 +
 .../multi_process/simple_mp/mp_commands.c     | 106 ++----------
 .../multi_process/simple_mp/mp_commands.h     |  14 --
 .../multi_process/simple_mp/mp_commands.list  |   3 +
 17 files changed, 257 insertions(+), 419 deletions(-)
 create mode 100755 buildtools/dpdk-cmdline-gen.py
 create mode 100644 examples/bond/commands.list
 delete mode 100644 examples/bond/main.h
 delete mode 100644 examples/multi_process/hotplug_mp/commands.h
 create mode 100644 examples/multi_process/hotplug_mp/commands.list
 delete mode 100644 examples/multi_process/simple_mp/mp_commands.h
 create mode 100644 examples/multi_process/simple_mp/mp_commands.list

--
2.39.2