From patchwork Wed Nov 22 16:45:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Euan Bourke X-Patchwork-Id: 428 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 D781743382; Wed, 22 Nov 2023 17:47:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54227410F2; Wed, 22 Nov 2023 17:47:56 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 911CE4028C for ; Wed, 22 Nov 2023 17:45:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700671557; x=1732207557; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ahnGYkk5bg2rd2rAvQowzqBXWUGKX3gPifLoblv3T8=; b=Hfo9CRI9sDZCY9NPfFkXhbkRwwjCtPq2EuxtlKLrfDA+OWMJRjochK2F tB0ZKaCZOBJ4RtlKBvtMwZIf56FPpnrBUEeW9ETJ2wgBzC3MOBUpWh+tw rtyCYbUWPm3Eziq9FL0w5+Ae8vEdOh7aLYs5S30medHuY7HzFXboAD7vh IxCAqnOxIO7M7BtzzHh8COelV/tcxK6PHxJ4PiQpgZ0SOGlC5SQq6OHns /QfGuE/Iwofq/SQpwQrzt/t+esNmn4K41AiYjnAep3Azyha8StzWLJyXu GHK0O9qGB/OJ4Fx7+kcAaHgmBzS9sX8Ieb6fGz5HGywZGV7+VodZJyK2z Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="456415980" X-IronPort-AV: E=Sophos;i="6.04,219,1695711600"; d="scan'208";a="456415980" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 08:45:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="884685067" X-IronPort-AV: E=Sophos;i="6.04,219,1695711600"; d="scan'208";a="884685067" Received: from unknown (HELO silpixa00400630.ir.intel.com) ([10.237.213.151]) by fmsmga002.fm.intel.com with ESMTP; 22 Nov 2023 08:45:55 -0800 From: Euan Bourke To: dev@dpdk.org Cc: Euan Bourke Subject: [PATCH 24.03 0/4] add new command line argument parsing library Date: Wed, 22 Nov 2023 16:45:46 +0000 Message-Id: <20231122164550.3873633-1-euan.bourke@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 22 Nov 2023 17:47:54 +0100 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 A recent thread on the mailing list[1] discussed corelist and coremask parsing and the idea of a new library dedicated to command line parsing was mentioned[2]. As I had been working on a public corelist parsing API at the time, this patchset adds the library, along with the new APIs, edits to EAL functions to call the API instead of implementing their own, and changes to the dlb2 driver to call the API. The new APIs work similar to existing functions in EAL, however instead of filling a core array like this: [1, -1, -1, 2, 3] (a non -1 refers to an 'active core' at that index) It fills it like this: [0, 3, 4] (with the value at each index being an 'active core'). The new APIs will also return the number of cores contained in the passed corelist/coremask, so in the above example, 3 would be returned. Planned future work for the library contains more parsing functions such as a "core string parser" which would take a string and return whether its a corelist or coremask based on heuristics. This could then be passed into the appropriate function. There are also several functions in EAL that implement their own version of a corelist/coremask parser, so the plan is to rework those in future versions of this patch. [1] Link to start of thread: https://mails.dpdk.org/archives/dev/2023-November/280957.html [2] Link to the mention of a new library: https://mails.dpdk.org/archives/dev/2023-November/280966.html Euan Bourke (4): arg_parser: new library for command line parsing arg_parser: add new coremask parsing API eal: add support for new arg parsing library dlb2: add new arg parsing library API support .mailmap | 1 + MAINTAINERS | 5 + doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + drivers/event/dlb2/dlb2_priv.h | 4 +- drivers/event/dlb2/pf/base/dlb2_resource.c | 54 +++---- lib/arg_parser/arg_parser.c | 171 +++++++++++++++++++++ lib/arg_parser/meson.build | 7 + lib/arg_parser/rte_arg_parser.h | 99 ++++++++++++ lib/arg_parser/version.map | 11 ++ lib/eal/common/eal_common_options.c | 114 ++------------ lib/eal/meson.build | 2 +- lib/meson.build | 1 + 13 files changed, 334 insertions(+), 139 deletions(-) create mode 100644 lib/arg_parser/arg_parser.c create mode 100644 lib/arg_parser/meson.build create mode 100644 lib/arg_parser/rte_arg_parser.h create mode 100644 lib/arg_parser/version.map