get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132759,
    "url": "http://patches.dpdk.org/api/patches/132759/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231017142403.2995341-3-lulu@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": "<20231017142403.2995341-3-lulu@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231017142403.2995341-3-lulu@redhat.com",
    "date": "2023-10-17T14:24:03",
    "name": "[RFC,v2,2/2] vhost: add reconnection support to VDUSE (WIP)",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4d1f64faa138f1b9cbea7dcac3df07b81887f9a7",
    "submitter": {
        "id": 3189,
        "url": "http://patches.dpdk.org/api/people/3189/?format=api",
        "name": "Cindy Lu",
        "email": "lulu@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/20231017142403.2995341-3-lulu@redhat.com/mbox/",
    "series": [
        {
            "id": 29884,
            "url": "http://patches.dpdk.org/api/series/29884/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29884",
            "date": "2023-10-17T14:24:01",
            "name": "vduse: Add support for reconnection",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/29884/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132759/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/132759/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 9858E4318D;\n\tTue, 17 Oct 2023 16:24:29 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E02F542DF3;\n\tTue, 17 Oct 2023 16:24:22 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id D458342DF3\n for <dev@dpdk.org>; Tue, 17 Oct 2023 16:24:20 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73])\n by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-357-j1rf6c55Ng2lm18U2aylNA-1; Tue, 17 Oct 2023 10:24:19 -0400",
            "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com\n [10.11.54.6])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F02F63801BC1;\n Tue, 17 Oct 2023 14:24:18 +0000 (UTC)",
            "from server.redhat.com (unknown [10.72.112.16])\n by smtp.corp.redhat.com (Postfix) with ESMTP id BE7DF2166B2E;\n Tue, 17 Oct 2023 14:24:16 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1697552660;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to: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=vOJh77q7fQ0cPSA1Cry56PwV7EA3rU6QKCaui30OHEw=;\n b=ffBVOjRREQGWAswt2CjVao/5nOk9l4o04RdgNr9bSBmj0saV2KBUND3e5AgM1tH+/4kgD6\n P7GZyHBvNAfhW9Ai80xTDVDGSeYftspRB8w2T9sBaYwpXzYpC5KF+iJDko2fRx3lOeXmeF\n TR8nThkngCTfQ9ATpicyAVZ2MfAdNcs=",
        "X-MC-Unique": "j1rf6c55Ng2lm18U2aylNA-1",
        "From": "Cindy Lu <lulu@redhat.com>",
        "To": "lulu@redhat.com, jasowang@redhat.com, xieyongji@bytedance.com,\n dev@dpdk.org, maxime.coquelin@redhat.com",
        "Subject": "[RFC v2 2/2] vhost: add reconnection support to VDUSE (WIP)",
        "Date": "Tue, 17 Oct 2023 22:24:03 +0800",
        "Message-Id": "<20231017142403.2995341-3-lulu@redhat.com>",
        "In-Reply-To": "<20231017142403.2995341-1-lulu@redhat.com>",
        "References": "<20231017142403.2995341-1-lulu@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.6",
        "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": "From: Maxime Coquelin <maxime.coquelin@redhat.com>\n\nthis patch is changed from\nhttps://gitlab.com/mcoquelin/dpdk-next-virtio/-/commit/a89dc311f2d03e99b8180f377b4a60a0e94\nthe biggest change is moving the mmaping-related process to the Previous patch\n\nSigned-off-by: Cindy Lu <lulu@redhat.com>\n---\n lib/vhost/vduse.c           | 43 ++++++++++++++++++++++++++-----------\n lib/vhost/virtio_net.c      | 22 +++++++++++++++++++\n lib/vhost/virtio_net_ctrl.c |  4 ++++\n 3 files changed, 56 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c\nindex 9b7f829a7a..4f12f039db 100644\n--- a/lib/vhost/vduse.c\n+++ b/lib/vhost/vduse.c\n@@ -165,7 +165,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused)\n }\n \n static void\n-vduse_vring_setup(struct virtio_net *dev, unsigned int index)\n+vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect)\n {\n \tstruct vhost_virtqueue *vq = dev->virtqueue[index];\n \tstruct vhost_vring_addr *ra = &vq->ring_addrs;\n@@ -181,15 +181,13 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)\n \t\treturn;\n \t}\n \n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"VQ %u info:\\n\", index);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tnum: %u\\n\", vq_info.num);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdesc_addr: %llx\\n\", vq_info.desc_addr);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdriver_addr: %llx\\n\", vq_info.driver_addr);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdevice_addr: %llx\\n\", vq_info.device_addr);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tavail_idx: %u\\n\", vq_info.split.avail_index);\n-\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tready: %u\\n\", vq_info.ready);\n-\n-\tvq->last_avail_idx = vq_info.split.avail_index;\n+\tif (reconnect) {\n+\t\tvq->last_avail_idx = vq->log->last_avail_idx;\n+\t\tvq->last_used_idx = vq->log->last_avail_idx;\n+\t} else {\n+\t\tvq->last_avail_idx = vq_info.split.avail_index;\n+\t\tvq->last_used_idx = vq_info.split.avail_index;\n+\t}\n \tvq->size = vq_info.num;\n \tvq->ready = vq_info.ready;\n \tvq->enabled = true;\n@@ -197,6 +195,14 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)\n \tra->avail_user_addr = vq_info.driver_addr;\n \tra->used_user_addr = vq_info.device_addr;\n \n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"VQ %u info:\\n\", index);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tnum: %u\\n\", vq_info.num);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdesc_addr: %llx\\n\", vq_info.desc_addr);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdriver_addr: %llx\\n\", vq_info.driver_addr);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tdevice_addr: %llx\\n\", vq_info.device_addr);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tavail_idx: %u\\n\", vq->last_avail_idx);\n+\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tready: %u\\n\", vq_info.ready);\n+\n \tvq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);\n \tif (vq->kickfd < 0) {\n \t\tVHOST_LOG_CONFIG(dev->ifname, ERR, \"Failed to init kickfd for VQ %u: %s\\n\",\n@@ -250,7 +256,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)\n }\n \n static void\n-vduse_device_start(struct virtio_net *dev)\n+vduse_device_start(struct virtio_net *dev, bool reconnect)\n {\n \tunsigned int i, ret;\n \n@@ -268,6 +274,16 @@ vduse_device_start(struct virtio_net *dev)\n \t\treturn;\n \t}\n \n+\tif (reconnect && dev->features != dev->log->features) {\n+\t\tVHOST_LOG_CONFIG(dev->ifname, ERR,\n+\t\t\t\t \"Mismatch between reconnect file features 0x%\" PRIx64\n+\t\t\t\t \" & device features 0x%\" PRIx64 \"\\n\",\n+\t\t\t\t (uint64_t)dev->log->features, dev->features);\n+\t\treturn;\n+\t}\n+\n+\tdev->log->features = dev->features;\n+\n \tVHOST_LOG_CONFIG(dev->ifname, INFO, \"negotiated Virtio features: 0x%\" PRIx64 \"\\n\",\n \t\tdev->features);\n \n@@ -281,7 +297,7 @@ vduse_device_start(struct virtio_net *dev)\n \t}\n \n \tfor (i = 0; i < dev->nr_vring; i++)\n-\t\tvduse_vring_setup(dev, i);\n+\t\tvduse_vring_setup(dev, i, reconnect);\n \n \tdev->flags |= VIRTIO_DEV_READY;\n \n@@ -335,9 +351,10 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)\n \t\tVHOST_LOG_CONFIG(dev->ifname, INFO, \"\\tnew status: 0x%08x\\n\",\n \t\t\t\treq.s.status);\n \t\tdev->status = req.s.status;\n+\t\tdev->log->status = dev->status;\n \n \t\tif (dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK)\n-\t\t\tvduse_device_start(dev);\n+\t\t\tvduse_device_start(dev, false);\n \n \t\tresp.result = VDUSE_REQ_RESULT_OK;\n \t\tbreak;\ndiff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex be28ea5151..49cce787bc 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -1443,6 +1443,8 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t}\n \n \t\tvq->last_avail_idx += num_buffers;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \t}\n \n \tdo_data_copy_enqueue(dev, vq);\n@@ -1838,6 +1840,8 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev, struct vhost_virtqueue\n \t\tpkts_info[slot_idx].mbuf = pkts[pkt_idx];\n \n \t\tvq->last_avail_idx += num_buffers;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \t}\n \n \tif (unlikely(pkt_idx == 0))\n@@ -1866,6 +1870,8 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev, struct vhost_virtqueue\n \t\t/* recover shadow used ring and available ring */\n \t\tvq->shadow_used_idx -= num_descs;\n \t\tvq->last_avail_idx -= num_descs;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \t}\n \n \t/* keep used descriptors */\n@@ -2077,9 +2083,15 @@ dma_error_handler_packed(struct vhost_virtqueue *vq, uint16_t slot_idx,\n \n \tif (vq->last_avail_idx >= descs_err) {\n \t\tvq->last_avail_idx -= descs_err;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \t} else {\n \t\tvq->last_avail_idx = vq->last_avail_idx + vq->size - descs_err;\n \t\tvq->avail_wrap_counter ^= 1;\n+\t\tif (vq->log) {\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n+\t\t\tvq->log->avail_wrap_counter = vq->avail_wrap_counter;\n+\t\t}\n \t}\n \n \tif (async->buffer_idx_packed >= buffers_err)\n@@ -3161,6 +3173,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\trte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);\n \n \tvq->last_avail_idx += i;\n+\tif (vq->log)\n+\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \n \tdo_data_copy_dequeue(vq);\n \tif (unlikely(i < count))\n@@ -3796,6 +3810,8 @@ virtio_dev_tx_async_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\tasync->desc_idx_split++;\n \n \t\tvq->last_avail_idx++;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \t}\n \n \tif (unlikely(dropped))\n@@ -3814,6 +3830,8 @@ virtio_dev_tx_async_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\tpkt_idx = n_xfer;\n \t\t/* recover available ring */\n \t\tvq->last_avail_idx -= pkt_err;\n+\t\tif (vq->log)\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n \n \t\t/**\n \t\t * recover async channel copy related structures and free pktmbufs\n@@ -4093,6 +4111,10 @@ virtio_dev_tx_async_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\tvq->last_avail_idx += vq->size - descs_err;\n \t\t\tvq->avail_wrap_counter ^= 1;\n \t\t}\n+\t\tif (vq->log) {\n+\t\t\tvq->log->last_avail_idx = vq->last_avail_idx;\n+\t\t\tvq->log->avail_wrap_counter = vq->avail_wrap_counter;\n+\t\t}\n \t}\n \n \tasync->pkts_idx += pkt_idx;\ndiff --git a/lib/vhost/virtio_net_ctrl.c b/lib/vhost/virtio_net_ctrl.c\nindex 36e34153e7..00c55a12e5 100644\n--- a/lib/vhost/virtio_net_ctrl.c\n+++ b/lib/vhost/virtio_net_ctrl.c\n@@ -168,6 +168,8 @@ virtio_net_ctrl_pop(struct virtio_net *dev, struct vhost_virtqueue *cvq,\n \tcvq->last_avail_idx++;\n \tif (cvq->last_avail_idx >= cvq->size)\n \t\tcvq->last_avail_idx -= cvq->size;\n+\tif (cvq->log)\n+\t\tcvq->log->last_avail_idx = cvq->last_avail_idx;\n \n \tif (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))\n \t\tvhost_avail_event(cvq) = cvq->last_avail_idx;\n@@ -180,6 +182,8 @@ virtio_net_ctrl_pop(struct virtio_net *dev, struct vhost_virtqueue *cvq,\n \tcvq->last_avail_idx++;\n \tif (cvq->last_avail_idx >= cvq->size)\n \t\tcvq->last_avail_idx -= cvq->size;\n+\tif (cvq->log)\n+\t\tcvq->log->last_avail_idx = cvq->last_avail_idx;\n \n \tif (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))\n \t\tvhost_avail_event(cvq) = cvq->last_avail_idx;\n",
    "prefixes": [
        "RFC",
        "v2",
        "2/2"
    ]
}