get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 805911,
    "url": "http://patchwork.ozlabs.org/api/patches/805911/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1503670805-31051-3-git-send-email-yi.y.yang@intel.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1503670805-31051-3-git-send-email-yi.y.yang@intel.com>",
    "list_archive_url": null,
    "date": "2017-08-25T14:20:04",
    "name": "[ovs-dev,net-next,v6,2/3] net: gso: Add GSO support for NSH",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "a70bb76de9bd7ca0aaa988e2d3856f2bb7e62dcd",
    "submitter": {
        "id": 68962,
        "url": "http://patchwork.ozlabs.org/api/people/68962/?format=api",
        "name": "Yang, Yi",
        "email": "yi.y.yang@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1503670805-31051-3-git-send-email-yi.y.yang@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/805911/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/805911/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@mail.linuxfoundation.org"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xf3Pg0yKpz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 26 Aug 2017 00:26:31 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 295C3AB2;\n\tFri, 25 Aug 2017 14:25:46 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 949C095E\n\tfor <dev@openvswitch.org>; Fri, 25 Aug 2017 14:25:45 +0000 (UTC)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id BBF8320C\n\tfor <dev@openvswitch.org>; Fri, 25 Aug 2017 14:24:59 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Aug 2017 07:24:07 -0700",
            "from unknown (HELO localhost.localdomain.bj.intel.com)\n\t([10.240.224.185])\n\tby fmsmga004.fm.intel.com with ESMTP; 25 Aug 2017 07:24:05 -0700"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,426,1498546800\"; d=\"scan'208\";a=\"304381276\"",
        "From": "Yi Yang <yi.y.yang@intel.com>",
        "To": "netdev@vger.kernel.org",
        "Date": "Fri, 25 Aug 2017 22:20:04 +0800",
        "Message-Id": "<1503670805-31051-3-git-send-email-yi.y.yang@intel.com>",
        "X-Mailer": "git-send-email 2.1.0",
        "In-Reply-To": "<1503670805-31051-1-git-send-email-yi.y.yang@intel.com>",
        "References": "<1503670805-31051-1-git-send-email-yi.y.yang@intel.com>",
        "X-Spam-Status": "No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED,\n\tRP_MATCHES_RCVD autolearn=unavailable version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Cc": "dev@openvswitch.org, jbenc@redhat.com, e@erig.me",
        "Subject": "[ovs-dev] [PATCH net-next v6 2/3] net: gso: Add GSO support for NSH",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "NSH (Network Service Header)[1] is a new protocol for service\nfunction chaining, it can be handled as a L3 protocol like\nIPv4 and IPv6, Eth + NSH + Inner packet or VxLAN-gpe + NSH +\nInner packet are two typical use cases.\n\nWe need to enbale Open vSwitch to support NSH, this patch\nis to make Linux network infrastructure able to support\nNSH GSO for big packet.\n\n[1] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/\n\nSigned-off-by: Yi Yang <yi.y.yang@intel.com>\n---\n include/linux/netdevice.h |   1 +\n include/linux/skbuff.h    |   8 +++-\n net/Kconfig               |   1 +\n net/Makefile              |   1 +\n net/core/dev.c            |  14 ++++++\n net/ipv4/udp_offload.c    |   7 +++\n net/nsh/Kconfig           |  11 +++++\n net/nsh/Makefile          |   4 ++\n net/nsh/nsh_gso.c         | 106 ++++++++++++++++++++++++++++++++++++++++++++++\n 9 files changed, 151 insertions(+), 2 deletions(-)\n create mode 100644 net/nsh/Kconfig\n create mode 100644 net/nsh/Makefile\n create mode 100644 net/nsh/nsh_gso.c",
    "diff": "diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex c5475b3..b017418 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -3253,6 +3253,7 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi);\n gro_result_t napi_gro_frags(struct napi_struct *napi);\n struct packet_offload *gro_find_receive_by_type(__be16 type);\n struct packet_offload *gro_find_complete_by_type(__be16 type);\n+struct packet_offload *find_gso_segment_by_type(__be16 type);\n \n static inline void napi_free_frags(struct napi_struct *napi)\n {\ndiff --git a/include/linux/skbuff.h b/include/linux/skbuff.h\nindex 7594e19..aafc8ff 100644\n--- a/include/linux/skbuff.h\n+++ b/include/linux/skbuff.h\n@@ -766,7 +766,7 @@ struct sk_buff {\n \t__u8\t\t\tndisc_nodetype:2;\n #endif\n \t__u8\t\t\tipvs_property:1;\n-\t__u8\t\t\tinner_protocol_type:1;\n+\t__u8\t\t\tinner_protocol_type:2;\n \t__u8\t\t\tremcsum_offload:1;\n #ifdef CONFIG_NET_SWITCHDEV\n \t__u8\t\t\toffload_fwd_mark:1;\n@@ -2174,12 +2174,16 @@ static inline void skb_tailroom_reserve(struct sk_buff *skb, unsigned int mtu,\n \n #define ENCAP_TYPE_ETHER\t0\n #define ENCAP_TYPE_IPPROTO\t1\n+#define ENCAP_TYPE_NSH\t\t2\n \n static inline void skb_set_inner_protocol(struct sk_buff *skb,\n \t\t\t\t\t  __be16 protocol)\n {\n \tskb->inner_protocol = protocol;\n-\tskb->inner_protocol_type = ENCAP_TYPE_ETHER;\n+\tif (skb->inner_protocol == htons(ETH_P_NSH))\n+\t\tskb->inner_protocol_type = ENCAP_TYPE_NSH;\n+\telse\n+\t\tskb->inner_protocol_type = ENCAP_TYPE_ETHER;\n }\n \n static inline void skb_set_inner_ipproto(struct sk_buff *skb,\ndiff --git a/net/Kconfig b/net/Kconfig\nindex 7d57ef3..818df7a 100644\n--- a/net/Kconfig\n+++ b/net/Kconfig\n@@ -240,6 +240,7 @@ source \"net/switchdev/Kconfig\"\n source \"net/l3mdev/Kconfig\"\n source \"net/qrtr/Kconfig\"\n source \"net/ncsi/Kconfig\"\n+source \"net/nsh/Kconfig\"\n \n config RPS\n \tbool\ndiff --git a/net/Makefile b/net/Makefile\nindex bed80fa..82bfac6 100644\n--- a/net/Makefile\n+++ b/net/Makefile\n@@ -85,3 +85,4 @@ obj-y\t\t\t\t+= l3mdev/\n endif\n obj-$(CONFIG_QRTR)\t\t+= qrtr/\n obj-$(CONFIG_NET_NCSI)\t\t+= ncsi/\n+obj-$(CONFIG_NET_NSH_GSO)\t\t+= nsh/\ndiff --git a/net/core/dev.c b/net/core/dev.c\nindex 270b547..02a988d 100644\n--- a/net/core/dev.c\n+++ b/net/core/dev.c\n@@ -4874,6 +4874,20 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)\n }\n EXPORT_SYMBOL(gro_find_complete_by_type);\n \n+struct packet_offload *find_gso_segment_by_type(__be16 type)\n+{\n+\tstruct list_head *offload_head = &offload_base;\n+\tstruct packet_offload *ptype;\n+\n+\tlist_for_each_entry_rcu(ptype, offload_head, list) {\n+\t\tif (ptype->type != type || !ptype->callbacks.gso_segment)\n+\t\t\tcontinue;\n+\t\treturn ptype;\n+\t}\n+\treturn NULL;\n+}\n+EXPORT_SYMBOL(find_gso_segment_by_type);\n+\n static void napi_skb_free_stolen_head(struct sk_buff *skb)\n {\n \tskb_dst_drop(skb);\ndiff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c\nindex 97658bf..31f9383 100644\n--- a/net/ipv4/udp_offload.c\n+++ b/net/ipv4/udp_offload.c\n@@ -155,6 +155,7 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,\n \t__be16 protocol = skb->protocol;\n \tconst struct net_offload **offloads;\n \tconst struct net_offload *ops;\n+\tconst struct packet_offload *po;\n \tstruct sk_buff *segs = ERR_PTR(-EINVAL);\n \tstruct sk_buff *(*gso_inner_segment)(struct sk_buff *skb,\n \t\t\t\t\t     netdev_features_t features);\n@@ -173,6 +174,12 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,\n \t\t\tgoto out_unlock;\n \t\tgso_inner_segment = ops->callbacks.gso_segment;\n \t\tbreak;\n+\tcase ENCAP_TYPE_NSH:\n+\t\tprotocol = skb->inner_protocol;\n+\t\tpo = find_gso_segment_by_type(protocol);\n+\t\tif (!po || !po->callbacks.gso_segment)\n+\t\t\tgoto out_unlock;\n+\t\tgso_inner_segment = po->callbacks.gso_segment;\n \tdefault:\n \t\tgoto out_unlock;\n \t}\ndiff --git a/net/nsh/Kconfig b/net/nsh/Kconfig\nnew file mode 100644\nindex 0000000..0157b26\n--- /dev/null\n+++ b/net/nsh/Kconfig\n@@ -0,0 +1,11 @@\n+#\n+# NSH GSO support\n+#\n+\n+config NET_NSH_GSO\n+\tbool \"NSH GSO support\"\n+\tdepends on INET\n+\tdefault y\n+\t---help---\n+\t  This allows segmentation of GSO packet that have had NSH header\n+\t  pushed onto them and thus become NSH GSO packets.\ndiff --git a/net/nsh/Makefile b/net/nsh/Makefile\nnew file mode 100644\nindex 0000000..eb4bca0\n--- /dev/null\n+++ b/net/nsh/Makefile\n@@ -0,0 +1,4 @@\n+#\n+# Makefile for NSH GSO.\n+#\n+obj-$(CONFIG_NET_NSH_GSO) += nsh_gso.o\ndiff --git a/net/nsh/nsh_gso.c b/net/nsh/nsh_gso.c\nnew file mode 100644\nindex 0000000..4b6fb29\n--- /dev/null\n+++ b/net/nsh/nsh_gso.c\n@@ -0,0 +1,106 @@\n+/*\n+ *\tNSH GSO Support\n+ *\n+ *\tAuthors: Yi Yang (yi.y.yang@intel.com)\n+ *\n+ *\tThis program is free software; you can redistribute it and/or\n+ *\tmodify it under the terms of the GNU General Public License\n+ *\tas published by the Free Software Foundation; either version\n+ *\t2 of the License, or (at your option) any later version.\n+ *\n+ *\tBased on: net/mpls/mpls_gso.c\n+ */\n+\n+#include <linux/err.h>\n+#include <linux/netdev_features.h>\n+#include <linux/netdevice.h>\n+#include <linux/skbuff.h>\n+#include <net/protocol.h>\n+#include <net/nsh.h>\n+\n+struct sk_buff *nsh_gso_segment(struct sk_buff *skb,\n+\t\t\t\tnetdev_features_t features)\n+{\n+\tstruct sk_buff *segs = ERR_PTR(-EINVAL);\n+\tint nshoff;\n+\t__be16 inner_proto;\n+\tstruct nsh_hdr *nsh;\n+\tunsigned int nsh_hlen;\n+\tstruct packet_offload *po;\n+\tstruct sk_buff *(*gso_inner_segment)(struct sk_buff *skb,\n+\t\t\t\t\t     netdev_features_t features);\n+\n+\tskb_reset_network_header(skb);\n+\tnshoff = skb_network_header(skb) - skb_mac_header(skb);\n+\n+\tif (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN)))\n+\t\tgoto out;\n+\n+\tnsh = (struct nsh_hdr *)skb_network_header(skb);\n+\tnsh_hlen = nsh_hdr_len(nsh);\n+\tif (unlikely(!pskb_may_pull(skb, nsh_hlen)))\n+\t\tgoto out;\n+\n+\tnsh = (struct nsh_hdr *)skb_network_header(skb);\n+\t__skb_pull(skb, nsh_hlen);\n+\n+\tskb_reset_transport_header(skb);\n+\n+\tswitch (nsh->np) {\n+\tcase NSH_P_ETHERNET:\n+\t\tinner_proto = htons(ETH_P_TEB);\n+\t\tgso_inner_segment = skb_mac_gso_segment;\n+\t\tbreak;\n+\tcase NSH_P_IPV4:\n+\t\tinner_proto = htons(ETH_P_IP);\n+\t\tpo = find_gso_segment_by_type(inner_proto);\n+\t\tif (!po || !po->callbacks.gso_segment)\n+\t\t\tgoto out;\n+\t\tgso_inner_segment = po->callbacks.gso_segment;\n+\t\tbreak;\n+\tcase NSH_P_IPV6:\n+\t\tinner_proto = htons(ETH_P_IPV6);\n+\t\tpo = find_gso_segment_by_type(inner_proto);\n+\t\tif (!po || !po->callbacks.gso_segment)\n+\t\t\tgoto out;\n+\t\tgso_inner_segment = po->callbacks.gso_segment;\n+\t\tbreak;\n+\tcase NSH_P_NSH:\n+\t\tinner_proto = htons(ETH_P_NSH);\n+\t\tgso_inner_segment = nsh_gso_segment;\n+\t\tbreak;\n+\tdefault:\n+\t\tgoto out;\n+\t}\n+\n+\tsegs = gso_inner_segment(skb, features);\n+\tif (IS_ERR_OR_NULL(segs))\n+\t\tgoto out;\n+\n+\tskb = segs;\n+\tdo {\n+\t\tnsh = (struct nsh_hdr *)(skb_mac_header(skb) + nshoff);\n+\t\tskb->network_header = (u8 *)nsh - skb->head;\n+\t} while ((skb = skb->next));\n+\n+out:\n+\treturn segs;\n+}\n+EXPORT_SYMBOL(nsh_gso_segment);\n+\n+static struct packet_offload nsh_offload __read_mostly = {\n+\t.type = cpu_to_be16(ETH_P_NSH),\n+\t.priority = 15,\n+\t.callbacks = {\n+\t\t.gso_segment    =\tnsh_gso_segment,\n+\t},\n+};\n+\n+static int __init nsh_gso_init(void)\n+{\n+\tdev_add_offload(&nsh_offload);\n+\n+\treturn 0;\n+}\n+\n+device_initcall(nsh_gso_init);\n",
    "prefixes": [
        "ovs-dev",
        "net-next",
        "v6",
        "2/3"
    ]
}