get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74989,
    "url": "http://patches.dpdk.org/api/patches/74989/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200729092000.233036-4-maxime.coquelin@redhat.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": "<20200729092000.233036-4-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200729092000.233036-4-maxime.coquelin@redhat.com",
    "date": "2020-07-29T09:20:00",
    "name": "[v3,3/3] net/vhost: fix interrupt mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "33ebc9af5edbbfbaba6a69166d7a895027f6f3ce",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200729092000.233036-4-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 11390,
            "url": "http://patches.dpdk.org/api/series/11390/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11390",
            "date": "2020-07-29T09:19:57",
            "name": "Fix Vhost regressions",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/11390/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74989/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/74989/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 277A8A052B;\n\tWed, 29 Jul 2020 11:20:41 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 34C8E1C044;\n\tWed, 29 Jul 2020 11:20:28 +0200 (CEST)",
            "from us-smtp-delivery-74.mimecast.com\n (us-smtp-delivery-74.mimecast.com [63.128.21.74])\n by dpdk.org (Postfix) with ESMTP id A65AA1C038\n for <dev@dpdk.org>; Wed, 29 Jul 2020 11:20:25 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-446-QQxbCEh8OSSyE0spMDM62w-1; Wed, 29 Jul 2020 05:20:21 -0400",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55C971005510;\n Wed, 29 Jul 2020 09:20:20 +0000 (UTC)",
            "from localhost.localdomain (unknown [10.36.110.21])\n by smtp.corp.redhat.com (Postfix) with ESMTP id E21C46842F;\n Wed, 29 Jul 2020 09:20:17 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1596014425;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=mjApHZogp9SdUfPRpXDjhfT4juvRw2vCB06pmyJ4RvA=;\n b=gG5V9s1SUSR0Cp3eQ5K9hiG9hwcVjLRmFPQxOKVzazVBAVqOFYbwRrliD+zeG3c9cNZAnf\n ebdUKRW/6DLDf2BNFYoz/td5AFK+DOx/hrn6rPQyjVbHchKk0hwgOzZ7Q65FGeRnB7Pzxt\n U+BtPOpWCL//BeRpY8eHBxMIa1t+drY=",
        "X-MC-Unique": "QQxbCEh8OSSyE0spMDM62w-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, matan@mellanox.com, chenbo.xia@intel.com,\n yong.liu@intel.com,\n yinan.wang@intel.com",
        "Cc": "thomas@monjalon.net, ferruh.yigit@intel.com, david.marchand@redhat.com,\n Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Wed, 29 Jul 2020 11:20:00 +0200",
        "Message-Id": "<20200729092000.233036-4-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20200729092000.233036-1-maxime.coquelin@redhat.com>",
        "References": "<20200729092000.233036-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 3/3] net/vhost: fix interrupt mode",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "At .new_device() time, only the first vring pair is\nnow ready, other vrings are consfigured later.\n\nProblem is that when application will setup and enable\ninterrupts, only the first queue pair Rx interrupt will\nbe enabled.\n\nThis patches fixes the issue by setting the number of\nmax interrupts to the number of Rx queues that will be\nlater initialized. Then, as soon as a Rx vring is ready\nand interrupt enabled by the application, it removes the\ncorresponding uninitialized epoll event, and install a\nnew one with the valid FD.\n\nFixes: 604052ae5395 (\"net/vhost: support queue update\")\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/vhost/rte_eth_vhost.c | 75 +++++++++++++++++++++++++++----\n 1 file changed, 66 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c\nindex 951929c663..237785dd66 100644\n--- a/drivers/net/vhost/rte_eth_vhost.c\n+++ b/drivers/net/vhost/rte_eth_vhost.c\n@@ -5,6 +5,7 @@\n #include <unistd.h>\n #include <pthread.h>\n #include <stdbool.h>\n+#include <sys/epoll.h>\n \n #include <rte_mbuf.h>\n #include <rte_ethdev_driver.h>\n@@ -95,6 +96,8 @@ struct vhost_queue {\n \tuint16_t port;\n \tuint16_t virtqueue_id;\n \tstruct vhost_stats stats;\n+\tint intr_enable;\n+\trte_spinlock_t intr_lock;\n };\n \n struct pmd_internal {\n@@ -524,6 +527,45 @@ find_internal_resource(char *ifname)\n \treturn list;\n }\n \n+static int\n+eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)\n+{\n+\tstruct rte_intr_handle *handle = eth_dev->intr_handle;\n+\tstruct rte_epoll_event rev;\n+\tint epfd, ret;\n+\n+\tif (handle->efds[rxq_idx] == handle->elist[rxq_idx].fd)\n+\t\treturn 0;\n+\n+\tVHOST_LOG(INFO, \"kickfd for rxq-%d was changed, updating handler.\\n\",\n+\t\t\trxq_idx);\n+\n+\t/*\n+\t * First remove invalid epoll event, and then isntall\n+\t * the new one. May be solved with a proper API in the\n+\t * future.\n+\t */\n+\tepfd = handle->elist[rxq_idx].epfd;\n+\trev = handle->elist[rxq_idx];\n+\tret = rte_epoll_ctl(epfd, EPOLL_CTL_DEL, rev.fd,\n+\t\t\t&handle->elist[rxq_idx]);\n+\tif (ret) {\n+\t\tVHOST_LOG(ERR, \"Delete epoll event failed.\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\trev.fd = handle->efds[rxq_idx];\n+\thandle->elist[rxq_idx] = rev;\n+\tret = rte_epoll_ctl(epfd, EPOLL_CTL_ADD, rev.fd,\n+\t\t\t&handle->elist[rxq_idx]);\n+\tif (ret) {\n+\t\tVHOST_LOG(ERR, \"Add epoll event failed.\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid)\n {\n@@ -537,6 +579,11 @@ eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid)\n \t\treturn -1;\n \t}\n \n+\trte_spinlock_lock(&vq->intr_lock);\n+\tvq->intr_enable = 1;\n+\tret = eth_vhost_update_intr(dev, qid);\n+\trte_spinlock_unlock(&vq->intr_lock);\n+\n \tret = rte_vhost_get_vhost_vring(vq->vid, (qid << 1) + 1, &vring);\n \tif (ret < 0) {\n \t\tVHOST_LOG(ERR, \"Failed to get rxq%d's vring\\n\", qid);\n@@ -571,6 +618,8 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)\n \trte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0);\n \trte_wmb();\n \n+\tvq->intr_enable = 0;\n+\n \treturn 0;\n }\n \n@@ -593,7 +642,6 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)\n {\n \tstruct rte_vhost_vring vring;\n \tstruct vhost_queue *vq;\n-\tint count = 0;\n \tint nb_rxq = dev->data->nb_rx_queues;\n \tint i;\n \tint ret;\n@@ -623,6 +671,8 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)\n \n \tVHOST_LOG(INFO, \"Prepare intr vec\\n\");\n \tfor (i = 0; i < nb_rxq; i++) {\n+\t\tdev->intr_handle->intr_vec[i] = RTE_INTR_VEC_RXTX_OFFSET + i;\n+\t\tdev->intr_handle->efds[i] = -1;\n \t\tvq = dev->data->rx_queues[i];\n \t\tif (!vq) {\n \t\t\tVHOST_LOG(INFO, \"rxq-%d not setup yet, skip!\\n\", i);\n@@ -641,14 +691,12 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)\n \t\t\t\t\"rxq-%d's kickfd is invalid, skip!\\n\", i);\n \t\t\tcontinue;\n \t\t}\n-\t\tdev->intr_handle->intr_vec[i] = RTE_INTR_VEC_RXTX_OFFSET + i;\n \t\tdev->intr_handle->efds[i] = vring.kickfd;\n-\t\tcount++;\n \t\tVHOST_LOG(INFO, \"Installed intr vec for rxq-%d\\n\", i);\n \t}\n \n-\tdev->intr_handle->nb_efd = count;\n-\tdev->intr_handle->max_intr = count + 1;\n+\tdev->intr_handle->nb_efd = nb_rxq;\n+\tdev->intr_handle->max_intr = nb_rxq + 1;\n \tdev->intr_handle->type = RTE_INTR_HANDLE_VDEV;\n \n \treturn 0;\n@@ -835,6 +883,7 @@ vring_conf_update(int vid, struct rte_eth_dev *eth_dev, uint16_t vring_id)\n {\n \tstruct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;\n \tstruct pmd_internal *internal = eth_dev->data->dev_private;\n+\tstruct vhost_queue *vq;\n \tstruct rte_vhost_vring vring;\n \tint rx_idx = vring_id % 2 ? (vring_id - 1) >> 1 : -1;\n \tint ret = 0;\n@@ -853,12 +902,18 @@ vring_conf_update(int vid, struct rte_eth_dev *eth_dev, uint16_t vring_id)\n \t\t\t\t\tvring_id);\n \t\t\treturn ret;\n \t\t}\n+\t\teth_dev->intr_handle->efds[rx_idx] = vring.kickfd;\n \n-\t\tif (vring.kickfd != eth_dev->intr_handle->efds[rx_idx]) {\n-\t\t\tVHOST_LOG(INFO, \"kickfd for rxq-%d was changed.\\n\",\n-\t\t\t\t\t  rx_idx);\n-\t\t\teth_dev->intr_handle->efds[rx_idx] = vring.kickfd;\n+\t\tvq = eth_dev->data->rx_queues[rx_idx];\n+\t\tif (!vq) {\n+\t\t\tVHOST_LOG(ERR, \"rxq%d is not setup yet\\n\", rx_idx);\n+\t\t\treturn -1;\n \t\t}\n+\n+\t\trte_spinlock_lock(&vq->intr_lock);\n+\t\tif (vq->intr_enable)\n+\t\t\tret = eth_vhost_update_intr(eth_dev, rx_idx);\n+\t\trte_spinlock_unlock(&vq->intr_lock);\n \t}\n \n \treturn ret;\n@@ -1152,6 +1207,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,\n \n \tvq->mb_pool = mb_pool;\n \tvq->virtqueue_id = rx_queue_id * VIRTIO_QNUM + VIRTIO_TXQ;\n+\trte_spinlock_init(&vq->intr_lock);\n \tdev->data->rx_queues[rx_queue_id] = vq;\n \n \treturn 0;\n@@ -1173,6 +1229,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,\n \t}\n \n \tvq->virtqueue_id = tx_queue_id * VIRTIO_QNUM + VIRTIO_RXQ;\n+\trte_spinlock_init(&vq->intr_lock);\n \tdev->data->tx_queues[tx_queue_id] = vq;\n \n \treturn 0;\n",
    "prefixes": [
        "v3",
        "3/3"
    ]
}