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 3E21C43700; Fri, 15 Dec 2023 18:26:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E5304336F; Fri, 15 Dec 2023 18:26:43 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 01B9E402DA for ; Fri, 15 Dec 2023 18:26:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702661202; x=1734197202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BPIs8cEuMmJ1aGt2NRVrzF6AOARpFQSzSyFt9SqviyY=; b=EArE77gED/AbvCT9PHe2aFJSKEvzDg94Hpy8iUyd812+enH3NOZDlzCH +rR1N9uxyzVpFgJovE6lPa1r6qy6oOMxw4XLUhBtieyhl0PcUMwuAbZgg 3+33Fg4VpnS9FIzpxckqKNEM8meRNi/q8LxCbiGyKRUE1a5JgWrgDwTNf YbwS6Bj5QMU0SFhaByw/ycVCKiAjk4YLXSlKC67VUiRHd9EfkUYnLrf8L sfEJkUZ1noHVjK5fu+xqPtd9g0528nuWW2wKl8dnhGH7VCBJAZGan7cNt safLHp9i9SMfILlWTV6RcHbauys2JahNFpn2gWLeKTgCITLDCk0dq0G/F g==; X-IronPort-AV: E=McAfee;i="6600,9927,10925"; a="8662417" X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="8662417" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 09:26:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="22914234" Received: from unknown (HELO silpixa00400630.ir.intel.com) ([10.237.213.151]) by orviesa001.jf.intel.com with ESMTP; 15 Dec 2023 09:26:40 -0800 From: Euan Bourke To: dev@dpdk.org Cc: Euan Bourke Subject: [PATCH v4 0/8] add new command line argument parsing library Date: Fri, 15 Dec 2023 17:26:24 +0000 Message-Id: <20231215172632.3102502-1-euan.bourke@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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]. This patchset adds the library, along with the new APIs, and edits the existing EAL, DLB2 driver and some example application functions to use these APIs, rather than each implementing their own copies. The new APIs work similar to the 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. Also included in this patchest is a heuristic parser which searches for key markers in the core string, returning a enum value based off this search to indicate if a parameter is likely a coremask or a corelist. This heuristic function is also wrapped in a parser function allowing apps to handle both coremasks and corelists simultaneously. [1] https://mails.dpdk.org/archives/dev/2023-November/280957.html [2] https://mails.dpdk.org/archives/dev/2023-November/280966.html v4: * functions now return -EINVAL instead of -1. * enum moved to header file. * documentation changes for rte_arg_parse_arg_type() function. * minor changes for issues flagged during review. v3: * new 'combined core string parser' and 'heuristic parser' * changes to eventdev_pipeline and l3fwd-power example applications * various struct optimisations in arg_parser.c * fix for windows build relating to RTE_SWAP() * minor changes for issues flagged during review v2: * changes to EAL service core related parsers to call API. * various optimisations in core_bit related functions in arg_parser.c. * add lib to list for windows build. * minor changes for issues flagged during review. Euan Bourke (8): arg_parser: new library for command line parsing arg_parser: add new coremask parsing API eal: add support for new arg parsing library eal: update to service core related parsers event/dlb2: add new arg parsing library API support arg_parser: added common core string and heuristic parsers examples/eventdev_pipeline: update to call arg parser API examples/l3fwd-power: update to call arg parser API .mailmap | 1 + MAINTAINERS | 4 + doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + drivers/event/dlb2/dlb2_priv.h | 4 +- drivers/event/dlb2/pf/base/dlb2_resource.c | 51 ++-- examples/eventdev_pipeline/main.c | 66 +---- examples/eventdev_pipeline/pipeline_common.h | 1 + examples/l3fwd-power/perf_core.c | 52 +--- lib/arg_parser/arg_parser.c | 221 ++++++++++++++ lib/arg_parser/meson.build | 7 + lib/arg_parser/rte_arg_parser.h | 164 +++++++++++ lib/arg_parser/version.map | 13 + lib/eal/common/eal_common_options.c | 285 ++++--------------- lib/eal/meson.build | 2 +- lib/meson.build | 2 + 16 files changed, 510 insertions(+), 365 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 -- 2.34.1