get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 48499,
    "url": "http://patches.dpdk.org/api/patches/48499/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20181203141515.28368-4-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": "<20181203141515.28368-4-jfreimann@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181203141515.28368-4-jfreimann@redhat.com",
    "date": "2018-12-03T14:15:09",
    "name": "[v11,3/9] net/virtio: add packed virtqueue helpers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e6a70588be9bf56960f067f2c951ba40c42328af",
    "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/20181203141515.28368-4-jfreimann@redhat.com/mbox/",
    "series": [
        {
            "id": 2645,
            "url": "http://patches.dpdk.org/api/series/2645/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2645",
            "date": "2018-12-03T14:15:06",
            "name": "implement packed virtqueues",
            "version": 11,
            "mbox": "http://patches.dpdk.org/series/2645/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/48499/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/48499/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 6D4F91B432;\n\tMon,  3 Dec 2018 15:16:35 +0100 (CET)",
            "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id 01CF35F44\n\tfor <dev@dpdk.org>; Mon,  3 Dec 2018 15:16:34 +0100 (CET)",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\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 62E82308624B;\n\tMon,  3 Dec 2018 14:16:33 +0000 (UTC)",
            "from localhost (dhcp-192-205.str.redhat.com [10.33.192.205])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id A3F9A62943;\n\tMon,  3 Dec 2018 14:16:10 +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": "Mon,  3 Dec 2018 15:15:09 +0100",
        "Message-Id": "<20181203141515.28368-4-jfreimann@redhat.com>",
        "In-Reply-To": "<20181203141515.28368-1-jfreimann@redhat.com>",
        "References": "<20181203141515.28368-1-jfreimann@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.49]); Mon, 03 Dec 2018 14:16:33 +0000 (UTC)",
        "Subject": "[dpdk-dev] [PATCH v11 3/9] net/virtio: add packed virtqueue helpers",
        "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": "Add helper functions to set/clear and check descriptor flags.\n\nSigned-off-by: Jens Freimann <jfreimann@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c |  2 +\n drivers/net/virtio/virtqueue.h     | 73 +++++++++++++++++++++++++++++-\n 2 files changed, 73 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex fdcb7ecaa..48707b7b8 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -310,6 +310,7 @@ virtio_init_vring(struct virtqueue *vq)\n \tif (vtpci_packed_queue(vq->hw)) {\n \t\tvring_init_packed(&vq->ring_packed, ring_mem, VIRTIO_PCI_VRING_ALIGN, size);\n \t\tvring_desc_init_packed(vq, size);\n+\t\tvirtqueue_disable_intr_packed(vq);\n \t} else {\n \t\tvring_init_split(vr, ring_mem, VIRTIO_PCI_VRING_ALIGN, size);\n \t\tvring_desc_init_split(vr->desc, size);\n@@ -383,6 +384,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \tvq->hw = hw;\n \tvq->vq_queue_index = vtpci_queue_idx;\n \tvq->vq_nentries = vq_size;\n+\tvq->event_flags_shadow = 0;\n \tif (vtpci_packed_queue(hw)) {\n \t\tvq->avail_wrap_counter = 1;\n \t\tvq->used_wrap_counter = 1;\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 1401a9844..20b42f5fb 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -170,6 +170,7 @@ struct virtqueue {\n \tstruct vring_packed ring_packed;  /**< vring keeping desc, used and avail */\n \tbool avail_wrap_counter;\n \tbool used_wrap_counter;\n+\tuint16_t event_flags_shadow;\n \n \t/**\n \t * Last consumed descriptor in the used table,\n@@ -250,6 +251,32 @@ struct virtio_tx_region {\n \t\t\t   __attribute__((__aligned__(16)));\n };\n \n+static inline void\n+_set_desc_avail(struct vring_packed_desc *desc, int wrap_counter)\n+{\n+\tdesc->flags |= VRING_DESC_F_AVAIL(wrap_counter) |\n+\t\t       VRING_DESC_F_USED(!wrap_counter);\n+}\n+\n+static inline void\n+set_desc_avail(struct virtqueue *vq, struct vring_packed_desc *desc)\n+{\n+\t_set_desc_avail(desc, vq->avail_wrap_counter);\n+}\n+\n+static inline int\n+desc_is_used(struct vring_packed_desc *desc, struct virtqueue *vq)\n+{\n+\tuint16_t used, avail, flags;\n+\n+\tflags = desc->flags;\n+\tused = !!(flags & VRING_DESC_F_USED(1));\n+\tavail = !!(flags & VRING_DESC_F_AVAIL(1));\n+\n+\treturn avail == used && used == vq->used_wrap_counter;\n+}\n+\n+\n static inline void\n vring_desc_init_packed(struct virtqueue *vq, int n)\n {\n@@ -273,22 +300,64 @@ vring_desc_init_split(struct vring_desc *dp, uint16_t n)\n \tdp[i].next = VQ_RING_DESC_CHAIN_END;\n }\n \n+/**\n+ * Tell the backend not to interrupt us.\n+ */\n+static inline void\n+virtqueue_disable_intr_packed(struct virtqueue *vq)\n+{\n+\tuint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags;\n+\n+\tif (*event_flags != RING_EVENT_FLAGS_DISABLE) {\n+\t\t*event_flags = RING_EVENT_FLAGS_DISABLE;\n+\t}\n+}\n+\n+\n /**\n  * Tell the backend not to interrupt us.\n  */\n static inline void\n virtqueue_disable_intr(struct virtqueue *vq)\n {\n-\tvq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;\n+\tif (vtpci_packed_queue(vq->hw))\n+\t\tvirtqueue_disable_intr_packed(vq);\n+\telse\n+\t\tvq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;\n+}\n+\n+/**\n+ * Tell the backend to interrupt us.\n+ */\n+static inline void\n+virtqueue_enable_intr_packed(struct virtqueue *vq)\n+{\n+\tuint16_t *off_wrap = &vq->ring_packed.driver_event->desc_event_off_wrap;\n+\tuint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags;\n+\n+\t*off_wrap = vq->vq_used_cons_idx |\n+\t\t((uint16_t)(vq->used_wrap_counter << 15));\n+\n+\tif (vq->event_flags_shadow == RING_EVENT_FLAGS_DISABLE) {\n+\t\tvirtio_wmb();\n+\t\tvq->event_flags_shadow =\n+\t\t\tvtpci_with_feature(vq->hw, VIRTIO_RING_F_EVENT_IDX) ?\n+\t\t\t\tRING_EVENT_FLAGS_DESC : RING_EVENT_FLAGS_ENABLE;\n+\t\t*event_flags = vq->event_flags_shadow;\n+\t}\n }\n \n+\n /**\n  * Tell the backend to interrupt us.\n  */\n static inline void\n virtqueue_enable_intr(struct virtqueue *vq)\n {\n-\tvq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);\n+\tif (vtpci_packed_queue(vq->hw))\n+\t\tvirtqueue_enable_intr_packed(vq);\n+\telse\n+\t\tvq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);\n }\n \n /**\n",
    "prefixes": [
        "v11",
        "3/9"
    ]
}