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 F22324234F; Thu, 12 Oct 2023 15:51:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E053E40698; Thu, 12 Oct 2023 15:51:37 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id AAAA2402C9 for ; Thu, 12 Oct 2023 15:51:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697118692; x=1728654692; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=V7H3ekzrGuC4bVU813aDtEO/Np3/53XAtxxRtoGsLk0=; b=QtSfbNVuSc9jo9wLwNe6Okc6qU8d6WHTmldd5NxOfsEZdyD9FPfkXJlE p1inbi23rOkEjC3TDe3YYGEgUFzTKb1YX/wBOmLdB4Q4NPzoQwb9Jo7i2 uxyaqD8OKE6GhfK4UiE70+qH94O+DZgAxY1GMdxgGviX88Cd4n1Fc8Qdi iEc74t9PJ5wZ+AfN429qCrxId2eotUkTQkYrfNFn3rLCWOryDJ9lKZ13b jVDUly5h4MLHOFk4uJMX1P2QPYNtTg0vus5C7wjmdAtHeM1gy0oCZC5d7 h6LpfqJ8jVDEGqY0brEKsGLG0ataCbevStgeTUjnbuRvqKyUHyxvwzzX5 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="365194003" X-IronPort-AV: E=Sophos;i="6.03,219,1694761200"; d="scan'208";a="365194003" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 06:51:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="1001551492" X-IronPort-AV: E=Sophos;i="6.03,219,1694761200"; d="scan'208";a="1001551492" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Oct 2023 06:51:26 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) 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:51:19 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) 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:51:19 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) 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:51:19 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.102) 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:51:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UmLeY3MNFt5itg5yYIvKlg+U3gH7N0X0jRsbpsrJpLmSJXrZreUxDB9Rerlo6msXjwt9gMdZi8SVcT+uAjYNz/E/OVZBfkq/ybErhaVH33nf6cbXLp8fHtAX+IOBMwkLYbndFeaKy8ymv9xpcCK6KBTL/buQERe6IfLBQsGUm6OCBwaG9WljoJY84cxq+TomBI2mNngVidRKtbATa2umxdUjRAUov9yBqusLOKmz0LOowhJlMzZnaUrYe4820Wu7NLBLZtdFSqG+qd5K4r3Qs7A1IIkDrxQSKmOnbdjsgNrXbZ8bJIYmMBzKrdKJGbisHoo8kMrcdWlbgfSsLu2LyA== 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=f5Cw+vrKBXoLQQpoeK79apq9uIEQkbMP+gtGL6Q3W9g=; b=cq2sJTECDpeIurv+yRc6ucHvlU+29zOqE5qwk2U9TIwSmP/e1W2jW7a2f/v1X5uSg+7LWB0P5XirqPaZjzUxLki8s3Y0PsiWbVL2SYqlLf4f+TDC2Ec5AIVuajjZitKtnGTTNHSKYHDrf+W42Y9vyfbPNeNpX+wLB6r5jARB/gZ1NMrjKrZwxkwix7QhzH2Kqx9NCQdxD/aOrtoudDudUC/ZDNCiANhAT9sQ1mWOaelvDYawkF7kK/uuHmsAn2AvSU+nB8kxsHPOMx6lRhan/H0eV76o+w9CiOo1BbUrhpPzhPxXY5LBSKFxZp+q1sqBCKlZEs99qZ3RcHwCvgkIfQ== 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:51:16 +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:51:16 +0000 Date: Thu, 12 Oct 2023 14:51:12 +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: DU7PR01CA0030.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::19) 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: 781ace6d-5f1f-4adb-083f-08dbcb2a4dfc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M06jugrNdCZBrqS1bHd38siMEkMPlS/nSV7frKSib7uXcnbX4EbY74PgCSsAb6J9PLjfe/i0L2GUr3inJBkHjSW1SSEZaiLuN6BQCr3yC5zeQQJfMgQylAjGxoknlwmRkSjARJ10GcIWLFsed0U0BQf5Z7Tp+Xmv8sflKQY3WOduoj94IJj8p3g37K8TP107x8IFz/84H0HgwDCvQ+mDMBDzJRiNFfK0xV0RXEQ2QjPJv1pxWhDlcjmcoTLj473Ci8WL4RJpxwrOVC7I8pUYkrzR2l4hjH9sJSUkRShcR6INDJZaM2St0myqYVv6zfp0G5JFHZCoHN+N9/8AzHuhW1PC5or+wpOsOxEwyh8nZL25SZeLbfg4k/EefMKDKGKWcgohrZuzfFkLxBNCmiJsD0yQdYfuqTfJOOFUs8aTiuWhGSl88XBqEZyTZ4aKRjkm+QQGt8ky1E33a7/es6vfEQHcHr3r9FrdEjiozUECg5E1wEryHQQ8lY5y+J2K556FuCL1M+LNWksBlNG5/qbODmw+oMM+WL39EZQgUexTOGaJ2agtW5meKkK+77una8fg 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?YXdISkZ4TnpZNFhkZ1FtdkEvWjVpSHZMMk03Vm9DRzdiMDYxZnQ2SUxxcEo4?= =?utf-8?B?REVZSVVkVGdnMlQrS2lURW1GRG0xMzYvWWVrQkdnbG02QzN2RXNsYUdMN2hy?= =?utf-8?B?WFZDYThwaXo3Z1V5YTRuS3kyQVlMdUNNLzdhdzVLaEZpNTI1bDZ4MjcrRlMx?= =?utf-8?B?QmsyckcvcnRCaVNKWloyZVN1aU41VXFTYTVmU2o4aThsSGhqUFlJbmVzN2lV?= =?utf-8?B?WU5LZlR5aW10VTF4TmZ4bkp4UUZxdDJlUXpFTW5tNmlzUkwyRyt3OExsMmE2?= =?utf-8?B?NDYrYkZHZ3E1YUVBTmd0VWJ6KzZlVVc2ekQwZmtGWkYwS29YSUdFQTFsWnNO?= =?utf-8?B?Y1BQZjd2d0Q2aFBjRU52MmtvYUFHM2hmY2Y3OXhCTms0aEoxNEQ5VnR0c2xy?= =?utf-8?B?SHJLWVZMaHlKVmJSYTNJYTljeDZLa0lwSnY5Mm1DYXpxbW1heHdGY3dQb2tB?= =?utf-8?B?Y0NZY0tv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KzRa?= =?utf-8?B?cmZJN1VIU3FJSHZIaHVUdU9uR0JMNHo5TS8ySjFSemd6ZldYK0QzZFZRUEtP?= =?utf-8?B?R09SM0pqdit4dnRUc2luUjc2RXc4S0lxd0xTMzVkdHF6SGFodDVMbEs1cUJn?= =?utf-8?B?VVRyLzRQOWRTVUpqRjdVMHdHMnNEV1dnMzZ3bnh0SmM3QkdQQTZMYzlWRlU0?= =?utf-8?B?eit4L0k2L2Jyc09YM0MxNVNRaWJ6cHY5SjFEYWFnQm1Ic1Q1RUZTTXlTR003?= =?utf-8?B?MC9GUHlrT2FEYXE5OHQ1Z2V1SDYvdkh5V2xZL01iWXN5MHNPeTlKSlltZy83?= =?utf-8?B?TGMwTmR3TXdWUnhud2hPdWJsdktsUTFrVlliZFhjSFMyaUc0N3Nqa2I5SzEx?= =?utf-8?B?dWVGSWdZaGdGVk1OYjJVV0svM0xtbGMvU1NYM2hFOFF4L2picFZyZjV4a2VQ?= =?utf-8?B?K2FaL2RYZU5STzcyaW43MitXME9LUmRXVEZCaDVKQ1NUZlIxWGpWWHVEUjh3?= =?utf-8?B?dksyT0RlT2g0RXRiVWF3dVF0eFBDaDZPV20yeDFuYXdncE43eU9uOU9OUVNN?= =?utf-8?B?ZkZiSXhCazRoRzJ2S21pWDQ3bTZ0SVB5N054SnBlbVRHR0JLM2dlQ2h2SnlC?= =?utf-8?B?NktyTDdHU09vZ1JQWFdhcHRzR0dWeU5kUis0SXRVKy9CcDIvc25Ta3FrOExw?= =?utf-8?B?aW1DclRxM2N2dmZHUkZvalYrSkY5V1FhbGk0WUpScmRIOHlacVUvc1FLS0dv?= =?utf-8?B?OHoxMDNsclFoSnlGRXYxeFJsUVAzYlF1b2QyYU9uREE5RkgwOW9XTDlJRUM0?= =?utf-8?B?L1E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 781ace6d-5f1f-4adb-083f-08dbcb2a4dfc 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:51:16.2577 (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: eAzqM051/VIgA+r37y6TTwGoAj1zTJArhNwdPk1Of1RFOQtyfABekn1pvqm1+XLKjjlL1inuTj5UirmJzjcoZzZk6bdL9SobgbsGD/pdnFo= 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's probably lots more LOC that can be removed beyond this, if we put in a bit of effort looking. I just took three simple examples, and managed to save ~100LOC each. However, the big benefit I find is for anyone working on new apps - using a script makes it SOOOO much easier to add a commandline and then subsequently to extend with new commands as you go! Just add the new command to the list file, and write the new callback function and you're done. Since cmdline library is not going to be going anywhere, anytime soon, since it's so integrated into testpmd and dpdk-test, we might as well make it useful for others. /Bruce