get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2323,
    "url": "https://patches.dpdk.org/api/patches/2323/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421298930-15210-21-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-21-git-send-email-changchun.ouyang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421298930-15210-21-git-send-email-changchun.ouyang@intel.com",
    "date": "2015-01-15T05:15:28",
    "name": "[dpdk-dev,20/22] example/vhost: Avoid inserting vlan twice",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ab8cea33647440cd6d9c4db47cf7c9e1f04e1b43",
    "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-21-git-send-email-changchun.ouyang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2323/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2323/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 2A3385AA0;\n\tThu, 15 Jan 2015 06:17:08 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id D37845A97\n\tfor <dev@dpdk.org>; Thu, 15 Jan 2015 06:16:27 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP; 14 Jan 2015 21:13:42 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 14 Jan 2015 21:16:26 -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 t0F5GKit002156;\n\tThu, 15 Jan 2015 13:16:20 +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 t0F5GHOA015384; Thu, 15 Jan 2015 13:16:19 +0800",
            "(from couyang@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0F5GHkH015380; \n\tThu, 15 Jan 2015 13:16:17 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,401,1418112000\"; d=\"scan'208\";a=\"637552593\"",
        "From": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 15 Jan 2015 13:15:28 +0800",
        "Message-Id": "<1421298930-15210-21-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 20/22] example/vhost: Avoid inserting vlan twice",
        "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": "Check if it has already been vlan-tagged packet, if true, avoid inserting a\nduplicated vlan tag into it.\n\nThis is a possible case when guest has the capability of inserting vlan tag.\n\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\n---\n examples/vhost/main.c | 18 ++++++++++++++----\n 1 file changed, 14 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex 1f1edbe..a7e623e 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -1120,6 +1120,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag)\n \tunsigned len, ret, offset = 0;\n \tconst uint16_t lcore_id = rte_lcore_id();\n \tstruct virtio_net *dev = vdev->dev;\n+\tstruct ether_hdr *nh;\n \n \t/*check if destination is local VM*/\n \tif ((vm2vm_mode == VM2VM_SOFTWARE) && (virtio_tx_local(vdev, m) == 0)) {\n@@ -1141,12 +1142,21 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag)\n \ttx_q = &lcore_tx_queue[lcore_id];\n \tlen = tx_q->len;\n \n-\tm->ol_flags = PKT_TX_VLAN_PKT;\n+\tnh = rte_pktmbuf_mtod(m, struct ether_hdr *);\n+\tif (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) {\n+\t\t/* Guest has inserted the vlan tag. */\n+\t\tstruct vlan_hdr *vh = (struct vlan_hdr *) (nh + 1);\n+\t\tuint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag);\n+\t\tif (vh->vlan_tci != vlan_tag_be)\n+\t\t\tvh->vlan_tci = vlan_tag_be;\n+\t} else {\n+\t\tm->ol_flags = PKT_TX_VLAN_PKT;\n \n-\tm->data_len += offset;\n-\tm->pkt_len += offset;\n+\t\tm->data_len += offset;\n+\t\tm->pkt_len += offset;\n \n-\tm->vlan_tci = vlan_tag;\n+\t\tm->vlan_tci = vlan_tag;\n+\t}\n \n \ttx_q->m_table[len] = m;\n \tlen++;\n",
    "prefixes": [
        "dpdk-dev",
        "20/22"
    ]
}