get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 853,
    "url": "http://patches.dpdk.org/api/patches/853/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1413779906-28113-8-git-send-email-huawei.xie@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1413779906-28113-8-git-send-email-huawei.xie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1413779906-28113-8-git-send-email-huawei.xie@intel.com",
    "date": "2014-10-20T04:38:19",
    "name": "[dpdk-dev,07/14] patch virtio_tx_route",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "9d355ee858fe56c24a3cacd7829ad9c9eccc0e00",
    "submitter": {
        "id": 16,
        "url": "http://patches.dpdk.org/api/people/16/?format=api",
        "name": "Huawei Xie",
        "email": "huawei.xie@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1413779906-28113-8-git-send-email-huawei.xie@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/853/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/853/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 18E2B7EC8;\n\tMon, 20 Oct 2014 06:30:53 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 39DD67EB8\n\tfor <dev@dpdk.org>; Mon, 20 Oct 2014 06:30:50 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP; 19 Oct 2014 21:32:29 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 19 Oct 2014 21:38:57 -0700",
            "from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com\n\t[10.239.29.90])\n\tby shvmail01.sh.intel.com with ESMTP id s9K4ctIl003727;\n\tMon, 20 Oct 2014 12:38:55 +0800",
            "from shecgisg003.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s9K4crGK028197; Mon, 20 Oct 2014 12:38:55 +0800",
            "(from hxie5@localhost)\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s9K4cr8S028193; \n\tMon, 20 Oct 2014 12:38:53 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,749,1406617200\"; d=\"scan'208\";a=\"592145249\"",
        "From": "Huawei Xie <huawei.xie@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 20 Oct 2014 12:38:19 +0800",
        "Message-Id": "<1413779906-28113-8-git-send-email-huawei.xie@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1413779906-28113-1-git-send-email-huawei.xie@intel.com>",
        "References": "<1413779906-28113-1-git-send-email-huawei.xie@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 07/14] patch virtio_tx_route",
        "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": "in new vhost example, the packet passed to virtio_tx_route has been allocated \nmbuf, so there is no need to allocate mbuf for it.\nuse vlan offload to transmit vlan tagged packet.\n\nSigned-off-by: Huawei Xie <huawei.xie@intel.com>\n---\n examples/vhost/main.c | 65 ++++++++-------------------------------------------\n 1 file changed, 10 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex aad86f3..bbfdef6 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -1091,9 +1091,7 @@ static inline void __attribute__((always_inline))\n virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, struct rte_mempool *mbuf_pool, uint16_t vlan_tag)\n {\n \tstruct mbuf_table *tx_q;\n-\tstruct vlan_ethhdr *vlan_hdr;\n \tstruct rte_mbuf **m_table;\n-\tstruct rte_mbuf *mbuf, *prev;\n \tunsigned len, ret, offset = 0;\n \tconst uint16_t lcore_id = rte_lcore_id();\n \tstruct virtio_net_data_ll *dev_ll = ll_root_used;\n@@ -1101,8 +1099,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, struct rte_mempool *\n \tstruct virtio_net *dev = vdev->dev;\n \n \t/*check if destination is local VM*/\n-\tif ((vm2vm_mode == VM2VM_SOFTWARE) && (virtio_tx_local(vdev, m) == 0))\n+\tif ((vm2vm_mode == VM2VM_SOFTWARE) && (virtio_tx_local(vdev, m) == 0)) {\n+\t\trte_pktmbuf_free(m);\n \t\treturn;\n+\t}\n \n \tif (vm2vm_mode == VM2VM_HARDWARE) {\n \t\twhile (dev_ll != NULL) {\n@@ -1118,7 +1118,8 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, struct rte_mempool *\n \t\t\t\t\t\"(%\"PRIu64\") TX: Source and destination\"\n \t\t\t\t\t\" MAC addresses are the same. Dropping \"\n \t\t\t\t\t\"packet.\\n\",\n-\t\t\t\t\tdev_ll->vdev->device_fh);\n+\t\t\t\t\tdev_ll->vdev->dev->device_fh);\n+\t\t\t\t\trte_pktmbuf_free(m);\n \t\t\t\t\treturn;\n \t\t\t\t}\n \t\t\t\toffset = 4;\n@@ -1144,58 +1145,12 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, struct rte_mempool *\n \ttx_q = &lcore_tx_queue[lcore_id];\n \tlen = tx_q->len;\n \n-\t/* Allocate an mbuf and populate the structure. */\n-\tmbuf = rte_pktmbuf_alloc(mbuf_pool);\n-\tif (unlikely(mbuf == NULL)) {\n-\t\tRTE_LOG(ERR, VHOST_DATA,\n-\t\t\t\"Failed to allocate memory for mbuf.\\n\");\n-\t\treturn;\n-\t}\n-\n-\tmbuf->data_len = m->data_len + VLAN_HLEN + offset;\n-\tmbuf->pkt_len = m->pkt_len + VLAN_HLEN + offset;\n-\tmbuf->nb_segs = m->nb_segs;\n+\tm->ol_flags = PKT_TX_VLAN_PKT;\n+\t/*FIXME: offset*/\n+\tm->data_len += offset;\n+\tm->vlan_tci = vlan_tag;\n \n-\t/* Copy ethernet header to mbuf. */\n-\trte_memcpy(rte_pktmbuf_mtod(mbuf, void *),\n-\t\trte_pktmbuf_mtod(m, const void *),\n-\t\tETH_HLEN);\n-\n-\n-\t/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/\n-\tvlan_hdr = rte_pktmbuf_mtod(mbuf, struct vlan_ethhdr *);\n-\tvlan_hdr->h_vlan_encapsulated_proto = vlan_hdr->h_vlan_proto;\n-\tvlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);\n-\tvlan_hdr->h_vlan_TCI = htons(vlan_tag);\n-\n-\t/* Copy the remaining packet contents to the mbuf. */\n-\trte_memcpy((void *)(rte_pktmbuf_mtod(mbuf, uint8_t *) + VLAN_ETH_HLEN),\n-\t\t(const void *)(rte_pktmbuf_mtod(m, uint8_t *) + ETH_HLEN),\n-\t\t(m->data_len - ETH_HLEN));\n-\n-\t/* Copy the remaining segments for the whole packet. */\n-\tprev = mbuf;\n-\twhile (m->next) {\n-\t\t/* Allocate an mbuf and populate the structure. */\n-\t\tstruct rte_mbuf *next_mbuf = rte_pktmbuf_alloc(mbuf_pool);\n-\t\tif (unlikely(next_mbuf == NULL)) {\n-\t\t\trte_pktmbuf_free(mbuf);\n-\t\t\tRTE_LOG(ERR, VHOST_DATA,\n-\t\t\t\t\"Failed to allocate memory for mbuf.\\n\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tm = m->next;\n-\t\tprev->next = next_mbuf;\n-\t\tprev = next_mbuf;\n-\t\tnext_mbuf->data_len = m->data_len;\n-\n-\t\t/* Copy data to next mbuf. */\n-\t\trte_memcpy(rte_pktmbuf_mtod(next_mbuf, void *),\n-\t\t\trte_pktmbuf_mtod(m, const void *), m->data_len);\n-\t}\n-\n-\ttx_q->m_table[len] = mbuf;\n+\ttx_q->m_table[len] = m;\n \tlen++;\n \tif (enable_stats) {\n \t\tdev_statistics[dev->device_fh].tx_total++;\n",
    "prefixes": [
        "dpdk-dev",
        "07/14"
    ]
}