Show a patch.

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

{
    "id": 213,
    "url": "https://patches.dpdk.org/api/patches/213/?format=api",
    "web_url": "https://patches.dpdk.org/patch/213/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<20140826020845.804064642@networkplumber.org>",
    "date": "2014-08-26T02:07:51",
    "name": "[dpdk-dev,RFC,05/10] ether: add soft vlan encap/decap functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "c7920d7b226b2766470c75ee32f2bc609266b36e",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/213/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/213/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/213/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Content-Disposition": "inline; filename=vlan-encap-decap.patch",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Gm-Message-State": "ALoCoQlgXBAI7d1fBxsgW5qEng+UrHeOTN5bLYoyY1ZFrfFq4kNK/UD666fPUaZ5BJFQ6OujfOEX",
        "List-Post": "<mailto:dev@dpdk.org>",
        "MIME-Version": "1.0",
        "References": "<20140826020746.062748014@networkplumber.org>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [RFC 05/10] ether: add soft vlan encap/decap functions",
        "User-Agent": "quilt/0.63-1",
        "Content-Type": "text/plain; charset=UTF-8",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "Received": [
            "from mail-pd0-f178.google.com (mail-pd0-f178.google.com\n\t[209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 347A86A98\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 04:04:51 +0200 (CEST)",
            "by mail-pd0-f178.google.com with SMTP id w10so21589528pde.37\n\tfor <dev@dpdk.org>; Mon, 25 Aug 2014 19:08:48 -0700 (PDT)",
            "from localhost (static-50-53-65-80.bvtn.or.frontiernet.net.\n\t[50.53.65.80]) by mx.google.com with ESMTPSA id\n\tgz1sm1136963pbd.74.2014.08.25.19.08.46 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 25 Aug 2014 19:08:47 -0700 (PDT)"
        ],
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject\n\t:references:mime-version:content-type:content-disposition;\n\tbh=3Vx5fvsdzhkeWuP7mj33zltxn6wcvC1nZJsHjWmmGQI=;\n\tb=e6AaBDX95Pn21DH0wp3BigSOLVjK3QWzd1yvOqwVXJPC4VA3AR3P0o1ZqX7ZoABlf9\n\tqNeBYUQ0UL2fq7nvy3VGTMkdVa7j+NDIPwZGmIijaVbUag6Qj9PeEorOnnwCWvMtYnVR\n\tE7hVd0JYS7fb4+hqYO+C/KrGbY417/7QarKMVouAKzPA6u2GbuBS+0h0d9gs0q+fSrML\n\tH3eEmAztqu4hTxyoBrVhTCdWiD0o7z5xKTuu23oVSTS9g90a5atsd9czzvyqfHE+XsfC\n\tPeO+xOA8PZmmpaMAAKLMYVBNuHVfKzw8BuYtZKdjowrgaZaRjC1hSejv3pKT4/jeHR/m\n\tf5tQ==",
        "Date": "Mon, 25 Aug 2014 19:07:51 -0700",
        "X-Received": "by 10.66.182.130 with SMTP id ee2mr32416852pac.48.1409018928338; \n\tMon, 25 Aug 2014 19:08:48 -0700 (PDT)",
        "To": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "X-List-Received-Date": "Tue, 26 Aug 2014 02:04:52 -0000",
        "Cc": "dev@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Message-Id": "<20140826020845.804064642@networkplumber.org>",
        "Return-Path": "<stephen@networkplumber.org>"
    },
    "content": "It is helpful to allow device drivers that don't support hardware\nVLAN stripping to emulate this in software.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n\n\n---\n lib/librte_ether/rte_ether.h |   69 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)",
    "diff": "--- a/lib/librte_ether/rte_ether.h\t2014-08-25 19:00:06.978533976 -0700\n+++ b/lib/librte_ether/rte_ether.h\t2014-08-25 19:00:06.978533976 -0700\n@@ -48,6 +48,8 @@ extern \"C\" {\n \n #include <rte_memcpy.h>\n #include <rte_random.h>\n+#include <rte_mbuf.h>\n+#include <rte_byteorder.h>\n \n #define ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */\n #define ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */\n@@ -294,6 +296,73 @@ struct vlan_hdr {\n #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */\n #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */\n \n+/**\n+ * Extract VLAN tag information into mbuf\n+ *\n+ * Software version of VLAN stripping\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   - 0: Success\n+ *   - 1: not a vlan packet\n+ */\n+static inline int rte_vlan_strip(struct rte_mbuf *m)\n+{\n+\tstruct ether_hdr *eh\n+\t\t = rte_pktmbuf_mtod(m, struct ether_hdr *);\n+\n+\tif (eh->ether_type != ETHER_TYPE_VLAN)\n+\t\treturn -1;\n+\n+\tstruct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);\n+\tm->ol_flags |= PKT_RX_VLAN_PKT;\n+\tm->pkt.vlan_macip.f.vlan_tci = rte_be_to_cpu_16(vh->vlan_tci);\n+\n+\t/* Copy ether header over rather than moving whole packet */\n+\tmemmove(rte_pktmbuf_adj(m, sizeof(struct vlan_hdr)),\n+\t\teh, 2 * ETHER_ADDR_LEN);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * Insert VLAN tag into mbuf.\n+ *\n+ * Software version of VLAN unstripping\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   - 0: On success\n+ *   -EPERM: mbuf is is shared overwriting would be unsafe\n+ *   -ENOSPC: not enough headroom in mbuf\n+ */\n+static inline int rte_vlan_insert(struct rte_mbuf *m)\n+{\n+\tstruct ether_hdr *oh, *nh;\n+\tstruct vlan_hdr *vh;\n+\n+#ifdef RTE_MBUF_SCATTER_GATHER\n+\t/* Can't insert header if mbuf is shared */\n+\tif (rte_mbuf_refcnt_read(m) > 1)\n+\t\treturn -EINVAL;\n+#endif\n+\toh = rte_pktmbuf_mtod(m, struct ether_hdr *);\n+\tnh = (struct ether_hdr *)\n+\t\trte_pktmbuf_prepend(m, sizeof(struct vlan_hdr));\n+\tif (nh == NULL)\n+\t\treturn -ENOSPC;\n+\n+\tmemmove(nh, oh, 2 * ETHER_ADDR_LEN);\n+\tnh->ether_type = ETHER_TYPE_VLAN;\n+\n+\tvh = (struct vlan_hdr *) (nh + 1);\n+\tvh->vlan_tci = rte_cpu_to_be_16(m->pkt.vlan_macip.f.vlan_tci);\n+\n+\treturn 0;\n+}\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "05/10"
    ]
}