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 023644234F; Thu, 12 Oct 2023 15:48:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3F43402F2; Thu, 12 Oct 2023 15:47:59 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 4BB83402C9 for ; Thu, 12 Oct 2023 15:47:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697118479; x=1728654479; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=L+tp218ADOPvDSPmxLA63Q6XngPp6QWcYrKbgxDgEo0=; b=deB+imBSFoFLNQbaUapDSD8r4bS7J7Yied1AYxAENKKCAr/9/qc5jEDx cMaZJdYLEOPDKs0JRHkblc0hGbbOPcDhNOQ9G3ZpQVL1h7ujtCPc1BCfb cWUkkRSB/CZjMFS17LR1IPCGgCzXYfo1XermaPYDEdS/R+fT3hwR1tdd5 5j1YVxDZHbIhvoes6akCl7NfXlzCphAQSSsxw3qR9ho10Q6xm80n+w+o0 hqI0ippJBLC8aKZ6f8QxCX5ep3JWZbBjLFs+AHQRgGRoLVlMUgn2g72MK ssfneyritSHYFhmRBjltVESA/9zTUv1hQl8ViDaFBT2k9QRH/9vphtzEE A==; X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="3525592" X-IronPort-AV: E=Sophos;i="6.03,219,1694761200"; d="scan'208";a="3525592" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 06:47:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="870582953" X-IronPort-AV: E=Sophos;i="6.03,219,1694761200"; d="scan'208";a="870582953" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Oct 2023 06:47:57 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 12 Oct 2023 06:47:56 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 12 Oct 2023 06:47:56 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Thu, 12 Oct 2023 06:47:56 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 12 Oct 2023 06:47:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FfbEthwm/V+BwUxqXcw0oRc3nUzT3DXn65q0+fA04gJPcxQx0Kj/vgYVSGmm7obyi+/c7/puyJX7xNzPA2a/rIBN2/LBv/wRgkut+XwMNgM5Zu3J2t0PRmP0Jd0QD0CqOZmchRxwRIitszfanN6SmU+XmNtAZMmFryXbvWdJxhr6nTvzuNod+8emohumo4YUs3692xamRpqneMVGlhMio0xuOGDvPWvjS4DtxRJSkTF+7F0h/w8kbHtNNdFyr6MS7+M/FL/sP0gcszSb9w57QTU57i5fdMAARIiLc+5yOO5rWbISTGgNFIH69E20MfScNH6KpsiXbs31ErBlSgbYCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IHDxa83LyrerXsCLnlfi9qerm+l7eeKOW2a5iNZbcjI=; b=esT5LMl4y5sy/+Qs6/Zlz0zEBEyFI+CX/UJqCgBS3RCDG9WOVpXBBywPUB2pv6HZknQmiwALUhBLF2463dXf3uM9UALtROYIzgJRJC8URiMKPVdtPVjGGVbeKn67N2whTpJUla9FtoRw9xDNoygAMwwB5yKrPKd+TVgYY/gQDQQbsxMbS6QG3O0aK/KceTebZ4G9a+kg6Cbc6lo3Ek64u8ZUHomX2aXeLemSh5wrII5PN/Lo3X0exBBfwYlkxCKocMKXLcWcpQLR+a4B4B1ZGQdZ71pT60SaZD8rlQcOv89ZIc+RzSdR9nisal7/ILIuzHu1ur7hSRdlapC/LXCgBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by DS0PR11MB6398.namprd11.prod.outlook.com (2603:10b6:8:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Thu, 12 Oct 2023 13:47:53 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aa85:ead1:baa8:c652]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aa85:ead1:baa8:c652%2]) with mapi id 15.20.6863.043; Thu, 12 Oct 2023 13:47:53 +0000 Date: Thu, 12 Oct 2023 14:47:48 +0100 From: Bruce Richardson To: David Marchand CC: Subject: Re: [PATCH v3 0/5] document and simplify use of cmdline Message-ID: References: <20230802170052.955323-1-bruce.richardson@intel.com> <20231011133357.111058-1-bruce.richardson@intel.com> Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: DUZPR01CA0073.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::11) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DS0PR11MB6398:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cbffe30-8461-44d7-8716-08dbcb29d509 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /47LC1BQV1fmwmOrj2tH7ilEiLCYE4maO++dn4gIoaOk0IBy3dRSKxbfxLvijy/r75vHpxFMvwwsAPgnAGpzaCSFOkmZnqXd4sn9vqazjtlZBSIb6Pvvl5VjeX1KjZ56snx8UIxWieFihxEVf2XfWqgpUomp/1HdUovq/4VHyNb1WBfTpld16X+YyXftQmFerssDtzcARwJ1Biik+9bkim1xXpfx3XxjSXH4Dgu0yPKOBZXD8T1Lb0iCMoChfQtGAi+6CF2izNryOlBeNih3tLX0VYoYpE72txh4jufoIH07fSzxmJ53isoDEn7A+RkKnInjUYu9pjT9sQwZ66KfLPPkTbBFnX1saC0Ka7Bw39BQHaFpbscqDJaq6oaU9Or8zfw5Xn/Lwg0wND9NVCJL3E+FAvrbmGp8YwCXmNRVxim83iNnFFHb1duS6X0kHCYsFXBGYmPOQYuRSKv/Ur9oR7QiNSF+WVak6Fhrf3GQWhxPwmTTMnOcyhppAndYyQAHkT6PkZCVTqE4/rPzzioWbDL//FiyYHG1HJwNRFouimpEvCesa6be5vZW0/1O6DSi X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(376002)(346002)(366004)(396003)(136003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(2906002)(6486002)(478600001)(41300700001)(8676002)(4326008)(8936002)(5660300002)(44832011)(66946007)(66556008)(66476007)(83380400001)(6916009)(316002)(26005)(82960400001)(6506007)(6512007)(53546011)(86362001)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Sjh3NGZ5aWRqNFczakkxQmo5bWNLVEY0UU4yRldvd05kNHN4Zk9BS1N6c3h4?= =?utf-8?B?SGk2SGtrOUJvL3hwaklQT2QwTm82UWFpWHpmNHhwM1RRbGZoSnlRd3kvYnVX?= =?utf-8?B?V1pCNS9JWXlMMVBaMVRHaWs3K0pYSDdrL3M4bHlKcGFKeVJuZEdhaTA4S01Y?= =?utf-8?B?cEJaYk9UUkNRczBqc3hjdTY5bk1TejJLdGpWcFQxZlExOS8zL01kMEl2aTFp?= =?utf-8?B?bFZ4QkJYM1RwOW5zYU9TbDJQZFpUdXFqTmQralFSbW5lVzVDVmp3SmZ6L0lX?= =?utf-8?B?VDdmL2hnSm9RRXdianZyUkZzNTdZTkE1N21zYTNKTWpwMCtyS0RhaHdkQXY3?= =?utf-8?B?cm4yTEhwWFp5LzFQM2tMeFROZUpBVFRtVDdrOEtQV2NaQnA2UU8wMFRrR2lD?= =?utf-8?B?cG5TZ0RWYU5EUHFxRVUyWnVaL2Q0V2tFR2pwRmZVdFJhVEl5OEp0TFJCTjh5?= =?utf-8?B?cjhNa0V1WUlwdjQzekZoM2F6K1R3OWZsMVVESURHNlQ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nRzbnRxYTdVLzBUZXFtN0JMdEpoSmRsL1kz?= =?utf-8?B?eDlnMmtJeXQ4dFMxWEtSWnRTdStqRS9VNDMwblMvWTVTa0dhNlZiaE1mVVh2?= =?utf-8?B?RzRobmp4aFB5QkM0b3oyQmZ3MW14STdMc3Yvb3gxZkRzOFB3K3B2Z3NVYWhz?= =?utf-8?B?aWNoUjBxLzFtMXdHZGdkVXFEb0RiNTZJcmxQSkl0Kys4UzYvZ0JhZFhtZkNn?= =?utf-8?B?bHhsRmRLSlBhUk1kZXhWQ0dNSlFtMFNRY2luMTlzZmk5a2FNZFRGK2w1NVlE?= =?utf-8?B?N2U5cHJydkNJOXdCc3htSWI2TlovMkZYRmZOUWoyZjFwL1gxT3hjL0VzRkFO?= =?utf-8?B?Q3Z1RzVjbDNWR3M0YmljNm4vdDBnTXBOdllFbVlOREZXMWVnVVplWnIzTkor?= =?utf-8?B?aFlGc1RoNENxdndxZ1JrRWh3V0FVVDdUeVhJOU9xMUZPZi96enVXK25kbUtF?= =?utf-8?B?cWhJcWloZllJeGFZWmF6cmU1SVZObmVJb0x5b2F6WDZkWFpNV1QvcVFKdDkv?= =?utf-8?B?dndmZ0F6cGo3Ni9raU9QNDl2a1J4czNLTzVHUVFJZ1didWpva3k4cWhJQmQ4?= =?utf-8?B?Q01zbXNJblNGaWUxTHliL1k4RzlXekt0bzFVdlVZTERBY0ZCcjBhdGkwRGJs?= =?utf-8?B?WUdtcGRRQVhUU0xTWi9PbWNtemVYV25wa01PMmFsQ0tGc2JTNTlxK2hJNkdU?= =?utf-8?B?Uyt1RUxKSDZvZWpoMms0QXNHNklCMmJwb290azBZY0c1WUVtV2VtZmk4V2RG?= =?utf-8?B?VFE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6cbffe30-8461-44d7-8716-08dbcb29d509 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 13:47:53.5601 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X8zYuHNxUBp0NI1iCHDivTBkrExPKL8emcpgUGS6+HAEAVfO2/vMv/VUxYOEqhhNtPIyPu36e5dLYdbefeS2zpahHLuEv7pMln3mDgMzZDw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6398 X-OriginatorOrg: intel.com 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 Thu, Oct 12, 2023 at 03:21:08PM +0200, David Marchand wrote: > On Wed, Oct 11, 2023 at 3:34 PM 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 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. 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. > > > > 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 (5): > > doc/prog_guide: new chapter on cmdline library > > buildtools: script to generate cmdline boilerplate > > examples/simple_mp: auto-generate cmdline boilerplate > > examples/hotplug_mp: auto-generate cmdline boilerplate > > examples/bond: auto-generate cmdline boilerplate > > > > app/test/commands.c | 2 + > > buildtools/dpdk-cmdline-gen.py | 167 +++++++ > > buildtools/meson.build | 7 + > > doc/guides/prog_guide/cmdline.rst | 466 ++++++++++++++++++ > > 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 | 5 + > > 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 | 3 + > > 20 files changed, 745 insertions(+), 422 deletions(-) > > Interesting series. > So if we remove the doc addition, this patch is removing loc, so +1 from me :-). > > There is a problem though with externally building the examples. > Maybe the dpdk-cmdline-gen.py has not been exported in the install process. > It has, but it's not visible to the external builds in github actions. The following one-line fix should correct that, I believe. I was testing it in my own github yesterday, but never sent a v4 series. /Bruce diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index e0b62bac90..3db9d9de6e 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -174,6 +174,7 @@ fi if [ "$BUILD_EXAMPLES" = "true" ]; then [ -d install ] || DESTDIR=$(pwd)/install meson install -C build export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH + export PATH=$(dirname $(find $(pwd)/install -name dpdk-devbind.py)):$PATH export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH export PKGCONF="pkg-config --define-prefix" find build/examples -maxdepth 1 -type f -name "dpdk-*" |