get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8038,
    "url": "https://patches.dpdk.org/api/patches/8038/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445926375-18986-2-git-send-email-mukawa@igel.co.jp/",
    "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": "<1445926375-18986-2-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445926375-18986-2-git-send-email-mukawa@igel.co.jp",
    "date": "2015-10-27T06:12:53",
    "name": "[dpdk-dev,1/3] vhost: Fix wrong handling of virtqueue array index",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "ca1ea9faaf49fc457b1e610647abe8ac6272642e",
    "submitter": {
        "id": 64,
        "url": "https://patches.dpdk.org/api/people/64/?format=api",
        "name": "Tetsuya Mukawa",
        "email": "mukawa@igel.co.jp"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445926375-18986-2-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8038/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8038/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 255278DA4;\n\tTue, 27 Oct 2015 07:13:15 +0100 (CET)",
            "from mail-pa0-f44.google.com (mail-pa0-f44.google.com\n\t[209.85.220.44]) by dpdk.org (Postfix) with ESMTP id 021628DA1\n\tfor <dev@dpdk.org>; Tue, 27 Oct 2015 07:13:12 +0100 (CET)",
            "by padhk11 with SMTP id hk11so212324725pad.1\n\tfor <dev@dpdk.org>; Mon, 26 Oct 2015 23:13:12 -0700 (PDT)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby smtp.gmail.com with ESMTPSA id\n\tcn4sm37312954pbc.94.2015.10.26.23.13.09\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 26 Oct 2015 23:13:11 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=igel_co_jp.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=NuX5WkSHL1yeU9u1H+b2UipVZQFhnBdpDR5FSClnBAc=;\n\tb=x1RoOp30IMCyifEOSWo3ZOxDa3qx7u2MAjA08dOr/5o/Q860nWSqZb6Z7TyOvuMOcz\n\tynY7pNtcv40pGI5utMfreU0bfr6fX3x1Xzsa5uS8LkttjS5ZR6WRKTMg2LLpSwca4wCQ\n\tgTY+5yqIuDj5bb5P9LkB2bkkU03kyNMdc7/ID5b3yWJUg0deVEKNrKUQ12I7O9y1GaZP\n\t1pqKd6IMRJl+MhotnrlshE5yA+HdtjMt0QFZ51uDzLWswm3Pz4LrStuCX1B2jlI2hfJt\n\ttz+URASEguKoVbzFXYJ7i47AEtR9dE3L4vK7OVu61BTLDUJhl1R0Kt3wfMk+HdEUNbjl\n\tbQjQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=NuX5WkSHL1yeU9u1H+b2UipVZQFhnBdpDR5FSClnBAc=;\n\tb=DriVQec5z/iUqZipWrX93Z2y+/GNNpJnH1zaVdTuADFMC1EZc3l873QTyHYIin5RwU\n\tNpb2zr4Oi8SO8EOv9azc8fYPEUuSmlV7PstPGkTlEm3Q4q0A79s7ikO9knJjz6qIaFF3\n\tjKJpoayXCTC1mct9UliX0bIUX8/PBzM4PsAAIUDOxx+rJYC/F1My2T3Cts9yRhKrgb56\n\tXDyv+/1x+QsGjiFrpG2dGEUWzAHqSuiM5E2rA1704oviXPjuoaI7h1LICEp6zyC6YfKP\n\teFTzsmBZEiHie8xdjpwJuzmjbM1QIThloocqGhW2uVnnwn1ezyGYW6aNnsVseM8+jPvY\n\tGBaQ==",
        "X-Gm-Message-State": "ALoCoQkfDg7+LCrXjTnx1VotkoFiFWzG8cK0FZCZo2lOIFBOzA5sAbeTLNL6r5Gw2GoanieojHBf",
        "X-Received": "by 10.66.250.202 with SMTP id ze10mr1924125pac.132.1445926392280;\n\tMon, 26 Oct 2015 23:13:12 -0700 (PDT)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Oct 2015 15:12:53 +0900",
        "Message-Id": "<1445926375-18986-2-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1445926375-18986-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1445507150-1481-2-git-send-email-mukawa@igel.co.jp>\n\t<1445926375-18986-1-git-send-email-mukawa@igel.co.jp>",
        "Cc": "ann.zhuangyanying@huawei.com",
        "Subject": "[dpdk-dev] [PATCH 1/3] vhost: Fix wrong handling of virtqueue array\n\tindex",
        "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": "The patch fixes wrong handling of virtqueue array index.\n\nGET_VRING_BASE:\nThe vhost backend will receive the message per virtqueue.\nAlso we should call a destroy callback when both RXQ and TXQ receives\nthe message.\n\nSET_BACKEND:\nBecause vhost library supports multiple queue, the index may be over 2.\nAlso a vhost frontend(QEMU) may send such a index.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_vhost/vhost_user/virtio-net-user.c | 22 +++++++++++-----------\n lib/librte_vhost/virtio-net.c                 |  5 +++--\n 2 files changed, 14 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c\nindex a998ad8..3e8dfea 100644\n--- a/lib/librte_vhost/vhost_user/virtio-net-user.c\n+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c\n@@ -283,12 +283,10 @@ user_get_vring_base(struct vhost_device_ctx ctx,\n \tstruct vhost_vring_state *state)\n {\n \tstruct virtio_net *dev = get_device(ctx);\n+\tuint16_t base_idx = state->index / VIRTIO_QNUM;\n \n \tif (dev == NULL)\n \t\treturn -1;\n-\t/* We have to stop the queue (virtio) if it is running. */\n-\tif (dev->flags & VIRTIO_DEV_RUNNING)\n-\t\tnotify_ops->destroy_device(dev);\n \n \t/* Here we are safe to get the last used index */\n \tops->get_vring_base(ctx, state->index, state);\n@@ -300,15 +298,17 @@ user_get_vring_base(struct vhost_device_ctx ctx,\n \t * sent and only sent in vhost_vring_stop.\n \t * TODO: cleanup the vring, it isn't usable since here.\n \t */\n-\tif (dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd >= 0) {\n-\t\tclose(dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd);\n-\t\tdev->virtqueue[state->index + VIRTIO_RXQ]->kickfd = -1;\n-\t}\n-\tif (dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd >= 0) {\n-\t\tclose(dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd);\n-\t\tdev->virtqueue[state->index + VIRTIO_TXQ]->kickfd = -1;\n+\tif (dev->virtqueue[state->index]->kickfd >= 0) {\n+\t\tclose(dev->virtqueue[state->index]->kickfd);\n+\t\tdev->virtqueue[state->index]->kickfd = -1;\n \t}\n \n+\t/* We have to stop the queue (virtio) if it is running. */\n+\tif ((dev->flags & VIRTIO_DEV_RUNNING) &&\n+\t\t\t(dev->virtqueue[base_idx + VIRTIO_RXQ]->kickfd == -1) &&\n+\t\t\t(dev->virtqueue[base_idx + VIRTIO_TXQ]->kickfd == -1))\n+\t\tnotify_ops->destroy_device(dev);\n+\n \treturn 0;\n }\n \n@@ -321,7 +321,7 @@ user_set_vring_enable(struct vhost_device_ctx ctx,\n \t\t      struct vhost_vring_state *state)\n {\n \tstruct virtio_net *dev = get_device(ctx);\n-\tuint16_t base_idx = state->index;\n+\tuint16_t base_idx = state->index / VIRTIO_QNUM;\n \tint enable = (int)state->num;\n \n \tRTE_LOG(INFO, VHOST_CONFIG,\ndiff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c\nindex 97213c5..ee2e84d 100644\n--- a/lib/librte_vhost/virtio-net.c\n+++ b/lib/librte_vhost/virtio-net.c\n@@ -778,6 +778,7 @@ static int\n set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n {\n \tstruct virtio_net *dev;\n+\tuint32_t base_idx = file->index / VIRTIO_QNUM;\n \n \tdev = get_device(ctx);\n \tif (dev == NULL)\n@@ -791,8 +792,8 @@ set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n \t * we add the device.\n \t */\n \tif (!(dev->flags & VIRTIO_DEV_RUNNING)) {\n-\t\tif (((int)dev->virtqueue[VIRTIO_TXQ]->backend != VIRTIO_DEV_STOPPED) &&\n-\t\t\t((int)dev->virtqueue[VIRTIO_RXQ]->backend != VIRTIO_DEV_STOPPED)) {\n+\t\tif (((int)dev->virtqueue[base_idx + VIRTIO_RXQ]->backend != VIRTIO_DEV_STOPPED) &&\n+\t\t\t((int)dev->virtqueue[base_idx + VIRTIO_TXQ]->backend != VIRTIO_DEV_STOPPED)) {\n \t\t\treturn notify_ops->new_device(dev);\n \t\t}\n \t/* Otherwise we remove it. */\n",
    "prefixes": [
        "dpdk-dev",
        "1/3"
    ]
}