get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7722,
    "url": "https://patches.dpdk.org/api/patches/7722/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445149744-3217-4-git-send-email-huawei.xie@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": "<1445149744-3217-4-git-send-email-huawei.xie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445149744-3217-4-git-send-email-huawei.xie@intel.com",
    "date": "2015-10-18T06:29:00",
    "name": "[dpdk-dev,v2,3/7] virtio: rx/tx ring layout optimization",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0597c7243646a2f31f2fe67bb3c687396f9a267d",
    "submitter": {
        "id": 16,
        "url": "https://patches.dpdk.org/api/people/16/?format=api",
        "name": "Huawei Xie",
        "email": "huawei.xie@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445149744-3217-4-git-send-email-huawei.xie@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7722/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7722/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 9E4EE8E70;\n\tSun, 18 Oct 2015 08:29:23 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id B08448E6F\n\tfor <dev@dpdk.org>; Sun, 18 Oct 2015 08:29:21 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP; 17 Oct 2015 23:29:20 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 17 Oct 2015 23:29:20 -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 t9I6TIIP026507;\n\tSun, 18 Oct 2015 14:29:18 +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 t9I6TGPH003273; Sun, 18 Oct 2015 14:29:18 +0800",
            "(from hxie5@localhost)\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t9I6TGPB003269; \n\tSun, 18 Oct 2015 14:29:16 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,696,1437462000\"; d=\"scan'208\";a=\"829527518\"",
        "From": "Huawei Xie <huawei.xie@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Sun, 18 Oct 2015 14:29:00 +0800",
        "Message-Id": "<1445149744-3217-4-git-send-email-huawei.xie@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1445149744-3217-1-git-send-email-huawei.xie@intel.com>",
        "References": "<1443537953-23917-1-git-send-email-huawei.xie@intel.com>\n\t<1445149744-3217-1-git-send-email-huawei.xie@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 3/7] virtio: rx/tx ring layout optimization",
        "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 DPDK based switching enviroment, mostly vhost runs on a dedicated core\nwhile virtio processing in guest VMs runs on different cores.\nTake RX for example, with generic implementation, for each guest buffer,\na) virtio driver allocates a descriptor from free descriptor list\nb) modify the entry of avail ring to point to allocated descriptor\nc) after packet is received, free the descriptor\n\nWhen vhost fetches the avail ring, it needs to fetch the modified L1 cache from\nvirtio core, which is a heavy cost in current CPU implementation.\n\nThis idea of this optimization is:\n    allocate the fixed descriptor for each entry of avail ring.\nand avail ring will always be the same during the run.\nThis removes L1 cache transfer from virtio core to vhost core for avail ring.\nBesides, no descriptor free and allocation is needed.\nThis also makes vector procesing possible to further accelerate the processing.\n\nThis is the layout for the avail ring(take 256 ring entries for example), with\neach entry pointing to the descriptor with the same index.\n                    avail\n                    idx\n                    +\n                    |\n+----+----+---+-------------+------+\n| 0  | 1  | 2 | ... |  254  | 255  |  avail ring\n+-+--+-+--+-+-+---------+---+--+---+\n  |    |    |       |   |      |\n  |    |    |       |   |      |\n  v    v    v       |   v      v\n+-+--+-+--+-+-+---------+---+--+---+\n| 0  | 1  | 2 | ... |  254  | 255  |  desc ring\n+----+----+---+-------------+------+\n                    |\n                    |\n+----+----+---+-------------+------+\n| 0  | 1  | 2 |     |  254  | 255  |  used ring\n+----+----+---+-------------+------+\n                    |\n                    +\n\nThis is the ring layout for TX.\nAs we need one virtio header for each xmit packet, we have 128 slots available.\n\n                         ++\n                         ||\n                         ||\n+-----+-----+-----+--------------+------+------+------+\n|  0  |  1  | ... |  127 || 128  | 129  | ...  | 255  |   avail ring\n+--+--+--+--+-----+---+------+---+--+---+------+--+---+\n   |     |            |  ||  |      |             |\n   v     v            v  ||  v      v             v\n+--+--+--+--+-----+---+------+---+--+---+------+--+---+\n| 127 | 128 | ... |  255 || 127  | 128  | ...  | 255  |   desc ring for virtio_net_hdr\n+--+--+--+--+-----+---+------+---+--+---+------+--+---+\n   |     |            |  ||  |      |             |\n   v     v            v  ||  v      v             v\n+--+--+--+--+-----+---+------+---+--+---+------+--+---+\n|  0  |  1  | ... |  127 ||  0   |  1   | ...  | 127  |   desc ring for tx dat\n+-----+-----+-----+--------------+------+------+------+\n                         ||\n                         ||\n                         ++\n\nSigned-off-by: Huawei Xie <huawei.xie@intel.com>\n---\n drivers/net/virtio/virtio_rxtx.c | 24 ++++++++++++++++++++++++\n 1 file changed, 24 insertions(+)",
    "diff": "diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 5c00e9d..7c82a6a 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -302,6 +302,12 @@ virtio_dev_vring_start(struct virtqueue *vq, int queue_type)\n \t\tnbufs = 0;\n \t\terror = ENOSPC;\n \n+\t\tif (use_simple_rxtx)\n+\t\t\tfor (i = 0; i < vq->vq_nentries; i++) {\n+\t\t\t\tvq->vq_ring.avail->ring[i] = i;\n+\t\t\t\tvq->vq_ring.desc[i].flags = VRING_DESC_F_WRITE;\n+\t\t\t}\n+\n \t\tmemset(&vq->fake_mbuf, 0, sizeof(vq->fake_mbuf));\n \t\tfor (i = 0; i < RTE_PMD_VIRTIO_RX_MAX_BURST; i++)\n \t\t\tvq->sw_ring[vq->vq_nentries + i] = &vq->fake_mbuf;\n@@ -332,6 +338,24 @@ virtio_dev_vring_start(struct virtqueue *vq, int queue_type)\n \t\tVIRTIO_WRITE_REG_4(vq->hw, VIRTIO_PCI_QUEUE_PFN,\n \t\t\tvq->mz->phys_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);\n \t} else if (queue_type == VTNET_TQ) {\n+\t\tif (use_simple_rxtx) {\n+\t\t\tint mid_idx  = vq->vq_nentries >> 1;\n+\t\t\tfor (i = 0; i < mid_idx; i++) {\n+\t\t\t\tvq->vq_ring.avail->ring[i] = i + mid_idx;\n+\t\t\t\tvq->vq_ring.desc[i + mid_idx].next = i;\n+\t\t\t\tvq->vq_ring.desc[i + mid_idx].addr =\n+\t\t\t\t\tvq->virtio_net_hdr_mem +\n+\t\t\t\t\t\tmid_idx * vq->hw->vtnet_hdr_size;\n+\t\t\t\tvq->vq_ring.desc[i + mid_idx].len =\n+\t\t\t\t\tvq->hw->vtnet_hdr_size;\n+\t\t\t\tvq->vq_ring.desc[i + mid_idx].flags =\n+\t\t\t\t\tVRING_DESC_F_NEXT;\n+\t\t\t\tvq->vq_ring.desc[i].flags = 0;\n+\t\t\t}\n+\t\t\tfor (i = mid_idx; i < vq->vq_nentries; i++)\n+\t\t\t\tvq->vq_ring.avail->ring[i] = i;\n+\t\t}\n+\n \t\tVIRTIO_WRITE_REG_2(vq->hw, VIRTIO_PCI_QUEUE_SEL,\n \t\t\tvq->vq_queue_index);\n \t\tVIRTIO_WRITE_REG_4(vq->hw, VIRTIO_PCI_QUEUE_PFN,\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "3/7"
    ]
}