[RFC,v2,0/5] use script to simplify use of cmdline lib

Message ID 20230918130352.379478-1-bruce.richardson@intel.com (mailing list archive)
Headers
Series use script to simplify use of cmdline lib |

Message

Bruce Richardson Sept. 18, 2023, 1:03 p.m. UTC
  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