get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 93758,
    "url": "https://patches.dpdk.org/api/patches/93758/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1622646329-279450-1-git-send-email-jiayu.hu@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": "<1622646329-279450-1-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1622646329-279450-1-git-send-email-jiayu.hu@intel.com",
    "date": "2021-06-02T15:05:29",
    "name": "vhost: allow to check in-flight packets for async vhost",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7d1b105ae00ab0836ace3eafb54fea22ebe351e7",
    "submitter": {
        "id": 539,
        "url": "https://patches.dpdk.org/api/people/539/?format=api",
        "name": "Hu, Jiayu",
        "email": "jiayu.hu@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/1622646329-279450-1-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [
        {
            "id": 17203,
            "url": "https://patches.dpdk.org/api/series/17203/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17203",
            "date": "2021-06-02T15:05:29",
            "name": "vhost: allow to check in-flight packets for async vhost",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/17203/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/93758/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/93758/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BDCCAA0524;\n\tWed,  2 Jun 2021 10:36:45 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4EE564069F;\n\tWed,  2 Jun 2021 10:36:45 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id E434A40689\n for <dev@dpdk.org>; Wed,  2 Jun 2021 10:36:43 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 02 Jun 2021 01:36:38 -0700",
            "from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25])\n by fmsmga001.fm.intel.com with ESMTP; 02 Jun 2021 01:36:36 -0700"
        ],
        "IronPort-SDR": [
            "\n WlRrb9ESLeC80bu2/YOn6dKeLU2PAiw8oZs9GuiJHr6MUXo7LoyTws2AXIFKk1co2y5fH9KM02\n l2ItorwFzOaw==",
            "\n TWo2sLxTGBDpgyyg/GuQ8/80JFJDZ2y9RFBG/aqxUURUzh22u78EDJQghi/pcUI6Vq/65koRmC\n RYpvO5nr13Lw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10002\"; a=\"267612582\"",
            "E=Sophos;i=\"5.83,241,1616482800\"; d=\"scan'208\";a=\"267612582\"",
            "E=Sophos;i=\"5.83,241,1616482800\"; d=\"scan'208\";a=\"550050124\""
        ],
        "X-ExtLoop1": "1",
        "From": "Jiayu Hu <jiayu.hu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "maxime.coquelin@redhat.com, chenbo.xia@intel.com,\n Jiayu Hu <jiayu.hu@intel.com>",
        "Date": "Wed,  2 Jun 2021 11:05:29 -0400",
        "Message-Id": "<1622646329-279450-1-git-send-email-jiayu.hu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH] vhost: allow to check in-flight packets for\n async vhost",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch allows to check the amount of in-flight packets\nfor vhost queues which register async channel acceleration.\n\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\n---\n doc/guides/prog_guide/vhost_lib.rst |  5 +++++\n lib/vhost/rte_vhost_async.h         | 14 ++++++++++++++\n lib/vhost/version.map               |  3 +++\n lib/vhost/vhost.c                   | 35 +++++++++++++++++++++++++++++++++++\n 4 files changed, 57 insertions(+)",
    "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex d18fb98..9fdc6d5 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -281,6 +281,11 @@ The following is an overview of some key Vhost API functions:\n   Poll enqueue completion status from async data path. Completed packets\n   are returned to applications through ``pkts``.\n \n+* ``rte_vhost_async_get_inflight(vid, queue_id)``\n+\n+  This function returns the amount of in-flight packets by now for the\n+  vhost queue which registers async channel acceleration.\n+\n Vhost-user Implementations\n --------------------------\n \ndiff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h\nindex 6faa31f..553da4d 100644\n--- a/lib/vhost/rte_vhost_async.h\n+++ b/lib/vhost/rte_vhost_async.h\n@@ -193,4 +193,18 @@ __rte_experimental\n uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,\n \t\tstruct rte_mbuf **pkts, uint16_t count);\n \n+/**\n+ * This function returns the amount of in-flight packets by now\n+ * for the vhost queue which registers async channel acceleration.\n+ *\n+ * @param vid\n+ *  id of vhost device to enqueue data\n+ * @param queue_id\n+ *  queue id to enqueue data\n+ * @return\n+ *  the amount of in-flight packets on success; -1 on failure\n+ */\n+__rte_experimental\n+int rte_vhost_async_get_inflight(int vid, uint16_t queue_id);\n+\n #endif /* _RTE_VHOST_ASYNC_H_ */\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex 9103a23..28238cb 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -79,4 +79,7 @@ EXPERIMENTAL {\n \n \t# added in 21.05\n \trte_vhost_get_negotiated_protocol_features;\n+\n+\t# added in 21.08\n+\trte_vhost_async_get_inflight;\n };\ndiff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex c96f633..4547705 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1780,5 +1780,40 @@ int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)\n \treturn ret;\n }\n \n+int rte_vhost_async_get_inflight(int vid, uint16_t queue_id)\n+{\n+\tstruct vhost_virtqueue *vq;\n+\tstruct virtio_net *dev = get_device(vid);\n+\tint ret = -1;\n+\n+\tif (dev == NULL)\n+\t\treturn ret;\n+\n+\tif (queue_id >= VHOST_MAX_VRING)\n+\t\treturn ret;\n+\n+\tvq = dev->virtqueue[queue_id];\n+\n+\tif (vq == NULL)\n+\t\treturn ret;\n+\n+\tret = 0;\n+\n+\tif (!vq->async_registered)\n+\t\treturn ret;\n+\n+\tif (!rte_spinlock_trylock(&vq->access_lock)) {\n+\t\tVHOST_LOG_CONFIG(ERR, \"Failed to check in-flight packets. \"\n+\t\t\t\"virt queue busy.\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tret = vq->async_pkts_inflight_n;\n+\trte_spinlock_unlock(&vq->access_lock);\n+\n+\treturn ret;\n+\n+}\n+\n RTE_LOG_REGISTER_SUFFIX(vhost_config_log_level, config, INFO);\n RTE_LOG_REGISTER_SUFFIX(vhost_data_log_level, data, WARNING);\n",
    "prefixes": []
}