From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E1104432E6; Fri, 10 Nov 2023 15:17:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7EA740695; Fri, 10 Nov 2023 15:17:03 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A3A0A4064C for ; Fri, 10 Nov 2023 15:17:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699625822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wtm+DKSHIue0kvimCulELiVoRjB7OftViRgrQRDPBpU=; b=AwCuCYdmWYg8+7/yc3EQZLvGksEX5+TV/qR9xxU67V6rrNC/suGHrisN4wHo6lIR+nFN2v cGhcv2LXMYSwkDsALEwIU6pChZTPBwRfuGB5olZTYdTo7qpuUpNGxxSxz6MeuHBh0JZZXg YWUZeg34C3YhR5fCB1arpGIVPCSDWqs= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-KDlimmUHNvuSvqYL_V27Hg-1; Fri, 10 Nov 2023 09:17:00 -0500 X-MC-Unique: KDlimmUHNvuSvqYL_V27Hg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c6ed6f7146so22807401fa.0 for ; Fri, 10 Nov 2023 06:17:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699625819; x=1700230619; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wtm+DKSHIue0kvimCulELiVoRjB7OftViRgrQRDPBpU=; b=Kvybf8DwFAk1B38iMbkBmSNZIH4ZchBEt6qCxeiZzRKxUlshdt+CU71FTvEnnjnBWV 8B74qThbvPsZfNPElioq1o+9/wl9ZcSbw2mtLEp5A9/o2pp2eZBJxla3pcyat6VHsu9F Vr2qbel40pj3TGp8YJHYUsjfbneFaUlh/xMgaTzNWaGE3KpKNgYpg6oVQ0j2qlECgu0v 3m4s4Wtvq5C3da7hixXBRZOLkdavpP3xhmHNaj96LNOHPsyy8l6KeIeIe18Xp5OHuSHK bBINbiYxDpss7Nh7OLfk3nzPZK7vaLXIPatdd9nA1tZY/dkoFuIUFGNQHYuXJ8YYwSFf aWSw== X-Gm-Message-State: AOJu0YxYNFWUp//3N3/6WaMVaz8c0g0+DL933xeSAMPdn1gliWmUicOb 2YG72qqEJkjA4E8MIocaJJ47KnCBarlALwKZo0BobZvpM5BI2wKSwxqpSGatsQEUN0aKEjOAGOV O181KVZqgPsCP5asyGiE= X-Received: by 2002:a2e:300a:0:b0:2c5:3b1:c084 with SMTP id w10-20020a2e300a000000b002c503b1c084mr6909046ljw.42.1699625819322; Fri, 10 Nov 2023 06:16:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBuKPuvrvSxmE8Xe1mkolhsj+y7RFBMKnA9t5RebJXCiznQuX1YbZ8TSZggRwanwdSJYZC2smM+FrXAL0EzpA= X-Received: by 2002:a2e:300a:0:b0:2c5:3b1:c084 with SMTP id w10-20020a2e300a000000b002c503b1c084mr6909022ljw.42.1699625818889; Fri, 10 Nov 2023 06:16:58 -0800 (PST) MIME-Version: 1.0 References: <20230802170052.955323-1-bruce.richardson@intel.com> <20231027110117.70995-1-bruce.richardson@intel.com> In-Reply-To: <20231027110117.70995-1-bruce.richardson@intel.com> From: David Marchand Date: Fri, 10 Nov 2023 15:16:47 +0100 Message-ID: Subject: Re: [PATCH v7 0/9] document and simplify use of cmdline To: Bruce Richardson Cc: dev@dpdk.org, rjarry@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Oct 27, 2023 at 1:01=E2=80=AFPM Bruce Richardson 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 value= s, > 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 feedbac= k. > > 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 Series applied, thanks for this nice cleanup/improvement. --=20 David Marchand