Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806754/?format=api
{ "id": 806754, "url": "http://patchwork.ozlabs.org/api/patches/806754/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/e201e59a62a483c8c4919ab99aa27e0391ecb370.1503948295.git.jbenc@redhat.com/", "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": "<e201e59a62a483c8c4919ab99aa27e0391ecb370.1503948295.git.jbenc@redhat.com>", "list_archive_url": null, "date": "2017-08-28T19:43:24", "name": "[net-next,4/4] nsh: add GSO support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "35f7b1a584a0fc8949aaa63bdce1db71b92850ad", "submitter": { "id": 9287, "url": "http://patchwork.ozlabs.org/api/people/9287/?format=api", "name": "Jiri Benc", "email": "jbenc@redhat.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/e201e59a62a483c8c4919ab99aa27e0391ecb370.1503948295.git.jbenc@redhat.com/mbox/", "series": [ { "id": 248, "url": "http://patchwork.ozlabs.org/api/series/248/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=248", "date": "2017-08-28T19:43:20", "name": "nsh: headers, GSO", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/248/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806754/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806754/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>)", "ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jbenc@redhat.com" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xh2JV0WPvz9s76\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 05:43:54 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751469AbdH1Tnw (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 15:43:52 -0400", "from mx1.redhat.com ([209.132.183.28]:39846 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751192AbdH1Tnp (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 28 Aug 2017 15:43:45 -0400", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 61DD0883B9;\n\tMon, 28 Aug 2017 19:43:45 +0000 (UTC)", "from griffin.upir.cz (ovpn-117-53.ams2.redhat.com [10.36.117.53])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 2FCB05EDE2;\n\tMon, 28 Aug 2017 19:43:44 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 61DD0883B9", "From": "Jiri Benc <jbenc@redhat.com>", "To": "netdev@vger.kernel.org", "Cc": "Yi Yang <yi.y.yang@intel.com>, Eric Garver <e@erig.me>,\n\tJan Scheurich <jan.scheurich@ericsson.com>, Ben Pfaff <blp@ovn.org>", "Subject": "[PATCH net-next 4/4] nsh: add GSO support", "Date": "Mon, 28 Aug 2017 21:43:24 +0200", "Message-Id": "<e201e59a62a483c8c4919ab99aa27e0391ecb370.1503948295.git.jbenc@redhat.com>", "In-Reply-To": "<cover.1503948295.git.jbenc@redhat.com>", "References": "<cover.1503948295.git.jbenc@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tMon, 28 Aug 2017 19:43:45 +0000 (UTC)", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Add a new nsh/ directory. It currently holds only GSO functions but more\nwill come: in particular, code shared by openvswitch and tc to manipulate\nNSH headers.\n\nFor now, assume there's no hardware support for NSH segmentation. We can\nalways introduce netdev->nsh_features later.\n\nSigned-off-by: Jiri Benc <jbenc@redhat.com>\n---\n net/Kconfig | 1 +\n net/Makefile | 1 +\n net/nsh/Kconfig | 9 ++++++\n net/nsh/Makefile | 1 +\n net/nsh/nsh.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 103 insertions(+)\n create mode 100644 net/nsh/Kconfig\n create mode 100644 net/nsh/Makefile\n create mode 100644 net/nsh/nsh.c", "diff": "diff --git a/net/Kconfig b/net/Kconfig\nindex 7d57ef34b79c..45def78912ce 100644\n--- a/net/Kconfig\n+++ b/net/Kconfig\n@@ -235,6 +235,7 @@ source \"net/openvswitch/Kconfig\"\n source \"net/vmw_vsock/Kconfig\"\n source \"net/netlink/Kconfig\"\n source \"net/mpls/Kconfig\"\n+source \"net/nsh/Kconfig\"\n source \"net/hsr/Kconfig\"\n source \"net/switchdev/Kconfig\"\n source \"net/l3mdev/Kconfig\"\ndiff --git a/net/Makefile b/net/Makefile\nindex bed80fa398b7..e03c3888179f 100644\n--- a/net/Makefile\n+++ b/net/Makefile\n@@ -76,6 +76,7 @@ obj-$(CONFIG_NET_IFE)\t\t+= ife/\n obj-$(CONFIG_OPENVSWITCH)\t+= openvswitch/\n obj-$(CONFIG_VSOCKETS)\t+= vmw_vsock/\n obj-$(CONFIG_MPLS)\t\t+= mpls/\n+obj-$(CONFIG_NET_NSH)\t\t+= nsh/\n obj-$(CONFIG_HSR)\t\t+= hsr/\n ifneq ($(CONFIG_NET_SWITCHDEV),)\n obj-y\t\t\t\t+= switchdev/\ndiff --git a/net/nsh/Kconfig b/net/nsh/Kconfig\nnew file mode 100644\nindex 000000000000..bafc3dd60c2c\n--- /dev/null\n+++ b/net/nsh/Kconfig\n@@ -0,0 +1,9 @@\n+menuconfig NET_NSH\n+\ttristate \"Network Service Header (NSH) protocol\"\n+\tdefault n\n+\t---help---\n+\t Network Service Header is an implementation of Service Function\n+\t Chaining (RFC 7665). The current implementation in Linux supports\n+\t only MD type 1 and only with the openvswitch module.\n+\n+\t If unsure, say N.\ndiff --git a/net/nsh/Makefile b/net/nsh/Makefile\nnew file mode 100644\nindex 000000000000..c93c787385ca\n--- /dev/null\n+++ b/net/nsh/Makefile\n@@ -0,0 +1 @@\n+obj-$(CONFIG_NET_NSH) += nsh.o\ndiff --git a/net/nsh/nsh.c b/net/nsh/nsh.c\nnew file mode 100644\nindex 000000000000..58fb827439a8\n--- /dev/null\n+++ b/net/nsh/nsh.c\n@@ -0,0 +1,91 @@\n+/*\n+ * Network Service Header\n+ *\n+ * Copyright (c) 2017 Red Hat, Inc. -- Jiri Benc <jbenc@redhat.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License version 2 as\n+ * published by the Free Software Foundation.\n+ */\n+\n+#include <linux/module.h>\n+#include <linux/netdevice.h>\n+#include <linux/skbuff.h>\n+#include <net/nsh.h>\n+#include <net/tun_proto.h>\n+\n+static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,\n+\t\t\t\t netdev_features_t features)\n+{\n+\tstruct sk_buff *segs = ERR_PTR(-EINVAL);\n+\tunsigned int nsh_len, mac_len;\n+\t__be16 proto;\n+\tint nhoff;\n+\n+\tskb_reset_network_header(skb);\n+\n+\tnhoff = skb->network_header - skb->mac_header;\n+\tmac_len = skb->mac_len;\n+\n+\tif (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN)))\n+\t\tgoto out;\n+\tnsh_len = nsh_hdr_len(nsh_hdr(skb));\n+\tif (unlikely(!pskb_may_pull(skb, nsh_len)))\n+\t\tgoto out;\n+\n+\tproto = tun_p_to_eth_p(nsh_hdr(skb)->np);\n+\tif (!proto)\n+\t\tgoto out;\n+\n+\t__skb_pull(skb, nsh_len);\n+\n+\tskb_reset_mac_header(skb);\n+\tskb_reset_mac_len(skb);\n+\tskb->protocol = proto;\n+\n+\tfeatures &= NETIF_F_SG;\n+\tsegs = skb_mac_gso_segment(skb, features);\n+\tif (IS_ERR_OR_NULL(segs)) {\n+\t\tskb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len,\n+\t\t\t\t skb->network_header - nhoff,\n+\t\t\t\t mac_len);\n+\t\tgoto out;\n+\t}\n+\n+\tfor (skb = segs; skb; skb = skb->next) {\n+\t\tskb->protocol = htons(ETH_P_NSH);\n+\t\t__skb_push(skb, nsh_len);\n+\t\tskb_set_mac_header(skb, -nhoff);\n+\t\tskb->network_header = skb->mac_header + mac_len;\n+\t\tskb->mac_len = mac_len;\n+\t}\n+\n+out:\n+\treturn segs;\n+}\n+\n+static struct packet_offload nsh_packet_offload __read_mostly = {\n+\t.type = htons(ETH_P_NSH),\n+\t.priority = 15,\n+\t.callbacks = {\n+\t\t.gso_segment = nsh_gso_segment,\n+\t},\n+};\n+\n+static int __init nsh_init_module(void)\n+{\n+\tdev_add_offload(&nsh_packet_offload);\n+\treturn 0;\n+}\n+\n+static void __exit nsh_cleanup_module(void)\n+{\n+\tdev_remove_offload(&nsh_packet_offload);\n+}\n+\n+module_init(nsh_init_module);\n+module_exit(nsh_cleanup_module);\n+\n+MODULE_AUTHOR(\"Jiri Benc <jbenc@redhat.com>\");\n+MODULE_DESCRIPTION(\"NSH protocol\");\n+MODULE_LICENSE(\"GPL v2\");\n", "prefixes": [ "net-next", "4/4" ] }