Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96053/?format=api
http://patchwork.dpdk.org/api/patches/96053/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1626706847-276163-3-git-send-email-jiayu.hu@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<1626706847-276163-3-git-send-email-jiayu.hu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1626706847-276163-3-git-send-email-jiayu.hu@intel.com", "date": "2021-07-19T15:00:46", "name": "[v6,2/3] vhost: rework async configuration structure", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "96e5e449f8f4880a98906bd99b5a33787cd93439", "submitter": { "id": 539, "url": "http://patchwork.dpdk.org/api/people/539/?format=api", "name": "Hu, Jiayu", "email": "jiayu.hu@intel.com" }, "delegate": { "id": 2642, "url": "http://patchwork.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1626706847-276163-3-git-send-email-jiayu.hu@intel.com/mbox/", "series": [ { "id": 17891, "url": "http://patchwork.dpdk.org/api/series/17891/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17891", "date": "2021-07-19T15:00:44", "name": "provide thread unsafe async registration functions", "version": 6, "mbox": "http://patchwork.dpdk.org/series/17891/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/96053/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/96053/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 4F375A034F;\n\tMon, 19 Jul 2021 10:33:49 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9F673411A0;\n\tMon, 19 Jul 2021 10:33:39 +0200 (CEST)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id 3113341152\n for <dev@dpdk.org>; Mon, 19 Jul 2021 10:33:37 +0200 (CEST)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Jul 2021 01:33:36 -0700", "from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25])\n by fmsmga008.fm.intel.com with ESMTP; 19 Jul 2021 01:33:35 -0700" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10049\"; a=\"296577203\"", "E=Sophos;i=\"5.84,251,1620716400\"; d=\"scan'208\";a=\"296577203\"", "E=Sophos;i=\"5.84,251,1620716400\"; d=\"scan'208\";a=\"468347524\"" ], "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": "Mon, 19 Jul 2021 11:00:46 -0400", "Message-Id": "<1626706847-276163-3-git-send-email-jiayu.hu@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1626706847-276163-1-git-send-email-jiayu.hu@intel.com>", "References": "<1626465089-17052-2-git-send-email-jiayu.hu@intel.com>\n <1626706847-276163-1-git-send-email-jiayu.hu@intel.com>", "Subject": "[dpdk-dev] [PATCH v6 2/3] vhost: rework async configuration\n structure", "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 reworks the async configuration structure to improve code\nreadability. In addition, add preserved padding fields on the structure\nfor future usage.\n\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n doc/guides/prog_guide/vhost_lib.rst | 21 ++++++++++--------\n examples/vhost/main.c | 8 +++----\n lib/vhost/rte_vhost_async.h | 44 ++++++++++++++++++-------------------\n lib/vhost/vhost.c | 19 +++++++---------\n lib/vhost/vhost.h | 3 +--\n 5 files changed, 46 insertions(+), 49 deletions(-)", "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex d18fb98..2a61b85 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -218,26 +218,29 @@ The following is an overview of some key Vhost API functions:\n \n Enable or disable zero copy feature of the vhost crypto backend.\n \n-* ``rte_vhost_async_channel_register(vid, queue_id, features, ops)``\n+* ``rte_vhost_async_channel_register(vid, queue_id, config, ops)``\n \n- Register a vhost queue with async copy device channel after vring\n- is enabled. Following device ``features`` must be specified together\n+ Register an async copy device channel for a vhost queue after vring\n+ is enabled. Following device ``config`` must be specified together\n with the registration:\n \n- * ``async_inorder``\n+ * ``features``\n \n- Async copy device can guarantee the ordering of copy completion\n- sequence. Copies are completed in the same order with that at\n- the submission time.\n+ This field is used to specify async copy device features.\n \n- Currently, only ``async_inorder`` capable device is supported by vhost.\n+ ``RTE_VHOST_ASYNC_INORDER`` represents the async copy device can\n+ guarantee the order of copy completion is the same as the order\n+ of copy submission.\n+\n+ Currently, only ``RTE_VHOST_ASYNC_INORDER`` capable device is\n+ supported by vhost.\n \n * ``async_threshold``\n \n The copy length (in bytes) below which CPU copy will be used even if\n applications call async vhost APIs to enqueue/dequeue data.\n \n- Typical value is 512~1024 depending on the async device capability.\n+ Typical value is 256~1024 depending on the async device capability.\n \n Applications must provide following ``ops`` callbacks for vhost lib to\n work with the async copy devices:\ndiff --git a/examples/vhost/main.c b/examples/vhost/main.c\nindex d2179ea..9cd855a 100644\n--- a/examples/vhost/main.c\n+++ b/examples/vhost/main.c\n@@ -1468,7 +1468,7 @@ new_device(int vid)\n \t\tvid, vdev->coreid);\n \n \tif (async_vhost_driver) {\n-\t\tstruct rte_vhost_async_features f;\n+\t\tstruct rte_vhost_async_config config = {0};\n \t\tstruct rte_vhost_async_channel_ops channel_ops;\n \n \t\tif (dma_type != NULL && strncmp(dma_type, \"ioat\", 4) == 0) {\n@@ -1476,11 +1476,11 @@ new_device(int vid)\n \t\t\tchannel_ops.check_completed_copies =\n \t\t\t\tioat_check_completed_copies_cb;\n \n-\t\t\tf.async_inorder = 1;\n-\t\t\tf.async_threshold = 256;\n+\t\t\tconfig.features = RTE_VHOST_ASYNC_INORDER;\n+\t\t\tconfig.async_threshold = 256;\n \n \t\t\treturn rte_vhost_async_channel_register(vid, VIRTIO_RXQ,\n-\t\t\t\tf.intval, &channel_ops);\n+\t\t\t\tconfig, &channel_ops);\n \t\t}\n \t}\n \ndiff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h\nindex 6faa31f..ef8c1a2 100644\n--- a/lib/vhost/rte_vhost_async.h\n+++ b/lib/vhost/rte_vhost_async.h\n@@ -93,49 +93,47 @@ struct async_inflight_info {\n };\n \n /**\n- * dma channel feature bit definition\n+ * async channel features\n */\n-struct rte_vhost_async_features {\n-\tunion {\n-\t\tuint32_t intval;\n-\t\tstruct {\n-\t\t\tuint32_t async_inorder:1;\n-\t\t\tuint32_t resvd_0:15;\n-\t\t\tuint32_t async_threshold:12;\n-\t\t\tuint32_t resvd_1:4;\n-\t\t};\n-\t};\n+enum {\n+\tRTE_VHOST_ASYNC_INORDER = 1U << 0,\n };\n \n /**\n- * register an async channel for vhost\n+ * async channel configuration\n+ */\n+struct rte_vhost_async_config {\n+\tuint32_t async_threshold;\n+\tuint32_t features;\n+\tuint32_t rsvd[2];\n+};\n+\n+/**\n+ * Register an async channel for a vhost queue\n *\n * @param vid\n * vhost device id async channel to be attached to\n * @param queue_id\n * vhost queue id async channel to be attached to\n- * @param features\n- * DMA channel feature bit\n- * b0 : DMA supports inorder data transfer\n- * b1 - b15: reserved\n- * b16 - b27: Packet length threshold for DMA transfer\n- * b28 - b31: reserved\n+ * @param config\n+ * Async channel configuration structure\n * @param ops\n- * DMA operation callbacks\n+ * Async channel operation callbacks\n * @return\n * 0 on success, -1 on failures\n */\n __rte_experimental\n int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n-\tuint32_t features, struct rte_vhost_async_channel_ops *ops);\n+\tstruct rte_vhost_async_config config,\n+\tstruct rte_vhost_async_channel_ops *ops);\n \n /**\n- * unregister a dma channel for vhost\n+ * Unregister an async channel for a vhost queue\n *\n * @param vid\n- * vhost device id DMA channel to be detached\n+ * vhost device id async channel to be detached from\n * @param queue_id\n- * vhost queue id DMA channel to be detached\n+ * vhost queue id async channel to be detached from\n * @return\n * 0 on success, -1 on failures\n */\ndiff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex 53a470f..908758e 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1619,19 +1619,17 @@ int rte_vhost_extern_callback_register(int vid,\n \treturn 0;\n }\n \n-int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n-\t\t\t\t\tuint32_t features,\n-\t\t\t\t\tstruct rte_vhost_async_channel_ops *ops)\n+int\n+rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n+\t\tstruct rte_vhost_async_config config,\n+\t\tstruct rte_vhost_async_channel_ops *ops)\n {\n \tstruct vhost_virtqueue *vq;\n \tstruct virtio_net *dev = get_device(vid);\n-\tstruct rte_vhost_async_features f;\n \n \tif (dev == NULL || ops == NULL)\n \t\treturn -1;\n \n-\tf.intval = features;\n-\n \tif (queue_id >= VHOST_MAX_VRING)\n \t\treturn -1;\n \n@@ -1640,7 +1638,7 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \tif (unlikely(vq == NULL || !dev->async_copy))\n \t\treturn -1;\n \n-\tif (unlikely(!f.async_inorder)) {\n+\tif (unlikely(!(config.features & RTE_VHOST_ASYNC_INORDER))) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"async copy is not supported on non-inorder mode \"\n \t\t\t\"(vid %d, qid: %d)\\n\", vid, queue_id);\n@@ -1719,9 +1717,7 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \n \tvq->async_ops.check_completed_copies = ops->check_completed_copies;\n \tvq->async_ops.transfer_data = ops->transfer_data;\n-\n-\tvq->async_inorder = f.async_inorder;\n-\tvq->async_threshold = f.async_threshold;\n+\tvq->async_threshold = config.async_threshold;\n \n \tvq->async_registered = true;\n \n@@ -1731,7 +1727,8 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \treturn 0;\n }\n \n-int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)\n+int\n+rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)\n {\n \tstruct vhost_virtqueue *vq;\n \tstruct virtio_net *dev = get_device(vid);\ndiff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h\nindex 8ffe387..d98ca8a 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -218,9 +218,8 @@ struct vhost_virtqueue {\n \t};\n \n \t/* vq async features */\n-\tbool\t\tasync_inorder;\n \tbool\t\tasync_registered;\n-\tuint16_t\tasync_threshold;\n+\tuint32_t\tasync_threshold;\n \n \tint\t\t\tnotif_enable;\n #define VIRTIO_UNINITIALIZED_NOTIF\t(-1)\n", "prefixes": [ "v6", "2/3" ] }{ "id": 96053, "url": "