get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 45076,
    "url": "http://patches.dpdk.org/api/patches/45076/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180921103308.16357-10-jfreimann@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": "<20180921103308.16357-10-jfreimann@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180921103308.16357-10-jfreimann@redhat.com",
    "date": "2018-09-21T10:33:06",
    "name": "[v6,09/11] net/virtio: add virtio send command packed queue support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4bebf055d06cabb512c467219a9ebe4dd37fa83a",
    "submitter": {
        "id": 745,
        "url": "http://patches.dpdk.org/api/people/745/?format=api",
        "name": "Jens Freimann",
        "email": "jfreimann@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/20180921103308.16357-10-jfreimann@redhat.com/mbox/",
    "series": [
        {
            "id": 1435,
            "url": "http://patches.dpdk.org/api/series/1435/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1435",
            "date": "2018-09-21T10:32:57",
            "name": "implement packed virtqueues",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/1435/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/45076/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/45076/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 ED8584CC3;\n\tFri, 21 Sep 2018 12:34:30 +0200 (CEST)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id AF8325B2E\n\tfor <dev@dpdk.org>; Fri, 21 Sep 2018 12:34:28 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 2833930820CF;\n\tFri, 21 Sep 2018 10:34:28 +0000 (UTC)",
            "from localhost (dhcp-192-209.str.redhat.com [10.33.192.209])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 047C918220;\n\tFri, 21 Sep 2018 10:34:21 +0000 (UTC)"
        ],
        "From": "Jens Freimann <jfreimann@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "tiwei.bie@intel.com,\n\tmaxime.coquelin@redhat.com,\n\tGavin.Hu@arm.com",
        "Date": "Fri, 21 Sep 2018 12:33:06 +0200",
        "Message-Id": "<20180921103308.16357-10-jfreimann@redhat.com>",
        "In-Reply-To": "<20180921103308.16357-1-jfreimann@redhat.com>",
        "References": "<20180921103308.16357-1-jfreimann@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.16",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.47]); Fri, 21 Sep 2018 10:34:28 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH v6 09/11] net/virtio: add virtio send command\n\tpacked queue support",
        "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": "Use packed virtqueue format when reading and writing descriptors\nto/from the ring.\n\nSigned-off-by: Jens Freimann <jfreimann@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 90 ++++++++++++++++++++++++++++++\n 1 file changed, 90 insertions(+)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex c4ef095ed..c1d95141d 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -141,6 +141,90 @@ static const struct rte_virtio_xstats_name_off rte_virtio_txq_stat_strings[] = {\n \n struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];\n \n+static struct virtio_pmd_ctrl *\n+virtio_pq_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,\n+\t\t       int *dlen, int pkt_num)\n+{\n+\tstruct virtqueue *vq = cvq->vq;\n+\tint head;\n+\tstruct vring_desc_packed *desc = vq->vq_ring.desc_packed;\n+\tstruct virtio_pmd_ctrl *result;\n+\tint wrap_counter;\n+\tint sum = 0;\n+\tint k;\n+\n+\t/*\n+\t * Format is enforced in qemu code:\n+\t * One TX packet for header;\n+\t * At least one TX packet per argument;\n+\t * One RX packet for ACK.\n+\t */\n+\thead = vq->vq_avail_idx;\n+\twrap_counter = vq->vq_ring.avail_wrap_counter;\n+\tdesc[head].flags = VRING_DESC_F_NEXT;\n+\tdesc[head].addr = cvq->virtio_net_hdr_mem;\n+\tdesc[head].len = sizeof(struct virtio_net_ctrl_hdr);\n+\tvq->vq_free_cnt--;\n+\tif (++vq->vq_avail_idx >= vq->vq_nentries) {\n+\t\tvq->vq_avail_idx -= vq->vq_nentries;\n+\t\tvq->vq_ring.avail_wrap_counter ^= 1;\n+\t}\n+\n+\tfor (k = 0; k < pkt_num; k++) {\n+\t\tdesc[vq->vq_avail_idx].addr = cvq->virtio_net_hdr_mem\n+\t\t\t+ sizeof(struct virtio_net_ctrl_hdr)\n+\t\t\t+ sizeof(ctrl->status) + sizeof(uint8_t) * sum;\n+\t\tdesc[vq->vq_avail_idx].len = dlen[k];\n+\t\tdesc[vq->vq_avail_idx].flags = VRING_DESC_F_NEXT;\n+\t\tsum += dlen[k];\n+\t\tvq->vq_free_cnt--;\n+\t\t_set_desc_avail(&desc[vq->vq_avail_idx],\n+\t\t\t\tvq->vq_ring.avail_wrap_counter);\n+\t\trte_smp_wmb();\n+\t\tvq->vq_free_cnt--;\n+\t\tif (++vq->vq_avail_idx >= vq->vq_nentries) {\n+\t\t\tvq->vq_avail_idx -= vq->vq_nentries;\n+\t\t\tvq->vq_ring.avail_wrap_counter ^= 1;\n+\t\t}\n+\t}\n+\n+\n+\tdesc[vq->vq_avail_idx].addr = cvq->virtio_net_hdr_mem\n+\t\t+ sizeof(struct virtio_net_ctrl_hdr);\n+\tdesc[vq->vq_avail_idx].len = sizeof(ctrl->status);\n+\tdesc[vq->vq_avail_idx].flags = VRING_DESC_F_WRITE;\n+\t_set_desc_avail(&desc[vq->vq_avail_idx],\n+\t\t\tvq->vq_ring.avail_wrap_counter);\n+\t_set_desc_avail(&desc[head], wrap_counter);\n+\trte_smp_wmb();\n+\n+\tvq->vq_free_cnt--;\n+\tif (++vq->vq_avail_idx >= vq->vq_nentries) {\n+\t\tvq->vq_avail_idx -= vq->vq_nentries;\n+\t\tvq->vq_ring.avail_wrap_counter ^= 1;\n+\t}\n+\n+\tvirtqueue_notify(vq);\n+\n+\t/* wait for used descriptors in virtqueue */\n+\tdo {\n+\t\trte_rmb();\n+\t\tusleep(100);\n+\t} while (!_desc_is_used(&desc[head]));\n+\n+\t/* now get used descriptors */\n+\twhile(desc_is_used(&desc[vq->vq_used_cons_idx], &vq->vq_ring)) {\n+\t\tvq->vq_free_cnt++;\n+\t\tif (++vq->vq_used_cons_idx >= vq->vq_nentries) {\n+\t\t\tvq->vq_used_cons_idx -= vq->vq_nentries;\n+\t\t\tvq->vq_ring.used_wrap_counter ^= 1;\n+\t\t}\n+\t}\n+\n+\tresult = cvq->virtio_net_hdr_mz->addr;\n+\treturn result;\n+}\n+\n static int\n virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,\n \t\tint *dlen, int pkt_num)\n@@ -174,6 +258,11 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,\n \tmemcpy(cvq->virtio_net_hdr_mz->addr, ctrl,\n \t\tsizeof(struct virtio_pmd_ctrl));\n \n+\tif (vtpci_packed_queue(vq->hw)) {\n+\t\tresult = virtio_pq_send_command(cvq, ctrl, dlen, pkt_num);\n+\t\tgoto out_unlock;\n+\t}\n+\n \t/*\n \t * Format is enforced in qemu code:\n \t * One TX packet for header;\n@@ -245,6 +334,7 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,\n \n \tresult = cvq->virtio_net_hdr_mz->addr;\n \n+out_unlock:\n \trte_spinlock_unlock(&cvq->lock);\n \treturn result->status;\n }\n",
    "prefixes": [
        "v6",
        "09/11"
    ]
}