get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 50019,
    "url": "https://patches.dpdk.org/api/patches/50019/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190123130259.162871-1-xiao.w.wang@intel.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": "<20190123130259.162871-1-xiao.w.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190123130259.162871-1-xiao.w.wang@intel.com",
    "date": "2019-01-23T13:02:59",
    "name": "vhost: remove available ring relay helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c8c58a436f52b47e4959f541b6f7674fbcb0f49a",
    "submitter": {
        "id": 281,
        "url": "https://patches.dpdk.org/api/people/281/?format=api",
        "name": "Xiao Wang",
        "email": "xiao.w.wang@intel.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/20190123130259.162871-1-xiao.w.wang@intel.com/mbox/",
    "series": [
        {
            "id": 3304,
            "url": "https://patches.dpdk.org/api/series/3304/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=3304",
            "date": "2019-01-23T13:02:59",
            "name": "vhost: remove available ring relay helper",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/3304/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/50019/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/50019/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2F7BF2B84;\n\tWed, 23 Jan 2019 14:15:14 +0100 (CET)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id E2BE71150\n\tfor <dev@dpdk.org>; Wed, 23 Jan 2019 14:15:11 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Jan 2019 05:15:10 -0800",
            "from dpdk-xiao-1.sh.intel.com ([10.67.111.145])\n\tby orsmga001.jf.intel.com with ESMTP; 23 Jan 2019 05:15:08 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,511,1539673200\"; d=\"scan'208\";a=\"131005853\"",
        "From": "Xiao Wang <xiao.w.wang@intel.com>",
        "To": "maxime.coquelin@redhat.com",
        "Cc": "dev@dpdk.org, tiwei.bie@intel.com, xiaolong.ye@intel.com,\n\tXiao Wang <xiao.w.wang@intel.com>",
        "Date": "Wed, 23 Jan 2019 21:02:59 +0800",
        "Message-Id": "<20190123130259.162871-1-xiao.w.wang@intel.com>",
        "X-Mailer": "git-send-email 2.15.1",
        "Subject": "[dpdk-dev] [PATCH] vhost: remove available ring relay helper",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "We don't need to relay available ring and check the desc, vdpa device\ncan access the available ring in the guest directly. With this patch,\nwe can achieve better throughput and lower CPU usage.\n\nSigned-off-by: Xiao Wang <xiao.w.wang@intel.com>\n---\n drivers/net/ifc/ifcvf_vdpa.c           |  27 ++++---\n lib/librte_vhost/rte_vdpa.h            |  19 -----\n lib/librte_vhost/rte_vhost_version.map |   1 -\n lib/librte_vhost/vdpa.c                | 126 ---------------------------------\n 4 files changed, 12 insertions(+), 161 deletions(-)",
    "diff": "diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c\nindex 972033b86..921a7e058 100644\n--- a/drivers/net/ifc/ifcvf_vdpa.c\n+++ b/drivers/net/ifc/ifcvf_vdpa.c\n@@ -584,9 +584,12 @@ m_ifcvf_start(struct ifcvf_internal *internal)\n \t\t}\n \t\thw->vring[i].desc = gpa;\n \n-\t\thw->vring[i].avail = m_vring_iova +\n-\t\t\t(char *)internal->m_vring[i].avail -\n-\t\t\t(char *)internal->m_vring[i].desc;\n+\t\tgpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.avail);\n+\t\tif (gpa == 0) {\n+\t\t\tDRV_LOG(ERR, \"Fail to get GPA for available ring.\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\thw->vring[i].avail = gpa;\n \n \t\thw->vring[i].used = m_vring_iova +\n \t\t\t(char *)internal->m_vring[i].used -\n@@ -673,13 +676,6 @@ m_disable_vfio_intr(struct ifcvf_internal *internal)\n \trte_intr_disable(intr_handle);\n }\n \n-static void\n-update_avail_ring(struct ifcvf_internal *internal, uint16_t qid)\n-{\n-\trte_vdpa_relay_vring_avail(internal->vid, qid, &internal->m_vring[qid]);\n-\tifcvf_notify_queue(&internal->hw, qid);\n-}\n-\n static void\n update_used_ring(struct ifcvf_internal *internal, uint16_t qid)\n {\n@@ -703,12 +699,10 @@ vring_relay(void *arg)\n \tvid = internal->vid;\n \tq_num = rte_vhost_get_vring_num(vid);\n \t/* prepare the mediated vring */\n-\tfor (qid = 0; qid < q_num; qid++) {\n+\tfor (qid = 0; qid < q_num; qid++)\n \t\trte_vhost_get_vring_base(vid, qid,\n \t\t\t\t&internal->m_vring[qid].avail->idx,\n \t\t\t\t&internal->m_vring[qid].used->idx);\n-\t\trte_vdpa_relay_vring_avail(vid, qid, &internal->m_vring[qid]);\n-\t}\n \n \t/* add notify fd and interrupt fd to epoll */\n \tepfd = epoll_create(IFCVF_MAX_QUEUES * 2);\n@@ -775,7 +769,7 @@ vring_relay(void *arg)\n \t\t\tif (events[i].data.u32 & 1)\n \t\t\t\tupdate_used_ring(internal, qid);\n \t\t\telse\n-\t\t\t\tupdate_avail_ring(internal, qid);\n+\t\t\t\tifcvf_notify_queue(&internal->hw, qid);\n \t\t}\n \t}\n \n@@ -818,13 +812,14 @@ static int\n ifcvf_sw_fallback_switchover(struct ifcvf_internal *internal)\n {\n \tint ret;\n+\tint vid = internal->vid;\n \n \t/* stop the direct IO data path */\n \tunset_notify_relay(internal);\n \tvdpa_ifcvf_stop(internal);\n \tvdpa_disable_vfio_intr(internal);\n \n-\tret = rte_vhost_host_notifier_ctrl(internal->vid, false);\n+\tret = rte_vhost_host_notifier_ctrl(vid, false);\n \tif (ret && ret != -ENOTSUP)\n \t\tgoto error;\n \n@@ -843,6 +838,8 @@ ifcvf_sw_fallback_switchover(struct ifcvf_internal *internal)\n \tif (ret)\n \t\tgoto stop_vf;\n \n+\trte_vhost_host_notifier_ctrl(vid, true);\n+\n \tinternal->sw_fallback_running = true;\n \n \treturn 0;\ndiff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h\nindex c3c14816b..51a9a7b74 100644\n--- a/lib/librte_vhost/rte_vdpa.h\n+++ b/lib/librte_vhost/rte_vdpa.h\n@@ -174,25 +174,6 @@ rte_vdpa_get_device_num(void);\n int __rte_experimental\n rte_vhost_host_notifier_ctrl(int vid, bool enable);\n \n-/**\n- * @warning\n- * @b EXPERIMENTAL: this API may change without prior notice\n- *\n- * Synchronize the available ring from guest to mediated ring, help to\n- * check desc validity to protect against malicious guest driver.\n- *\n- * @param vid\n- *  vhost device id\n- * @param qid\n- *  vhost queue id\n- * @param vring_m\n- *  mediated virtio ring pointer\n- * @return\n- *  number of synced available entries on success, -1 on failure\n- */\n-int __rte_experimental\n-rte_vdpa_relay_vring_avail(int vid, uint16_t qid, void *vring_m);\n-\n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\ndiff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map\nindex dd3b4c1cb..bc843e297 100644\n--- a/lib/librte_vhost/rte_vhost_version.map\n+++ b/lib/librte_vhost/rte_vhost_version.map\n@@ -84,6 +84,5 @@ EXPERIMENTAL {\n \trte_vhost_crypto_set_zero_copy;\n \trte_vhost_va_from_guest_pa;\n \trte_vhost_host_notifier_ctrl;\n-\trte_vdpa_relay_vring_avail;\n \trte_vdpa_relay_vring_used;\n };\ndiff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c\nindex 02083bb8a..1ff9b00b8 100644\n--- a/lib/librte_vhost/vdpa.c\n+++ b/lib/librte_vhost/vdpa.c\n@@ -123,132 +123,6 @@ rte_vdpa_get_device_num(void)\n \treturn vdpa_device_num;\n }\n \n-static bool\n-invalid_desc_check(struct virtio_net *dev, struct vhost_virtqueue *vq,\n-\t\tuint64_t desc_iova, uint64_t desc_len, uint8_t perm)\n-{\n-\tuint64_t desc_addr, desc_chunck_len;\n-\n-\twhile (desc_len) {\n-\t\tdesc_chunck_len = desc_len;\n-\t\tdesc_addr = vhost_iova_to_vva(dev, vq,\n-\t\t\t\tdesc_iova,\n-\t\t\t\t&desc_chunck_len,\n-\t\t\t\tperm);\n-\n-\t\tif (!desc_addr)\n-\t\t\treturn true;\n-\n-\t\tdesc_len -= desc_chunck_len;\n-\t\tdesc_iova += desc_chunck_len;\n-\t}\n-\n-\treturn false;\n-}\n-\n-int __rte_experimental\n-rte_vdpa_relay_vring_avail(int vid, uint16_t qid, void *vring_m)\n-{\n-\tstruct virtio_net *dev = get_device(vid);\n-\tuint16_t idx, idx_m, desc_id;\n-\tstruct vring_desc desc;\n-\tstruct vhost_virtqueue *vq;\n-\tstruct vring_desc *desc_ring;\n-\tstruct vring_desc *idesc = NULL;\n-\tstruct vring *s_vring;\n-\tuint64_t dlen;\n-\tuint32_t nr_descs;\n-\tint ret;\n-\tuint8_t perm;\n-\n-\tif (!dev || !vring_m)\n-\t\treturn -1;\n-\n-\tif (qid >= dev->nr_vring)\n-\t\treturn -1;\n-\n-\tif (vq_is_packed(dev))\n-\t\treturn -1;\n-\n-\ts_vring = (struct vring *)vring_m;\n-\tvq = dev->virtqueue[qid];\n-\tidx = vq->avail->idx;\n-\tidx_m = s_vring->avail->idx;\n-\tret = (uint16_t)(idx - idx_m);\n-\n-\twhile (idx_m != idx) {\n-\t\t/* avail entry copy */\n-\t\tdesc_id = vq->avail->ring[idx_m & (vq->size - 1)];\n-\t\tif (unlikely(desc_id >= vq->size))\n-\t\t\treturn -1;\n-\n-\t\ts_vring->avail->ring[idx_m & (vq->size - 1)] = desc_id;\n-\t\tdesc_ring = vq->desc;\n-\t\tnr_descs = vq->size;\n-\n-\t\tif (vq->desc[desc_id].flags & VRING_DESC_F_INDIRECT) {\n-\t\t\tdlen = vq->desc[desc_id].len;\n-\t\t\tnr_descs = dlen / sizeof(struct vring_desc);\n-\t\t\tif (unlikely(nr_descs > vq->size))\n-\t\t\t\treturn -1;\n-\n-\t\t\tdesc_ring = (struct vring_desc *)(uintptr_t)\n-\t\t\t\tvhost_iova_to_vva(dev, vq,\n-\t\t\t\t\t\tvq->desc[desc_id].addr, &dlen,\n-\t\t\t\t\t\tVHOST_ACCESS_RO);\n-\t\t\tif (unlikely(!desc_ring))\n-\t\t\t\treturn -1;\n-\n-\t\t\tif (unlikely(dlen < vq->desc[desc_id].len)) {\n-\t\t\t\tidesc = alloc_copy_ind_table(dev, vq,\n-\t\t\t\t\t\tvq->desc[desc_id].addr,\n-\t\t\t\t\t\tvq->desc[desc_id].len);\n-\t\t\t\tif (unlikely(!idesc))\n-\t\t\t\t\treturn -1;\n-\n-\t\t\t\tdesc_ring = idesc;\n-\t\t\t}\n-\n-\t\t\tdesc_id = 0;\n-\t\t}\n-\n-\t\t/* check if the buf addr is within the guest memory */\n-\t\tdo {\n-\t\t\tif (unlikely(desc_id >= vq->size))\n-\t\t\t\tgoto fail;\n-\t\t\tif (unlikely(nr_descs-- == 0))\n-\t\t\t\tgoto fail;\n-\t\t\tdesc = desc_ring[desc_id];\n-\t\t\tperm = desc.flags & VRING_DESC_F_WRITE ?\n-\t\t\t\tVHOST_ACCESS_WO : VHOST_ACCESS_RO;\n-\t\t\tif (invalid_desc_check(dev, vq, desc.addr, desc.len,\n-\t\t\t\t\t\tperm))\n-\t\t\t\tgoto fail;\n-\t\t\tdesc_id = desc.next;\n-\t\t} while (desc.flags & VRING_DESC_F_NEXT);\n-\n-\t\tif (unlikely(idesc)) {\n-\t\t\tfree_ind_table(idesc);\n-\t\t\tidesc = NULL;\n-\t\t}\n-\n-\t\tidx_m++;\n-\t}\n-\n-\trte_smp_wmb();\n-\ts_vring->avail->idx = idx;\n-\n-\tif (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))\n-\t\tvhost_avail_event(vq) = idx;\n-\n-\treturn ret;\n-\n-fail:\n-\tif (unlikely(idesc))\n-\t\tfree_ind_table(idesc);\n-\treturn -1;\n-}\n-\n int __rte_experimental\n rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m)\n {\n",
    "prefixes": []
}