Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/47736/?format=api
http://patchwork.dpdk.org/api/patches/47736/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1541158623-29742-2-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-2-git-send-email-cristian.dumitrescu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1541158623-29742-2-git-send-email-cristian.dumitrescu@intel.com", "date": "2018-11-02T11:36:53", "name": "[02/12] examples/ip_pipeline: track table rules on add", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "28feb66f133407433bc516447f22790a6401366b", "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-2-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/47736/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/47736/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 D81E71B439;\n\tFri, 2 Nov 2018 12:37:09 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 6B9B71B3FB\n\tfor <dev@dpdk.org>; Fri, 2 Nov 2018 12:37:07 +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:06 -0700", "from silpixa00382658.ir.intel.com ([10.237.223.29])\n\tby orsmga002.jf.intel.com with ESMTP; 02 Nov 2018 04:37:05 -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=\"105381767\"", "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>", "To": "dev@dpdk.org", "Cc": "Jasvinder Singh <jasvinder.singh@intel.com>,\n\tHongjun Ni <hongjun.ni@intel.com>", "Date": "Fri, 2 Nov 2018 11:36:53 +0000", "Message-Id": "<1541158623-29742-2-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 02/12] examples/ip_pipeline: track table rules on\n\tadd", "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": "Support table rule tracking on table rule add operation.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Hongjun Ni <hongjun.ni@intel.com>\n---\n examples/ip_pipeline/cli.c | 4 +---\n examples/ip_pipeline/pipeline.h | 3 +--\n examples/ip_pipeline/thread.c | 45 ++++++++++++++++++++++++++++++-----------\n 3 files changed, 35 insertions(+), 17 deletions(-)", "diff": "diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c\nindex d1e5540..65600b7 100644\n--- a/examples/ip_pipeline/cli.c\n+++ b/examples/ip_pipeline/cli.c\n@@ -4321,7 +4321,6 @@ cmd_pipeline_table_rule_add(char **tokens,\n \tstruct table_rule_match m;\n \tstruct table_rule_action a;\n \tchar *pipeline_name;\n-\tvoid *data;\n \tuint32_t table_id, t0, n_tokens_parsed;\n \tint status;\n \n@@ -4379,8 +4378,7 @@ cmd_pipeline_table_rule_add(char **tokens,\n \t\treturn;\n \t}\n \n-\tstatus = pipeline_table_rule_add(pipeline_name, table_id,\n-\t\t&m, &a, &data);\n+\tstatus = pipeline_table_rule_add(pipeline_name, table_id, &m, &a);\n \tif (status) {\n \t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n \t\treturn;\ndiff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h\nindex 2034504..58067ed 100644\n--- a/examples/ip_pipeline/pipeline.h\n+++ b/examples/ip_pipeline/pipeline.h\n@@ -329,8 +329,7 @@ int\n pipeline_table_rule_add(const char *pipeline_name,\n \tuint32_t table_id,\n \tstruct table_rule_match *match,\n-\tstruct table_rule_action *action,\n-\tvoid **data);\n+\tstruct table_rule_action *action);\n \n int\n pipeline_table_rule_add_bulk(const char *pipeline_name,\ndiff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c\nindex 4bd971f..5019de9 100644\n--- a/examples/ip_pipeline/thread.c\n+++ b/examples/ip_pipeline/thread.c\n@@ -1210,19 +1210,19 @@ int\n pipeline_table_rule_add(const char *pipeline_name,\n \tuint32_t table_id,\n \tstruct table_rule_match *match,\n-\tstruct table_rule_action *action,\n-\tvoid **data)\n+\tstruct table_rule_action *action)\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(action == NULL) ||\n-\t\t(data == NULL))\n+\t\t(action == NULL))\n \t\treturn -1;\n \n \tp = pipeline_find(pipeline_name);\n@@ -1232,16 +1232,26 @@ pipeline_table_rule_add(const char *pipeline_name,\n \t\taction_check(action, p, table_id))\n \t\treturn -1;\n \n+\ttable = &p->table[table_id];\n+\n+\trule = calloc(1, sizeof(struct table_rule));\n+\tif (rule == NULL)\n+\t\treturn -1;\n+\n+\tmemcpy(&rule->match, match, sizeof(*match));\n+\tmemcpy(&rule->action, action, sizeof(*action));\n+\n \tif (!pipeline_is_running(p)) {\n-\t\tstruct rte_table_action *a = p->table[table_id].a;\n \t\tunion table_rule_match_low_level match_ll;\n \t\tstruct rte_pipeline_table_entry *data_in, *data_out;\n \t\tint key_found;\n \t\tuint8_t *buffer;\n \n \t\tbuffer = calloc(TABLE_RULE_ACTION_SIZE_MAX, sizeof(uint8_t));\n-\t\tif (buffer == NULL)\n+\t\tif (buffer == NULL) {\n+\t\t\tfree(rule);\n \t\t\treturn -1;\n+\t\t}\n \n \t\t/* Table match-action rule conversion */\n \t\tdata_in = (struct rte_pipeline_table_entry *)buffer;\n@@ -1249,12 +1259,14 @@ pipeline_table_rule_add(const char *pipeline_name,\n \t\tstatus = match_convert(match, &match_ll, 1);\n \t\tif (status) {\n \t\t\tfree(buffer);\n+\t\t\tfree(rule);\n \t\t\treturn -1;\n \t\t}\n \n-\t\tstatus = action_convert(a, action, data_in);\n+\t\tstatus = action_convert(table->a, action, data_in);\n \t\tif (status) {\n \t\t\tfree(buffer);\n+\t\t\tfree(rule);\n \t\t\treturn -1;\n \t\t}\n \n@@ -1267,11 +1279,13 @@ pipeline_table_rule_add(const char *pipeline_name,\n \t\t\t\t&data_out);\n \t\tif (status) {\n \t\t\tfree(buffer);\n+\t\t\tfree(rule);\n \t\t\treturn -1;\n \t\t}\n \n \t\t/* Write Response */\n-\t\t*data = data_out;\n+\t\trule->data = data_out;\n+\t\ttable_rule_add(table, rule);\n \n \t\tfree(buffer);\n \t\treturn 0;\n@@ -1279,8 +1293,10 @@ pipeline_table_rule_add(const char *pipeline_name,\n \n \t/* Allocate request */\n \treq = pipeline_msg_alloc();\n-\tif (req == NULL)\n+\tif (req == NULL) {\n+\t\tfree(rule);\n \t\treturn -1;\n+\t}\n \n \t/* Write request */\n \treq->type = PIPELINE_REQ_TABLE_RULE_ADD;\n@@ -1290,13 +1306,18 @@ pipeline_table_rule_add(const char *pipeline_name,\n \n \t/* Send request and wait for response */\n \trsp = pipeline_msg_send_recv(p, req);\n-\tif (rsp == NULL)\n+\tif (rsp == NULL) {\n+\t\tfree(rule);\n \t\treturn -1;\n+\t}\n \n \t/* Read response */\n \tstatus = rsp->status;\n-\tif (status == 0)\n-\t\t*data = rsp->table_rule_add.data;\n+\tif (status == 0) {\n+\t\trule->data = rsp->table_rule_add.data;\n+\t\ttable_rule_add(table, rule);\n+\t} else\n+\t\tfree(rule);\n \n \t/* Free response */\n \tpipeline_msg_free(rsp);\n", "prefixes": [ "02/12" ] }{ "id": 47736, "url": "