get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806753,
    "url": "http://patchwork.ozlabs.org/api/patches/806753/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/4abd24a9ec958622186efacb4e46d709831fbaae.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": "<4abd24a9ec958622186efacb4e46d709831fbaae.1503948295.git.jbenc@redhat.com>",
    "list_archive_url": null,
    "date": "2017-08-28T19:43:23",
    "name": "[net-next,3/4] net: add NSH header structures and helpers",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "231f2593b4772a8a7353cc80927c362cc3ca1bb9",
    "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/4abd24a9ec958622186efacb4e46d709831fbaae.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/806753/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806753/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-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx05.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 3xh2JN1pG0z9s7M\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 05:43:48 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751463AbdH1Tnq (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 15:43:46 -0400",
            "from mx1.redhat.com ([209.132.183.28]:32872 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751411AbdH1Tno (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tMon, 28 Aug 2017 15:43:44 -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 D819913A49;\n\tMon, 28 Aug 2017 19:43:43 +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 538825EDE7;\n\tMon, 28 Aug 2017 19:43:42 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com D819913A49",
        "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 3/4] net: add NSH header structures and helpers",
        "Date": "Mon, 28 Aug 2017 21:43:23 +0200",
        "Message-Id": "<4abd24a9ec958622186efacb4e46d709831fbaae.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.29]);\n\tMon, 28 Aug 2017 19:43:44 +0000 (UTC)",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "From: Yi Yang <yi.y.yang@intel.com>\n\nNSH (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\nThis patch adds NSH header structures and helpers for NSH GSO\nsupport and Open vSwitch NSH support.\n\n[1] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/\n\n[Jiri: added nsh_hdr() helper and renamed the header struct to \"struct\nnshhdr\" to match the usual pattern. Removed packet type defines, these are\nnow shared with VXLAN-GPE.]\n\nSigned-off-by: Yi Yang <yi.y.yang@intel.com>\nSigned-off-by: Jiri Benc <jbenc@redhat.com>\n---\n include/net/nsh.h | 307 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 307 insertions(+)\n create mode 100644 include/net/nsh.h",
    "diff": "diff --git a/include/net/nsh.h b/include/net/nsh.h\nnew file mode 100644\nindex 000000000000..a1eaea20be96\n--- /dev/null\n+++ b/include/net/nsh.h\n@@ -0,0 +1,307 @@\n+#ifndef __NET_NSH_H\n+#define __NET_NSH_H 1\n+\n+#include <linux/skbuff.h>\n+\n+/*\n+ * Network Service Header:\n+ *  0                   1                   2                   3\n+ *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ * |Ver|O|U|    TTL    |   Length  |U|U|U|U|MD Type| Next Protocol |\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ * |          Service Path Identifier (SPI)        | Service Index |\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ * |                                                               |\n+ * ~               Mandatory/Optional Context Headers              ~\n+ * |                                                               |\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ *\n+ * Version: The version field is used to ensure backward compatibility\n+ * going forward with future NSH specification updates.  It MUST be set\n+ * to 0x0 by the sender, in this first revision of NSH.  Given the\n+ * widespread implementation of existing hardware that uses the first\n+ * nibble after an MPLS label stack for ECMP decision processing, this\n+ * document reserves version 01b and this value MUST NOT be used in\n+ * future versions of the protocol.  Please see [RFC7325] for further\n+ * discussion of MPLS-related forwarding requirements.\n+ *\n+ * O bit: Setting this bit indicates an Operations, Administration, and\n+ * Maintenance (OAM) packet.  The actual format and processing of SFC\n+ * OAM packets is outside the scope of this specification (see for\n+ * example [I-D.ietf-sfc-oam-framework] for one approach).\n+ *\n+ * The O bit MUST be set for OAM packets and MUST NOT be set for non-OAM\n+ * packets.  The O bit MUST NOT be modified along the SFP.\n+ *\n+ * SF/SFF/SFC Proxy/Classifier implementations that do not support SFC\n+ * OAM procedures SHOULD discard packets with O bit set, but MAY support\n+ * a configurable parameter to enable forwarding received SFC OAM\n+ * packets unmodified to the next element in the chain.  Forwarding OAM\n+ * packets unmodified by SFC elements that do not support SFC OAM\n+ * procedures may be acceptable for a subset of OAM functions, but can\n+ * result in unexpected outcomes for others, thus it is recommended to\n+ * analyze the impact of forwarding an OAM packet for all OAM functions\n+ * prior to enabling this behavior.  The configurable parameter MUST be\n+ * disabled by default.\n+ *\n+ * TTL: Indicates the maximum SFF hops for an SFP.  This field is used\n+ * for service plane loop detection.  The initial TTL value SHOULD be\n+ * configurable via the control plane; the configured initial value can\n+ * be specific to one or more SFPs.  If no initial value is explicitly\n+ * provided, the default initial TTL value of 63 MUST be used.  Each SFF\n+ * involved in forwarding an NSH packet MUST decrement the TTL value by\n+ * 1 prior to NSH forwarding lookup.  Decrementing by 1 from an incoming\n+ * value of 0 shall result in a TTL value of 63.  The packet MUST NOT be\n+ * forwarded if TTL is, after decrement, 0.\n+ *\n+ * All other flag fields, marked U, are unassigned and available for\n+ * future use, see Section 11.2.1.  Unassigned bits MUST be set to zero\n+ * upon origination, and MUST be ignored and preserved unmodified by\n+ * other NSH supporting elements.  Elements which do not understand the\n+ * meaning of any of these bits MUST NOT modify their actions based on\n+ * those unknown bits.\n+ *\n+ * Length: The total length, in 4-byte words, of NSH including the Base\n+ * Header, the Service Path Header, the Fixed Length Context Header or\n+ * Variable Length Context Header(s).  The length MUST be 0x6 for MD\n+ * Type equal to 0x1, and MUST be 0x2 or greater for MD Type equal to\n+ * 0x2.  The length of the NSH header MUST be an integer multiple of 4\n+ * bytes, thus variable length metadata is always padded out to a\n+ * multiple of 4 bytes.\n+ *\n+ * MD Type: Indicates the format of NSH beyond the mandatory Base Header\n+ * and the Service Path Header.  MD Type defines the format of the\n+ * metadata being carried.\n+ *\n+ * 0x0 - This is a reserved value.  Implementations SHOULD silently\n+ * discard packets with MD Type 0x0.\n+ *\n+ * 0x1 - This indicates that the format of the header includes a fixed\n+ * length Context Header (see Figure 4 below).\n+ *\n+ * 0x2 - This does not mandate any headers beyond the Base Header and\n+ * Service Path Header, but may contain optional variable length Context\n+ * Header(s).  The semantics of the variable length Context Header(s)\n+ * are not defined in this document.  The format of the optional\n+ * variable length Context Headers is provided in Section 2.5.1.\n+ *\n+ * 0xF - This value is reserved for experimentation and testing, as per\n+ * [RFC3692].  Implementations not explicitly configured to be part of\n+ * an experiment SHOULD silently discard packets with MD Type 0xF.\n+ *\n+ * Next Protocol: indicates the protocol type of the encapsulated data.\n+ * NSH does not alter the inner payload, and the semantics on the inner\n+ * protocol remain unchanged due to NSH service function chaining.\n+ * Please see the IANA Considerations section below, Section 11.2.5.\n+ *\n+ * This document defines the following Next Protocol values:\n+ *\n+ * 0x1: IPv4\n+ * 0x2: IPv6\n+ * 0x3: Ethernet\n+ * 0x4: NSH\n+ * 0x5: MPLS\n+ * 0xFE: Experiment 1\n+ * 0xFF: Experiment 2\n+ *\n+ * Packets with Next Protocol values not supported SHOULD be silently\n+ * dropped by default, although an implementation MAY provide a\n+ * configuration parameter to forward them.  Additionally, an\n+ * implementation not explicitly configured for a specific experiment\n+ * [RFC3692] SHOULD silently drop packets with Next Protocol values 0xFE\n+ * and 0xFF.\n+ *\n+ * Service Path Identifier (SPI): Identifies a service path.\n+ * Participating nodes MUST use this identifier for Service Function\n+ * Path selection.  The initial classifier MUST set the appropriate SPI\n+ * for a given classification result.\n+ *\n+ * Service Index (SI): Provides location within the SFP.  The initial\n+ * classifier for a given SFP SHOULD set the SI to 255, however the\n+ * control plane MAY configure the initial value of SI as appropriate\n+ * (i.e., taking into account the length of the service function path).\n+ * The Service Index MUST be decremented by a value of 1 by Service\n+ * Functions or by SFC Proxy nodes after performing required services\n+ * and the new decremented SI value MUST be used in the egress packet's\n+ * NSH.  The initial Classifier MUST send the packet to the first SFF in\n+ * the identified SFP for forwarding along an SFP.  If re-classification\n+ * occurs, and that re-classification results in a new SPI, the\n+ * (re)classifier is, in effect, the initial classifier for the\n+ * resultant SPI.\n+ *\n+ * The SI is used in conjunction the with Service Path Identifier for\n+ * Service Function Path Selection and for determining the next SFF/SF\n+ * in the path.  The SI is also valuable when troubleshooting or\n+ * reporting service paths.  Additionally, while the TTL field is the\n+ * main mechanism for service plane loop detection, the SI can also be\n+ * used for detecting service plane loops.\n+ *\n+ * When the Base Header specifies MD Type = 0x1, a Fixed Length Context\n+ * Header (16-bytes) MUST be present immediately following the Service\n+ * Path Header. The value of a Fixed Length Context\n+ * Header that carries no metadata MUST be set to zero.\n+ *\n+ * When the base header specifies MD Type = 0x2, zero or more Variable\n+ * Length Context Headers MAY be added, immediately following the\n+ * Service Path Header (see Figure 5).  Therefore, Length = 0x2,\n+ * indicates that only the Base Header followed by the Service Path\n+ * Header are present.  The optional Variable Length Context Headers\n+ * MUST be of an integer number of 4-bytes.  The base header Length\n+ * field MUST be used to determine the offset to locate the original\n+ * packet or frame for SFC nodes that require access to that\n+ * information.\n+ *\n+ * The format of the optional variable length Context Headers\n+ *\n+ *  0                   1                   2                   3\n+ *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ * |          Metadata Class       |      Type     |U|    Length   |\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ * |                      Variable Metadata                        |\n+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+ *\n+ * Metadata Class (MD Class): Defines the scope of the 'Type' field to\n+ * provide a hierarchical namespace.  The IANA Considerations\n+ * Section 11.2.4 defines how the MD Class values can be allocated to\n+ * standards bodies, vendors, and others.\n+ *\n+ * Type: Indicates the explicit type of metadata being carried.  The\n+ * definition of the Type is the responsibility of the MD Class owner.\n+ *\n+ * Unassigned bit: One unassigned bit is available for future use. This\n+ * bit MUST NOT be set, and MUST be ignored on receipt.\n+ *\n+ * Length: Indicates the length of the variable metadata, in bytes.  In\n+ * case the metadata length is not an integer number of 4-byte words,\n+ * the sender MUST add pad bytes immediately following the last metadata\n+ * byte to extend the metadata to an integer number of 4-byte words.\n+ * The receiver MUST round up the length field to the nearest 4-byte\n+ * word boundary, to locate and process the next field in the packet.\n+ * The receiver MUST access only those bytes in the metadata indicated\n+ * by the length field (i.e., actual number of bytes) and MUST ignore\n+ * the remaining bytes up to the nearest 4-byte word boundary.  The\n+ * Length may be 0 or greater.\n+ *\n+ * A value of 0 denotes a Context Header without a Variable Metadata\n+ * field.\n+ *\n+ * [0] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/\n+ */\n+\n+/**\n+ * struct nsh_md1_ctx - Keeps track of NSH context data\n+ * @nshc<1-4>: NSH Contexts.\n+ */\n+struct nsh_md1_ctx {\n+\t__be32 context[4];\n+};\n+\n+struct nsh_md2_tlv {\n+\t__be16 md_class;\n+\tu8 type;\n+\tu8 length;\n+\tu8 md_value[];\n+};\n+\n+struct nshhdr {\n+\t__be16 ver_flags_ttl_len;\n+\tu8 mdtype;\n+\tu8 np;\n+\t__be32 path_hdr;\n+\tunion {\n+\t    struct nsh_md1_ctx md1;\n+\t    struct nsh_md2_tlv md2;\n+\t};\n+};\n+\n+/* Masking NSH header fields. */\n+#define NSH_VER_MASK       0xc000\n+#define NSH_VER_SHIFT      14\n+#define NSH_FLAGS_MASK     0x3000\n+#define NSH_FLAGS_SHIFT    12\n+#define NSH_TTL_MASK       0x0fc0\n+#define NSH_TTL_SHIFT      6\n+#define NSH_LEN_MASK       0x003f\n+#define NSH_LEN_SHIFT      0\n+\n+#define NSH_MDTYPE_MASK    0x0f\n+#define NSH_MDTYPE_SHIFT   0\n+\n+#define NSH_SPI_MASK       0xffffff00\n+#define NSH_SPI_SHIFT      8\n+#define NSH_SI_MASK        0x000000ff\n+#define NSH_SI_SHIFT       0\n+\n+/* MD Type Registry. */\n+#define NSH_M_TYPE1     0x01\n+#define NSH_M_TYPE2     0x02\n+#define NSH_M_EXP1      0xFE\n+#define NSH_M_EXP2      0xFF\n+\n+/* NSH Base Header Length */\n+#define NSH_BASE_HDR_LEN  8\n+\n+/* NSH MD Type 1 header Length. */\n+#define NSH_M_TYPE1_LEN   24\n+\n+/* NSH header maximum Length. */\n+#define NSH_HDR_MAX_LEN 256\n+\n+/* NSH context headers maximum Length. */\n+#define NSH_CTX_HDRS_MAX_LEN 248\n+\n+static inline struct nshhdr *nsh_hdr(struct sk_buff *skb)\n+{\n+\treturn (struct nshhdr *)skb_network_header(skb);\n+}\n+\n+static inline u16 nsh_hdr_len(const struct nshhdr *nsh)\n+{\n+\treturn ((ntohs(nsh->ver_flags_ttl_len) & NSH_LEN_MASK)\n+\t\t>> NSH_LEN_SHIFT) << 2;\n+}\n+\n+static inline u8 nsh_get_ver(const struct nshhdr *nsh)\n+{\n+\treturn (ntohs(nsh->ver_flags_ttl_len) & NSH_VER_MASK)\n+\t\t>> NSH_VER_SHIFT;\n+}\n+\n+static inline u8 nsh_get_flags(const struct nshhdr *nsh)\n+{\n+\treturn (ntohs(nsh->ver_flags_ttl_len) & NSH_FLAGS_MASK)\n+\t\t>> NSH_FLAGS_SHIFT;\n+}\n+\n+static inline u8 nsh_get_ttl(const struct nshhdr *nsh)\n+{\n+\treturn (ntohs(nsh->ver_flags_ttl_len) & NSH_TTL_MASK)\n+\t\t>> NSH_TTL_SHIFT;\n+}\n+\n+static inline void __nsh_set_xflag(struct nshhdr *nsh, u16 xflag, u16 xmask)\n+{\n+\tnsh->ver_flags_ttl_len\n+\t\t= (nsh->ver_flags_ttl_len & ~htons(xmask)) | htons(xflag);\n+}\n+\n+static inline void nsh_set_flags_and_ttl(struct nshhdr *nsh, u8 flags, u8 ttl)\n+{\n+\t__nsh_set_xflag(nsh, ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK) |\n+\t\t\t     ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK),\n+\t\t\tNSH_FLAGS_MASK | NSH_TTL_MASK);\n+}\n+\n+static inline void nsh_set_flags_ttl_len(struct nshhdr *nsh, u8 flags,\n+\t\t\t\t\t u8 ttl, u8 len)\n+{\n+\tlen = len >> 2;\n+\t__nsh_set_xflag(nsh, ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK) |\n+\t\t\t     ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK) |\n+\t\t\t     ((len << NSH_LEN_SHIFT) & NSH_LEN_MASK),\n+\t\t\tNSH_FLAGS_MASK | NSH_TTL_MASK | NSH_LEN_MASK);\n+}\n+\n+#endif /* __NET_NSH_H */\n",
    "prefixes": [
        "net-next",
        "3/4"
    ]
}