Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/98400/?format=api
https://patches.dpdk.org/api/patches/98400/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210909055758.106588-1-xuan.ding@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": "<20210909055758.106588-1-xuan.ding@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210909055758.106588-1-xuan.ding@intel.com", "date": "2021-09-09T05:57:58", "name": "vhost: add unsafe API to check inflight packets", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "14021e75e51a9ba57e3454ddcca2c1dca3f09d8d", "submitter": { "id": 1401, "url": "https://patches.dpdk.org/api/people/1401/?format=api", "name": "Ding, Xuan", "email": "xuan.ding@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/20210909055758.106588-1-xuan.ding@intel.com/mbox/", "series": [ { "id": 18778, "url": "https://patches.dpdk.org/api/series/18778/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18778", "date": "2021-09-09T05:57:58", "name": "vhost: add unsafe API to check inflight packets", "version": 1, "mbox": "https://patches.dpdk.org/series/18778/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/98400/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/98400/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 6AF4DA0547;\n\tThu, 9 Sep 2021 07:58:27 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2F3434003E;\n\tThu, 9 Sep 2021 07:58:27 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 11B444003C\n for <dev@dpdk.org>; Thu, 9 Sep 2021 07:58:24 +0200 (CEST)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Sep 2021 22:58:23 -0700", "from dpdk-xuanding-dev2.sh.intel.com ([10.67.119.115])\n by fmsmga008.fm.intel.com with ESMTP; 08 Sep 2021 22:58:21 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10101\"; a=\"200890911\"", "E=Sophos;i=\"5.85,279,1624345200\"; d=\"scan'208\";a=\"200890911\"", "E=Sophos;i=\"5.85,279,1624345200\"; d=\"scan'208\";a=\"504069648\"" ], "X-ExtLoop1": "1", "From": "Xuan Ding <xuan.ding@intel.com>", "To": "dev@dpdk.org,\n\tmaxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com", "Cc": "jiayu.hu@intel.com, cheng.jiang@intel.com, bruce.richardson@intel.com,\n sunil.pai.g@intel.com, Xuan Ding <xuan.ding@intel.com>", "Date": "Thu, 9 Sep 2021 05:57:58 +0000", "Message-Id": "<20210909055758.106588-1-xuan.ding@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH] vhost: add unsafe API to check inflight packets", "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": "In async data path, when vring state changes, it is necessary to\nknow the number of inflight packets in DMA engine. This patch\nprovides a thread unsafe API to return the number of inflight\npackets without using any lock.\n\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\n---\n doc/guides/prog_guide/vhost_lib.rst | 5 +++++\n doc/guides/rel_notes/release_21_11.rst | 5 +++++\n lib/vhost/rte_vhost_async.h | 14 ++++++++++++++\n lib/vhost/version.map | 3 +++\n lib/vhost/vhost.c | 25 +++++++++++++++++++++++++\n 5 files changed, 52 insertions(+)", "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex 8874033165..b4b1134f54 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -305,6 +305,11 @@ The following is an overview of some key Vhost API functions:\n This function returns the amount of in-flight packets for the vhost\n queue using async acceleration.\n \n+ ``rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id)``\n+\n+ Get the number of inflight packets for a vhost queue without\n+ performing any locking.\n+\n * ``rte_vhost_clear_queue_thread_unsafe(vid, queue_id, **pkts, count)``\n \n Clear inflight packets which are submitted to DMA engine in vhost async data\ndiff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst\nindex 675b573834..db080e9490 100644\n--- a/doc/guides/rel_notes/release_21_11.rst\n+++ b/doc/guides/rel_notes/release_21_11.rst\n@@ -55,6 +55,11 @@ New Features\n Also, make sure to start the actual text at the margin.\n =======================================================\n \n+* **Added vhost API to get the number of inflight packets.**\n+\n+ Added an API which can get the number of inflight packets in\n+ vhost async data path.\n+\n * **Enabled new devargs parser.**\n \n * Enabled devargs syntax\ndiff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h\nindex b25ff446f7..0af414bf78 100644\n--- a/lib/vhost/rte_vhost_async.h\n+++ b/lib/vhost/rte_vhost_async.h\n@@ -246,6 +246,20 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,\n __rte_experimental\n int rte_vhost_async_get_inflight(int vid, uint16_t queue_id);\n \n+/**\n+ * This function is lock-free version to return the amount of in-flight\n+ * packets for the vhost queue which uses 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_thread_unsafe(int vid, uint16_t queue_id);\n+\n /**\n * This function checks async completion status and clear packets for\n * a specific vhost device queue. Packets which are inflight will be\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex c92a9d4962..b150dc408d 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -85,4 +85,7 @@ EXPERIMENTAL {\n \trte_vhost_async_channel_register_thread_unsafe;\n \trte_vhost_async_channel_unregister_thread_unsafe;\n \trte_vhost_clear_queue_thread_unsafe;\n+\n+\t#added in 21.11\n+\trte_vhost_async_get_inflight_thread_unsafe;\n };\ndiff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex 355ff37651..df96f84873 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1886,5 +1886,30 @@ int rte_vhost_async_get_inflight(int vid, uint16_t queue_id)\n \treturn ret;\n }\n \n+int rte_vhost_async_get_inflight_thread_unsafe(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+\tif (!vq->async_registered)\n+\t\treturn ret;\n+\n+\tret = vq->async_pkts_inflight_n;\n+\n+\treturn ret;\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": [] }{ "id": 98400, "url": "