Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134694/?format=api
http://patches.dpdk.org/api/patches/134694/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231128140745.595481-4-euan.bourke@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20231128140745.595481-4-euan.bourke@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231128140745.595481-4-euan.bourke@intel.com", "date": "2023-11-28T14:07:43", "name": "[24.03,v2,3/5] eal: add support for new arg parsing library", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "5aa2aafafa82230f4eae8633ee0221ebb9128702", "submitter": { "id": 3231, "url": "http://patches.dpdk.org/api/people/3231/?format=api", "name": "Euan Bourke", "email": "euan.bourke@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231128140745.595481-4-euan.bourke@intel.com/mbox/", "series": [ { "id": 30412, "url": "http://patches.dpdk.org/api/series/30412/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30412", "date": "2023-11-28T14:07:40", "name": "add new command line argument parsing library", "version": 2, "mbox": "http://patches.dpdk.org/series/30412/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/134694/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/134694/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2FEE443402;\n\tWed, 29 Nov 2023 17:07:01 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 772C342E40;\n\tWed, 29 Nov 2023 17:06:41 +0100 (CET)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 4D49C42D89\n for <dev@dpdk.org>; Tue, 28 Nov 2023 15:08:20 +0100 (CET)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Nov 2023 06:08:05 -0800", "from unknown (HELO silpixa00400630.ir.intel.com) ([10.237.213.151])\n by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2023 06:08:03 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1701180500; x=1732716500;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=VDhf5FB/kqu5Y1PkkCq5w5mK693GLL3rHOwzrWlAFBE=;\n b=NT6ShdFj0VMeOkh9AQI54MV76dGnADZyu9K+cJaI9515SVlv2ccktMeE\n cSjCs3wx3t7n+lMv3XkfO1CJheJ7zXnSFqLCw6PhT4S0UiuDrANfnrowE\n zuxxzhxE9p5F47RB/PQiP5v4atOEmrkNVFBVD6UM6VIpsoESyq3ZXsIxu\n qeLNIFXNVuaKklsYJYGymTu6xC6759RmuBw+6FG8Wdkgg28bTT93AqNKW\n wJE54awI8huIyFRUdob8r4HdwTFBmge0zeYOGbjHx2A8yS5jZ3HrzOV1f\n UvOCbKflIWv+2zrHLEAnx5YVdfnUHFW1DAd2Uw9sEvUENxfiP0Ur0DAND Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10907\"; a=\"395747466\"", "E=Sophos;i=\"6.04,234,1695711600\"; d=\"scan'208\";a=\"395747466\"", "E=McAfee;i=\"6600,9927,10907\"; a=\"912450889\"", "E=Sophos;i=\"6.04,234,1695711600\"; d=\"scan'208\";a=\"912450889\"" ], "X-ExtLoop1": "1", "From": "Euan Bourke <euan.bourke@intel.com>", "To": "dev@dpdk.org", "Cc": "Euan Bourke <euan.bourke@intel.com>", "Subject": "[PATCH 24.03 v2 3/5] eal: add support for new arg parsing library", "Date": "Tue, 28 Nov 2023 14:07:43 +0000", "Message-Id": "<20231128140745.595481-4-euan.bourke@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231128140745.595481-1-euan.bourke@intel.com>", "References": "<20231122164550.3873633-1-euan.bourke@intel.com>\n <20231128140745.595481-1-euan.bourke@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Mailman-Approved-At": "Wed, 29 Nov 2023 17:06:37 +0100", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Update to EAL functions relating to corelist and coremask parsing to\nsupport the new arg parsing library. Functions now call the API instead\nof implementing their own version.\n\nSigned-off-by: Euan Bourke <euan.bourke@intel.com>\n---\n lib/eal/common/eal_common_options.c | 114 ++++------------------------\n lib/eal/meson.build | 2 +-\n 2 files changed, 14 insertions(+), 102 deletions(-)", "diff": "diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c\nindex a6d21f1cba..7c89a1e18b 100644\n--- a/lib/eal/common/eal_common_options.c\n+++ b/lib/eal/common/eal_common_options.c\n@@ -30,6 +30,7 @@\n #include <rte_tailq.h>\n #include <rte_version.h>\n #include <rte_devargs.h>\n+#include <rte_arg_parser.h>\n #include <rte_memcpy.h>\n #ifndef RTE_EXEC_ENV_WINDOWS\n #include <rte_telemetry.h>\n@@ -706,7 +707,7 @@ update_lcore_config(int *cores)\n }\n \n static int\n-check_core_list(int *lcores, unsigned int count)\n+check_core_list(uint16_t *lcores, unsigned int count)\n {\n \tchar lcorestr[RTE_MAX_LCORE * 10];\n \tbool overflow = false;\n@@ -746,60 +747,18 @@ check_core_list(int *lcores, unsigned int count)\n int\n rte_eal_parse_coremask(const char *coremask, int *cores)\n {\n-\tconst char *coremask_orig = coremask;\n-\tint lcores[RTE_MAX_LCORE];\n-\tunsigned int count = 0;\n-\tint i, j, idx;\n-\tint val;\n-\tchar c;\n+\tint count;\n+\tuint16_t lcores[RTE_MAX_LCORE];\n+\tint idx;\n \n \tfor (idx = 0; idx < RTE_MAX_LCORE; idx++)\n \t\tcores[idx] = -1;\n-\tidx = 0;\n \n-\t/* Remove all blank characters ahead and after .\n-\t * Remove 0x/0X if exists.\n-\t */\n-\twhile (isblank(*coremask))\n-\t\tcoremask++;\n-\tif (coremask[0] == '0' && ((coremask[1] == 'x')\n-\t\t|| (coremask[1] == 'X')))\n-\t\tcoremask += 2;\n-\ti = strlen(coremask);\n-\twhile ((i > 0) && isblank(coremask[i - 1]))\n-\t\ti--;\n-\tif (i == 0) {\n-\t\tRTE_LOG(ERR, EAL, \"No lcores in coremask: [%s]\\n\",\n-\t\t\tcoremask_orig);\n-\t\treturn -1;\n-\t}\n+\t/* Call public coremask parsing API */\n+\tcount = rte_parse_coremask(coremask, lcores, RTE_MAX_LCORE);\n \n-\tfor (i = i - 1; i >= 0; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\tRTE_LOG(ERR, EAL, \"invalid characters in coremask: [%s]\\n\",\n-\t\t\t\tcoremask_orig);\n-\t\t\treturn -1;\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor (j = 0; j < BITS_PER_HEX; j++, idx++)\n-\t\t{\n-\t\t\tif ((1 << j) & val) {\n-\t\t\t\tif (count >= RTE_MAX_LCORE) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"Too many lcores provided. Cannot exceed RTE_MAX_LCORE (%d)\\n\",\n-\t\t\t\t\t\tRTE_MAX_LCORE);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t\tlcores[count++] = idx;\n-\t\t\t}\n-\t\t}\n-\t}\n-\tif (count == 0) {\n-\t\tRTE_LOG(ERR, EAL, \"No lcores in coremask: [%s]\\n\",\n-\t\t\tcoremask_orig);\n+\tif (count <= 0 || count > RTE_MAX_LCORE)\n \t\treturn -1;\n-\t}\n \n \tif (check_core_list(lcores, count))\n \t\treturn -1;\n@@ -898,64 +857,17 @@ eal_parse_service_corelist(const char *corelist)\n static int\n eal_parse_corelist(const char *corelist, int *cores)\n {\n-\tunsigned int count = 0, i;\n-\tint lcores[RTE_MAX_LCORE];\n-\tchar *end = NULL;\n-\tint min, max;\n+\tint count;\n+\tuint16_t lcores[RTE_MAX_LCORE];\n \tint idx;\n \n \tfor (idx = 0; idx < RTE_MAX_LCORE; idx++)\n \t\tcores[idx] = -1;\n \n-\t/* Remove all blank characters ahead */\n-\twhile (isblank(*corelist))\n-\t\tcorelist++;\n+\t/* Call public corelist parsing API */\n+\tcount = rte_parse_corelist(corelist, lcores, RTE_MAX_LCORE);\n \n-\t/* Get list of cores */\n-\tmin = -1;\n-\tdo {\n-\t\twhile (isblank(*corelist))\n-\t\t\tcorelist++;\n-\t\tif (*corelist == '\\0')\n-\t\t\treturn -1;\n-\t\terrno = 0;\n-\t\tidx = strtol(corelist, &end, 10);\n-\t\tif (errno || end == NULL)\n-\t\t\treturn -1;\n-\t\tif (idx < 0)\n-\t\t\treturn -1;\n-\t\twhile (isblank(*end))\n-\t\t\tend++;\n-\t\tif (*end == '-') {\n-\t\t\tmin = idx;\n-\t\t} else if ((*end == ',') || (*end == '\\0')) {\n-\t\t\tmax = idx;\n-\t\t\tif (min == -1)\n-\t\t\t\tmin = idx;\n-\t\t\tfor (idx = min; idx <= max; idx++) {\n-\t\t\t\tbool dup = false;\n-\n-\t\t\t\t/* Check if this idx is already present */\n-\t\t\t\tfor (i = 0; i < count; i++) {\n-\t\t\t\t\tif (lcores[i] == idx)\n-\t\t\t\t\t\tdup = true;\n-\t\t\t\t}\n-\t\t\t\tif (dup)\n-\t\t\t\t\tcontinue;\n-\t\t\t\tif (count >= RTE_MAX_LCORE) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"Too many lcores provided. Cannot exceed RTE_MAX_LCORE (%d)\\n\",\n-\t\t\t\t\t\tRTE_MAX_LCORE);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t\tlcores[count++] = idx;\n-\t\t\t}\n-\t\t\tmin = -1;\n-\t\t} else\n-\t\t\treturn -1;\n-\t\tcorelist = end + 1;\n-\t} while (*end != '\\0');\n-\n-\tif (count == 0)\n+\tif (count <= 0 || count > RTE_MAX_LCORE)\n \t\treturn -1;\n \n \tif (check_core_list(lcores, count))\ndiff --git a/lib/eal/meson.build b/lib/eal/meson.build\nindex e1d6c4cf17..52a22e2e66 100644\n--- a/lib/eal/meson.build\n+++ b/lib/eal/meson.build\n@@ -14,7 +14,7 @@ subdir(exec_env)\n \n subdir(arch_subdir)\n \n-deps += ['log', 'kvargs']\n+deps += ['log', 'kvargs', 'arg_parser']\n if not is_windows\n deps += ['telemetry']\n endif\n", "prefixes": [ "24.03", "v2", "3/5" ] }{ "id": 134694, "url": "