get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2308,
    "url": "https://patches.dpdk.org/api/patches/2308/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421298930-15210-6-git-send-email-changchun.ouyang@intel.com/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1421298930-15210-6-git-send-email-changchun.ouyang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421298930-15210-6-git-send-email-changchun.ouyang@intel.com",
    "date": "2015-01-15T05:15:13",
    "name": "[dpdk-dev,05/22] ether: Add soft vlan encap/decap functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "378d2412870d81c5c1c12eca2d614a466acb4db7",
    "submitter": {
        "id": 31,
        "url": "https://patches.dpdk.org/api/people/31/?format=api",
        "name": "Ouyang Changchun",
        "email": "changchun.ouyang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421298930-15210-6-git-send-email-changchun.ouyang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2308/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2308/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 3F0185AA1;\n\tThu, 15 Jan 2015 06:16:01 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 8BE4A5686\n\tfor <dev@dpdk.org>; Thu, 15 Jan 2015 06:15:54 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga102.fm.intel.com with ESMTP; 14 Jan 2015 21:15:54 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 14 Jan 2015 21:15:53 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id t0F5FkRJ032081;\n\tThu, 15 Jan 2015 13:15:46 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid t0F5Fhe0015278; Thu, 15 Jan 2015 13:15:45 +0800",
            "(from couyang@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0F5FhRE015274; \n\tThu, 15 Jan 2015 13:15:43 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,401,1418112000\"; d=\"scan'208\";a=\"662127847\"",
        "From": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 15 Jan 2015 13:15:13 +0800",
        "Message-Id": "<1421298930-15210-6-git-send-email-changchun.ouyang@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>",
        "References": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 05/22] ether: Add soft vlan encap/decap functions",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "It is helpful to allow device drivers that don't support hardware\nVLAN stripping to emulate this in software. This allows application\nto be device independent.\n\nAvoid discarding shared mbufs. Make a copy in rte_vlan_insert() of any\npacket to be tagged that has a reference count > 1.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\n---\n lib/librte_ether/rte_ether.h | 76 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 76 insertions(+)",
    "diff": "diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h\nindex 187608d..3b6ab4b 100644\n--- a/lib/librte_ether/rte_ether.h\n+++ b/lib/librte_ether/rte_ether.h\n@@ -49,6 +49,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@@ -332,6 +334,80 @@ struct vxlan_hdr {\n #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))\n /**< VXLAN tunnel header length. */\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->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_REFCNT\n+\t/* Can't insert header if mbuf is shared */\n+\tif (rte_mbuf_refcnt_read(*m) > 1) {\n+\t\tstruct rte_mbuf *copy;\n+\n+\t\tcopy = rte_pktmbuf_clone(*m, (*m)->pool);\n+\t\tif (unlikely(copy == NULL))\n+\t\t\treturn -ENOMEM;\n+\t\trte_pktmbuf_free(*m);\n+\t\t*m = copy;\n+\t}\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)->vlan_tci);\n+\n+\treturn 0;\n+}\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "05/22"
    ]
}