Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134695/?format=api
http://patchwork.dpdk.org/api/patches/134695/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231128140745.595481-5-euan.bourke@intel.com/", "project": { "id": 1, "url": "http://patchwork.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-5-euan.bourke@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231128140745.595481-5-euan.bourke@intel.com", "date": "2023-11-28T14:07:44", "name": "[24.03,v2,4/5] eal: update to service core related parsers", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "5dbc5b9d6c7ad45ad717d4b3d07a9138312fbbb8", "submitter": { "id": 3231, "url": "http://patchwork.dpdk.org/api/people/3231/?format=api", "name": "Euan Bourke", "email": "euan.bourke@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231128140745.595481-5-euan.bourke@intel.com/mbox/", "series": [ { "id": 30412, "url": "http://patchwork.dpdk.org/api/series/30412/?format=api", "web_url": "http://patchwork.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://patchwork.dpdk.org/series/30412/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/134695/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/134695/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 884DD43402;\n\tWed, 29 Nov 2023 17:07:09 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 893A842E4B;\n\tWed, 29 Nov 2023 17:06:42 +0100 (CET)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 13D0D42D89\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:07 -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:06 -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=1701180501; x=1732716501;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=tRpOZFtjLKYGr1rIFCT8IXRe2jnLTQQzM3S0E1dnOZY=;\n b=Cwn8dtvJlA4+hj3h0IQLUxxdcARdoQfhbUAdPLCO9/Dqflp0ObSCKPu5\n RSI0LYRQlyiDbbiBpqSAPf9TH4WTt0Cq3ikPE1ucf/cMK6b4NKr0izj+S\n jJEdDSxKXa3hyFPn9fIosA1IIq0oZLM1jkwR7gojbzek9Xlq/2vggF3Gd\n vcjqB4afuBJR6MjwAwU+Eah6aixsdaQmC8p6cYkHyo7sg7cK64ncYYQBD\n twyeNLvZbSforwuC6UFlg00xFLgXRQogcICGkLwayz8KSgdAT408NrFgO\n 4IYaALzm6aP96m1qTyu1XCmrZhvP2ZuIRjPYFvs23C74M5yy1Uhf2/Uy8 A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10907\"; a=\"395747492\"", "E=Sophos;i=\"6.04,234,1695711600\"; d=\"scan'208\";a=\"395747492\"", "E=McAfee;i=\"6600,9927,10907\"; a=\"912450894\"", "E=Sophos;i=\"6.04,234,1695711600\"; d=\"scan'208\";a=\"912450894\"" ], "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 4/5] eal: update to service core related parsers", "Date": "Tue, 28 Nov 2023 14:07:44 +0000", "Message-Id": "<20231128140745.595481-5-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": "Updates to the parse service cores functions in EAL to call the arg\nparser API instead of implementing its own versions.\n\nSigned-off-by: Euan Bourke <euan.bourke@intel.com>\n---\n lib/eal/common/eal_common_options.c | 177 ++++++++--------------------\n 1 file changed, 47 insertions(+), 130 deletions(-)", "diff": "diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c\nindex 7c89a1e18b..bf70d22975 100644\n--- a/lib/eal/common/eal_common_options.c\n+++ b/lib/eal/common/eal_common_options.c\n@@ -573,97 +573,52 @@ eal_plugins_init(void)\n * the global configuration (core role and core count) with the parsed\n * value.\n */\n-static int xdigit2val(unsigned char c)\n-{\n-\tint val;\n-\n-\tif (isdigit(c))\n-\t\tval = c - '0';\n-\telse if (isupper(c))\n-\t\tval = c - 'A' + 10;\n-\telse\n-\t\tval = c - 'a' + 10;\n-\treturn val;\n-}\n-\n static int\n eal_parse_service_coremask(const char *coremask)\n {\n \tstruct rte_config *cfg = rte_eal_get_configuration();\n-\tint i, j, idx = 0;\n-\tunsigned int count = 0;\n-\tchar c;\n-\tint val;\n+\tuint16_t cores[RTE_MAX_LCORE];\n+\tint64_t count;\n \tuint32_t taken_lcore_count = 0;\n \n-\tif (coremask == NULL)\n-\t\treturn -1;\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-\n-\tif (i == 0)\n-\t\treturn -1;\n-\n-\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\treturn -1;\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE;\n-\t\t\t\tj++, idx++) {\n-\t\t\tif ((1 << j) & val) {\n-\t\t\t\t/* handle main lcore already parsed */\n-\t\t\t\tuint32_t lcore = idx;\n-\t\t\t\tif (main_lcore_parsed &&\n-\t\t\t\t\t\tcfg->main_lcore == lcore) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\t\t\t\"lcore %u is main lcore, cannot use as service core\\n\",\n-\t\t\t\t\t\tidx);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n+\tfor (uint16_t idx = 0; idx < RTE_DIM(cores); idx++)\n+\t\tcores[idx] = -1;\n \n-\t\t\t\tif (eal_cpu_detected(idx) == 0) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\t\t\t\"lcore %u unavailable\\n\", idx);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n+\tcount = rte_parse_coremask(coremask, cores, RTE_DIM(cores));\n \n-\t\t\t\tif (cfg->lcore_role[idx] == ROLE_RTE)\n-\t\t\t\t\ttaken_lcore_count++;\n+\tif (count == 0 || count == -1)\n+\t\treturn -1;\n \n-\t\t\t\tlcore_config[idx].core_role = ROLE_SERVICE;\n-\t\t\t\tcount++;\n-\t\t\t}\n+\tfor (int i = 0; i < count; i++) {\n+\t\tuint32_t lcore = cores[i];\n+\t\tif (main_lcore_parsed &&\n+\t\t\t\tcfg->main_lcore == lcore) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"lcore %u is main lcore, cannot use as service core\\n\",\n+\t\t\t\tcores[i]);\n+\t\t\treturn -1;\n \t\t}\n-\t}\n \n-\tfor (; i >= 0; i--)\n-\t\tif (coremask[i] != '0')\n+\t\tif (eal_cpu_detected(cores[i]) == 0) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"lcore %u unavailable\\n\", cores[i]);\n \t\t\treturn -1;\n+\t\t}\n \n-\tfor (; idx < RTE_MAX_LCORE; idx++)\n-\t\tlcore_config[idx].core_index = -1;\n-\n-\tif (count == 0)\n-\t\treturn -1;\n+\t\tif (cfg->lcore_role[cores[i]] == ROLE_RTE)\n+\t\t\ttaken_lcore_count++;\n \n+\t\tlcore_config[cores[i]].core_role = ROLE_SERVICE;\n+\t}\n \tif (core_parsed && taken_lcore_count != count) {\n \t\tRTE_LOG(WARNING, EAL,\n-\t\t\t\"Not all service cores are in the coremask. \"\n+\t\t\t\"Not all service cores were in the coremask. \"\n \t\t\t\"Please ensure -c or -l includes service cores\\n\");\n \t}\n \n+\tfor (uint16_t j = count*4; j < RTE_MAX_LCORE; j++)\n+\t\tlcore_config[j].core_index = -1;\n+\n \tcfg->service_lcore_count = count;\n \treturn 0;\n }\n@@ -780,70 +735,32 @@ static int\n eal_parse_service_corelist(const char *corelist)\n {\n \tstruct rte_config *cfg = rte_eal_get_configuration();\n-\tint i;\n-\tunsigned count = 0;\n-\tchar *end = NULL;\n-\tuint32_t min, max, idx;\n+\tint64_t i, count;\n+\tuint16_t cores[RTE_MAX_LCORE];\n \tuint32_t taken_lcore_count = 0;\n \n-\tif (corelist == NULL)\n-\t\treturn -1;\n+\tfor (uint16_t idx = 0; idx < RTE_DIM(cores); idx++)\n+\t\tcores[idx] = -1;\n \n-\t/* Remove all blank characters ahead and after */\n-\twhile (isblank(*corelist))\n-\t\tcorelist++;\n-\ti = strlen(corelist);\n-\twhile ((i > 0) && isblank(corelist[i - 1]))\n-\t\ti--;\n+\tcount = rte_parse_corelist(corelist, cores, RTE_DIM(cores));\n \n-\t/* Get list of cores */\n-\tmin = RTE_MAX_LCORE;\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 = strtoul(corelist, &end, 10);\n-\t\tif (errno || end == NULL)\n-\t\t\treturn -1;\n-\t\tif (idx >= RTE_MAX_LCORE)\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 == RTE_MAX_LCORE)\n-\t\t\t\tmin = idx;\n-\t\t\tfor (idx = min; idx <= max; idx++) {\n-\t\t\t\tif (cfg->lcore_role[idx] != ROLE_SERVICE) {\n-\t\t\t\t\t/* handle main lcore already parsed */\n-\t\t\t\t\tuint32_t lcore = idx;\n-\t\t\t\t\tif (cfg->main_lcore == lcore &&\n-\t\t\t\t\t\t\tmain_lcore_parsed) {\n-\t\t\t\t\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\t\t\t\t\"Error: lcore %u is main lcore, cannot use as service core\\n\",\n-\t\t\t\t\t\t\tidx);\n-\t\t\t\t\t\treturn -1;\n-\t\t\t\t\t}\n-\t\t\t\t\tif (cfg->lcore_role[idx] == ROLE_RTE)\n-\t\t\t\t\t\ttaken_lcore_count++;\n-\n-\t\t\t\t\tlcore_config[idx].core_role =\n-\t\t\t\t\t\t\tROLE_SERVICE;\n-\t\t\t\t\tcount++;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tmin = RTE_MAX_LCORE;\n-\t\t} else\n+\tif (count == 0 || count == -1)\n+\t\treturn -1;\n+\n+\tfor (i = 0; i < count; i++) {\n+\t\tuint32_t lcore = cores[i];\n+\t\tif (cfg->main_lcore == lcore &&\n+\t\t\t\tmain_lcore_parsed) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"Error: lcore %u is main lcore, cannot use as service core\\n\",\n+\t\t\t\tcores[i]);\n \t\t\treturn -1;\n-\t\tcorelist = end + 1;\n-\t} while (*end != '\\0');\n+\t\t}\n+\t\tif (cfg->lcore_role[cores[i]] == ROLE_RTE)\n+\t\t\ttaken_lcore_count++;\n \n-\tif (count == 0)\n-\t\treturn -1;\n+\t\tlcore_config[cores[i]].core_role = ROLE_SERVICE;\n+\t}\n \n \tif (core_parsed && taken_lcore_count != count) {\n \t\tRTE_LOG(WARNING, EAL,\n", "prefixes": [ "24.03", "v2", "4/5" ] }{ "id": 134695, "url": "