Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/47744/?format=api
http://patchwork.dpdk.org/api/patches/47744/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1541158623-29742-10-git-send-email-cristian.dumitrescu@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": "<1541158623-29742-10-git-send-email-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1541158623-29742-10-git-send-email-cristian.dumitrescu@intel.com", "date": "2018-11-02T11:37:01", "name": "[10/12] examples/ip_pipeline: support rule time read", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "f71041a27af54c3b0f485cd7c78142ac7d977847", "submitter": { "id": 19, "url": "http://patchwork.dpdk.org/api/people/19/?format=api", "name": "Cristian Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "delegate": { "id": 10018, "url": "http://patchwork.dpdk.org/api/users/10018/?format=api", "username": "cristian_dumitrescu", "first_name": "Cristian", "last_name": "Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1541158623-29742-10-git-send-email-cristian.dumitrescu@intel.com/mbox/", "series": [ { "id": 2226, "url": "http://patchwork.dpdk.org/api/series/2226/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2226", "date": "2018-11-02T11:36:52", "name": "[01/12] examples/ip_pipeline: add rule list per table", "version": 1, "mbox": "http://patchwork.dpdk.org/series/2226/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/47744/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/47744/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B2A911B46F;\n\tFri, 2 Nov 2018 12:37:22 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 59B6D1B42B\n\tfor <dev@dpdk.org>; Fri, 2 Nov 2018 12:37:16 +0100 (CET)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Nov 2018 04:37:16 -0700", "from silpixa00382658.ir.intel.com ([10.237.223.29])\n\tby orsmga002.jf.intel.com with ESMTP; 02 Nov 2018 04:37:15 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,455,1534834800\"; d=\"scan'208\";a=\"105381812\"", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Cc": "Jasvinder Singh <jasvinder.singh@intel.com>", "Date": "Fri, 2 Nov 2018 11:37:01 +0000", "Message-Id": "<1541158623-29742-10-git-send-email-cristian.dumitrescu@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com>", "References": "<1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com>", "Subject": "[dpdk-dev] [PATCH 10/12] examples/ip_pipeline: support rule time\n\tread", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add support for the table rule timestamp read operation.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\n---\n examples/ip_pipeline/cli.c | 106 ++++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/pipeline.h | 7 +++\n examples/ip_pipeline/thread.c | 96 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 209 insertions(+)", "diff": "diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c\nindex 6561152..552e0df 100644\n--- a/examples/ip_pipeline/cli.c\n+++ b/examples/ip_pipeline/cli.c\n@@ -5407,6 +5407,92 @@ cmd_pipeline_table_rule_ttl_read(char **tokens,\n \t\tstats.n_packets);\n }\n \n+static const char cmd_pipeline_table_rule_time_read_help[] =\n+\"pipeline <pipeline_name> table <table_id> rule read time\\n\"\n+\" match <match>\\n\";\n+\n+static void\n+cmd_pipeline_table_rule_time_read(char **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct table_rule_match m;\n+\tchar *pipeline_name;\n+\tuint64_t timestamp;\n+\tuint32_t table_id, n_tokens_parsed;\n+\tint status;\n+\n+\tif (n_tokens < 7) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"table\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"table\");\n+\t\treturn;\n+\t}\n+\n+\tif (parser_read_uint32(&table_id, tokens[3]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"table_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[4], \"rule\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"rule\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"read\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"read\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[6], \"time\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"time\");\n+\t\treturn;\n+\t}\n+\n+\tn_tokens -= 7;\n+\ttokens += 7;\n+\n+\t/* match */\n+\tif ((n_tokens == 0) || strcmp(tokens[0], \"match\")) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"match\");\n+\t\treturn;\n+\t}\n+\n+\tn_tokens_parsed = parse_match(tokens,\n+\t\tn_tokens,\n+\t\tout,\n+\t\tout_size,\n+\t\t&m);\n+\tif (n_tokens_parsed == 0)\n+\t\treturn;\n+\tn_tokens -= n_tokens_parsed;\n+\ttokens += n_tokens_parsed;\n+\n+\t/* end */\n+\tif (n_tokens) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\t/* Read table rule timestamp. */\n+\tstatus = pipeline_table_rule_time_read(pipeline_name,\n+\t\ttable_id,\n+\t\t&m,\n+\t\t×tamp);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\t/* Print stats. */\n+\tsnprintf(out, out_size, \"Packets: %\" PRIu64 \"\\n\", timestamp);\n+}\n \n static const char cmd_thread_pipeline_enable_help[] =\n \"thread <thread_id> pipeline <pipeline_name> enable\\n\";\n@@ -5537,6 +5623,7 @@ cmd_help(char **tokens, uint32_t n_tokens, char *out, size_t out_size)\n \t\t\t\"\\tpipeline table rule meter read\\n\"\n \t\t\t\"\\tpipeline table dscp\\n\"\n \t\t\t\"\\tpipeline table rule ttl read\\n\"\n+\t\t\t\"\\tpipeline table rule time read\\n\"\n \t\t\t\"\\tthread pipeline enable\\n\"\n \t\t\t\"\\tthread pipeline disable\\n\\n\");\n \t\treturn;\n@@ -5788,6 +5875,15 @@ cmd_help(char **tokens, uint32_t n_tokens, char *out, size_t out_size)\n \t\t\t\tcmd_pipeline_table_rule_ttl_read_help);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif ((n_tokens == 5) &&\n+\t\t\t(strcmp(tokens[2], \"rule\") == 0) &&\n+\t\t\t(strcmp(tokens[3], \"time\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"read\") == 0)) {\n+\t\t\tsnprintf(out, out_size, \"\\n%s\\n\",\n+\t\t\t\tcmd_pipeline_table_rule_time_read_help);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif ((n_tokens == 3) &&\n@@ -6096,6 +6192,16 @@ cli_process(char *in, char *out, size_t out_size)\n \t\t\t\tout, out_size);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif ((n_tokens >= 7) &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"rule\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"read\") == 0) &&\n+\t\t\t(strcmp(tokens[6], \"time\") == 0)) {\n+\t\t\tcmd_pipeline_table_rule_time_read(tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif (strcmp(tokens[0], \"thread\") == 0) {\ndiff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h\nindex 4e2d328..278775c 100644\n--- a/examples/ip_pipeline/pipeline.h\n+++ b/examples/ip_pipeline/pipeline.h\n@@ -389,6 +389,13 @@ pipeline_table_rule_ttl_read(const char *pipeline_name,\n \tstruct table_rule_match *match,\n \tstruct rte_table_action_ttl_counters *stats,\n \tint clear);\n+\n+int\n+pipeline_table_rule_time_read(const char *pipeline_name,\n+\tuint32_t table_id,\n+\tstruct table_rule_match *match,\n+\tuint64_t *timestamp);\n+\n struct table_rule *\n table_rule_find(struct table *table,\n \tstruct table_rule_match *match);\ndiff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c\nindex e1142d9..e1b6fb6 100644\n--- a/examples/ip_pipeline/thread.c\n+++ b/examples/ip_pipeline/thread.c\n@@ -584,6 +584,7 @@ enum pipeline_req_type {\n \tPIPELINE_REQ_TABLE_RULE_MTR_READ,\n \tPIPELINE_REQ_TABLE_DSCP_TABLE_UPDATE,\n \tPIPELINE_REQ_TABLE_RULE_TTL_READ,\n+\tPIPELINE_REQ_TABLE_RULE_TIME_READ,\n \tPIPELINE_REQ_MAX\n };\n \n@@ -647,6 +648,10 @@ struct pipeline_msg_req_table_rule_ttl_read {\n \tint clear;\n };\n \n+struct pipeline_msg_req_table_rule_time_read {\n+\tvoid *data;\n+};\n+\n struct pipeline_msg_req {\n \tenum pipeline_req_type type;\n \tuint32_t id; /* Port IN, port OUT or table ID */\n@@ -666,6 +671,7 @@ struct pipeline_msg_req {\n \t\tstruct pipeline_msg_req_table_rule_mtr_read table_rule_mtr_read;\n \t\tstruct pipeline_msg_req_table_dscp_table_update table_dscp_table_update;\n \t\tstruct pipeline_msg_req_table_rule_ttl_read table_rule_ttl_read;\n+\t\tstruct pipeline_msg_req_table_rule_time_read table_rule_time_read;\n \t};\n };\n \n@@ -705,6 +711,10 @@ struct pipeline_msg_rsp_table_rule_ttl_read {\n \tstruct rte_table_action_ttl_counters stats;\n };\n \n+struct pipeline_msg_rsp_table_rule_time_read {\n+\tuint64_t timestamp;\n+};\n+\n struct pipeline_msg_rsp {\n \tint status;\n \n@@ -719,6 +729,7 @@ struct pipeline_msg_rsp {\n \t\tstruct pipeline_msg_rsp_table_rule_stats_read table_rule_stats_read;\n \t\tstruct pipeline_msg_rsp_table_rule_mtr_read table_rule_mtr_read;\n \t\tstruct pipeline_msg_rsp_table_rule_ttl_read table_rule_ttl_read;\n+\t\tstruct pipeline_msg_rsp_table_rule_time_read table_rule_time_read;\n \t};\n };\n \n@@ -2167,6 +2178,71 @@ pipeline_table_rule_ttl_read(const char *pipeline_name,\n \treturn status;\n }\n \n+int\n+pipeline_table_rule_time_read(const char *pipeline_name,\n+\tuint32_t table_id,\n+\tstruct table_rule_match *match,\n+\tuint64_t *timestamp)\n+{\n+\tstruct pipeline *p;\n+\tstruct table *table;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tstruct table_rule *rule;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif ((pipeline_name == NULL) ||\n+\t\t(match == NULL) ||\n+\t\t(timestamp == NULL))\n+\t\treturn -1;\n+\n+\tp = pipeline_find(pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(table_id >= p->n_tables) ||\n+\t\tmatch_check(match, p, table_id))\n+\t\treturn -1;\n+\n+\ttable = &p->table[table_id];\n+\n+\trule = table_rule_find(table, match);\n+\tif (rule == NULL)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstatus = rte_table_action_time_read(table->a,\n+\t\t\t\trule->data,\n+\t\t\t\ttimestamp);\n+\n+\t\treturn status;\n+\t}\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_TABLE_RULE_TIME_READ;\n+\treq->id = table_id;\n+\treq->table_rule_time_read.data = rule->data;\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\tif (status == 0)\n+\t\t*timestamp = rsp->table_rule_time_read.timestamp;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n /**\n * Data plane threads: message handling\n */\n@@ -2942,6 +3018,22 @@ pipeline_msg_handle_table_rule_ttl_read(struct pipeline_data *p,\n \treturn rsp;\n }\n \n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_rule_time_read(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *) req;\n+\tuint32_t table_id = req->id;\n+\tvoid *data = req->table_rule_time_read.data;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_time_read(a,\n+\t\tdata,\n+\t\t&rsp->table_rule_time_read.timestamp);\n+\n+\treturn rsp;\n+}\n+\n static void\n pipeline_msg_handle(struct pipeline_data *p)\n {\n@@ -3018,6 +3110,10 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\trsp = pipeline_msg_handle_table_rule_ttl_read(p, req);\n \t\t\tbreak;\n \n+\t\tcase PIPELINE_REQ_TABLE_RULE_TIME_READ:\n+\t\t\trsp = pipeline_msg_handle_table_rule_time_read(p, req);\n+\t\t\tbreak;\n+\n \t\tdefault:\n \t\t\trsp = (struct pipeline_msg_rsp *) req;\n \t\t\trsp->status = -1;\n", "prefixes": [ "10/12" ] }{ "id": 47744, "url": "