Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806752/?format=api
{ "id": 806752, "url": "http://patchwork.ozlabs.org/api/patches/806752/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/c4c6c88e5aadcddf08edc6851e7c194ced74fb4a.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": "<c4c6c88e5aadcddf08edc6851e7c194ced74fb4a.1503948295.git.jbenc@redhat.com>", "list_archive_url": null, "date": "2017-08-28T19:43:22", "name": "[net-next,2/4] vxlan: factor out VXLAN-GPE next protocol", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "b7b1cd1b1a3671671ed177b6a274edc1819975b5", "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/c4c6c88e5aadcddf08edc6851e7c194ced74fb4a.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/806752/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806752/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-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx01.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 3xh2JM0rRPz9s76\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 05:43:47 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751453AbdH1Tno (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 15:43:44 -0400", "from mx1.redhat.com ([209.132.183.28]:35346 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751192AbdH1Tnm (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 28 Aug 2017 15:43:42 -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 1443C81DF0;\n\tMon, 28 Aug 2017 19:43:42 +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 CA80C5EDE7;\n\tMon, 28 Aug 2017 19:43:40 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 1443C81DF0", "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 2/4] vxlan: factor out VXLAN-GPE next protocol", "Date": "Mon, 28 Aug 2017 21:43:22 +0200", "Message-Id": "<c4c6c88e5aadcddf08edc6851e7c194ced74fb4a.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.25]);\n\tMon, 28 Aug 2017 19:43:42 +0000 (UTC)", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "The values are shared between VXLAN-GPE and NSH. Originally probably by\ncoincidence but I notified both working groups about this last year and they\nseem to keep the values in sync since then.\n\nHopefully they'll get a single IANA registry for the values, too. (I asked\nthem for that.)\n\nFactor out the code to be shared by the NSH implementation.\n\nNSH and MPLS values are added in this patch, too. For MPLS, the drafts\nincorrectly assign only a single value, while we have two MPLS ethertypes.\nI raised the problem with both groups. For now, I assume the value is for\nunicast.\n\nSigned-off-by: Jiri Benc <jbenc@redhat.com>\n---\n drivers/net/vxlan.c | 32 +++++++-------------------------\n include/net/tun_proto.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++\n include/net/vxlan.h | 6 ------\n 3 files changed, 56 insertions(+), 31 deletions(-)\n create mode 100644 include/net/tun_proto.h", "diff": "diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c\nindex ae3a1da703c2..d7c49cf1d5e9 100644\n--- a/drivers/net/vxlan.c\n+++ b/drivers/net/vxlan.c\n@@ -26,6 +26,7 @@\n #include <net/inet_ecn.h>\n #include <net/net_namespace.h>\n #include <net/netns/generic.h>\n+#include <net/tun_proto.h>\n #include <net/vxlan.h>\n \n #if IS_ENABLED(CONFIG_IPV6)\n@@ -1261,19 +1262,9 @@ static bool vxlan_parse_gpe_hdr(struct vxlanhdr *unparsed,\n \tif (gpe->oam_flag)\n \t\treturn false;\n \n-\tswitch (gpe->next_protocol) {\n-\tcase VXLAN_GPE_NP_IPV4:\n-\t\t*protocol = htons(ETH_P_IP);\n-\t\tbreak;\n-\tcase VXLAN_GPE_NP_IPV6:\n-\t\t*protocol = htons(ETH_P_IPV6);\n-\t\tbreak;\n-\tcase VXLAN_GPE_NP_ETHERNET:\n-\t\t*protocol = htons(ETH_P_TEB);\n-\t\tbreak;\n-\tdefault:\n+\t*protocol = tun_p_to_eth_p(gpe->next_protocol);\n+\tif (!*protocol)\n \t\treturn false;\n-\t}\n \n \tunparsed->vx_flags &= ~VXLAN_GPE_USED_BITS;\n \treturn true;\n@@ -1799,19 +1790,10 @@ static int vxlan_build_gpe_hdr(struct vxlanhdr *vxh, u32 vxflags,\n \tstruct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)vxh;\n \n \tgpe->np_applied = 1;\n-\n-\tswitch (protocol) {\n-\tcase htons(ETH_P_IP):\n-\t\tgpe->next_protocol = VXLAN_GPE_NP_IPV4;\n-\t\treturn 0;\n-\tcase htons(ETH_P_IPV6):\n-\t\tgpe->next_protocol = VXLAN_GPE_NP_IPV6;\n-\t\treturn 0;\n-\tcase htons(ETH_P_TEB):\n-\t\tgpe->next_protocol = VXLAN_GPE_NP_ETHERNET;\n-\t\treturn 0;\n-\t}\n-\treturn -EPFNOSUPPORT;\n+\tgpe->next_protocol = tun_p_from_eth_p(protocol);\n+\tif (!gpe->next_protocol)\n+\t\treturn -EPFNOSUPPORT;\n+\treturn 0;\n }\n \n static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,\ndiff --git a/include/net/tun_proto.h b/include/net/tun_proto.h\nnew file mode 100644\nindex 000000000000..2ea3deba4c99\n--- /dev/null\n+++ b/include/net/tun_proto.h\n@@ -0,0 +1,49 @@\n+#ifndef __NET_TUN_PROTO_H\n+#define __NET_TUN_PROTO_H\n+\n+#include <linux/kernel.h>\n+\n+/* One byte protocol values as defined by VXLAN-GPE and NSH. These will\n+ * hopefully get a shared IANA registry.\n+ */\n+#define TUN_P_IPV4 0x01\n+#define TUN_P_IPV6 0x02\n+#define TUN_P_ETHERNET 0x03\n+#define TUN_P_NSH 0x04\n+#define TUN_P_MPLS_UC 0x05\n+\n+static inline __be16 tun_p_to_eth_p(u8 proto)\n+{\n+\tswitch (proto) {\n+\tcase TUN_P_IPV4:\n+\t\treturn htons(ETH_P_IP);\n+\tcase TUN_P_IPV6:\n+\t\treturn htons(ETH_P_IPV6);\n+\tcase TUN_P_ETHERNET:\n+\t\treturn htons(ETH_P_TEB);\n+\tcase TUN_P_NSH:\n+\t\treturn htons(ETH_P_NSH);\n+\tcase TUN_P_MPLS_UC:\n+\t\treturn htons(ETH_P_MPLS_UC);\n+\t}\n+\treturn 0;\n+}\n+\n+static inline u8 tun_p_from_eth_p(__be16 proto)\n+{\n+\tswitch (proto) {\n+\tcase htons(ETH_P_IP):\n+\t\treturn TUN_P_IPV4;\n+\tcase htons(ETH_P_IPV6):\n+\t\treturn TUN_P_IPV6;\n+\tcase htons(ETH_P_TEB):\n+\t\treturn TUN_P_ETHERNET;\n+\tcase htons(ETH_P_NSH):\n+\t\treturn TUN_P_NSH;\n+\tcase htons(ETH_P_MPLS_UC):\n+\t\treturn TUN_P_MPLS_UC;\n+\t}\n+\treturn 0;\n+}\n+\n+#endif\ndiff --git a/include/net/vxlan.h b/include/net/vxlan.h\nindex 3f430e38ab82..4e3876dde295 100644\n--- a/include/net/vxlan.h\n+++ b/include/net/vxlan.h\n@@ -168,12 +168,6 @@ struct vxlanhdr_gpe {\n #define VXLAN_GPE_USED_BITS (VXLAN_HF_VER | VXLAN_HF_NP | VXLAN_HF_OAM | \\\n \t\t\t cpu_to_be32(0xff))\n \n-/* VXLAN-GPE header Next Protocol. */\n-#define VXLAN_GPE_NP_IPV4 0x01\n-#define VXLAN_GPE_NP_IPV6 0x02\n-#define VXLAN_GPE_NP_ETHERNET 0x03\n-#define VXLAN_GPE_NP_NSH 0x04\n-\n struct vxlan_metadata {\n \tu32\t\tgbp;\n };\n", "prefixes": [ "net-next", "2/4" ] }