get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127919,
    "url": "http://patches.dpdk.org/api/patches/127919/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230601200812.672233-13-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": "<20230601200812.672233-13-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230601200812.672233-13-maxime.coquelin@redhat.com",
    "date": "2023-06-01T20:07:58",
    "name": "[v4,12/26] vhost: add helper for interrupt injection",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "791d87cd66ed2c793319d0db521505a8e372bd88",
    "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/20230601200812.672233-13-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 28308,
            "url": "http://patches.dpdk.org/api/series/28308/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28308",
            "date": "2023-06-01T20:07:46",
            "name": "Add VDUSE support to Vhost library",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/28308/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/127919/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/127919/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AD97842C08;\n\tThu,  1 Jun 2023 22:09:38 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C63AA42D3D;\n\tThu,  1 Jun 2023 22:08:57 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id E38A042B8C\n for <dev@dpdk.org>; Thu,  1 Jun 2023 22:08:56 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-638-HTbyjlyiN4eaWdnhBRaXSw-1; Thu, 01 Jun 2023 16:08:55 -0400",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com\n [10.11.54.4])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C6650800159;\n Thu,  1 Jun 2023 20:08:54 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.39.208.25])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 15A882029F6E;\n Thu,  1 Jun 2023 20:08:51 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1685650136;\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=BOFgfKVmUk5DBDxg658RC36571AMByiB0QftAZCajvA=;\n b=JSNXQ58I663L7KgZ9QADZiL+BhYAJs5OvqvA5iSbD7BWP4hW7xqXwI5PiZEYcbT2rjAklo\n xbnOoQiaO/wlafr0+UyjQiuyTciK7A+qBLr8VNC4XXDDprUWC+TG8ocEy9sxvX7/zgSmIE\n YVbHVCHacxk5n0k5zAU5v6FsKXBiVdU=",
        "X-MC-Unique": "HTbyjlyiN4eaWdnhBRaXSw-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,\n mkp@redhat.com, fbl@redhat.com, jasowang@redhat.com,\n cunming.liang@intel.com, xieyongji@bytedance.com, echaudro@redhat.com,\n eperezma@redhat.com, amorenoz@redhat.com, lulu@redhat.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[PATCH v4 12/26] vhost: add helper for interrupt injection",
        "Date": "Thu,  1 Jun 2023 22:07:58 +0200",
        "Message-Id": "<20230601200812.672233-13-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20230601200812.672233-1-maxime.coquelin@redhat.com>",
        "References": "<20230601200812.672233-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "Vhost-user uses eventfd to inject IRQs, but VDUSE uses\nan ioctl.\n\nThis patch prepares vhost_vring_call_split() and\nvhost_vring_call_packed() to support VDUSE by introducing\na new helper.\n\nIt also adds a new counter for guest notification failures,\nwhich could happen in case of uninitialized call file\ndescriptor for example.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n lib/vhost/vhost.c      | 25 +++++++++++++------------\n lib/vhost/vhost.h      | 19 +++++++++----------\n lib/vhost/vhost_user.c | 10 ++++++++++\n 3 files changed, 32 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex f77f30d674..eb6309b681 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -701,6 +701,11 @@ vhost_new_device(struct vhost_backend_ops *ops)\n \t\treturn -1;\n \t}\n \n+\tif (ops->inject_irq == NULL) {\n+\t\tVHOST_LOG_CONFIG(\"device\", ERR, \"missing IRQ injection backend op.\\n\");\n+\t\treturn -1;\n+\t}\n+\n \tpthread_mutex_lock(&vhost_dev_lock);\n \tfor (i = 0; i < RTE_MAX_VHOST_DEVICE; i++) {\n \t\tif (vhost_devices[i] == NULL)\n@@ -1511,20 +1516,16 @@ rte_vhost_notify_guest(int vid, uint16_t queue_id)\n \n \trte_rwlock_read_lock(&vq->access_lock);\n \n-\tif (vq->callfd >= 0) {\n-\t\tint ret = eventfd_write(vq->callfd, (eventfd_t)1);\n-\n-\t\tif (ret) {\n-\t\t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n-\t\t\t\t__atomic_fetch_add(&vq->stats.guest_notifications_error,\n+\tif (dev->backend_ops->inject_irq(dev, vq)) {\n+\t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n+\t\t\t__atomic_fetch_add(&vq->stats.guest_notifications_error,\n \t\t\t\t\t1, __ATOMIC_RELAXED);\n-\t\t} else {\n-\t\t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n-\t\t\t\t__atomic_fetch_add(&vq->stats.guest_notifications,\n+\t} else {\n+\t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n+\t\t\t__atomic_fetch_add(&vq->stats.guest_notifications,\n \t\t\t\t\t1, __ATOMIC_RELAXED);\n-\t\t\tif (dev->notify_ops->guest_notified)\n-\t\t\t\tdev->notify_ops->guest_notified(dev->vid);\n-\t\t}\n+\t\tif (dev->notify_ops->guest_notified)\n+\t\t\tdev->notify_ops->guest_notified(dev->vid);\n \t}\n \n \trte_rwlock_read_unlock(&vq->access_lock);\ndiff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h\nindex 25255aaea8..ea2798b0bf 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -90,16 +90,20 @@\n #endif\n \n struct virtio_net;\n+struct vhost_virtqueue;\n+\n typedef void (*vhost_iotlb_remove_notify)(uint64_t addr, uint64_t off, uint64_t size);\n \n typedef int (*vhost_iotlb_miss_cb)(struct virtio_net *dev, uint64_t iova, uint8_t perm);\n \n+typedef int (*vhost_vring_inject_irq_cb)(struct virtio_net *dev, struct vhost_virtqueue *vq);\n /**\n  * Structure that contains backend-specific ops.\n  */\n struct vhost_backend_ops {\n \tvhost_iotlb_remove_notify iotlb_remove_notify;\n \tvhost_iotlb_miss_cb iotlb_miss;\n+\tvhost_vring_inject_irq_cb inject_irq;\n };\n \n /**\n@@ -906,8 +910,6 @@ vhost_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old)\n static __rte_always_inline void\n vhost_vring_inject_irq(struct virtio_net *dev, struct vhost_virtqueue *vq)\n {\n-\tint ret;\n-\n \tif (dev->notify_ops->guest_notify &&\n \t    dev->notify_ops->guest_notify(dev->vid, vq->index)) {\n \t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n@@ -916,8 +918,7 @@ vhost_vring_inject_irq(struct virtio_net *dev, struct vhost_virtqueue *vq)\n \t\treturn;\n \t}\n \n-\tret = eventfd_write(vq->callfd, (eventfd_t) 1);\n-\tif (ret) {\n+\tif (dev->backend_ops->inject_irq(dev, vq)) {\n \t\tif (dev->flags & VIRTIO_DEV_STATS_ENABLED)\n \t\t\t__atomic_fetch_add(&vq->stats.guest_notifications_error,\n \t\t\t\t1, __ATOMIC_RELAXED);\n@@ -950,14 +951,12 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq)\n \t\t\t\"%s: used_event_idx=%d, old=%d, new=%d\\n\",\n \t\t\t__func__, vhost_used_event(vq), old, new);\n \n-\t\tif ((vhost_need_event(vhost_used_event(vq), new, old) ||\n-\t\t\t\t\tunlikely(!signalled_used_valid)) &&\n-\t\t\t\tvq->callfd >= 0)\n+\t\tif (vhost_need_event(vhost_used_event(vq), new, old) ||\n+\t\t\t\tunlikely(!signalled_used_valid))\n \t\t\tvhost_vring_inject_irq(dev, vq);\n \t} else {\n \t\t/* Kick the guest if necessary. */\n-\t\tif (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT) &&\n-\t\t\t\t(vq->callfd >= 0))\n+\t\tif (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))\n \t\t\tvhost_vring_inject_irq(dev, vq);\n \t}\n }\n@@ -1009,7 +1008,7 @@ vhost_vring_call_packed(struct virtio_net *dev, struct vhost_virtqueue *vq)\n \tif (vhost_need_event(off, new, old))\n \t\tkick = true;\n kick:\n-\tif (kick && vq->callfd >= 0)\n+\tif (kick)\n \t\tvhost_vring_inject_irq(dev, vq);\n }\n \ndiff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex 30ad63aba0..901a80bbaa 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -3465,8 +3465,18 @@ int rte_vhost_host_notifier_ctrl(int vid, uint16_t qid, bool enable)\n \treturn ret;\n }\n \n+static int\n+vhost_user_inject_irq(struct virtio_net *dev __rte_unused, struct vhost_virtqueue *vq)\n+{\n+\tif (vq->callfd < 0)\n+\t\treturn -1;\n+\n+\treturn eventfd_write(vq->callfd, (eventfd_t)1);\n+}\n+\n static struct vhost_backend_ops vhost_user_backend_ops = {\n \t.iotlb_miss = vhost_user_iotlb_miss,\n+\t.inject_irq = vhost_user_inject_irq,\n };\n \n int\n",
    "prefixes": [
        "v4",
        "12/26"
    ]
}