From: David Marchand <david.marchand@redhat.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, rjarry@redhat.com
Subject: Re: [PATCH v7 0/9] document and simplify use of cmdline
Date: Fri, 10 Nov 2023 15:16:47 +0100 [thread overview]
Message-ID: <CAJFAV8zT7Jqjt_qygqdi6Q4R19y8ek94=WQSpMy-9gi7QpYvug@mail.gmail.com> (raw)
In-Reply-To: <20231027110117.70995-1-bruce.richardson@intel.com>
On Fri, Oct 27, 2023 at 1:01 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> The DPDK commandline library is widely used by apps and examples within
> DPDK, but it is not documented in our programmers guide and it 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 patchset contains a new documentation chapter on cmdline library,
> going through step-by-step how to add commands and create the necessary
> token lists and parse contexts.
>
> Following that initial doc patch, the set then contains a
> boilerplate-generating script, as well as a set of four patches showing
> its use, by converting four 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.
>
> Final two patches, from V5 onwards, add support for option-lists in values,
> and then use that support to convert over a fifth sample app - ntb.
>
> Cmdline script obviously does not cover the full range of capabilities
> of the commandline lib, but does cover the most used parts. The
> code-saving to each of the examples by auto-generating the boilerplate
> is significant, and probably more examples with commandlines can be
> converted over in future.
>
> The "cmdline" example itself, is not converted over, as it should
> probably remain as a simple example of direct library use without the
> script.
>
> v7:
> * Increased use of multi-line strings in python script, following feedback.
>
> v6:
> * rework syntax of the option lists following feedback from David.
> Now use "(x,y,z)" instead of "|x|y|z|", to avoid giving impression
> of regex support
>
> V5:
> * Added copyright headers to command list files
> * Add support for option lists
> * Convert examples/ntb to use script
>
> V4:
> * Reworked script following feedback from Robin J.
> - formatted code with black
> - used multi-line strings
> - replaced sys.exit(1) with proper error handling
> - per-command function returns lists rather than printing directly
> - other small cleanups
> * Added change to CI script so the cmdline script is in PATH
> * Converted VDPA example to script, saving another 100 LOC
>
> V3:
> * Added lots of documentation
> * Added support for help text for each command
> * Cleaned up script a little so it passes pycodestyle and most flake8
> checks, when line-length is set to max 100.
> * Removed RFC tag, as I consider this patchset stable enough for
> consideration in a release.
>
> 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 (9):
> doc/prog_guide: new chapter on cmdline library
> buildtools: script to generate cmdline boilerplate
> ci: allow use of DPDK tools when building examples
> examples/simple_mp: auto-generate cmdline boilerplate
> examples/hotplug_mp: auto-generate cmdline boilerplate
> examples/bond: auto-generate cmdline boilerplate
> examples/vdpa: auto-generate cmdline boilerplate
> buildtools/dpdk-cmdline-gen: support option strings
> examples/ntb: auto-generate cmdline boilerplate
>
> .ci/linux-build.sh | 1 +
> app/test/commands.c | 2 +
> buildtools/dpdk-cmdline-gen.py | 202 ++++++++
> buildtools/meson.build | 7 +
> doc/guides/prog_guide/cmdline.rst | 473 ++++++++++++++++++
> doc/guides/prog_guide/index.rst | 1 +
> examples/bond/Makefile | 12 +-
> 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 | 12 +-
> examples/multi_process/hotplug_mp/commands.c | 147 +-----
> examples/multi_process/hotplug_mp/commands.h | 10 -
> .../multi_process/hotplug_mp/commands.list | 8 +
> examples/multi_process/hotplug_mp/meson.build | 9 +
> examples/multi_process/simple_mp/Makefile | 12 +-
> 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 | 6 +
> examples/ntb/Makefile | 12 +-
> examples/ntb/commands.list | 11 +
> examples/ntb/meson.build | 7 +
> examples/ntb/ntb_fwd.c | 200 +-------
> examples/vdpa/Makefile | 12 +-
> examples/vdpa/commands.list | 8 +
> examples/vdpa/main.c | 131 +----
> examples/vdpa/meson.build | 7 +
> 29 files changed, 871 insertions(+), 733 deletions(-)
> create mode 100755 buildtools/dpdk-cmdline-gen.py
> create mode 100644 doc/guides/prog_guide/cmdline.rst
> 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
> create mode 100644 examples/ntb/commands.list
> create mode 100644 examples/vdpa/commands.list
I fixed a few issues:
- devtools/test-meson.builds.sh was missing some update so the new
script is used when building examples out of dpdk tree,
- the examples/bond patch contained a change belonging to a previous patch,
- some meson.build updates contained tabs,
- the documentation and the new script were not referenced in the
MAINTAINERS file,
- the cmdline documentation used explicitly numbered items while the
coding style for the doc recommends use of #.,
For the series,
Acked-by: David Marchand <david.marchand@redhat.com>
Series applied, thanks for this nice cleanup/improvement.
--
David Marchand
prev parent reply other threads:[~2023-11-10 14:17 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 17:00 [RFC PATCH 0/1] make cmdline library easier to use Bruce Richardson
2023-08-02 17:00 ` [RFC PATCH 1/1] cmdline/dpdk-cmdline-gen: generate boilerplate for simple cmds Bruce Richardson
2023-08-02 18:05 ` [RFC PATCH 0/1] make cmdline library easier to use Stephen Hemminger
2023-08-03 8:11 ` Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 0/5] use script to simplify use of cmdline lib Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 1/5] buildtools/dpdk-cmdline-gen: generate boilerplate for simple cmds Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 2/5] examples/simple_mp: auto-generate cmdline boilerplate Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 3/5] examples/hotplug_mp: " Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 4/5] buildtools/dpdk-cmdline-gen: add IP address support Bruce Richardson
2023-09-18 13:03 ` [RFC PATCH v2 5/5] examples/bond: auto-generate cmdline boilerplate Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 0/5] document and simplify use of cmdline Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 1/5] doc/prog_guide: new chapter on cmdline library Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 2/5] buildtools: script to generate cmdline boilerplate Bruce Richardson
2023-10-13 12:23 ` Robin Jarry
2023-10-13 12:43 ` Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 3/5] examples/simple_mp: auto-generate " Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 4/5] examples/hotplug_mp: " Bruce Richardson
2023-10-11 13:33 ` [PATCH v3 5/5] examples/bond: " Bruce Richardson
2023-10-12 13:21 ` [PATCH v3 0/5] document and simplify use of cmdline David Marchand
2023-10-12 13:47 ` Bruce Richardson
2023-10-12 13:51 ` Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 0/7] " Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 1/7] doc/prog_guide: new chapter on cmdline library Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 2/7] buildtools: script to generate cmdline boilerplate Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 3/7] ci: allow use of DPDK tools when building examples Bruce Richardson
2023-10-17 12:24 ` Aaron Conole
2023-10-17 12:28 ` Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 4/7] examples/simple_mp: auto-generate cmdline boilerplate Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 5/7] examples/hotplug_mp: " Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 6/7] examples/bond: " Bruce Richardson
2023-10-16 14:06 ` [PATCH v4 7/7] examples/vdpa: " Bruce Richardson
2023-10-17 7:10 ` [PATCH v4 0/7] document and simplify use of cmdline David Marchand
2023-10-17 8:29 ` Bruce Richardson
2023-10-17 12:16 ` Bruce Richardson
2023-10-17 16:23 ` David Marchand
2023-10-17 17:02 ` Bruce Richardson
2023-10-17 17:08 ` Bruce Richardson
2023-10-18 11:21 ` David Marchand
2023-10-18 11:37 ` Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 0/9] " Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 1/9] doc/prog_guide: new chapter on cmdline library Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 2/9] buildtools: script to generate cmdline boilerplate Bruce Richardson
2023-10-25 13:04 ` Robin Jarry
2023-10-25 13:33 ` Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 3/9] ci: allow use of DPDK tools when building examples Bruce Richardson
2023-10-17 14:08 ` Aaron Conole
2023-10-17 12:13 ` [PATCH v5 4/9] examples/simple_mp: auto-generate cmdline boilerplate Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 5/9] examples/hotplug_mp: " Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 6/9] examples/bond: " Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 7/9] examples/vdpa: " Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 8/9] buildtools/dpdk-cmdline-gen: support option strings Bruce Richardson
2023-10-17 12:13 ` [PATCH v5 9/9] examples/ntb: auto-generate cmdline boilerplate Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 0/9] document and simplify use of cmdline Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 1/9] doc/prog_guide: new chapter on cmdline library Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 2/9] buildtools: script to generate cmdline boilerplate Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 3/9] ci: allow use of DPDK tools when building examples Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 4/9] examples/simple_mp: auto-generate cmdline boilerplate Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 5/9] examples/hotplug_mp: " Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 6/9] examples/bond: " Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 7/9] examples/vdpa: " Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 8/9] buildtools/dpdk-cmdline-gen: support option strings Bruce Richardson
2023-10-23 13:15 ` [PATCH v6 9/9] examples/ntb: auto-generate cmdline boilerplate Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 0/9] document and simplify use of cmdline Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 1/9] doc/prog_guide: new chapter on cmdline library Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 2/9] buildtools: script to generate cmdline boilerplate Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 3/9] ci: allow use of DPDK tools when building examples Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 4/9] examples/simple_mp: auto-generate cmdline boilerplate Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 5/9] examples/hotplug_mp: " Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 6/9] examples/bond: " Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 7/9] examples/vdpa: " Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 8/9] buildtools/dpdk-cmdline-gen: support option strings Bruce Richardson
2023-10-27 11:01 ` [PATCH v7 9/9] examples/ntb: auto-generate cmdline boilerplate Bruce Richardson
2023-11-10 14:16 ` David Marchand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJFAV8zT7Jqjt_qygqdi6Q4R19y8ek94=WQSpMy-9gi7QpYvug@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=rjarry@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).