From patchwork Mon Sep 18 13:03:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 147 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE0AE425D1; Mon, 18 Sep 2023 15:04:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2A114025D; Mon, 18 Sep 2023 15:04:03 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id AAE1A4025C for ; Mon, 18 Sep 2023 15:04:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695042241; x=1726578241; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hu3lNUoELAvBwv2HLT5VbuF76ndv2f7ulw/8vCOsS9o=; b=Ohxx9tlVs6pugwa/be5dPqDvkURncDJXRItA7Kcvzh7DZ4oCk/vjFqJp Sw/LgNkCYNi28mRRtSlb/d1t9bCIfEfxfzUjOzbAhoGfU6iYWglho0eNq 8ivK2YB4MAxZ6D6rVLJLSEO72VCIP0aRDQBwru0wxcpy6WPZXFvhSYoQt ooz+8olw99cByFJWiJDhj+aQpFkrEA4QATbDt8cFP1p+6btuRIMSF1oPf az0t6L4Ku29NCZncQtu35dCAY3rx6IuvvravvGZ31pt6R7nT+SC9kS7b6 Lntwib0IPPUYiFsktI1DmmeNpzdKb/7m2TDB0laOiC84SkLrWbc4b0gpu w==; X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="369969363" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="369969363" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 06:04:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="739130623" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="739130623" Received: from silpixa00401385.ir.intel.com ([10.237.214.14]) by orsmga007.jf.intel.com with ESMTP; 18 Sep 2023 06:03:59 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Olivier Matz , Bruce Richardson Subject: [RFC PATCH v2 0/5] use script to simplify use of cmdline lib Date: Mon, 18 Sep 2023 14:03:47 +0100 Message-Id: <20230918130352.379478-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230802170052.955323-1-bruce.richardson@intel.com> References: <20230802170052.955323-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 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