From patchwork Thu Nov 2 17:28:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 351 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 7BD9543270; Thu, 2 Nov 2023 18:33:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3711427DA; Thu, 2 Nov 2023 18:32:54 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mails.dpdk.org (Postfix) with ESMTP id 23C9642D78 for ; Thu, 2 Nov 2023 18:32:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698946374; x=1730482374; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=T1N0tBjHr8bFOESq0oU6cFHTyPQTgwWLjUTOW2rOTHo=; b=GJfMyJuj9Eer2UAkijOWQYlt1SI0I38fP0ufDPboFkkgYrF2KNbOEOWo oOu4rHdkl7/4qv9SVoJFxHuo8VEYatIlqN63XD8qozzjQAc0e1DxRZPDq c46CsuBZQk/8VgKY+HRJHu2zCK201Usnkx5VYY17m1dliHiAh+vmsP/O5 AdWdrHreUxYD5xFw9tMJ08f4G0qNZLMIPMWpxBVkBMghLMDGwKZhqvwwK e/ZqbgouIUKXAP10505yzeShDfQni613JiQRStAAsTgdyt5JB6ciIy+mm G23JmXqEJe0lwnWmbxyiphZXVvj83ob38hZ9B95CvAMDngOBxfYqttGKt Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="1645193" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="1645193" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 10:28:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="878330460" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="878330460" Received: from silpixa00401385.ir.intel.com ([10.237.214.164]) by fmsmga002.fm.intel.com with ESMTP; 02 Nov 2023 10:28:58 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [24.03 RFC 0/3] Add argument manipulation library Date: Thu, 2 Nov 2023 17:28:46 +0000 Message-Id: <20231102172849.7400-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 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 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