get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 818036,
    "url": "http://patchwork.ozlabs.org/api/patches/818036/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170925032941.14586-8-tom@quantonium.net/",
    "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": "<20170925032941.14586-8-tom@quantonium.net>",
    "list_archive_url": null,
    "date": "2017-09-25T03:29:36",
    "name": "[v3,net-next,07/12] gtp: udp recv clean up",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e1a0cb9d4dc67cc484a0a9c23519fa0b66e4b607",
    "submitter": {
        "id": 72064,
        "url": "http://patchwork.ozlabs.org/api/people/72064/?format=api",
        "name": "Tom Herbert",
        "email": "tom@quantonium.net"
    },
    "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/20170925032941.14586-8-tom@quantonium.net/mbox/",
    "series": [
        {
            "id": 4865,
            "url": "http://patchwork.ozlabs.org/api/series/4865/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4865",
            "date": "2017-09-25T03:29:29",
            "name": "gtp: Additional feature support - Part I",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/4865/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/818036/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/818036/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=quantonium-net.20150623.gappssmtp.com\n\theader.i=@quantonium-net.20150623.gappssmtp.com\n\theader.b=\"xtg3Ru7L\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0qND4NB3z9t3t\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 13:30:20 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933037AbdIYDaS (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 24 Sep 2017 23:30:18 -0400",
            "from mail-pf0-f173.google.com ([209.85.192.173]:48801 \"EHLO\n\tmail-pf0-f173.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932999AbdIYDaQ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 24 Sep 2017 23:30:16 -0400",
            "by mail-pf0-f173.google.com with SMTP id n24so3141451pfk.5\n\tfor <netdev@vger.kernel.org>; Sun, 24 Sep 2017 20:30:16 -0700 (PDT)",
            "from localhost.localdomain (c-73-162-13-107.hsd1.ca.comcast.net.\n\t[73.162.13.107]) by smtp.gmail.com with ESMTPSA id\n\tj2sm9112907pgn.26.2017.09.24.20.30.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 24 Sep 2017 20:30:15 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=quantonium-net.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=G5gS2YcdNOL7PfeoOGrAzI2uDXz5s6P1cpqdBXFzg9c=;\n\tb=xtg3Ru7LVhAZAUixYRshyYTezmSvuOoM+zEzV1h518NLRwx5b0lqcd3jKIpwEjgXzf\n\t8XnGrmd2mAeCT6LU17iK8ulu8J4BpgmmrufP38UzfcEjq7tSgev+h/sGcqa1vdwdIUvB\n\tDKpLoj4RXeuFtYHaIL+qSMWi5X2c/bS847lIBtyf4Uypxv+rdvooWv8XyIbPmHwAR51B\n\trTKBCyRnWvHBGthzcn/fBFWrs/l5EVCQyL/Zd+NfUkZznAlcXfuzaM3cFGgavk1Eq0xV\n\tnDdpOv9hL+P990aHVir/naWXZP7WI4jesRbwL52I86Xlo8Fu2I/bJkegFreZzOpF0Vcf\n\tIr/w==",
        "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=G5gS2YcdNOL7PfeoOGrAzI2uDXz5s6P1cpqdBXFzg9c=;\n\tb=OvYG2UwtC6ohc3qgUWMwuk+t5V8EIvMvglOtWKeFKv/e3jrRHG3M1E2HNHV0jq4Q6O\n\tbfUMyyAgmWvcZafY5dgdOUZWfLEcKsF0DN74FR5SfMbWfeSZ1keyzXIfRB41/utTxTwD\n\tlyw6J84yzcuMO9DDnHWsn7oMpoBByemYgYkpXU6ugIBMwJ9K2S+nJKFsaYmT8tv6Aabb\n\ttaKGh5w6zFScu3HikSJA7WDfDoLoQOtTMSJCJ9RohgfSbg9fhfb0S0JsfrytqVliMjRo\n\tlVXRwJaUM5S1HpurAMfcp9oXgtngO3K/1jCcLxahyuYTjMY0yEdVtE+RROgbcHqn4xnx\n\tH9Kw==",
        "X-Gm-Message-State": "AHPjjUjXDUGo7WfckRspyfLEC5sngLn9yoK5edo98blmttZCxRVqrQjr\n\t3nT9SqLIp9CioC37bLTvgXUhHw==",
        "X-Google-Smtp-Source": "AOwi7QAsCUZQLlaIfAtVWEIy0wxMZwxXvmvWgYYzLwmQx1rym9YYHZzghuajpIWvMMMNWJC5u4JhLg==",
        "X-Received": "by 10.99.168.72 with SMTP id i8mr6369839pgp.427.1506310215978;\n\tSun, 24 Sep 2017 20:30:15 -0700 (PDT)",
        "From": "Tom Herbert <tom@quantonium.net>",
        "To": "davem@davemloft.net",
        "Cc": "pablo@netfilter.org, laforge@gnumonks.org, aschultz@tpip.net,\n\tnetdev@vger.kernel.org, rohit@quantonium.net,\n\tTom Herbert <tom@quantonium.net>",
        "Subject": "[PATCH v3 net-next 07/12] gtp: udp recv clean up",
        "Date": "Sun, 24 Sep 2017 20:29:36 -0700",
        "Message-Id": "<20170925032941.14586-8-tom@quantonium.net>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20170925032941.14586-1-tom@quantonium.net>",
        "References": "<20170925032941.14586-1-tom@quantonium.net>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Create separate UDP receive functions for GTP version 0 and version 1.\nSet encap_rcv appropriately when configuring a socket.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\n---\n drivers/net/gtp.c | 100 ++++++++++++++++++++++++++----------------------------\n 1 file changed, 49 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c\nindex 00e5ea5cb935..a6e2e0a1f424 100644\n--- a/drivers/net/gtp.c\n+++ b/drivers/net/gtp.c\n@@ -225,14 +225,20 @@ static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb,\n \treturn 0;\n }\n \n-/* 1 means pass up to the stack, -1 means drop and 0 means decapsulated. */\n-static int gtp0_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)\n+/* UDP encapsulation receive handler for GTPv0-U . See net/ipv4/udp.c.\n+ * Return codes: 0: success, <0: error, >0: pass up to userspace UDP socket.\n+ */\n+static int gtp0_udp_encap_recv(struct sock *sk, struct sk_buff *skb)\n {\n+\tstruct gtp_dev *gtp = rcu_dereference_sk_user_data(sk);\n \tunsigned int hdrlen = sizeof(struct udphdr) +\n \t\t\t      sizeof(struct gtp0_header);\n \tstruct gtp0_header *gtp0;\n \tstruct pdp_ctx *pctx;\n \n+\tif (!gtp)\n+\t\tgoto pass;\n+\n \tif (!pskb_may_pull(skb, hdrlen))\n \t\tgoto drop;\n \n@@ -244,26 +250,41 @@ static int gtp0_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)\n \tif (gtp0->type != GTP_TPDU)\n \t\tgoto pass;\n \n+\tnetdev_dbg(gtp->dev, \"received GTP0 packet\\n\");\n+\n \tpctx = gtp0_pdp_find(gtp, be64_to_cpu(gtp0->tid));\n \tif (!pctx) {\n \t\tnetdev_dbg(gtp->dev, \"No PDP ctx to decap skb=%p\\n\", skb);\n \t\tgoto pass;\n \t}\n \n-\treturn gtp_rx(pctx, skb, hdrlen, gtp->role);\n+\tif (!gtp_rx(pctx, skb, hdrlen, gtp->role)) {\n+\t\t/* Successfully received */\n+\t\treturn 0;\n+\t}\n+\n drop:\n-\treturn -1;\n+\tkfree_skb(skb);\n+\treturn 0;\n+\n pass:\n \treturn 1;\n }\n \n-static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)\n+/* UDP encapsulation receive handler for GTPv0-U . See net/ipv4/udp.c.\n+ * Return codes: 0: success, <0: error, >0: pass up to userspace UDP socket.\n+ */\n+static int gtp1u_udp_encap_recv(struct sock *sk, struct sk_buff *skb)\n {\n+\tstruct gtp_dev *gtp = rcu_dereference_sk_user_data(sk);\n \tunsigned int hdrlen = sizeof(struct udphdr) +\n \t\t\t      sizeof(struct gtp1_header);\n \tstruct gtp1_header *gtp1;\n \tstruct pdp_ctx *pctx;\n \n+\tif (!gtp)\n+\t\tgoto pass;\n+\n \tif (!pskb_may_pull(skb, hdrlen))\n \t\tgoto drop;\n \n@@ -275,6 +296,8 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)\n \tif (gtp1->type != GTP_TPDU)\n \t\tgoto pass;\n \n+\tnetdev_dbg(gtp->dev, \"received GTP1 packet\\n\");\n+\n \t/* From 29.060: \"This field shall be present if and only if any one or\n \t * more of the S, PN and E flags are set.\".\n \t *\n@@ -296,9 +319,15 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb)\n \t\tgoto drop;\n \t}\n \n-\treturn gtp_rx(pctx, skb, hdrlen, gtp->role);\n+\tif (!gtp_rx(pctx, skb, hdrlen, gtp->role)) {\n+\t\t/* Successfully received */\n+\t\treturn 0;\n+\t}\n+\n drop:\n-\treturn -1;\n+\tkfree_skb(skb);\n+\treturn 0;\n+\n pass:\n \treturn 1;\n }\n@@ -329,49 +358,6 @@ static void gtp_encap_disable(struct gtp_dev *gtp)\n \tgtp_encap_disable_sock(gtp->sk1u);\n }\n \n-/* UDP encapsulation receive handler. See net/ipv4/udp.c.\n- * Return codes: 0: success, <0: error, >0: pass up to userspace UDP socket.\n- */\n-static int gtp_encap_recv(struct sock *sk, struct sk_buff *skb)\n-{\n-\tstruct gtp_dev *gtp;\n-\tint ret = 0;\n-\n-\tgtp = rcu_dereference_sk_user_data(sk);\n-\tif (!gtp)\n-\t\treturn 1;\n-\n-\tnetdev_dbg(gtp->dev, \"encap_recv sk=%p\\n\", sk);\n-\n-\tswitch (udp_sk(sk)->encap_type) {\n-\tcase UDP_ENCAP_GTP0:\n-\t\tnetdev_dbg(gtp->dev, \"received GTP0 packet\\n\");\n-\t\tret = gtp0_udp_encap_recv(gtp, skb);\n-\t\tbreak;\n-\tcase UDP_ENCAP_GTP1U:\n-\t\tnetdev_dbg(gtp->dev, \"received GTP1U packet\\n\");\n-\t\tret = gtp1u_udp_encap_recv(gtp, skb);\n-\t\tbreak;\n-\tdefault:\n-\t\tret = -1; /* Shouldn't happen. */\n-\t}\n-\n-\tswitch (ret) {\n-\tcase 1:\n-\t\tnetdev_dbg(gtp->dev, \"pass up to the process\\n\");\n-\t\tbreak;\n-\tcase 0:\n-\t\tbreak;\n-\tcase -1:\n-\t\tnetdev_dbg(gtp->dev, \"GTP packet has been dropped\\n\");\n-\t\tkfree_skb(skb);\n-\t\tret = 0;\n-\t\tbreak;\n-\t}\n-\n-\treturn ret;\n-}\n-\n static int gtp_dev_init(struct net_device *dev)\n {\n \tstruct gtp_dev *gtp = netdev_priv(dev);\n@@ -824,9 +810,21 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,\n \tsk = sock->sk;\n \tsock_hold(sk);\n \n+\tswitch (type) {\n+\tcase UDP_ENCAP_GTP0:\n+\t\ttuncfg.encap_rcv = gtp0_udp_encap_recv;\n+\t\tbreak;\n+\tcase UDP_ENCAP_GTP1U:\n+\t\ttuncfg.encap_rcv = gtp1u_udp_encap_recv;\n+\t\tbreak;\n+\tdefault:\n+\t\tpr_debug(\"Unknown encap type %u\\n\", type);\n+\t\tsk = ERR_PTR(-EINVAL);\n+\t\tgoto out_sock;\n+\t}\n+\n \ttuncfg.sk_user_data = gtp;\n \ttuncfg.encap_type = type;\n-\ttuncfg.encap_rcv = gtp_encap_recv;\n \ttuncfg.encap_destroy = gtp_encap_destroy;\n \n \tsetup_udp_tunnel_sock(sock_net(sock->sk), sock, &tuncfg);\n",
    "prefixes": [
        "v3",
        "net-next",
        "07/12"
    ]
}