Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96283/?format=api
http://patchwork.dpdk.org/api/patches/96283/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210726115137.6994-2-konstantin.ananyev@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": "<20210726115137.6994-2-konstantin.ananyev@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210726115137.6994-2-konstantin.ananyev@intel.com", "date": "2021-07-26T11:51:36", "name": "[v2,1/2] app/acl: allow comment and empty lines", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "e2e1ca2cbf5884d78cf4ac9403d28aa7d081b06c", "submitter": { "id": 33, "url": "http://patchwork.dpdk.org/api/people/33/?format=api", "name": "Ananyev, Konstantin", "email": "konstantin.ananyev@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/20210726115137.6994-2-konstantin.ananyev@intel.com/mbox/", "series": [ { "id": 17991, "url": "http://patchwork.dpdk.org/api/series/17991/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17991", "date": "2021-07-26T11:51:35", "name": "app/acl: help to automate testing", "version": 2, "mbox": "http://patchwork.dpdk.org/series/17991/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/96283/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/96283/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 84F14A0C47;\n\tMon, 26 Jul 2021 13:52:27 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6F7C4410E1;\n\tMon, 26 Jul 2021 13:52:27 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 35C6340DDA\n for <dev@dpdk.org>; Mon, 26 Jul 2021 13:52:25 +0200 (CEST)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Jul 2021 04:52:24 -0700", "from sivswdev08.ir.intel.com ([10.237.217.47])\n by fmsmga008.fm.intel.com with ESMTP; 26 Jul 2021 04:52:23 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10056\"; a=\"210326656\"", "E=Sophos;i=\"5.84,270,1620716400\"; d=\"scan'208\";a=\"210326656\"", "E=Sophos;i=\"5.84,270,1620716400\"; d=\"scan'208\";a=\"473661387\"" ], "X-ExtLoop1": "1", "From": "Konstantin Ananyev <konstantin.ananyev@intel.com>", "To": "dev@dpdk.org", "Cc": "Konstantin Ananyev <konstantin.ananyev@intel.com>", "Date": "Mon, 26 Jul 2021 12:51:36 +0100", "Message-Id": "<20210726115137.6994-2-konstantin.ananyev@intel.com>", "X-Mailer": "git-send-email 2.18.0", "In-Reply-To": "<20210726115137.6994-1-konstantin.ananyev@intel.com>", "References": "<20210518112619.4237-1-konstantin.ananyev@intel.com>\n <20210726115137.6994-1-konstantin.ananyev@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 1/2] app/acl: allow comment and empty lines", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Allow comment (lines starting with '#') and empty lines in input\n(rules, traces) files. These lines will be just skipped and shouldn't\naffect the result anyhow.\n\nSigned-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n app/test-acl/main.c | 51 +++++++++++++++++++++++++++++++++++++--------\n 1 file changed, 42 insertions(+), 9 deletions(-)", "diff": "diff --git a/app/test-acl/main.c b/app/test-acl/main.c\nindex 2cb2fe2579..c2de18770d 100644\n--- a/app/test-acl/main.c\n+++ b/app/test-acl/main.c\n@@ -48,6 +48,8 @@\n \n #define\tRULE_NUM\t\t0x10000\n \n+#define COMMENT_LEAD_CHAR\t'#'\n+\n enum {\n \tDUMP_NONE,\n \tDUMP_SEARCH,\n@@ -472,13 +474,28 @@ parse_cb_ipv6_trace(char *str, struct ipv6_5tuple *v)\n \treturn 0;\n }\n \n+/* Bypass comment and empty lines */\n+static int\n+skip_line(const char *buf)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; isspace(buf[i]) != 0; i++)\n+\t\t;\n+\n+\tif (buf[i] == 0 || buf[i] == COMMENT_LEAD_CHAR)\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n static void\n tracef_init(void)\n {\n \tstatic const char name[] = APP_NAME;\n \tFILE *f;\n \tsize_t sz;\n-\tuint32_t n;\n+\tuint32_t i, k, n;\n \tstruct ipv4_5tuple *v;\n \tstruct ipv6_5tuple *w;\n \n@@ -497,27 +514,36 @@ tracef_init(void)\n \n \tv = config.traces;\n \tw = config.traces;\n-\tfor (n = 0; n != config.nb_traces; n++) {\n+\tk = 0;\n+\tn = 0;\n+\tfor (i = 0; n != config.nb_traces; i++) {\n \n \t\tif (fgets(line, sizeof(line), f) == NULL)\n \t\t\tbreak;\n \n+\t\tif (skip_line(line) != 0) {\n+\t\t\tk++;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tn = i - k;\n+\n \t\tif (config.ipv6) {\n \t\t\tif (parse_cb_ipv6_trace(line, w + n) != 0)\n \t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\"%s: failed to parse ipv6 trace \"\n \t\t\t\t\t\"record at line %u\\n\",\n-\t\t\t\t\tconfig.trace_file, n + 1);\n+\t\t\t\t\tconfig.trace_file, i + 1);\n \t\t} else {\n \t\t\tif (parse_cb_ipv4_trace(line, v + n) != 0)\n \t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\"%s: failed to parse ipv4 trace \"\n \t\t\t\t\t\"record at line %u\\n\",\n-\t\t\t\t\tconfig.trace_file, n + 1);\n+\t\t\t\t\tconfig.trace_file, i + 1);\n \t\t}\n \t}\n \n-\tconfig.used_traces = n;\n+\tconfig.used_traces = i - k;\n \tfclose(f);\n }\n \n@@ -727,20 +753,27 @@ static int\n add_cb_rules(FILE *f, struct rte_acl_ctx *ctx)\n {\n \tint rc;\n-\tuint32_t n;\n+\tuint32_t i, k, n;\n \tstruct acl_rule v;\n \tparse_5tuple parser;\n \n \tmemset(&v, 0, sizeof(v));\n \tparser = (config.ipv6 != 0) ? parse_cb_ipv6_rule : parse_cb_ipv4_rule;\n \n-\tfor (n = 1; fgets(line, sizeof(line), f) != NULL; n++) {\n+\tk = 0;\n+\tfor (i = 1; fgets(line, sizeof(line), f) != NULL; i++) {\n+\n+\t\tif (skip_line(line) != 0) {\n+\t\t\tk++;\n+\t\t\tcontinue;\n+\t\t}\n \n+\t\tn = i - k;\n \t\trc = parser(line, &v);\n \t\tif (rc != 0) {\n \t\t\tRTE_LOG(ERR, TESTACL, \"line %u: parse_cb_ipv4vlan_rule\"\n \t\t\t\t\" failed, error code: %d (%s)\\n\",\n-\t\t\t\tn, rc, strerror(-rc));\n+\t\t\t\ti, rc, strerror(-rc));\n \t\t\treturn rc;\n \t\t}\n \n@@ -753,7 +786,7 @@ add_cb_rules(FILE *f, struct rte_acl_ctx *ctx)\n \t\tif (rc != 0) {\n \t\t\tRTE_LOG(ERR, TESTACL, \"line %u: failed to add rules \"\n \t\t\t\t\"into ACL context, error code: %d (%s)\\n\",\n-\t\t\t\tn, rc, strerror(-rc));\n+\t\t\t\ti, rc, strerror(-rc));\n \t\t\treturn rc;\n \t\t}\n \t}\n", "prefixes": [ "v2", "1/2" ] }{ "id": 96283, "url": "