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 22AE043433; Wed, 6 Dec 2023 14:30:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E044C42E7A; Wed, 6 Dec 2023 14:30:20 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 085D142E79 for ; Wed, 6 Dec 2023 14:30:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701869419; x=1733405419; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=ClloodbsvISZ4YfJTmdkVOY5epAOVKK76Qntj18G3nQ=; b=lxeQraFHvzxfUHhEgEJ4RMVO+O+GgDiis6ltu3fpnnB2NLnYZZZ4I+ji dlBIFz5rI74+1Y+RVDIIpkFJjgeNp6QBMJzMBhAEfIp3SkfaNHfOqpWD/ OdMDe5AI1A5VTqrg7hZtBMaYalb6b4hBRRN48HwHkx4uv8pliI6F4R6co AFcLGNYdA8up0O1JaRWjYwbuT1o01cCQ7irx5WjzuoiefHWbvAjc8Ht3w Y/2WZsOTrPuXiy2Ur8OKWBa8byVnw5gAQvU5gFE3zEj08Ofl+rUvD4jC/ SohqnMe1u/SOIrFP1fdKf6iKhQgCZRqzcraGEY7RXe3BEl3PNIEBtiLzH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="7411315" X-IronPort-AV: E=Sophos;i="6.04,255,1695711600"; d="scan'208";a="7411315" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2023 05:30:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="841846297" X-IronPort-AV: E=Sophos;i="6.04,255,1695711600"; d="scan'208";a="841846297" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Dec 2023 05:30:17 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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.35; Wed, 6 Dec 2023 05:30:16 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 6 Dec 2023 05:30:16 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.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.35; Wed, 6 Dec 2023 05:30:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PywHW+Ge9It+tVKq8CZPxT9nosY8L3BT9sZG1m167sxgmvTliRFUdO/YhbCa5qHnZNGrDpnvi4/no6zPJqoRF2TZ8CFD3d9TsmNqRInbu8BmpviFZB90GVMO3aj9p/vSRP2wRkCngCdUhldIJAeJ0NWExf5HIbSYrzhem6Xhofs8J3m7i3FMHMddEXNIr74IxTCLGZhMLUduhoVZ71n50ixcK6vp3r+GkA0nOOEQ6YtBbaiGFw/r+svGUphOXtTowI/4lw7Xo+D77uKNurJXjtQI6LXUHbC5jFR8YZvU82AlRN/0s8ZQcXDlhFhazuuvx1jnYXzgtfFhTirtuClehw== 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=ILI6DR4HT9FwWN7nHDf3k4L0rrMB/RPzhuedLtafVeA=; b=IyF7i6CsZ7ocXEouccxybL88G8M1ew4c2IYhTy1BODKcdfPVg/k7NwT6QHgEwsi4gFRnJkA9u9uw6HONOtN3LFu9g/8KJ3cdtV5SyuR36lny+shxU2eSJHnS/Zrk+CDvbnZddDjfPwU+NyL7j8PhRxM7ZwMrxXLfcroFtx2uHrlWLTTSwl4cT7PYY2zJ4nme4t44aI8WkfAo+zProO1aBNWjwWDZ3D4K8u/EHQopdvcuhMQqa7R2c77XfmTvJHUh9oYAjNMdfYOyqyi37hXh2FzJmYSkbx4jh4/UsJCy3smlaPC+ZPetTXJB2WhedqkzouKT7/rvKnByz3ajRcHHmg== 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 SJ0PR11MB5167.namprd11.prod.outlook.com (2603:10b6:a03:2d9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 13:30:13 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49%7]) with mapi id 15.20.7046.034; Wed, 6 Dec 2023 13:30:13 +0000 Date: Wed, 6 Dec 2023 13:30:08 +0000 From: Bruce Richardson To: Sunil Kumar Kori CC: "dev@dpdk.org" , "david.marchand@redhat.com" Subject: Re: [EXT] [PATCH 1/3] buildtools/dpdk-cmdline-gen: support optional parameters Message-ID: References: <20231205145109.1000464-1-bruce.richardson@intel.com> <20231205145109.1000464-2-bruce.richardson@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DU2PR04CA0013.eurprd04.prod.outlook.com (2603:10a6:10:3b::18) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SJ0PR11MB5167:EE_ X-MS-Office365-Filtering-Correlation-Id: e4207cfb-ca43-41c8-5084-08dbf65f7a07 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oc+zRiWoaEv7V1LcFpbbP4GddLlfrnvNBh1PvFqRUab+fydCS3Sbm4wJ90AKxzSGH1CU5QuCHxjUw66OdpxbLOMjwbMTOm8PyRaxPctP9/sIxIqHcXXhFD6emD+LIEv8x+ByuEfmdl4hjEf7F/KGZK9ItqcRptJWjlJznO5VXl5ne/z/dwZyenFKIzOrtXsxMQ/Y41hMHlcvxtP44aWPGaFjg6FpFD6CEEzW/NpYLaHctaBaPrJdXvvQUR81RTJx262Gqd6yxzDaHNhBlzkt0lbxNZuEYvCXilH6RjbrOXGR52/X1A3Xf09UXUTiXIs445/j5KjTbUlDkFve/j9OMI6gV3jAEyaAJX/83y6Nywihfs8X+ewFWRB/5ghAumEo7qeSZ0vY0RvqA/tJtAQcsmBZglQpSCHblP7DLcSfKt3WVzz2eRd2n56Bj6s6WgU3dVvw60HleUVeyk+VAgiygD52b5OAJ6WyvUyK+ekZTiglHcOBO++cBcfrTuMOqIK9BDzT7T5JGfljF+8AWsHQKXkqkYL9eyAwF0683AP0DvKk1oDy2kvpYbAdHlj4CU/xXejRVKqAjYYl9tGLLKN94GhJ505H6xq9+jUxW0W+pBXomC/bxtlK65eBdkoe9k1T 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)(396003)(366004)(346002)(136003)(376002)(39860400002)(230273577357003)(230173577357003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(26005)(6512007)(6666004)(6486002)(8936002)(6506007)(83380400001)(53546011)(5660300002)(44832011)(2906002)(8676002)(41300700001)(478600001)(4326008)(66556008)(66946007)(66476007)(54906003)(6916009)(316002)(82960400001)(86362001)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DlD4Z+bNfGNiYc1u3u+O7V+Z5x7BItODHWMrEAm0QU5M+igRSFIKGp46otYg?= =?us-ascii?Q?1dRkAxlkkpIU+IZ9fUl5J5bUdSFuDmOMUZX+ZaZlMfUYQQS5kQ4t/mzJS7Hg?= =?us-ascii?Q?89vWV7mZul6dLb9O80dLsq+P6RUNB3BjJRrb8h2spi02sMTuMyy6zQcckHeA?= =?us-ascii?Q?JzsotvgQfu7fmIatHEMtDZrr8sP5agvpczhu/vRMQuhaEAh6mwUaiGveV+/5?= =?us-ascii?Q?V05SCxNQSJdM1WjXwPbSkZh+gYutxbr0Rr17YP1zo0cFK4NOASusyIhZ69ca?= =?us-ascii?Q?VGw4f8hRXSytFLBCgsvCGrpPHuzKaCNsbhaYrTCLkXFpfaOgIKT4QO7dvLTQ?= =?us-ascii?Q?5bs/pUZP7BQ09pv+I7mpDr0s0UUup9hWcBGPfob6qTFK+dOnNIbDMFkMxeZh?= =?us-ascii?Q?5HUDOeE6nfw+JOWd/0ec3Hu+oLt1CAbCY+e4KQd+2SOhy/BZlcml6T8ijbXW?= =?us-ascii?Q?E1s0uZVuQzCyvn3TalfF6ehG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ut?= =?us-ascii?Q?omDvo+34YAb1ehXunDDIpD7XNBSTeuvMIPfPstJ1B1UL5xe7QV1pdc5gS8pv?= =?us-ascii?Q?rca6b6V5M/Qj8zXEZooZnW7fKSTnvyY/9y35TP+EAAqMU87Fnk/rw9geDx9g?= =?us-ascii?Q?WpiglsXIbIPHyJ77Z9f77sMIe3WnWsFVaD2Q5q+9ogBsVC5oTOZB5qbZkU+I?= =?us-ascii?Q?stSZ8Lx4/V8I7u+6pS7Zc4XMhUrNdlPg75Ty3+YimsLlunLM2DOEuH3auvWX?= =?us-ascii?Q?XQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e4207cfb-ca43-41c8-5084-08dbf65f7a07 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 13:30:13.5243 (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: 0zMThFbL6kD+ztXNNm1hxPrJCsU2V3TmmZRb5DWpUjrHNvR9NxLl67XhLuHx5B/s1IUptHjLO0KWMY2BgSvsR4EtiYuxkORhvqwXGgtOYLQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5167 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 Wed, Dec 06, 2023 at 07:23:51AM +0000, Sunil Kumar Kori wrote: > > -----Original Message----- > > From: Bruce Richardson > > Sent: Tuesday, December 5, 2023 8:21 PM > > To: dev@dpdk.org > > Cc: Sunil Kumar Kori ; david.marchand@redhat.com; > > Bruce Richardson > > Subject: [EXT] [PATCH 1/3] buildtools/dpdk-cmdline-gen: support optional > > parameters > > > > External Email > > > > ---------------------------------------------------------------------- > > Sometimes a user may want to have a command which takes an optional > > parameter. For commands with an optional constant string, this is no issue, > > as it can be configured as two separate commands, e.g. > > > > start > > start tx_first. > > > > However, if we want to have a variable parameter on the command, we hit > > issues, because variable tokens do not form part of the generated > > command names used for function and result-struct naming. To avoid > > duplicate name issues, we add a special syntax to allow the user to > > indicate that a particular variable parameter should be included in the > > name. Any leading variable names starting with a "__" will be included in > > command naming. > > > > This then allows us to have: > > > > start > > start tx_first > > start tx_first __n > > > > without hitting any naming conflicts. > > > It's a good option provided to user to choose name as per the need. I have another thought that how about providing flexibility to skip a token too along with implemented support. > Consider following example: > 1. ethdev dev mtu size > 2. ethdev dev promiscuous <(on,off)>enable > > So tokens and functions should be as cmd_ethdev_mtu_parsed() and cmd_ethdev_ promiscuous_parsed(). > Here token dev should be skipped. If it make sense, then please add this support too. > It does and at the same time it doesn't. :-) I understand how what you suggest would indeed lead to better function names. However, given that these are functions for cmdline, and unlikely to be ever called from regular code, how much does the function name matter, so long as it doesn't conflict with anything else? It was the avoiding name conflicts, more so than having better names, was the driving force for this patch. In the case you describe, if we take this patch, we can change "dev" to "__dev" to give you the functions: cmd_ethdev_dev_mtu_parsed() and cmd_ethdev_dev_promiscuous_parsed(). The extra "dev" is a little untidy, but then again if app isn't ever calling this directly, does it really matter? If we do want to have precise control over what the functions are called, rather than adding in lots of different tweak rules, I would instead look to see if there is some syntax we could use to specify directly the name to be used for the function and result structs. However, right now, I'd rather not implement this, as I'm not sure how to do so in a clean way. /Bruce