From patchwork Tue Nov 28 14:07:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Euan Bourke X-Patchwork-Id: 444 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 8A7D743402; Wed, 29 Nov 2023 17:06:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09080409FA; Wed, 29 Nov 2023 17:06:38 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 3844942D89 for ; Tue, 28 Nov 2023 15:08:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701180484; x=1732716484; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xjBusURUrvjgLo+hBoTbS17BhJ49OKh53HUN3Eq+stI=; b=OU2/ZO4uwirjWSa/W0/OtrqsO7psHLERgUWZcLEKEdVpCV4LUZTrD1aL bBLgzW2AXB+AlvRiZltsqdaTVjiywgyvEAb0j9cnKHwIBHF+/m89iDk91 awFKCzdBq+Oxn0vIYx4q2o+9aQj5QGvhwa1dFkN3cjqIx9x6UsmaZJtrS u25v/TrZ9u4wUDNw7D9cKxLC3rbF8v58cEmLQKF191VSlwRrB4YRiSvUV DRjJd18ASk58hxBDBnfJxHAcsIBvSI71tEt3+b6MGlivoViCz50z2vkuQ 9xFCJW0EZgaA/LKk3d9WhMHnh8+mDP+/8iZvXt5qLMbdWqyQvdjZtTg8O w==; X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="395747313" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="395747313" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 06:07:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="912450867" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="912450867" Received: from unknown (HELO silpixa00400630.ir.intel.com) ([10.237.213.151]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2023 06:07:47 -0800 From: Euan Bourke To: dev@dpdk.org Cc: Euan Bourke Subject: [PATCH 24.03 v2 0/5] add new command line argument parsing library Date: Tue, 28 Nov 2023 14:07:40 +0000 Message-Id: <20231128140745.595481-1-euan.bourke@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231122164550.3873633-1-euan.bourke@intel.com> References: <20231122164550.3873633-1-euan.bourke@intel.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 29 Nov 2023 17:06:36 +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]. 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 example applications that implement their own version of a corelist/coremask parser, so the plan is to rework those in future versions of this patch. [1] https://mails.dpdk.org/archives/dev/2023-November/280957.html [2] https://mails.dpdk.org/archives/dev/2023-November/280966.html 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 (5): 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 .mailmap | 1 + MAINTAINERS | 4 + 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 | 51 ++-- lib/arg_parser/arg_parser.c | 170 ++++++++++++ lib/arg_parser/meson.build | 7 + lib/arg_parser/rte_arg_parser.h | 98 +++++++ lib/arg_parser/version.map | 11 + lib/eal/common/eal_common_options.c | 291 +++++---------------- lib/eal/meson.build | 2 +- lib/meson.build | 2 + 13 files changed, 378 insertions(+), 267 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