Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/75551/?format=api
http://patches.dpdk.org/api/patches/75551/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200814191606.26312-3-chenbo.xia@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": "<20200814191606.26312-3-chenbo.xia@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200814191606.26312-3-chenbo.xia@intel.com", "date": "2020-08-14T19:16:06", "name": "[RFC,v1,2/2] emudev: Add library for emulated device", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "a4f32fb39a40fcdbd3ca5e40f00299594614b7d9", "submitter": { "id": 1276, "url": "http://patches.dpdk.org/api/people/1276/?format=api", "name": "Chenbo Xia", "email": "chenbo.xia@intel.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200814191606.26312-3-chenbo.xia@intel.com/mbox/", "series": [ { "id": 11653, "url": "http://patches.dpdk.org/api/series/11653/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11653", "date": "2020-08-14T19:16:04", "name": "Add device emulation support in DPDK", "version": 1, "mbox": "http://patches.dpdk.org/series/11653/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/75551/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/75551/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E670CA04B0;\n\tFri, 14 Aug 2020 12:27:10 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BF90C1C10E;\n\tFri, 14 Aug 2020 12:27:03 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by dpdk.org (Postfix) with ESMTP id 03AA41C0DC\n for <dev@dpdk.org>; Fri, 14 Aug 2020 12:27:01 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Aug 2020 03:27:01 -0700", "from npg-dpdk-virtio-xiachenbo-nw.sh.intel.com ([10.67.119.123])\n by orsmga006.jf.intel.com with ESMTP; 14 Aug 2020 03:26:59 -0700" ], "IronPort-SDR": [ "\n wJcpB1/FhTI1dhxoh3lcUS7MHoKE6KiBixxB+KDpnBun0mx1kVSdBftz+4KDwdAZ09xUnx/0tN\n 1WWX/mQk3vRQ==", "\n 13312pMLVMfArqpfMYLhGiBLxvrPNKiraV9AI+myI/pjt7T+UsCbbM9tNC775ggIJtcneQbSvB\n X6bvR6Aui5tg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9712\"; a=\"153616454\"", "E=Sophos;i=\"5.76,312,1592895600\"; d=\"scan'208\";a=\"153616454\"", "E=Sophos;i=\"5.76,312,1592895600\"; d=\"scan'208\";a=\"295717612\"" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Chenbo Xia <chenbo.xia@intel.com>", "To": "dev@dpdk.org, thomas@monjalon.net, xuan.ding@intel.com,\n xiuchun.lu@intel.com, cunming.liang@intel.com, changpeng.liu@intel.com", "Cc": "zhihong.wang@intel.com", "Date": "Fri, 14 Aug 2020 19:16:06 +0000", "Message-Id": "<20200814191606.26312-3-chenbo.xia@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200814191606.26312-1-chenbo.xia@intel.com>", "References": "<20200814191606.26312-1-chenbo.xia@intel.com>", "Subject": "[dpdk-dev] [RFC v1 2/2] emudev: Add library for emulated device", "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 <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": "To enable DPDK to be an alternative I/O device emulation library\nof building virtualized devices in separate processes outside QEMU,\na new device class named emudev is introduced in this patch. Emudev\nis a device type for emulated devices. Providers, which are specific\nemudev drivers, could choose the transport to QEMU. An option of\ntranport could be vfio-over-socket (also called vfio-user), which is\ndefined by a standard protocol in QEMU.\n\nSigned-off-by: Chenbo Xia <chenbo.xia@intel.com>\nSigned-off-by: Xiuchun Lu <xiuchun.lu@intel.com>\n---\n lib/librte_emudev/rte_emudev.h | 315 +++++++++++++++++++++++++++++++++\n 1 file changed, 315 insertions(+)\n create mode 100644 lib/librte_emudev/rte_emudev.h", "diff": "diff --git a/lib/librte_emudev/rte_emudev.h b/lib/librte_emudev/rte_emudev.h\nnew file mode 100644\nindex 000000000..2ffc4dbe0\n--- /dev/null\n+++ b/lib/librte_emudev/rte_emudev.h\n@@ -0,0 +1,315 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+\n+#ifndef _RTE_EMUDEV_H_\n+#define _RTE_EMUDEV_H_\n+\n+#include <rte_config.h>\n+#include <rte_malloc.h>\n+#include <rte_ring.h>\n+\n+typedef void *rte_emudev_conf_t;\n+typedef void *rte_emudev_attr_t;\n+typedef void *rte_emudev_mem_table_t;\n+typedef char *emu_dev_type_t;\n+\n+struct rte_emu_dev;\n+\n+struct emu_dev_info {\n+\temu_dev_type_t dev_type;\n+\tuint32_t max_qp_num;\n+\tuint32_t max_event_num;\n+};\n+\n+struct emu_dev_q_info {\n+\tuint64_t base;\n+\tuint64_t size;\n+\tuint32_t doorbell_id;\n+\tuint32_t irq_vector;\n+\tvoid *priv;\n+};\n+\n+struct emu_dev_irq_info {\n+\tuint32_t vector;\n+\tint fd;\n+\tvoid *priv;\n+};\n+\n+struct emu_dev_db_info {\n+\tuint32_t id;\n+\tuint32_t flag;\n+#define EMU_DEV_DB_FD\t(0x1 << 0)\n+#define EMU_DEV_DB_MEM\t(0x1 << 1)\n+\tunion {\n+\t\tint fd;\n+\t\tstruct {\n+\t\t\tuint64_t base;\n+\t\t\tuint64_t size;\n+\t\t} mem;\n+\t} data;\n+\tvoid *priv;\n+};\n+\n+/**\n+ * Back-end driver and emualated device provider should have\n+ * the same definiton of events and events message.\n+ */\n+struct emu_dev_event_channel {\n+\tint fd;\n+\tstruct rte_ring *queue;\n+};\n+\n+struct emu_dev_attr_info {\n+\tconst char *attr_name;\n+\trte_emudev_attr_t attr;\n+};\n+\n+struct emu_dev_ops {\n+\tint (*dev_start)(struct rte_emu_dev *dev);\n+\tvoid (*dev_stop)(struct rte_emu_dev *dev);\n+\tint (*dev_configure)(struct rte_emu_dev *dev,\n+\t\trte_emudev_conf_t dev_conf);\n+\tint (*dev_close)(struct rte_emu_dev *dev);\n+\tstruct emu_dev_info *(*get_dev_info)(struct rte_emu_dev *dev);\n+\tint (*subscribe_event)(struct rte_emu_dev *dev,\n+\t\tconst struct emu_dev_event_channel *ev_chnl);\n+\tint (*unsubscribe_event)(struct rte_emu_dev *dev,\n+\t\tconst struct emu_dev_event_channel *ev_chnl);\n+\trte_emudev_mem_table_t (*get_mem_table)(struct rte_emu_dev *dev);\n+\tstruct emu_dev_q_info *(*get_queue_info)(struct rte_emu_dev *dev,\n+\t\tuint32_t queue);\n+\tstruct emu_dev_irq_info *(*get_irq_info)(struct rte_emu_dev *dev,\n+\t\tuint32_t vector);\n+\tstruct emu_dev_db_info *(*get_db_info)(struct rte_emu_dev *dev,\n+\t\tuint32_t doorbell);\n+\trte_emudev_attr_t (*get_attr)(struct rte_emu_dev *dev,\n+\t\tconst char *attr_name);\n+\tint (*set_attr)(struct rte_emu_dev *dev, const char *attr_name,\n+\t\trte_emudev_attr_t attr);\n+\tint (*region_map)(struct rte_emu_dev *dev, const char *region_name,\n+\t\tuint16_t region_size, uint64_t *base_addr);\n+};\n+\n+struct rte_emu_dev {\n+\tstruct rte_device *device;\n+\tconst struct emu_dev_ops *dev_ops;\n+\tconst struct emu_dev_event_channel *ev_chnl;\n+\tstruct emu_dev_info *dev_info;\n+\tuint16_t num_attr;\n+\tstruct emu_dev_attr_info **attr;\n+\tvoid *priv_data;\n+} __rte_cache_aligned;\n+\n+/**\n+ * Note that 'rte_emu_dev_allocate','rte_emu_dev_release' and\n+ * 'rte_emu_dev_allocated' should be called by emulated device\n+ * provider.\n+ * /\n+\n+/**\n+ * Allocate a new emudev for an emulation device and retures the pointer\n+ * to the emudev.\n+ *\n+ * @param name\n+ * Name of the emudev\n+ * @return\n+ * Pointer to rte_emu_dev on success, NULL on failure\n+ */\n+struct rte_emu_dev *\n+rte_emu_dev_allocate(const char *name);\n+\n+/**\n+ * Release the emudev.\n+ *\n+ * @param dev\n+ * The emulated device\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int\n+rte_emu_dev_release(struct rte_emu_dev *dev);\n+\n+/**\n+ * Find an emudev using name.\n+ *\n+ * @param name\n+ * Name of the emudev\n+ * @return\n+ * Pointer to rte_emu_dev on success, NULL on failure\n+ */\n+struct rte_emu_dev *\n+rte_emu_dev_allocated(const char *name);\n+\n+/**\n+ * Start an emulation device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_dev_start(uint16_t dev_id);\n+\n+/**\n+ * Stop an emulation device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ */\n+void rte_emu_dev_stop(uint16_t dev_id);\n+\n+/**\n+ * Configure an emulation device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param dev_conf\n+ * Device configure info\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_dev_configure(uint16_t dev_id, rte_emudev_conf_t dev_conf);\n+\n+/**\n+ * Close an emulation device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ */\n+void rte_emu_dev_close(uint16_t dev_id);\n+\n+/* Note that below APIs should only be called by back-end driver */\n+\n+/**\n+ * Back-end driver subscribes events of the emulated device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param ev_chnl\n+ * Event channel that events should be passed to\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_subscribe_event(uint16_t dev_id,\n+\t\tconst struct emu_dev_event_channel *ev_chnl);\n+\n+/**\n+ * Back-end driver unsubscribes events of the emulated device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param set\n+ * Event channel that events should be passed to\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_unsubscribe_event(uint16_t dev_id,\n+\t\tconst struct emu_dev_event_channel *ev_chnl);\n+\n+/**\n+ * Back-end driver gets the device info of the emulated device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @return\n+ * Pointer to dev info on success, NULL on failure\n+ */\n+struct emu_dev_info *rte_emu_get_dev_info(uint16_t dev_id);\n+\n+/**\n+ * Get the memory table content and operations of the emulated device.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @return\n+ * Pointer to memory table on success, NULL on failure\n+ */\n+rte_emudev_mem_table_t rte_emu_get_mem_table(uint16_t dev_id);\n+\n+/**\n+ * Get queue info of the emudev.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param queue\n+ * Queue ID of emudev\n+ * @return\n+ * Pointer to queue info on success, NULL on failure\n+ */\n+struct emu_dev_q_info *rte_emu_get_queue_info(uint16_t dev_id,\n+\t\tuint32_t queue);\n+\n+/**\n+ * Get irq info of the emudev.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param vector\n+ * Interrupt vector\n+ * @return\n+ * Pointer to irq info on success, NULL on failure\n+ */\n+struct emu_dev_irq_info *rte_emu_get_irq_info(uint16_t dev_id,\n+\t\tuint32_t vector);\n+\n+/**\n+ * Get doorbell info of the emudev.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param doorbell\n+ * Doorbell ID\n+ * @return\n+ * Pointer to doorbell info on success, NULL on failure\n+ */\n+struct emu_dev_db_info *rte_emu_get_db_info(uint16_t dev_id,\n+\t\tuint32_t doorbell);\n+\n+/**\n+ * Set attribute of the emudev.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param attr_name\n+ * Opaque object representing an attribute in implementation.\n+ * @param attr\n+ * Pointer to attribute\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_set_attr(uint16_t dev_id, const char *attr_name,\n+\trte_emudev_attr_t attr);\n+\n+/**\n+ * Get attribute of the emudev.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param attr_name\n+ * Opaque object representing an attribute in implementation.\n+ * @return\n+ * Corresponding attr on success, NULL on failure\n+ */\n+rte_emudev_attr_t rte_emu_get_attr(uint16_t dev_id, const char *attr_name);\n+\n+/**\n+ * Back-end driver maps a region to the emulated device.\n+ * Region name identifies the meaning of the region and the emulated\n+ * device and the back-end driver should have the same definition of\n+ * region name and its meaning.\n+ *\n+ * @param dev_id\n+ * Device ID of emudev\n+ * @param region_name\n+ * .\n+ * @param attr\n+ * Pointer to attribute\n+ * @return\n+ * 0 on success, -1 on failure\n+ */\n+int rte_emu_region_map(uint16_t dev_id, const char *region_name,\n+\tuint16_t region_size, uint64_t *base_addr);\n+\n+extern struct rte_emu_dev rte_emu_devices[];\n+#endif /* _RTE_EMUDEV_H_ */\n", "prefixes": [ "RFC", "v1", "2/2" ] }{ "id": 75551, "url": "