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 2A42F43270; Thu, 2 Nov 2023 19:13:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1675C40262; Thu, 2 Nov 2023 19:13:04 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6176C40144 for ; Thu, 2 Nov 2023 19:13:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698948782; x=1730484782; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=oSb8zwA4oFax2nyD/n7EF4aejT2BpBBDPiXCiEq5TbQ=; b=nZI/tjIjcdJoU1/q9KbsOtYX+Ab9DLv729d2XGOFxunHEt6cb/1WBW8f TshmlD+ZkEfU2yzUjLT8XESXKvueEM7VknFJVnsqoiczqDP5/S6Wm413c h0K2VttKlO7oCoKExez6+6PHKnOs1jlLZWf8Uib6uZy9GbTD8kZSV/RSh XmbGt2P3x0gpcFYR7HAwPX27R11GrJ58MK13AtgprQqEDb7lswMHaD230 JXMOZNX4YKb2ZBkKa6JbQoTKD4dLLl2cAYQhAxVaRmFJsST8TpLLQr1/W NoJdCqkMgPUe5ad/2Glltz/L3AVWHhhcn4H5fTEJFnHsPYVCQXRBqPHq5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="368986607" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="368986607" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 11:13:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="1092806200" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="1092806200" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 02 Nov 2023 11:13:01 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 2 Nov 2023 11:13:00 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) 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.34; Thu, 2 Nov 2023 11:13:00 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.34 via Frontend Transport; Thu, 2 Nov 2023 11:13:00 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Thu, 2 Nov 2023 11:12:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hcU7CrNIm69d/ag/36um7eP7TH9wtgcrUJneu0WH6NLJzZgQQynIwhyCeda7lijCGQ0+MJ4enyLYRoVsum1We3z3eDq3LP1sH20JHIkVx4tXokSSb+snL97/UDe7dOCY0ouADUt1ui9GShrt/aeYJXkRUXHHIIl7KaBzzrDkOO7bY1spnFAy01kVRRMA9r+oWZG1uz4+B/PHcBuoquS0+UL3Jk0T4gxAIne5npgxIsbpBE9e95K6hIid7qev3s3XB/aAeLsQ13PIE20o4FNMDfIdTStkVX/AR1P2D01tnr6cVjFdQM9C878sCBmy06z772UP7mYTFqU1NBVmfFWjQA== 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=dUJ7O56Y8rkq68Uo0IMpqFD0aYGIj1i8l+JIU8/JNCQ=; b=lhz6SrFyVxcR40wHOMdnrUuu0uVcCcEpYOo6c5MXm42CE96eMk1mPSrBR4uza+Mxv97O5zTiu54EuZ3nsiNJhPd9FK+G3GnbPqcp0J4NYgVutbD+kGf1yTQ5I+aCRkPHm4vI1/KV8NduWjynKGW6pRkygGsgRgBR8/nAswwog0t1fOCqT00GUY4Y3LctVzmodIotTz24gRiqhH9Kes0oko7YWQ1ir5jcfLw2v5IpM5HCC8pK0hM0B70z1eXEUhyi6DXtwgdHkXBDK1g9OgZXamMOwO0VFfxhLP8EfMmisKrbhyzb/TuDAaeVOUhtndAa8Bd3D+Kfeo/Tt/gAxlEePA== 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 CY8PR11MB7924.namprd11.prod.outlook.com (2603:10b6:930:7a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Thu, 2 Nov 2023 18:12:56 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d70b:11a0:d28f:ec44]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d70b:11a0:d28f:ec44%6]) with mapi id 15.20.6954.019; Thu, 2 Nov 2023 18:12:56 +0000 Date: Thu, 2 Nov 2023 18:12:51 +0000 From: Bruce Richardson To: Stephen Hemminger CC: Subject: Re: [24.03 RFC 0/3] Add argument manipulation library Message-ID: References: <20231102172849.7400-1-bruce.richardson@intel.com> <20231102105029.2c9eff43@fedora> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231102105029.2c9eff43@fedora> X-ClientProxiedBy: DB9PR05CA0011.eurprd05.prod.outlook.com (2603:10a6:10:1da::16) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CY8PR11MB7924:EE_ X-MS-Office365-Filtering-Correlation-Id: b19ddbc0-4d6e-4bd3-6c3a-08dbdbcf5686 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CI7KurZPXtMROLW0LZJ/74TFrQCbvCObkoqqLK/kHSQxsIoeirJY3AKG2A2JEwWVV86oFya7bvH97M59O5dhidqY2FGUwlgUT8puYMF5545vrLYhLTIX3qwhjT1UA9uwt9W9ZOJ0BCjSL5NuvOkGOhGI40XujcShetjtFqmO8NLhHnMyaVDQ0ufinL9NwZ/hmqFavAbOvmp34hv/tTnqPcUVcE8UE5maWXNIz06HKC2XtCt9Rc4fYA5ishG37NBtHtFnKvr60uJv6SnGlAigXnOobYLQ2jaGSNCoWC1y2mKcNfaPYXFZnb2axb7S6mD++bT4PVVOFNbA1K0CxDcSQ1iKZLPEWzbNNoUlUMH6CYvjSrMZOXkGjzzspPyZuwsyYBqy7CU/k4cYuaAF9tFRgzXgZdysveedpak9XvzL6/oRcQErF14h81FMHv+x/NFoRJ5AWf3Xc5Y+1xqLqU2PyZggB0newc3c6Sel3hJabEjZvnSmb9TV9TkmEH1EG8RpR7D+HSx+eLJoLREOzAE5De7byQ4sy/hmt29EKnjuPzQ= 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)(376002)(39860400002)(346002)(396003)(366004)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(66946007)(6916009)(86362001)(316002)(66476007)(66556008)(82960400001)(5660300002)(2906002)(966005)(6486002)(8676002)(38100700002)(8936002)(4326008)(478600001)(41300700001)(44832011)(6666004)(6512007)(6506007)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FdkH/dyMeGaoPuR/F21LijuJVV7koAsMVb+peQgHXgHfObjWCbgEilByUNNL?= =?us-ascii?Q?TnNzkhzaDh7MuCLIsMqx7oOK8mZlRf/PLD7oORiU3mfGH10pI5UZCRElKVkg?= =?us-ascii?Q?CfVwYcXonZ0mqR0farOMuy3At9BU4o8C8IBA+rsSRcuBP0J5CTo9a2jYfrBS?= =?us-ascii?Q?17/+IVZewiMiRlpezb7fIsFn2dK7NfPRBiNxEF6XaiUdRM/bPZg7XLGggkGU?= =?us-ascii?Q?rrOxMxtg//+3SGUtDzJJ0DVcOcZEBDepltq1TCGBpAa8Nq2SF3Ecyy3Iyk91?= =?us-ascii?Q?h0pmJU2XrhDHRMJqqGnuoAyTOU7YcJ4xFqOsylJJD4rD4T7J9VlgzjDG+bkM?= =?us-ascii?Q?RRDT2mmxRm9qk2wkqwo7HLADQ0wEGBxuHgZ2tEKy5WVn5yIcGNEAtAoqiaCI?= =?us-ascii?Q?LuroIG1JODDGKsWBVePJNkoUaPRpW7nLkav0uKfF2R6ZOvIRDiJ4l9yunX7M?= =?us-ascii?Q?t/fH0kpX2oCXBEj5+uOWgvcLFNGEKHTwR3SJYqiHoEcGho16AZ1ye9tbV7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SI8X7vN9hJKIAq+m6gwYgTP1fueX4Qt?= =?us-ascii?Q?BSbKL/CgKFVjsotb3787vNXa/kUh7ngk8HXrKmEzczvFNhUuYEDV4Nvg37sF?= =?us-ascii?Q?S6NA8z6NRSxvajHo5O1x9+bhNsDpo0mGOjtQ7oYsTtgR0KtdA26Vs2VEo6EI?= =?us-ascii?Q?DDv0rq/pEXNrEGrsdzasD6tpxW7S8k8QbVZd6Fsyq2MtuE6pXHcbt7lzoBDd?= =?us-ascii?Q?xw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b19ddbc0-4d6e-4bd3-6c3a-08dbdbcf5686 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2023 18:12:56.1510 (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: ucHwFfIMI2QiSUemA/az2WDh+nRtri2byIowyXoT653syrPVbKWZdNF6iZzkriAI/KQsNT7zyS9R41C+gN1yc8CLwENj261b+uv9nok1bWQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7924 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, Nov 02, 2023 at 10:50:29AM -0700, Stephen Hemminger wrote: > On Thu, 2 Nov 2023 17:28:46 +0000 > Bruce Richardson wrote: > > > DPDK has traditionally assumed that apps are written where argc/argv > > parameters are passed directly to rte_eal_init() and then app arguments > > are handled afterwards, as is done in the DPDK apps and examples. > > > > However, based on other projects, like VPP and OVS, we know that this is > > often not the case. Instead, the apps build up argument lists internally > > themselves and pass those to the init function, and DPDK never directly > > accesses the real argc/argv values. > > > > Therefore, let's make this mode of operation a little easier to use, by > > adding in an args library to allow an app to dynamically build up an > > args array and then pass that to EAL init. This library allows things > > like, for example, initializing a list from argv and then checking if a > > particular parameter is present, adding it if not. All the basics of > > such a library are included in patch 1, and I've found it of use myself > > when writing some simple apps internally using DPDK. > > > > Patches 2 and 3 go a little further than this, and allow for a slightly > > different use-case, that where an app may want to allow mixing of EAL > > arguments in with app args. These patches allow the user to query if a > > particular argument is an EAL arg or not, or a valid app argument. The > > idea here would be, that an app could go through it's argument list, > > building up an argument list for EAL init by just picking out the EAL > > arguments from a full argument list. I'm less convinced of the value of > > this compared to the basics in patch 1, but I think the idea is > > interesting so seeking feedback on it. > > > > Bruce Richardson (3): > > args: new library to allow easier manipulation of cmdline args > > eal: allow export of the cmdline argument parsing options > > args: add functions to check parameter validity > > > > doc/api/doxy-api-index.md | 1 + > > doc/api/doxy-api.conf.in | 1 + > > lib/args/args.c | 301 ++++++++++++++++++++++++++++ > > lib/args/meson.build | 5 + > > lib/args/rte_args.h | 255 +++++++++++++++++++++++ > > lib/args/version.map | 22 ++ > > lib/eal/common/eal_common_options.c | 9 + > > lib/eal/include/rte_eal.h | 14 ++ > > lib/eal/version.map | 1 + > > lib/meson.build | 2 + > > 10 files changed, 611 insertions(+) > > create mode 100644 lib/args/args.c > > create mode 100644 lib/args/meson.build > > create mode 100644 lib/args/rte_args.h > > create mode 100644 lib/args/version.map > > > > -- > > 2.39.2 > > > > It would be good to change rte_eal_init() from: > int rte_eal_init(int argc, char **argv); > > to > int rte_eal_init(int argc, char * const *argv); > > I.e it should not modify the argv's passed. > This would save unnecessary copy in applications that build synthetic args. > Example already exists in dumpcap. > Pushed up a quick patch proposal for that: http://patches.dpdk.org/project/dpdk/patch/20231102181148.56930-1-bruce.richardson@intel.com/