Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/65142/?format=api
http://patches.dpdk.org/api/patches/65142/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1580121053-26083-3-git-send-email-hariprasad.govindharajan@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": "<1580121053-26083-3-git-send-email-hariprasad.govindharajan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1580121053-26083-3-git-send-email-hariprasad.govindharajan@intel.com", "date": "2020-01-27T10:30:53", "name": "[2/2] eal: add eal_parse_optionlist to parse user input", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e6884d4ecfd4afaf2f02a0e5e5a0e64e7a5f986e", "submitter": { "id": 1311, "url": "http://patches.dpdk.org/api/people/1311/?format=api", "name": "Hariprasad Govindharajan", "email": "hariprasad.govindharajan@intel.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1580121053-26083-3-git-send-email-hariprasad.govindharajan@intel.com/mbox/", "series": [ { "id": 8303, "url": "http://patches.dpdk.org/api/series/8303/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8303", "date": "2020-01-27T10:30:51", "name": "app/testpmd: add portlist option to the testpmd", "version": 1, "mbox": "http://patches.dpdk.org/series/8303/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/65142/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/65142/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 70ED9A04B3;\n\tMon, 27 Jan 2020 11:31:19 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 649C81BF87;\n\tMon, 27 Jan 2020 11:31:07 +0100 (CET)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by dpdk.org (Postfix) with ESMTP id 601AF1BF80\n for <dev@dpdk.org>; Mon, 27 Jan 2020 11:31:05 +0100 (CET)", "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 27 Jan 2020 02:31:05 -0800", "from silpixa00393944.ir.intel.com ([10.237.223.184])\n by orsmga008.jf.intel.com with ESMTP; 27 Jan 2020 02:31:04 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.70,369,1574150400\"; d=\"scan'208\";a=\"221694738\"", "From": "Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>", "To": "", "Cc": "dev@dpdk.org,\n Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>", "Date": "Mon, 27 Jan 2020 10:30:53 +0000", "Message-Id": "\n <1580121053-26083-3-git-send-email-hariprasad.govindharajan@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "\n <1580121053-26083-1-git-send-email-hariprasad.govindharajan@intel.com>", "References": "\n <1580121053-26083-1-git-send-email-hariprasad.govindharajan@intel.com>", "Subject": "[dpdk-dev] [PATCH 2/2] eal: add eal_parse_optionlist to parse user\n\tinput", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "In current version, there is a function which parses\nthe corelist based on user value. A new generic\nfunction eal_parse_optionlist is added which will\nparse corelist as well as similar user input so\nthat we can use it as a public API too.\n\nSigned-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>\n---\n lib/librte_eal/common/eal_common_options.c | 45 ++++++++++++++++++------------\n lib/librte_eal/common/include/rte_eal.h | 34 ++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 1 +\n 3 files changed, 62 insertions(+), 18 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 5920233..aa59f8b 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -571,33 +571,36 @@ eal_parse_service_corelist(const char *corelist)\n \treturn 0;\n }\n \n-static int\n-eal_parse_corelist(const char *corelist, int *cores)\n+int\n+eal_parse_optionlist(const char *list, int *values, int maxsize)\n {\n \tunsigned count = 0;\n \tchar *end = NULL;\n \tint min, max;\n \tint idx;\n \n-\tfor (idx = 0; idx < RTE_MAX_LCORE; idx++)\n-\t\tcores[idx] = -1;\n+\tif (list == NULL || values == NULL || maxsize < 0)\n+\t\treturn -1;\n+\n+\tfor (idx = 0; idx < maxsize; idx++)\n+\t\tvalues[idx] = -1;\n \n \t/* Remove all blank characters ahead */\n-\twhile (isblank(*corelist))\n-\t\tcorelist++;\n+\twhile (isblank(*list))\n+\t\tlist++;\n+\n+\tmin = maxsize;\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\twhile (isblank(*list))\n+\t\t\tlist++;\n+\t\tif (*list == '\\0')\n \t\t\treturn -1;\n \t\terrno = 0;\n-\t\tidx = strtol(corelist, &end, 10);\n+\t\tidx = strtol(list, &end, 10);\n \t\tif (errno || end == NULL)\n \t\t\treturn -1;\n-\t\tif (idx < 0 || idx >= RTE_MAX_LCORE)\n+\t\tif (idx < 0 || idx >= maxsize)\n \t\t\treturn -1;\n \t\twhile (isblank(*end))\n \t\t\tend++;\n@@ -605,18 +608,18 @@ eal_parse_corelist(const char *corelist, int *cores)\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\tif (min == maxsize)\n \t\t\t\tmin = idx;\n \t\t\tfor (idx = min; idx <= max; idx++) {\n-\t\t\t\tif (cores[idx] == -1) {\n-\t\t\t\t\tcores[idx] = count;\n+\t\t\t\tif (values[idx] == -1) {\n+\t\t\t\t\tvalues[idx] = count;\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\tmin = maxsize;\n \t\t} else\n \t\t\treturn -1;\n-\t\tcorelist = end + 1;\n+\t\tlist = end + 1;\n \t} while (*end != '\\0');\n \n \tif (count == 0)\n@@ -624,6 +627,12 @@ eal_parse_corelist(const char *corelist, int *cores)\n \treturn 0;\n }\n \n+static int\n+eal_parse_corelist(const char *corelist, int *cores)\n+{\n+\treturn eal_parse_optionlist(corelist, cores, RTE_MAX_LCORE);\n+}\n+\n /* Changes the lcore id of the master thread */\n static int\n eal_parse_master_lcore(const char *arg)\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 2f9ed29..567b754 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -71,6 +71,40 @@ enum rte_proc_type_t rte_eal_process_type(void);\n int rte_eal_iopl_init(void);\n \n /**\n+ * Parse the user input\n+ *\n+ * This function can be used to read and parse the user input\n+ * from the command line. For example, when the user specifies\n+ * corelist or port list this function will read the input\n+ * and set the forwarding cores or ports\n+ *\n+ * @param[in] list\n+ * String containing the user input. User can specify\n+ * in these formats 1,3,5 or 1-3 or 1-2,5 or 3,5-6.\n+ * For example, if the user wants to use all the available\n+ * 4 ports in his system, then the input can be 0-3 or 0,1,2,3.\n+ * If the user wants to use only the ports 1,2 then the input\n+ * is 1,2.\n+ * valid characters are '-' and ','\n+ * invalid chars like '.' or '#' will result in\n+ * EAL: Error - exiting with code: 1\n+ * Cause: Invalid fwd port list\n+ * @param[in] values\n+ * An array pointer, used by this function to set the\n+ * array contents to a positive value if they are listed\n+ * in the input\n+ * else sets it to -1\n+ * @param[in] maxsize\n+ * This is the maximum value the list string can contain\n+ * @return\n+ * -On success, returns 0.\n+ * -On failure, returns -1.\n+ */\n+__rte_experimental\n+int\n+eal_parse_optionlist(const char *list, int *values, int maxsize);\n+\n+/**\n * Initialize the Environment Abstraction Layer (EAL).\n *\n * This function is to be executed on the MASTER lcore only, as soon\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex e38d025..3d72df8 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -332,4 +332,5 @@ EXPERIMENTAL {\n \t# added in 19.11\n \trte_log_get_stream;\n \trte_mcfg_get_single_file_segments;\n+\teal_parse_optionlist;\n };\n", "prefixes": [ "2/2" ] }{ "id": 65142, "url": "