get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74683,
    "url": "https://patches.dpdk.org/api/patches/74683/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200723130854.322771-2-maxime.coquelin@redhat.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": "<20200723130854.322771-2-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200723130854.322771-2-maxime.coquelin@redhat.com",
    "date": "2020-07-23T13:08:53",
    "name": "[1/2] vhost: fix guest notification setting",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "44c8eeeb1f3bb6d75b902eb59b0e6c22274bb1f2",
    "submitter": {
        "id": 512,
        "url": "https://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200723130854.322771-2-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 11255,
            "url": "https://patches.dpdk.org/api/series/11255/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11255",
            "date": "2020-07-23T13:08:53",
            "name": "Fix vhost performance regression",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/11255/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74683/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74683/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 2E86BA0521;\n\tThu, 23 Jul 2020 15:09:21 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 886CA1BFBA;\n\tThu, 23 Jul 2020 15:09:19 +0200 (CEST)",
            "from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com\n [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id DD0EC2C6E\n for <dev@dpdk.org>; Thu, 23 Jul 2020 15:09:17 +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-92-0U1BY-rCPoWpey1eIRJhBg-1; Thu, 23 Jul 2020 09:09:13 -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 C023791270;\n Thu, 23 Jul 2020 13:09:11 +0000 (UTC)",
            "from localhost.localdomain (unknown [10.36.110.21])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 5AC7161983;\n Thu, 23 Jul 2020 13:09:08 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1595509757;\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=Mm3mUOBk9yuUlONurHkE5muYsEHddyUtTXkitBruczs=;\n b=CDmWF2qP0/nGMF92BQTPmhsZCTwaNse8NdtlxSbo5ifuJHOk3xeBfj4UvPY38unh5EW6c6\n p5pErnLseW2ja/CTdg5l4PVN5yxe4QFQe8zmDBeYYc+T53oERnIBL5scjSmazw6QU+8K1f\n 7soQU59uqwS0S71YyxGkJtjmjhEqV6w=",
        "X-MC-Unique": "0U1BY-rCPoWpey1eIRJhBg-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": "Thu, 23 Jul 2020 15:08:53 +0200",
        "Message-Id": "<20200723130854.322771-2-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20200723130854.322771-1-maxime.coquelin@redhat.com>",
        "References": "<20200723130854.322771-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com",
        "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 1/2] vhost: fix guest notification setting",
        "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": "If rte_vhost_enable_guest_notification is called before\nthe virtqueue is ready, the configuration is lost.\n\nThis patch fixes this by saving the guest notification\nenablement value requested by the application, and apply\nit before the virtqueue is made ready to the application.\n\nFixes: 604052ae5395 (\"net/vhost: support queue update\")\n\nReported-by: Yinan Wang <yinan.wang@intel.com>\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/vhost.c      | 24 ++++++++++++++++++++----\n lib/librte_vhost/vhost.h      |  5 +++++\n lib/librte_vhost/vhost_user.c | 11 ++++++++---\n 3 files changed, 33 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex 14b3e253e8..8f20a0818f 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -534,6 +534,7 @@ init_vring_queue(struct virtio_net *dev, uint32_t vring_idx)\n \n \tvq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;\n \tvq->callfd = VIRTIO_UNINITIALIZED_EVENTFD;\n+\tvq->notif_enable = VIRTIO_UNINITIALIZED_NOTIF;\n \n \tvhost_user_iotlb_init(dev, vring_idx);\n \t/* Backends are set to -1 indicating an inactive device. */\n@@ -1311,6 +1312,23 @@ vhost_enable_notify_packed(struct virtio_net *dev,\n \treturn 0;\n }\n \n+int\n+vhost_enable_guest_notification(struct virtio_net *dev,\n+\t\tstruct vhost_virtqueue *vq, int enable)\n+{\n+\t/*\n+\t * If the virtqueue is not ready yet, it will be applied\n+\t * when it will become ready.\n+\t */\n+\tif (!vq->ready)\n+\t\treturn 0;\n+\n+\tif (vq_is_packed(dev))\n+\t\treturn vhost_enable_notify_packed(dev, vq, enable);\n+\telse\n+\t\treturn vhost_enable_notify_split(dev, vq, enable);\n+}\n+\n int\n rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int enable)\n {\n@@ -1325,10 +1343,8 @@ rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int enable)\n \n \trte_spinlock_lock(&vq->access_lock);\n \n-\tif (vq_is_packed(dev))\n-\t\tret = vhost_enable_notify_packed(dev, vq, enable);\n-\telse\n-\t\tret = vhost_enable_notify_split(dev, vq, enable);\n+\tvq->notif_enable = enable;\n+\tret = vhost_enable_guest_notification(dev, vq, enable);\n \n \trte_spinlock_unlock(&vq->access_lock);\n \ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 0f7212f888..a29c6638e2 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -164,6 +164,9 @@ struct vhost_virtqueue {\n \tint\t\t\tenabled;\n \tint\t\t\taccess_ok;\n \tint\t\t\tready;\n+\tint\t\t\tnotif_enable;\n+#define VIRTIO_UNINITIALIZED_NOTIF\t(-1)\n+\n \trte_spinlock_t\t\taccess_lock;\n \n \t/* Used to notify the guest (trigger interrupt) */\n@@ -668,6 +671,8 @@ void vhost_enable_dequeue_zero_copy(int vid);\n void vhost_set_builtin_virtio_net(int vid, bool enable);\n void vhost_enable_extbuf(int vid);\n void vhost_enable_linearbuf(int vid);\n+int vhost_enable_guest_notification(struct virtio_net *dev,\n+\t\tstruct vhost_virtqueue *vq, int enable);\n \n struct vhost_device_ops const *vhost_driver_callback_get(const char *path);\n \ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex 9ddeae3622..c3c924faec 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -235,6 +235,11 @@ vhost_user_notify_queue_state(struct virtio_net *dev, uint16_t index,\n \t\t\t      int enable)\n {\n \tstruct rte_vdpa_device *vdpa_dev = dev->vdpa_dev;\n+\tstruct vhost_virtqueue *vq = dev->virtqueue[index];\n+\n+\t/* Configure guest notifications on enable */\n+\tif (enable && vq->notif_enable != VIRTIO_UNINITIALIZED_NOTIF)\n+\t\tvhost_enable_guest_notification(dev, vq, vq->notif_enable);\n \n \tif (vdpa_dev && vdpa_dev->ops->set_vring_state)\n \t\tvdpa_dev->ops->set_vring_state(dev->vid, index, enable);\n@@ -1640,8 +1645,8 @@ vhost_user_set_vring_call(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \tvq = dev->virtqueue[file.index];\n \n \tif (vq->ready) {\n-\t\tvhost_user_notify_queue_state(dev, file.index, 0);\n \t\tvq->ready = 0;\n+\t\tvhost_user_notify_queue_state(dev, file.index, 0);\n \t}\n \n \tif (vq->callfd >= 0)\n@@ -1903,8 +1908,8 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \t}\n \n \tif (vq->ready) {\n-\t\tvhost_user_notify_queue_state(dev, file.index, 0);\n \t\tvq->ready = 0;\n+\t\tvhost_user_notify_queue_state(dev, file.index, 0);\n \t}\n \n \tif (vq->kickfd >= 0)\n@@ -2917,8 +2922,8 @@ vhost_user_msg_handler(int vid, int fd)\n \t\tbool cur_ready = vq_is_ready(dev, vq);\n \n \t\tif (cur_ready != (vq && vq->ready)) {\n-\t\t\tvhost_user_notify_queue_state(dev, i, cur_ready);\n \t\t\tvq->ready = cur_ready;\n+\t\t\tvhost_user_notify_queue_state(dev, i, cur_ready);\n \t\t}\n \t}\n \n",
    "prefixes": [
        "1/2"
    ]
}