get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/47735/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 47735,
    "url": "http://patches.dpdk.org/api/patches/47735/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1541158623-29742-1-git-send-email-cristian.dumitrescu@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": "<1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com",
    "date": "2018-11-02T11:36:52",
    "name": "[01/12] examples/ip_pipeline: add rule list per table",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fed353f01464af1e2393afe9ac9eb6b2fdecefdb",
    "submitter": {
        "id": 19,
        "url": "http://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patches.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 2226,
            "url": "http://patches.dpdk.org/api/series/2226/?format=api",
            "web_url": "http://patches.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://patches.dpdk.org/series/2226/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/47735/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/47735/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 3B9191B416;\n\tFri,  2 Nov 2018 12:37:08 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 8832B1B3FB\n\tfor <dev@dpdk.org>; Fri,  2 Nov 2018 12:37:06 +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:05 -0700",
            "from silpixa00382658.ir.intel.com ([10.237.223.29])\n\tby orsmga002.jf.intel.com with ESMTP; 02 Nov 2018 04:37:04 -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=\"105381760\"",
        "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:52 +0000",
        "Message-Id": "<1541158623-29742-1-git-send-email-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH 01/12] examples/ip_pipeline: add rule list per\n\ttable",
        "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": "For each pipeline table, have the master thread maintain the list of\nrules that are currently stored in the table. This list allows the\nmaster thread to handle table queries with minimal impact for the\ndata plane threads: requests to read the current set of table rules\nare fully handled by the master thread with no involvement from\ndata plane threads, requests to read the per table rule moving data\n(such as stats counters or timestamp associated with specific\nactions) are handled by the data plane threads through plain memory\nreads rather than key lookup.\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/pipeline.c | 88 +++++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/pipeline.h | 36 +++++++++++++++++\n 2 files changed, 124 insertions(+)",
    "diff": "diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c\nindex b23d6c0..78d590d 100644\n--- a/examples/ip_pipeline/pipeline.c\n+++ b/examples/ip_pipeline/pipeline.c\n@@ -1041,7 +1041,95 @@ pipeline_table_create(const char *pipeline_name,\n \tmemcpy(&table->params, params, sizeof(*params));\n \ttable->ap = ap;\n \ttable->a = action;\n+\tTAILQ_INIT(&table->rules);\n+\ttable->rule_default = NULL;\n+\n \tpipeline->n_tables++;\n \n \treturn 0;\n }\n+\n+struct table_rule *\n+table_rule_find(struct table *table,\n+    struct table_rule_match *match)\n+{\n+\tstruct table_rule *rule;\n+\n+\tTAILQ_FOREACH(rule, &table->rules, node)\n+\t\tif (memcmp(&rule->match, match, sizeof(*match)) == 0)\n+\t\t\treturn rule;\n+\n+\treturn NULL;\n+}\n+\n+void\n+table_rule_add(struct table *table,\n+    struct table_rule *new_rule)\n+{\n+\tstruct table_rule *existing_rule;\n+\n+\texisting_rule = table_rule_find(table, &new_rule->match);\n+\tif (existing_rule == NULL)\n+\t\tTAILQ_INSERT_TAIL(&table->rules, new_rule, node);\n+\telse {\n+\t\tTAILQ_INSERT_AFTER(&table->rules, existing_rule, new_rule, node);\n+\t\tTAILQ_REMOVE(&table->rules, existing_rule, node);\n+\t\tfree(existing_rule);\n+\t}\n+}\n+\n+void\n+table_rule_add_bulk(struct table *table,\n+    struct table_rule_list *list,\n+    uint32_t n_rules)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i < n_rules; i++) {\n+\t\tstruct table_rule *existing_rule, *new_rule;\n+\n+\t\tnew_rule = TAILQ_FIRST(list);\n+\t\tif (new_rule == NULL)\n+\t\t\tbreak;\n+\n+\t\tTAILQ_REMOVE(list, new_rule, node);\n+\n+\t\texisting_rule = table_rule_find(table, &new_rule->match);\n+\t\tif (existing_rule == NULL)\n+\t\t\tTAILQ_INSERT_TAIL(&table->rules, new_rule, node);\n+\t\telse {\n+\t\t\tTAILQ_INSERT_AFTER(&table->rules, existing_rule, new_rule, node);\n+\t\t\tTAILQ_REMOVE(&table->rules, existing_rule, node);\n+\t\t\tfree(existing_rule);\n+\t\t}\n+\t}\n+}\n+\n+void\n+table_rule_delete(struct table *table,\n+    struct table_rule_match *match)\n+{\n+\tstruct table_rule *rule;\n+\n+\trule = table_rule_find(table, match);\n+\tif (rule == NULL)\n+\t\treturn;\n+\n+\tTAILQ_REMOVE(&table->rules, rule, node);\n+\tfree(rule);\n+}\n+\n+void\n+table_rule_default_add(struct table *table,\n+\tstruct table_rule *rule)\n+{\n+\tfree(table->rule_default);\n+\ttable->rule_default = rule;\n+}\n+\n+void\n+table_rule_default_delete(struct table *table)\n+{\n+\tfree(table->rule_default);\n+\ttable->rule_default = NULL;\n+}\ndiff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h\nindex e5b1d5d..2034504 100644\n--- a/examples/ip_pipeline/pipeline.h\n+++ b/examples/ip_pipeline/pipeline.h\n@@ -143,6 +143,10 @@ struct table_params {\n \tconst char *action_profile_name;\n };\n \n+struct table_rule;\n+\n+TAILQ_HEAD(table_rule_list, table_rule);\n+\n struct port_in {\n \tstruct port_in_params params;\n \tstruct port_in_action_profile *ap;\n@@ -153,6 +157,8 @@ struct table {\n \tstruct table_params params;\n \tstruct table_action_profile *ap;\n \tstruct rte_table_action *a;\n+\tstruct table_rule_list rules;\n+\tstruct table_rule *rule_default;\n };\n \n struct pipeline {\n@@ -286,6 +292,13 @@ struct table_rule_action {\n \tstruct rte_table_action_decap_params decap;\n };\n \n+struct table_rule {\n+\tTAILQ_ENTRY(table_rule) node;\n+\tstruct table_rule_match match;\n+\tstruct table_rule_action action;\n+\tvoid *data;\n+};\n+\n int\n pipeline_port_in_stats_read(const char *pipeline_name,\n \tuint32_t port_id,\n@@ -380,5 +393,28 @@ pipeline_table_rule_ttl_read(const char *pipeline_name,\n \tvoid *data,\n \tstruct rte_table_action_ttl_counters *stats,\n \tint clear);\n+struct table_rule *\n+table_rule_find(struct table *table,\n+\tstruct table_rule_match *match);\n+\n+void\n+table_rule_add(struct table *table,\n+\tstruct table_rule *rule);\n+\n+void\n+table_rule_add_bulk(struct table *table,\n+\tstruct table_rule_list *list,\n+\tuint32_t n_rules);\n+\n+void\n+table_rule_delete(struct table *table,\n+\tstruct table_rule_match *match);\n+\n+void\n+table_rule_default_add(struct table *table,\n+\tstruct table_rule *rule);\n+\n+void\n+table_rule_default_delete(struct table *table);\n \n #endif /* _INCLUDE_PIPELINE_H_ */\n",
    "prefixes": [
        "01/12"
    ]
}