Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/111679/?format=api
http://patches.dpdk.org/api/patches/111679/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1653360497-18080-8-git-send-email-andy.pei@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": "<1653360497-18080-8-git-send-email-andy.pei@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1653360497-18080-8-git-send-email-andy.pei@intel.com", "date": "2022-05-24T02:48:11", "name": "[v10,07/13] vhost: add API to get vDPA device type", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "612f4ce8199665cb9f9a0c57a651740eb81f0eb0", "submitter": { "id": 1185, "url": "http://patches.dpdk.org/api/people/1185/?format=api", "name": "Pei, Andy", "email": "andy.pei@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/1653360497-18080-8-git-send-email-andy.pei@intel.com/mbox/", "series": [ { "id": 23108, "url": "http://patches.dpdk.org/api/series/23108/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23108", "date": "2022-05-24T02:48:04", "name": "add virtio_blk device support to vdpa/ifc", "version": 10, "mbox": "http://patches.dpdk.org/series/23108/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/111679/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/111679/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 5C96BA0501;\n\tTue, 24 May 2022 05:36:13 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0EAA142B72;\n\tTue, 24 May 2022 05:35:44 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 5F0944280C\n for <dev@dpdk.org>; Tue, 24 May 2022 05:35:42 +0200 (CEST)", "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 May 2022 20:35:41 -0700", "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga005.jf.intel.com with ESMTP; 23 May 2022 20:35:40 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1653363342; x=1684899342;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=sgVma+HXcoxJrqlI6pz21FaQ3Wu2hXCwKZt7tOxrHDk=;\n b=DdBTS+CGSvWRVGfK1/vsdWWsPB//3j+WZb4/qm2mmczQAStuO5xvKvTH\n BJZlkuyFkSTbBrmxsUJlClbuxZlVDhlSd+Nskx+DeS/3kS2BpWfZWdbC0\n K5cq+HT+nkfwgeSk1d9RuBziM17DS0MIL0yWYHpIRwP4xSbddkDSls6Sv\n to+iKUqU1o4DjZLY4rja4iZ1+Eg2AwUCvrW6dTn+cGZ8qXxLclTtgtt+P\n mdQJaFwpdmKS6Z6RQLyxsThSv6QP6dRrUzWuysPmsBU1dlsoMP0f1iqgH\n 0loZjvWTGRn1qPFmG5GDJQF0tIPmwYM+Ae3efCGKFhS8fmCnT15KEl/nI g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10356\"; a=\"273533627\"", "E=Sophos;i=\"5.91,247,1647327600\"; d=\"scan'208\";a=\"273533627\"", "E=Sophos;i=\"5.91,247,1647327600\"; d=\"scan'208\";a=\"745046987\"" ], "X-ExtLoop1": "1", "From": "Andy Pei <andy.pei@intel.com>", "To": "dev@dpdk.org", "Cc": "chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com,\n changpeng.liu@intel.com, rosen.xu@intel.com, qimaix.xiao@intel.com", "Subject": "[PATCH v10 07/13] vhost: add API to get vDPA device type", "Date": "Tue, 24 May 2022 10:48:11 +0800", "Message-Id": "<1653360497-18080-8-git-send-email-andy.pei@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1653360497-18080-1-git-send-email-andy.pei@intel.com>", "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1653360497-18080-1-git-send-email-andy.pei@intel.com>", "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" }, "content": "Vhost backend of different devices have different features.\nAdd an API to get vDPA device type, net device or blk device\ncurrently, so users can set different features for different\nkinds of devices.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n doc/guides/prog_guide/vhost_lib.rst | 5 ++++\n doc/guides/rel_notes/release_22_07.rst | 4 ++++\n lib/vhost/rte_vhost.h | 17 +++++++++++++\n lib/vhost/socket.c | 44 ++++++++++++++++++++++++++++++++++\n lib/vhost/vdpa_driver.h | 3 +++\n lib/vhost/version.map | 1 +\n 6 files changed, 74 insertions(+)", "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex f287b76..0337b38 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -282,6 +282,11 @@ The following is an overview of some key Vhost API functions:\n Clear inflight packets which are submitted to DMA engine in vhost async data\n path. Completed packets are returned to applications through ``pkts``.\n \n+* ``rte_vhost_driver_get_vdpa_dev_type(path, type)``\n+\n+ Get device type of vDPA device, such as VDPA_DEVICE_TYPE_NET,\n+ VDPA_DEVICE_TYPE_BLK.\n+\n Vhost-user Implementations\n --------------------------\n \ndiff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst\nindex e49cace..63875b7 100644\n--- a/doc/guides/rel_notes/release_22_07.rst\n+++ b/doc/guides/rel_notes/release_22_07.rst\n@@ -60,6 +60,10 @@ New Features\n Added an API which can get the number of in-flight packets in\n vhost async data path without using lock.\n \n+* **Added vhost API to get the device type of a vDPA device.**\n+\n+ Added an API which can get the device type of vDPA device.\n+\n * **Updated Intel iavf driver.**\n \n * Added Tx QoS queue rate limitation support.\ndiff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h\nindex c733f85..2f130ec 100644\n--- a/lib/vhost/rte_vhost.h\n+++ b/lib/vhost/rte_vhost.h\n@@ -117,6 +117,9 @@\n \n #define RTE_MAX_VHOST_DEVICE\t1024\n \n+#define RTE_VHOST_VDPA_DEVICE_TYPE_NET 0\n+#define RTE_VHOST_VDPA_DEVICE_TYPE_BLK 1\n+\n struct rte_vdpa_device;\n \n /**\n@@ -486,6 +489,20 @@ struct rte_vdpa_device *\n rte_vhost_driver_get_vdpa_device(const char *path);\n \n /**\n+ * Get the device type of the vdpa device.\n+ *\n+ * @param path\n+ * The vhost-user socket file path\n+ * @param type\n+ * the device type of the vdpa device\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+__rte_experimental\n+int\n+rte_vhost_driver_get_vdpa_dev_type(const char *path, uint32_t *type);\n+\n+/**\n * Set the feature bits the vhost-user driver supports.\n *\n * @param path\ndiff --git a/lib/vhost/socket.c b/lib/vhost/socket.c\nindex b304339..baef4d2 100644\n--- a/lib/vhost/socket.c\n+++ b/lib/vhost/socket.c\n@@ -619,6 +619,50 @@ struct rte_vdpa_device *\n }\n \n int\n+rte_vhost_driver_get_vdpa_dev_type(const char *path, uint32_t *type)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\tstruct rte_vdpa_device *vdpa_dev;\n+\tuint32_t vdpa_type = 0;\n+\tint ret = 0;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (!vsocket) {\n+\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t \"(%s) socket file is not registered yet.\\n\",\n+\t\t\t\t path);\n+\t\tret = -1;\n+\t\tgoto unlock_exit;\n+\t}\n+\n+\tvdpa_dev = vsocket->vdpa_dev;\n+\tif (!vdpa_dev) {\n+\t\tret = -1;\n+\t\tgoto unlock_exit;\n+\t}\n+\n+\tif (vdpa_dev->ops->get_dev_type) {\n+\t\tret = vdpa_dev->ops->get_dev_type(vdpa_dev, &vdpa_type);\n+\t\tif (ret) {\n+\t\t\tVHOST_LOG_CONFIG(ERR,\n+\t\t\t\t\t \"(%s) failed to get vdpa dev type for socket file.\\n\",\n+\t\t\t\t\t path);\n+\t\t\tret = -1;\n+\t\t\tgoto unlock_exit;\n+\t\t}\n+\t} else {\n+\t\tvdpa_type = RTE_VHOST_VDPA_DEVICE_TYPE_NET;\n+\t}\n+\n+\t*type = vdpa_type;\n+\n+unlock_exit:\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\treturn ret;\n+}\n+\n+int\n rte_vhost_driver_disable_features(const char *path, uint64_t features)\n {\n \tstruct vhost_user_socket *vsocket;\ndiff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h\nindex c4233a6..8b88a53 100644\n--- a/lib/vhost/vdpa_driver.h\n+++ b/lib/vhost/vdpa_driver.h\n@@ -78,6 +78,9 @@ struct rte_vdpa_dev_ops {\n \t/** Set the device configuration space */\n \tint (*set_config)(int vid, uint8_t *config, uint32_t offset,\n \t\t uint32_t size, uint32_t flags);\n+\n+\t/** get device type: net device, blk device... */\n+\tint (*get_dev_type)(struct rte_vdpa_device *dev, uint32_t *type);\n };\n \n /**\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex 5841315..583b4f3 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -90,6 +90,7 @@ EXPERIMENTAL {\n \n \t# added in 22.07\n \trte_vhost_async_get_inflight_thread_unsafe;\n+\trte_vhost_driver_get_vdpa_dev_type;\n \n };\n \n", "prefixes": [ "v10", "07/13" ] }{ "id": 111679, "url": "