get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 59719,
    "url": "http://patches.dpdk.org/api/patches/59719/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190925171329.63734-8-yong.liu@intel.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": "<20190925171329.63734-8-yong.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190925171329.63734-8-yong.liu@intel.com",
    "date": "2019-09-25T17:13:21",
    "name": "[v3,07/15] vhost: add flush function for batch enqueue",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0a2823a8e99458261dd4f0781dbcca9ee41033b9",
    "submitter": {
        "id": 17,
        "url": "http://patches.dpdk.org/api/people/17/?format=api",
        "name": "Marvin Liu",
        "email": "yong.liu@intel.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/20190925171329.63734-8-yong.liu@intel.com/mbox/",
    "series": [
        {
            "id": 6522,
            "url": "http://patches.dpdk.org/api/series/6522/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6522",
            "date": "2019-09-25T17:13:14",
            "name": "vhost packed ring performance optimization",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/6522/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/59719/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/59719/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 D6E261BEBA;\n\tWed, 25 Sep 2019 11:32:58 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id B24ED1BE82\n\tfor <dev@dpdk.org>; Wed, 25 Sep 2019 11:32:39 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Sep 2019 02:32:39 -0700",
            "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby fmsmga004.fm.intel.com with ESMTP; 25 Sep 2019 02:32:37 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,547,1559545200\"; d=\"scan'208\";a=\"213986202\"",
        "From": "Marvin Liu <yong.liu@intel.com>",
        "To": "maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, \n\tstephen@networkplumber.org, gavin.hu@arm.com",
        "Cc": "dev@dpdk.org,\n\tMarvin Liu <yong.liu@intel.com>",
        "Date": "Thu, 26 Sep 2019 01:13:21 +0800",
        "Message-Id": "<20190925171329.63734-8-yong.liu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190925171329.63734-1-yong.liu@intel.com>",
        "References": "<20190919163643.24130-2-yong.liu@intel.com>\n\t<20190925171329.63734-1-yong.liu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 07/15] vhost: add flush function for batch\n\tenqueue",
        "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": "Flush used flags when batched enqueue function is finished. Descriptor's\nflags are pre-calculated as they will be reset by vhost.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>",
    "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 18a207fc6..7bf9ff9b7 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -39,6 +39,9 @@\n \n #define VHOST_LOG_CACHE_NR 32\n \n+#define PACKED_RX_USED_FLAG  (0ULL | VRING_DESC_F_AVAIL | VRING_DESC_F_USED \\\n+\t\t\t\t| VRING_DESC_F_WRITE)\n+#define PACKED_RX_USED_WRAP_FLAG (VRING_DESC_F_WRITE)\n #define PACKED_BATCH_SIZE (RTE_CACHE_LINE_SIZE / \\\n \t\t\t    sizeof(struct vring_packed_desc))\n #define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1)\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex f85619dc2..a629e66d4 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -169,6 +169,49 @@ update_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n \tvq->shadow_used_packed[i].count = count;\n }\n \n+static __rte_always_inline void\n+flush_used_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tuint64_t *lens, uint16_t *ids, uint16_t flags)\n+{\n+\tuint16_t i;\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\tvq->desc_packed[vq->last_used_idx + i].id = ids[i];\n+\t\tvq->desc_packed[vq->last_used_idx + i].len = lens[i];\n+\t}\n+\n+\trte_smp_wmb();\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\tvq->desc_packed[vq->last_used_idx + i].flags = flags;\n+\n+\tvhost_log_cache_used_vring(dev, vq, vq->last_used_idx *\n+\t\t\t\t   sizeof(struct vring_packed_desc),\n+\t\t\t\t   sizeof(struct vring_packed_desc) *\n+\t\t\t\t   PACKED_BATCH_SIZE);\n+\tvhost_log_cache_sync(dev, vq);\n+\n+\tvq->last_used_idx += PACKED_BATCH_SIZE;\n+\tif (vq->last_used_idx >= vq->size) {\n+\t\tvq->used_wrap_counter ^= 1;\n+\t\tvq->last_used_idx -= vq->size;\n+\t}\n+}\n+\n+static __rte_always_inline void\n+flush_enqueue_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tuint64_t *lens, uint16_t *ids)\n+{\n+\tuint16_t flags = 0;\n+\n+\tif (vq->used_wrap_counter)\n+\t\tflags = PACKED_RX_USED_FLAG;\n+\telse\n+\t\tflags = PACKED_RX_USED_WRAP_FLAG;\n+\tflush_used_batch_packed(dev, vq, lens, ids, flags);\n+}\n+\n static __rte_always_inline void\n update_enqueue_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n \tuint16_t desc_idx, uint32_t len, uint16_t count)\n@@ -937,6 +980,7 @@ virtio_dev_rx_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE];\n \tuint32_t buf_offset = dev->vhost_hlen;\n \tuint64_t lens[PACKED_BATCH_SIZE];\n+\tuint16_t ids[PACKED_BATCH_SIZE];\n \tuint16_t i;\n \n \tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n@@ -1003,6 +1047,12 @@ virtio_dev_rx_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t   pkts[i]->pkt_len);\n \t}\n \n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\tids[i] = descs[avail_idx + i].id;\n+\n+\tflush_enqueue_batch_packed(dev, vq, lens, ids);\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "v3",
        "07/15"
    ]
}