get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806594,
    "url": "http://patchwork.ozlabs.org/api/patches/806594/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170828141105.14143.31609.stgit@john-Precision-Tower-5810/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/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": "<20170828141105.14143.31609.stgit@john-Precision-Tower-5810>",
    "list_archive_url": null,
    "date": "2017-08-28T14:11:05",
    "name": "[net-next,4/9] bpf: additional sockmap self tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "9a768be584c80788f7a2f088fe3de05a270fcff2",
    "submitter": {
        "id": 20028,
        "url": "http://patchwork.ozlabs.org/api/people/20028/?format=api",
        "name": "John Fastabend",
        "email": "john.fastabend@gmail.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170828141105.14143.31609.stgit@john-Precision-Tower-5810/mbox/",
    "series": [
        {
            "id": 179,
            "url": "http://patchwork.ozlabs.org/api/series/179/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=179",
            "date": "2017-08-28T14:09:45",
            "name": "sockmap UAPI updates and fixes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/179/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806594/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806594/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>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"fEbZBMuL\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgtwp1nWDz9s1h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 00:11:22 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751387AbdH1OLU (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 10:11:20 -0400",
            "from mail-pf0-f194.google.com ([209.85.192.194]:37522 \"EHLO\n\tmail-pf0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751347AbdH1OLT (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 10:11:19 -0400",
            "by mail-pf0-f194.google.com with SMTP id a2so391444pfj.4\n\tfor <netdev@vger.kernel.org>; Mon, 28 Aug 2017 07:11:19 -0700 (PDT)",
            "from [127.0.1.1] ([72.168.144.1]) by smtp.gmail.com with ESMTPSA id\n\tl14sm1015953pgu.46.2017.08.28.07.11.11\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 28 Aug 2017 07:11:17 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-transfer-encoding;\n\tbh=+YqLdbVRye+nUymw2mQHMbB6vXOGLmKSxWaJi3F9grw=;\n\tb=fEbZBMuLuo4ZklC4Y36gUg5kpSlQWO8GP6wewkzycWxz707zhq4WgUUNlS0iUe/8eM\n\ty9CD1IauNLT4hMILrQaRkBhYuK9m1et0YYYPFYndyXNjJZA94P+YDAi4Ya99ameuTjfa\n\tnLntc11LBbPXjlagNV0/GqKQ31iiBxWUPBSBNYFb8lkAgx9thyBhtNz3ovn/sUV2hXnH\n\tshd3vUsI48QoIDTSE9wxubPGPs9Bjexk7BD8QgYQl5eGti2+OBi5shPX8GbiZTjHXuX9\n\tTwEjVAuGebcz0cTTXY5Qo7zy0DHX5inbdYXT+n9EvSRIfPRsHH5bdLbihvLk/6eNcxSx\n\tuDww==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=+YqLdbVRye+nUymw2mQHMbB6vXOGLmKSxWaJi3F9grw=;\n\tb=SIOLjvrls6RHm0Gvp2NLchmEA/CLz5P1VFypBgesbjvGVoSt6bThGojDyVTfFmNGzZ\n\t+5JWuNe8+CaXUggvjtW8N4AtypIa5LHIWWpjEfo1gDcqjoKlDC0VZc0BJEiI8biZKYt7\n\tQ8MW+JY869jlc0QOAsewaIMnHejw1H3IRxEOv3HSyRXCkT4PTWUSnVwhTLDuQa8yY3Y9\n\tLo4JPQ1Ss7ntC/LWhNN4nvaZYDYxJp/O11MaOGAgmxlCOMKri6JkYTBwOt1tDxS4R16A\n\taPLpvnMLrJE7ZtsKWqqyBFc7oczGTY1m761Z7iezTmK/bnNUGYL3a2tEjM/s4B9QI6Wv\n\tJ69A==",
        "X-Gm-Message-State": "AHYfb5jN8fEFQW3AXSx46McQIsyFqYWz6PkVqJCu8TynTH0xd9TMyPxX\n\t+j0cF2hhm6/OWdk2",
        "X-Received": "by 10.84.215.199 with SMTP id g7mr882493plj.27.1503929478615;\n\tMon, 28 Aug 2017 07:11:18 -0700 (PDT)",
        "Subject": "[net-next PATCH 4/9] bpf: additional sockmap self tests",
        "From": "John Fastabend <john.fastabend@gmail.com>",
        "To": "ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net",
        "Cc": "netdev@vger.kernel.org, john.fastabend@gmail.com",
        "Date": "Mon, 28 Aug 2017 07:11:05 -0700",
        "Message-ID": "<20170828141105.14143.31609.stgit@john-Precision-Tower-5810>",
        "In-Reply-To": "<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>",
        "References": "<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>",
        "User-Agent": "StGit/0.17.1-dirty",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Add some more sockmap tests to cover,\n\n - forwarding to NULL entries\n - more than two maps to test list ops\n - forwarding to different map\n\nSigned-off-by: John Fastabend <john.fastabend@gmail.com>\n---\n tools/testing/selftests/bpf/sockmap_parse_prog.c   |    6 +\n tools/testing/selftests/bpf/sockmap_verdict_prog.c |   23 +++-\n tools/testing/selftests/bpf/test_maps.c            |  113 +++++++++++++-------\n 3 files changed, 96 insertions(+), 46 deletions(-)",
    "diff": "diff --git a/tools/testing/selftests/bpf/sockmap_parse_prog.c b/tools/testing/selftests/bpf/sockmap_parse_prog.c\nindex 710f43f..fae3b96 100644\n--- a/tools/testing/selftests/bpf/sockmap_parse_prog.c\n+++ b/tools/testing/selftests/bpf/sockmap_parse_prog.c\n@@ -19,16 +19,16 @@ int bpf_prog1(struct __sk_buff *skb)\n \tvoid *data = (void *)(long) skb->data;\n \t__u32 lport = skb->local_port;\n \t__u32 rport = skb->remote_port;\n-\tchar *d = data;\n+\t__u8 *d = data;\n \n-\tif (data + 8 > data_end)\n+\tif (data + 10 > data_end)\n \t\treturn skb->len;\n \n \t/* This write/read is a bit pointless but tests the verifier and\n \t * strparser handler for read/write pkt data and access into sk\n \t * fields.\n \t */\n-\td[0] = 1;\n+\td[7] = 1;\n \n \tbpf_printk(\"parse: data[0] = (%u): local_port %i remote %i\\n\",\n \t\t   d[0], lport, bpf_ntohl(rport));\ndiff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/sockmap_verdict_prog.c\nindex 0573c1d..dada207 100644\n--- a/tools/testing/selftests/bpf/sockmap_verdict_prog.c\n+++ b/tools/testing/selftests/bpf/sockmap_verdict_prog.c\n@@ -12,7 +12,14 @@\n \t\t\t\t##__VA_ARGS__);\t\t\t\\\n })\n \n-struct bpf_map_def SEC(\"maps\") sock_map = {\n+struct bpf_map_def SEC(\"maps\") sock_map_rx = {\n+\t.type = BPF_MAP_TYPE_SOCKMAP,\n+\t.key_size = sizeof(int),\n+\t.value_size = sizeof(int),\n+\t.max_entries = 20,\n+};\n+\n+struct bpf_map_def SEC(\"maps\") sock_map_tx = {\n \t.type = BPF_MAP_TYPE_SOCKMAP,\n \t.key_size = sizeof(int),\n \t.value_size = sizeof(int),\n@@ -26,11 +33,15 @@ int bpf_prog2(struct __sk_buff *skb)\n \tvoid *data = (void *)(long) skb->data;\n \t__u32 lport = skb->local_port;\n \t__u32 rport = skb->remote_port;\n-\tchar *d = data;\n+\t__u8 *d = data;\n+\t__u8 sk, map;\n \n \tif (data + 8 > data_end)\n \t\treturn SK_DROP;\n \n+\tmap = d[0];\n+\tsk = d[1];\n+\n \td[0] = 0xd;\n \td[1] = 0xe;\n \td[2] = 0xa;\n@@ -40,9 +51,11 @@ int bpf_prog2(struct __sk_buff *skb)\n \td[6] = 0xe;\n \td[7] = 0xf;\n \n-\tbpf_printk(\"verdict: data[0] = (%u): local_port %i remote %i redirect 5\\n\",\n-\t\t   d[0], lport, bpf_ntohl(rport));\n-\treturn bpf_sk_redirect_map(&sock_map, 5, 0);\n+\tbpf_printk(\"verdict: data[0] = redir(%u:%u)\\n\", map, sk);\n+\n+\tif (!map)\n+\t\treturn bpf_sk_redirect_map(&sock_map_rx, sk, 0);\n+\treturn bpf_sk_redirect_map(&sock_map_tx, sk, 0);\n }\n \n char _license[] SEC(\"license\") = \"GPL\";\ndiff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c\nindex 6df6e62..0a7f457 100644\n--- a/tools/testing/selftests/bpf/test_maps.c\n+++ b/tools/testing/selftests/bpf/test_maps.c\n@@ -465,10 +465,10 @@ static void test_sockmap(int task, void *data)\n {\n \tint ports[] = {50200, 50201, 50202, 50204};\n \tint err, i, fd, sfd[6] = {0xdeadbeef};\n-\tchar buf[] = \"hello sockmap user\\n\";\n-\tint one = 1, map_fd, s, sc, rc;\n+\tu8 buf[20] = {0x0, 0x5, 0x3, 0x2, 0x1, 0x0};\n+\tint one = 1, map_fd_rx, map_fd_tx, s, sc, rc;\n \tint parse_prog, verdict_prog;\n-\tstruct bpf_map *bpf_map;\n+\tstruct bpf_map *bpf_map_rx, *bpf_map_tx;\n \tstruct sockaddr_in addr;\n \tstruct bpf_object *obj;\n \tstruct timeval to;\n@@ -585,26 +585,38 @@ static void test_sockmap(int task, void *data)\n \t\tgoto out_sockmap;\n \t}\n \n-\tbpf_map = bpf_object__find_map_by_name(obj, \"sock_map\");\n-\tif (IS_ERR(bpf_map)) {\n-\t\tprintf(\"Failed to load map from verdict prog\\n\");\n+\tbpf_map_rx = bpf_object__find_map_by_name(obj, \"sock_map_rx\");\n+\tif (IS_ERR(bpf_map_rx)) {\n+\t\tprintf(\"Failed to load map rx from verdict prog\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n-\tmap_fd = bpf_map__fd(bpf_map);\n-\tif (map_fd < 0) {\n+\tmap_fd_rx = bpf_map__fd(bpf_map_rx);\n+\tif (map_fd_rx < 0) {\n \t\tprintf(\"Failed to get map fd\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n-\terr = bpf_prog_attach(parse_prog, map_fd,\n+\tbpf_map_tx = bpf_object__find_map_by_name(obj, \"sock_map_tx\");\n+\tif (IS_ERR(bpf_map_tx)) {\n+\t\tprintf(\"Failed to load map tx from verdict prog\\n\");\n+\t\tgoto out_sockmap;\n+\t}\n+\n+\tmap_fd_tx = bpf_map__fd(bpf_map_tx);\n+\tif (map_fd_tx < 0) {\n+\t\tprintf(\"Failed to get map tx fd\\n\");\n+\t\tgoto out_sockmap;\n+\t}\n+\n+\terr = bpf_prog_attach(parse_prog, map_fd_rx,\n \t\t      BPF_SK_SKB_STREAM_PARSER, 0);\n \tif (err) {\n \t\tprintf(\"Failed bpf prog attach\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n-\terr = bpf_prog_attach(verdict_prog, map_fd,\n+\terr = bpf_prog_attach(verdict_prog, map_fd_rx,\n \t\t\t      BPF_SK_SKB_STREAM_VERDICT, 0);\n \tif (err) {\n \t\tprintf(\"Failed bpf prog attach\\n\");\n@@ -613,9 +625,15 @@ static void test_sockmap(int task, void *data)\n \n \t/* Test map update elem afterwards fd lives in fd and map_fd */\n \tfor (i = 0; i < 6; i++) {\n-\t\terr = bpf_map_update_elem(map_fd, &i, &sfd[i], BPF_ANY);\n+\t\terr = bpf_map_update_elem(map_fd_rx, &i, &sfd[i], BPF_ANY);\n+\t\tif (err) {\n+\t\t\tprintf(\"Failed map_fd_rx update sockmap %i '%i:%i'\\n\",\n+\t\t\t       err, i, sfd[i]);\n+\t\t\tgoto out_sockmap;\n+\t\t}\n+\t\terr = bpf_map_update_elem(map_fd_tx, &i, &sfd[i], BPF_ANY);\n \t\tif (err) {\n-\t\t\tprintf(\"Failed map_fd update sockmap %i '%i:%i'\\n\",\n+\t\t\tprintf(\"Failed map_fd_tx update sockmap %i '%i:%i'\\n\",\n \t\t\t       err, i, sfd[i]);\n \t\t\tgoto out_sockmap;\n \t\t}\n@@ -623,42 +641,61 @@ static void test_sockmap(int task, void *data)\n \n \t/* Test map delete elem and remove send/recv sockets */\n \tfor (i = 2; i < 4; i++) {\n-\t\terr = bpf_map_delete_elem(map_fd, &i);\n+\t\terr = bpf_map_delete_elem(map_fd_rx, &i);\n+\t\tif (err) {\n+\t\t\tprintf(\"Failed delete sockmap rx %i '%i:%i'\\n\",\n+\t\t\t       err, i, sfd[i]);\n+\t\t\tgoto out_sockmap;\n+\t\t}\n+\t\terr = bpf_map_delete_elem(map_fd_tx, &i);\n \t\tif (err) {\n-\t\t\tprintf(\"Failed delete  sockmap %i '%i:%i'\\n\",\n+\t\t\tprintf(\"Failed delete sockmap tx %i '%i:%i'\\n\",\n \t\t\t       err, i, sfd[i]);\n \t\t\tgoto out_sockmap;\n \t\t}\n \t}\n \n \t/* Test map send/recv */\n-\tsc = send(sfd[2], buf, 10, 0);\n-\tif (sc < 0) {\n-\t\tprintf(\"Failed sockmap send\\n\");\n-\t\tgoto out_sockmap;\n-\t}\n+\tfor (i = 0; i < 2; i++) {\n+\t\tbuf[0] = i;\n+\t\tbuf[1] = 0x5;\n+\t\tsc = send(sfd[2], buf, 20, 0);\n+\t\tif (sc < 0) {\n+\t\t\tprintf(\"Failed sockmap send\\n\");\n+\t\t\tgoto out_sockmap;\n+\t\t}\n \n-\tFD_ZERO(&w);\n-\tFD_SET(sfd[3], &w);\n-\tto.tv_sec = 1;\n-\tto.tv_usec = 0;\n-\ts = select(sfd[3] + 1, &w, NULL, NULL, &to);\n-\tif (s == -1) {\n-\t\tperror(\"Failed sockmap select()\");\n-\t\tgoto out_sockmap;\n-\t} else if (!s) {\n-\t\tprintf(\"Failed sockmap unexpected timeout\\n\");\n-\t\tgoto out_sockmap;\n-\t}\n+\t\tFD_ZERO(&w);\n+\t\tFD_SET(sfd[3], &w);\n+\t\tto.tv_sec = 1;\n+\t\tto.tv_usec = 0;\n+\t\ts = select(sfd[3] + 1, &w, NULL, NULL, &to);\n+\t\tif (s == -1) {\n+\t\t\tperror(\"Failed sockmap select()\");\n+\t\t\tgoto out_sockmap;\n+\t\t} else if (!s) {\n+\t\t\tprintf(\"Failed sockmap unexpected timeout\\n\");\n+\t\t\tgoto out_sockmap;\n+\t\t}\n \n-\tif (!FD_ISSET(sfd[3], &w)) {\n-\t\tprintf(\"Failed sockmap select/recv\\n\");\n-\t\tgoto out_sockmap;\n+\t\tif (!FD_ISSET(sfd[3], &w)) {\n+\t\t\tprintf(\"Failed sockmap select/recv\\n\");\n+\t\t\tgoto out_sockmap;\n+\t\t}\n+\n+\t\trc = recv(sfd[3], buf, sizeof(buf), 0);\n+\t\tif (rc < 0) {\n+\t\t\tprintf(\"Failed sockmap recv\\n\");\n+\t\t\tgoto out_sockmap;\n+\t\t}\n \t}\n \n-\trc = recv(sfd[3], buf, sizeof(buf), 0);\n-\tif (rc < 0) {\n-\t\tprintf(\"Failed sockmap recv\\n\");\n+\t/* Negative null entry lookup from datapath should be dropped */\n+\tbuf[0] = 1;\n+\tbuf[1] = 12;\n+\tsc = send(sfd[2], buf, 20, 0);\n+\tif (sc < 0) {\n+\t\tprintf(\"Failed sockmap send\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n@@ -730,7 +767,7 @@ static void test_sockmap(int task, void *data)\n \tfor (i = 0; i < 6; i++)\n \t\tclose(sfd[i]);\n \tclose(fd);\n-\tclose(map_fd);\n+\tclose(map_fd_rx);\n \tbpf_object__close(obj);\n \treturn;\n out:\n",
    "prefixes": [
        "net-next",
        "4/9"
    ]
}