Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134932/?format=api
http://patchwork.dpdk.org/api/patches/134932/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231207161818.2590661-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": "<20231207161818.2590661-5-euan.bourke@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231207161818.2590661-5-euan.bourke@intel.com", "date": "2023-12-07T16:18:14", "name": "[v3,4/8] eal: update to service core related parsers", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1d7ed865ae6ca8a5ed7106b1487a80e34749d03f", "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/20231207161818.2590661-5-euan.bourke@intel.com/mbox/", "series": [ { "id": 30478, "url": "http://patchwork.dpdk.org/api/series/30478/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30478", "date": "2023-12-07T16:18:10", "name": "add new command line argument parsing library", "version": 3, "mbox": "http://patchwork.dpdk.org/series/30478/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/134932/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/134932/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 B5BCF4369D;\n\tThu, 7 Dec 2023 17:19:09 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B499642F45;\n\tThu, 7 Dec 2023 17:18:43 +0100 (CET)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 71B0242F37\n for <dev@dpdk.org>; Thu, 7 Dec 2023 17:18:41 +0100 (CET)", "from orsmga007.jf.intel.com ([10.7.209.58])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Dec 2023 08:18:40 -0800", "from unknown (HELO silpixa00400630.ir.intel.com) ([10.237.213.151])\n by orsmga007.jf.intel.com with ESMTP; 07 Dec 2023 08:18:39 -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=1701965921; x=1733501921;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=LVghYsSuh7gYwi/527BOt+d4xJ7IPnG1RmWH9spLqnc=;\n b=SnpQVg4RYfj2ZArFWA+/UXOpZuARu7RdmIAfwdQCOMlTaji5Kq86L9WN\n OncAGmA4i0IHkAeFYSC1yjiW4xYUjTqdnahNRpzl3WIoqY4lE7Dg+l9ee\n MUd5uvDSTvH0DbzXsFi81vhaBoGVUM375wUZ8kTiJOHQnENNkgHd+DiNf\n VHK7E2qekrmIbscgJYeNhfWXFBTpvFr9/FkuWQRqlBN+E4+6FkGRhNzUT\n p1WhFkvZnUT2ZhLUuvTld8H+wG1c4RxhN8ZxXSB21tqmbtH6KLgfzEGMN\n z98q/ClPGBdjr6bEe/wEQmPREezY9hpx+2hz3yVpF5KFUCjG1pdsyBGpq A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10917\"; a=\"397048617\"", "E=Sophos;i=\"6.04,256,1695711600\"; d=\"scan'208\";a=\"397048617\"", "E=McAfee;i=\"6600,9927,10917\"; a=\"765153974\"", "E=Sophos;i=\"6.04,256,1695711600\"; d=\"scan'208\";a=\"765153974\"" ], "X-ExtLoop1": "1", "From": "Euan Bourke <euan.bourke@intel.com>", "To": "dev@dpdk.org", "Cc": "Euan Bourke <euan.bourke@intel.com>", "Subject": "[PATCH v3 4/8] eal: update to service core related parsers", "Date": "Thu, 7 Dec 2023 16:18:14 +0000", "Message-Id": "<20231207161818.2590661-5-euan.bourke@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231207161818.2590661-1-euan.bourke@intel.com>", "References": "<20231207161818.2590661-1-euan.bourke@intel.com>", "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 <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 | 171 +++++++---------------------\n 1 file changed, 41 insertions(+), 130 deletions(-)", "diff": "diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c\nindex 60ba12a368..d44654f621 100644\n--- a/lib/eal/common/eal_common_options.c\n+++ b/lib/eal/common/eal_common_options.c\n@@ -573,97 +573,49 @@ 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+\tcount = rte_arg_parse_coremask(coremask, cores, RTE_DIM(cores));\n+\n+\tif (count == 0 || count == -1)\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+\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\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 \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-\n-\t\t\t\tif (cfg->lcore_role[idx] == ROLE_RTE)\n-\t\t\t\t\ttaken_lcore_count++;\n-\n-\t\t\t\tlcore_config[idx].core_role = ROLE_SERVICE;\n-\t\t\t\tcount++;\n-\t\t\t}\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 +732,29 @@ 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+\tcount = rte_arg_parse_corelist(corelist, cores, RTE_DIM(cores));\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+\tif (count == 0 || count == -1)\n+\t\treturn -1;\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+\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": [ "v3", "4/8" ] }{ "id": 134932, "url": "