Show a patch.

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

{
    "id": 42277,
    "url": "http://patches.dpdk.org/api/patches/42277/",
    "web_url": "http://patches.dpdk.org/patch/42277/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180704215438.5579-11-maxime.coquelin@redhat.com>",
    "date": "2018-07-04T21:54:33",
    "name": "[v7,10/15] vhost: create descriptor mapping function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "50e76989f67061064492720e5d0bfff2cadc0a85",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/patch/42277/mbox/",
    "series": [
        {
            "id": 404,
            "url": "http://patches.dpdk.org/api/series/404/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=404",
            "date": "2018-07-04T21:54:23",
            "name": "Vhost: add support to packed ring layout",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/404/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42277/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42277/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<20180704215438.5579-1-maxime.coquelin@redhat.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D09031BF74;\n\tWed,  4 Jul 2018 23:55:09 +0200 (CEST)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 1A53D1BF6B\n\tfor <dev@dpdk.org>; Wed,  4 Jul 2018 23:55:08 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id B754D4075384;\n\tWed,  4 Jul 2018 21:55:07 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-34.ams2.redhat.com\n\t[10.36.112.34])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id B79E82156880;\n\tWed,  4 Jul 2018 21:55:05 +0000 (UTC)"
        ],
        "References": "<20180704215438.5579-1-maxime.coquelin@redhat.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6",
        "Message-Id": "<20180704215438.5579-11-maxime.coquelin@redhat.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.7]); Wed, 04 Jul 2018 21:55:07 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.7]); \n\tWed, 04 Jul 2018 21:55:07 +0000 (UTC) for IP:'10.11.54.6'\n\tDOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''"
        ],
        "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>",
        "To": "tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com,\n\tdev@dpdk.org",
        "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>",
        "Date": "Wed,  4 Jul 2018 23:54:33 +0200",
        "Cc": "mst@redhat.com, jasowang@redhat.com, wexu@redhat.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v7 10/15] vhost: create descriptor mapping\n\tfunction"
    },
    "content": "Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/virtio_net.c | 70 ++++++++++++++++++++++++-------------------\n 1 file changed, 40 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex da5a13aad..e3b73c951 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -291,6 +291,40 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)\n \t}\n }\n \n+static __rte_always_inline int\n+map_one_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\t\tstruct buf_vector *buf_vec, uint16_t *vec_idx,\n+\t\tuint64_t desc_iova, uint64_t desc_len, uint8_t perm)\n+{\n+\tuint16_t vec_id = *vec_idx;\n+\n+\twhile (desc_len) {\n+\t\tuint64_t desc_addr;\n+\t\tuint64_t desc_chunck_len = desc_len;\n+\n+\t\tif (unlikely(vec_id >= BUF_VECTOR_MAX))\n+\t\t\treturn -1;\n+\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+\t\tif (unlikely(!desc_addr))\n+\t\t\treturn -1;\n+\n+\t\tbuf_vec[vec_id].buf_iova = desc_iova;\n+\t\tbuf_vec[vec_id].buf_addr = desc_addr;\n+\t\tbuf_vec[vec_id].buf_len  = desc_chunck_len;\n+\n+\t\tdesc_len -= desc_chunck_len;\n+\t\tdesc_iova += desc_chunck_len;\n+\t\tvec_id++;\n+\t}\n+\t*vec_idx = vec_id;\n+\n+\treturn 0;\n+}\n+\n static __rte_always_inline int\n fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t uint32_t avail_idx, uint16_t *vec_idx,\n@@ -300,7 +334,7 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tuint16_t idx = vq->avail->ring[avail_idx & (vq->size - 1)];\n \tuint16_t vec_id = *vec_idx;\n \tuint32_t len    = 0;\n-\tuint64_t dlen, desc_avail, desc_iova;\n+\tuint64_t dlen;\n \tstruct vring_desc *descs = vq->desc;\n \tstruct vring_desc *idesc = NULL;\n \n@@ -337,37 +371,13 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\treturn -1;\n \t\t}\n \n-\n \t\tlen += descs[idx].len;\n-\t\tdesc_avail = descs[idx].len;\n-\t\tdesc_iova = descs[idx].addr;\n-\n-\t\twhile (desc_avail) {\n-\t\t\tuint64_t desc_addr;\n-\t\t\tuint64_t desc_chunck_len = desc_avail;\n-\n-\t\t\tif (unlikely(vec_id >= BUF_VECTOR_MAX)) {\n-\t\t\t\tfree_ind_table(idesc);\n-\t\t\t\treturn -1;\n-\t\t\t}\n \n-\t\t\tdesc_addr = vhost_iova_to_vva(dev, vq,\n-\t\t\t\t\tdesc_iova,\n-\t\t\t\t\t&desc_chunck_len,\n-\t\t\t\t\tperm);\n-\t\t\tif (unlikely(!desc_addr)) {\n-\t\t\t\tfree_ind_table(idesc);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\n-\t\t\tbuf_vec[vec_id].buf_iova = desc_iova;\n-\t\t\tbuf_vec[vec_id].buf_addr = desc_addr;\n-\t\t\tbuf_vec[vec_id].buf_len  = desc_chunck_len;\n-\t\t\tbuf_vec[vec_id].desc_idx = idx;\n-\n-\t\t\tdesc_avail -= desc_chunck_len;\n-\t\t\tdesc_iova += desc_chunck_len;\n-\t\t\tvec_id++;\n+\t\tif (unlikely(map_one_desc(dev, vq, buf_vec, &vec_id,\n+\t\t\t\t\t\tdescs[idx].addr, descs[idx].len,\n+\t\t\t\t\t\tperm))) {\n+\t\t\tfree_ind_table(idesc);\n+\t\t\treturn -1;\n \t\t}\n \n \t\tif ((descs[idx].flags & VRING_DESC_F_NEXT) == 0)\n",
    "prefixes": [
        "v7",
        "10/15"
    ]
}