get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 815137,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/815137/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170918193057.37644-2-kraigatgoog@gmail.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170918193057.37644-2-kraigatgoog@gmail.com>",
    "list_archive_url": null,
    "date": "2017-09-18T19:30:55",
    "name": "[net-next,1/3] bpf: Implement map_delete_elem for BPF_MAP_TYPE_LPM_TRIE",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7f490b631ae5c7c94d83586d9ab410a77781adda",
    "submitter": {
        "id": 67365,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/67365/?format=api",
        "name": "Craig Gallek",
        "email": "kraigatgoog@gmail.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170918193057.37644-2-kraigatgoog@gmail.com/mbox/",
    "series": [
        {
            "id": 3720,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/3720/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=3720",
            "date": "2017-09-18T19:30:54",
            "name": "Implement delete for BPF LPM trie",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3720/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/815137/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/815137/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xwx201Wq2z9s7G\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 05:31:04 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751284AbdIRTbC (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 15:31:02 -0400",
            "from mail-qt0-f181.google.com ([209.85.216.181]:50936 \"EHLO\n\tmail-qt0-f181.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750938AbdIRTbA (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 15:31:00 -0400",
            "by mail-qt0-f181.google.com with SMTP id f15so1660886qtf.7\n\tfor <netdev@vger.kernel.org>; Mon, 18 Sep 2017 12:31:00 -0700 (PDT)",
            "from monkey.nyc.corp.google.com ([100.101.213.79])\n\tby smtp.gmail.com with ESMTPSA id\n\te67sm5483579qkb.67.2017.09.18.12.30.58\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 18 Sep 2017 12:30:58 -0700 (PDT)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=JNxJujDEl1wO1dLl9VBW+4YMqZEJiTcr5sSEKDsp4P0=;\n\tb=qlFu9YyJWp8VSxJOO52wgBOXij2MBFN7EzofKkokk3hUBaJaaaqm0DFMQjrkBMQQHg\n\tgVp3SI55VE9c0S220nf8Kw6urHvpNTS3shk5B41bVwqeAH4wNdK8K5yCDXMGxS9qtjPN\n\tuJapgJ0d+gQE4xpWoG9rFw/VlVqkiWfKYyfP2/u+G0fttvjE1e3kq2FGSbChwhaJFAA6\n\tXxkerkzZZ8xPvnAiKptQFLPO1HlcdAFS34d58ZAlgFssLQTyB4EdAMAmB0q5xhgxT4Vf\n\t9/AKBADA2MWs0ZcVjsX2C0VvCn93KBXyQM7KFqqd3nKDXSKCuYYDrS15Wt5CPKA6Zere\n\tGKrA==",
        "X-Gm-Message-State": "AHPjjUgCBEfVdDgQJrGRhG5KojTu6Kw52pPv+txpS+XOEmRBOpr92FoM\n\twusmbVApwhidOff+",
        "X-Google-Smtp-Source": "AOwi7QAPXqh/NlOGdnmr7MHZnJAXRp2869klz6hmcfSez3wtETCGVMjz69D4/NpzIdPQr1WwuT/CGA==",
        "X-Received": "by 10.200.52.117 with SMTP id v50mr54299593qtb.333.1505763059701;\n\tMon, 18 Sep 2017 12:30:59 -0700 (PDT)",
        "From": "Craig Gallek <kraigatgoog@gmail.com>",
        "To": "Daniel Mack <daniel@zonque.org>, Alexei Starovoitov <ast@fb.com>,\n\tDaniel Borkmann <daniel@iogearbox.net>,\n\t\"David S . Miller\" <davem@davemloft.net>",
        "Cc": "netdev@vger.kernel.org",
        "Subject": "[PATCH net-next 1/3] bpf: Implement map_delete_elem for\n\tBPF_MAP_TYPE_LPM_TRIE",
        "Date": "Mon, 18 Sep 2017 15:30:55 -0400",
        "Message-Id": "<20170918193057.37644-2-kraigatgoog@gmail.com>",
        "X-Mailer": "git-send-email 2.14.1.690.gbb1197296e-goog",
        "In-Reply-To": "<20170918193057.37644-1-kraigatgoog@gmail.com>",
        "References": "<20170918193057.37644-1-kraigatgoog@gmail.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "From: Craig Gallek <kraig@google.com>\n\nThis is a simple non-recursive delete operation.  It prunes paths\nof empty nodes in the tree, but it does not try to further compress\nthe tree as nodes are removed.\n\nSigned-off-by: Craig Gallek <kraig@google.com>\n---\n kernel/bpf/lpm_trie.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 77 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c\nindex 1b767844a76f..9d58a576b2ae 100644\n--- a/kernel/bpf/lpm_trie.c\n+++ b/kernel/bpf/lpm_trie.c\n@@ -389,10 +389,84 @@ static int trie_update_elem(struct bpf_map *map,\n \treturn ret;\n }\n \n-static int trie_delete_elem(struct bpf_map *map, void *key)\n+/* Called from syscall or from eBPF program */\n+static int trie_delete_elem(struct bpf_map *map, void *_key)\n {\n-\t/* TODO */\n-\treturn -ENOSYS;\n+\tstruct lpm_trie *trie = container_of(map, struct lpm_trie, map);\n+\tstruct bpf_lpm_trie_key *key = _key;\n+\tstruct lpm_trie_node __rcu **trim;\n+\tstruct lpm_trie_node *node;\n+\tunsigned long irq_flags;\n+\tunsigned int next_bit;\n+\tsize_t matchlen = 0;\n+\tint ret = 0;\n+\n+\tif (key->prefixlen > trie->max_prefixlen)\n+\t\treturn -EINVAL;\n+\n+\traw_spin_lock_irqsave(&trie->lock, irq_flags);\n+\n+\t/* Walk the tree looking for an exact key/length match and keeping\n+\t * track of where we could begin trimming the tree.  The trim-point\n+\t * is the sub-tree along the walk consisting of only single-child\n+\t * intermediate nodes and ending at a leaf node that we want to\n+\t * remove.\n+\t */\n+\ttrim = &trie->root;\n+\tnode = rcu_dereference_protected(\n+\t\ttrie->root, lockdep_is_held(&trie->lock));\n+\twhile (node) {\n+\t\tmatchlen = longest_prefix_match(trie, node, key);\n+\n+\t\tif (node->prefixlen != matchlen ||\n+\t\t    node->prefixlen == key->prefixlen)\n+\t\t\tbreak;\n+\n+\t\tnext_bit = extract_bit(key->data, node->prefixlen);\n+\t\t/* If we hit a node that has more than one child or is a valid\n+\t\t * prefix itself, do not remove it. Reset the root of the trim\n+\t\t * path to its descendant on our path.\n+\t\t */\n+\t\tif (!(node->flags & LPM_TREE_NODE_FLAG_IM) ||\n+\t\t    (node->child[0] && node->child[1]))\n+\t\t\ttrim = &node->child[next_bit];\n+\t\tnode = rcu_dereference_protected(\n+\t\t\tnode->child[next_bit], lockdep_is_held(&trie->lock));\n+\t}\n+\n+\tif (!node || node->prefixlen != key->prefixlen ||\n+\t    (node->flags & LPM_TREE_NODE_FLAG_IM)) {\n+\t\tret = -ENOENT;\n+\t\tgoto out;\n+\t}\n+\n+\ttrie->n_entries--;\n+\n+\t/* If the node we are removing is not a leaf node, simply mark it\n+\t * as intermediate and we are done.\n+\t */\n+\tif (rcu_access_pointer(node->child[0]) ||\n+\t    rcu_access_pointer(node->child[1])) {\n+\t\tnode->flags |= LPM_TREE_NODE_FLAG_IM;\n+\t\tgoto out;\n+\t}\n+\n+\t/* trim should now point to the slot holding the start of a path from\n+\t * zero or more intermediate nodes to our leaf node for deletion.\n+\t */\n+\twhile ((node = rcu_dereference_protected(\n+\t\t\t*trim, lockdep_is_held(&trie->lock)))) {\n+\t\tRCU_INIT_POINTER(*trim, NULL);\n+\t\ttrim = rcu_access_pointer(node->child[0]) ?\n+\t\t\t&node->child[0] :\n+\t\t\t&node->child[1];\n+\t\tkfree_rcu(node, rcu);\n+\t}\n+\n+out:\n+\traw_spin_unlock_irqrestore(&trie->lock, irq_flags);\n+\n+\treturn ret;\n }\n \n #define LPM_DATA_SIZE_MAX\t256\n",
    "prefixes": [
        "net-next",
        "1/3"
    ]
}