Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/131766/?format=api
http://patchwork.dpdk.org/api/patches/131766/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230921100832.2036256-4-skori@marvell.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": "<20230921100832.2036256-4-skori@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230921100832.2036256-4-skori@marvell.com", "date": "2023-09-21T10:08:23", "name": "[v5,03/12] app/graph: add parser utility APIs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "cb8688e68a3cde2913cdf2e12c03d0fb70b70bb7", "submitter": { "id": 1318, "url": "http://patchwork.dpdk.org/api/people/1318/?format=api", "name": "Sunil Kumar Kori", "email": "skori@marvell.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/20230921100832.2036256-4-skori@marvell.com/mbox/", "series": [ { "id": 29586, "url": "http://patchwork.dpdk.org/api/series/29586/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29586", "date": "2023-09-21T10:08:20", "name": "add CLI based graph application", "version": 5, "mbox": "http://patchwork.dpdk.org/series/29586/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/131766/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/131766/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 18039425F4;\n\tThu, 21 Sep 2023 12:09:01 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5267A40A7D;\n\tThu, 21 Sep 2023 12:08:49 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 8689940A72\n for <dev@dpdk.org>; Thu, 21 Sep 2023 12:08:46 +0200 (CEST)", "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 38L7cL1G001514 for <dev@dpdk.org>; Thu, 21 Sep 2023 03:08:45 -0700", "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3t7u4ddjx9-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 21 Sep 2023 03:08:45 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Thu, 21 Sep 2023 03:08:43 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Thu, 21 Sep 2023 03:08:43 -0700", "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id 63E1B5B693B;\n Thu, 21 Sep 2023 03:08:42 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=MqAdiW6fwUKlP3oWw4/ShTU4xBCMBOL0BqoMaCMdPkU=;\n b=c7CKit4NRqLzEst2dMGkWkv3yk/aVCDvZUKdy33Z02b2cG1QABvz48dNgjVZfDfPnGPJ\n 301x7vKnx8hyjBZyQHf8/LrwkXTeMGBlZygVVjf+HZIM/HaAeWZ7caBD52kVS1iYtdI3\n n8IfsZbH3cMzY79ArJSc53KM+fO8Uzr3UzYRPZnLtvqbuDBaNcvLrqJKFH0/1SA6QG4W\n tn527yGFS1Nf0P/TmxEU3irSIFXHJJW18sdZNxAzcGwxuiWquyxVQZGHaMHt0rrHGi58\n hFMaJi+KVVWnGXg3HBQGv7SizZfXW5No2LduYy4YHejj8mhQY/xz7jHgD0YI2HbGQTTB TA==", "From": "<skori@marvell.com>", "To": "Sunil Kumar Kori <skori@marvell.com>, Rakesh Kudurumalla\n <rkudurumalla@marvell.com>", "CC": "<dev@dpdk.org>", "Subject": "[PATCH v5 03/12] app/graph: add parser utility APIs", "Date": "Thu, 21 Sep 2023 15:38:23 +0530", "Message-ID": "<20230921100832.2036256-4-skori@marvell.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20230921100832.2036256-1-skori@marvell.com>", "References": "<20230919160455.1678716-1-skori@marvell.com>\n <20230921100832.2036256-1-skori@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-ORIG-GUID": "oz1Ntu77rdTfmjJiJxn-u5IUVESn9VeB", "X-Proofpoint-GUID": "oz1Ntu77rdTfmjJiJxn-u5IUVESn9VeB", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26\n definitions=2023-09-21_07,2023-09-20_01,2023-05-22_02", "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": "From: Sunil Kumar Kori <skori@marvell.com>\n\nIt adds some helper functions to parse IPv4, IPv6 and MAC addresses\nstring into respective datatype.\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\nSigned-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>\n---\n app/graph/meson.build | 1 +\n app/graph/module_api.h | 1 +\n app/graph/utils.c | 156 +++++++++++++++++++++++++++++++++++++++++\n app/graph/utils.h | 14 ++++\n 4 files changed, 172 insertions(+)\n create mode 100644 app/graph/utils.c\n create mode 100644 app/graph/utils.h", "diff": "diff --git a/app/graph/meson.build b/app/graph/meson.build\nindex 7e1ab0a214..ed3bcb1567 100644\n--- a/app/graph/meson.build\n+++ b/app/graph/meson.build\n@@ -12,4 +12,5 @@ sources = files(\n 'cli.c',\n 'conn.c',\n 'main.c',\n+ 'utils.c',\n )\ndiff --git a/app/graph/module_api.h b/app/graph/module_api.h\nindex b927de9470..acf63d15fa 100644\n--- a/app/graph/module_api.h\n+++ b/app/graph/module_api.h\n@@ -10,6 +10,7 @@\n \n #include \"cli.h\"\n #include \"conn.h\"\n+#include \"utils.h\"\n /*\n * Externs\n */\ndiff --git a/app/graph/utils.c b/app/graph/utils.c\nnew file mode 100644\nindex 0000000000..c7b6ae83cf\n--- /dev/null\n+++ b/app/graph/utils.c\n@@ -0,0 +1,156 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#include <ctype.h>\n+#include <errno.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+\n+#include <rte_common.h>\n+\n+#include \"module_api.h\"\n+\n+#define white_spaces_skip(pos)\t\t\t\\\n+({\t\t\t\t\t\t\\\n+\t__typeof__(pos) _p = (pos);\t\t\\\n+\tfor ( ; isspace(*_p); _p++)\t\t\\\n+\t\t;\t\t\t\t\\\n+\t_p;\t\t\t\t\t\\\n+})\n+\n+static void\n+hex_string_to_uint64(uint64_t *dst, const char *hexs)\n+{\n+\tchar buf[2] = {0};\n+\tuint8_t shift = 4;\n+\tint iter = 0;\n+\tchar c;\n+\n+\twhile ((c = *hexs++)) {\n+\t\tbuf[0] = c;\n+\t\t*dst |= (strtol(buf, NULL, 16) << shift);\n+\t\tshift -= 4;\n+\t\titer++;\n+\t\tif (iter == 2) {\n+\t\t\titer = 0;\n+\t\t\tshift = 4;\n+\t\t\tdst++;\n+\t\t}\n+\t}\n+}\n+\n+int\n+parser_uint64_read(uint64_t *value, const char *p)\n+{\n+\tchar *next;\n+\tuint64_t val;\n+\n+\tp = white_spaces_skip(p);\n+\tif (!isdigit(*p))\n+\t\treturn -EINVAL;\n+\n+\tval = strtoul(p, &next, 0);\n+\tif (p == next)\n+\t\treturn -EINVAL;\n+\n+\tp = next;\n+\tswitch (*p) {\n+\tcase 'T':\n+\t\tval *= 1024ULL;\n+\t\t/* fall through */\n+\tcase 'G':\n+\t\tval *= 1024ULL;\n+\t\t/* fall through */\n+\tcase 'M':\n+\t\tval *= 1024ULL;\n+\t\t/* fall through */\n+\tcase 'k':\n+\tcase 'K':\n+\t\tval *= 1024ULL;\n+\t\tp++;\n+\t\tbreak;\n+\t}\n+\n+\tp = white_spaces_skip(p);\n+\tif (*p != '\\0')\n+\t\treturn -EINVAL;\n+\n+\t*value = val;\n+\treturn 0;\n+}\n+\n+int\n+parser_uint32_read(uint32_t *value, const char *p)\n+{\n+\tuint64_t val = 0;\n+\tint rc = parser_uint64_read(&val, p);\n+\n+\tif (rc < 0)\n+\t\treturn rc;\n+\n+\tif (val > UINT32_MAX)\n+\t\treturn -ERANGE;\n+\n+\t*value = val;\n+\treturn 0;\n+}\n+\n+int\n+parser_ip4_read(uint32_t *value, char *p)\n+{\n+\tuint8_t shift = 24;\n+\tuint32_t ip = 0;\n+\tchar *token;\n+\n+\ttoken = strtok(p, \".\");\n+\twhile (token != NULL) {\n+\t\tip |= (((uint32_t)strtoul(token, NULL, 10)) << shift);\n+\t\ttoken = strtok(NULL, \".\");\n+\t\tshift -= 8;\n+\t}\n+\n+\t*value = ip;\n+\n+\treturn 0;\n+}\n+\n+int\n+parser_ip6_read(uint8_t *value, char *p)\n+{\n+\tuint64_t val = 0;\n+\tchar *token;\n+\n+\ttoken = strtok(p, \":\");\n+\twhile (token != NULL) {\n+\t\thex_string_to_uint64(&val, token);\n+\t\t*value = val;\n+\t\ttoken = strtok(NULL, \":\");\n+\t\tvalue++;\n+\t\tval = 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+parser_mac_read(uint64_t *value, char *p)\n+{\n+\tuint64_t mac = 0, val = 0;\n+\tuint8_t shift = 40;\n+\tchar *token;\n+\n+\ttoken = strtok(p, \":\");\n+\twhile (token != NULL) {\n+\t\thex_string_to_uint64(&val, token);\n+\t\tmac |= val << shift;\n+\t\ttoken = strtok(NULL, \":\");\n+\t\tshift -= 8;\n+\t\tval = 0;\n+\t}\n+\n+\t*value = mac;\n+\n+\treturn 0;\n+}\ndiff --git a/app/graph/utils.h b/app/graph/utils.h\nnew file mode 100644\nindex 0000000000..0ebb5de55a\n--- /dev/null\n+++ b/app/graph/utils.h\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2023 Marvell.\n+ */\n+\n+#ifndef APP_GRAPH_UTILS_H\n+#define APP_GRAPH_UTILS_H\n+\n+int parser_uint64_read(uint64_t *value, const char *p);\n+int parser_uint32_read(uint32_t *value, const char *p);\n+int parser_ip4_read(uint32_t *value, char *p);\n+int parser_ip6_read(uint8_t *value, char *p);\n+int parser_mac_read(uint64_t *value, char *p);\n+\n+#endif\n", "prefixes": [ "v5", "03/12" ] }{ "id": 131766, "url": "