Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/50482/?format=api
http://patchwork.dpdk.org/api/patches/50482/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1551081095-14286-1-git-send-email-changpeng.liu@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": "<1551081095-14286-1-git-send-email-changpeng.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1551081095-14286-1-git-send-email-changpeng.liu@intel.com", "date": "2019-02-25T07:51:35", "name": "vhost: add virtio configuration space access socket messages", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "af342b31da56026700af515c378768999df84eb3", "submitter": { "id": 565, "url": "http://patchwork.dpdk.org/api/people/565/?format=api", "name": "Liu, Changpeng", "email": "changpeng.liu@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/1551081095-14286-1-git-send-email-changpeng.liu@intel.com/mbox/", "series": [ { "id": 3532, "url": "http://patchwork.dpdk.org/api/series/3532/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=3532", "date": "2019-02-25T07:51:35", "name": "vhost: add virtio configuration space access socket messages", "version": 1, "mbox": "http://patchwork.dpdk.org/series/3532/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/50482/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/50482/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5103A2A6A;\n\tMon, 25 Feb 2019 08:33:00 +0100 (CET)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id B00D229C6\n\tfor <dev@dpdk.org>; Mon, 25 Feb 2019 08:32:58 +0100 (CET)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Feb 2019 23:32:57 -0800", "from fedora.sh.intel.com ([10.67.114.176])\n\tby orsmga002.jf.intel.com with ESMTP; 24 Feb 2019 23:32:55 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.58,410,1544515200\"; d=\"scan'208\";a=\"136933967\"", "From": "Changpeng Liu <changpeng.liu@intel.com>", "To": "dev@dpdk.org", "Cc": "changpeng.liu@intel.com, dariusz.stojaczyk@intel.com,\n\tmaxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com", "Date": "Mon, 25 Feb 2019 15:51:35 +0800", "Message-Id": "<1551081095-14286-1-git-send-email-changpeng.liu@intel.com>", "X-Mailer": "git-send-email 1.9.3", "Subject": "[dpdk-dev] [PATCH] vhost: add virtio configuration space access\n\tsocket messages", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch adds new vhost user messages GET_CONFIG and SET_CONFIG\nused to get/set virtio device's PCI configuration space.\n\nSigned-off-by: Changpeng Liu <changpeng.liu@intel.com>\n---\n lib/librte_vhost/rte_vhost.h | 8 ++++++++\n lib/librte_vhost/vhost_user.c | 44 +++++++++++++++++++++++++++++++++++++++++++\n lib/librte_vhost/vhost_user.h | 16 ++++++++++++++++\n 3 files changed, 68 insertions(+)", "diff": "diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h\nindex 2753670..ab710ce 100644\n--- a/lib/librte_vhost/rte_vhost.h\n+++ b/lib/librte_vhost/rte_vhost.h\n@@ -63,6 +63,10 @@\n #define VHOST_USER_PROTOCOL_F_PAGEFAULT 8\n #endif\n \n+#ifndef VHOST_USER_PROTOCOL_F_CONFIG\n+#define VHOST_USER_PROTOCOL_F_CONFIG 9\n+#endif\n+\n #ifndef VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD\n #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD 10\n #endif\n@@ -173,6 +177,10 @@ struct vhost_device_ops {\n \n \tint (*vring_state_changed)(int vid, uint16_t queue_id, int enable);\t/**< triggered when a vring is enabled or disabled */\n \n+\tint (*get_config)(int vid, uint8_t *config, uint32_t config_len);\n+\tint (*set_config)(int vid, uint8_t *config, uint32_t offset,\n+\t\t\t uint32_t len, uint32_t flags);\n+\n \t/**\n \t * Features could be changed after the feature negotiation.\n \t * For example, VHOST_F_LOG_ALL will be set/cleared at the\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex b086ad9..8e42734 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -73,6 +73,8 @@\n \t[VHOST_USER_NET_SET_MTU] = \"VHOST_USER_NET_SET_MTU\",\n \t[VHOST_USER_SET_SLAVE_REQ_FD] = \"VHOST_USER_SET_SLAVE_REQ_FD\",\n \t[VHOST_USER_IOTLB_MSG] = \"VHOST_USER_IOTLB_MSG\",\n+\t[VHOST_USER_GET_CONFIG] = \"VHOST_USER_GET_CONFIG\",\n+\t[VHOST_USER_SET_CONFIG] = \"VHOST_USER_SET_CONFIG\",\n \t[VHOST_USER_CRYPTO_CREATE_SESS] = \"VHOST_USER_CRYPTO_CREATE_SESS\",\n \t[VHOST_USER_CRYPTO_CLOSE_SESS] = \"VHOST_USER_CRYPTO_CLOSE_SESS\",\n \t[VHOST_USER_POSTCOPY_ADVISE] = \"VHOST_USER_POSTCOPY_ADVISE\",\n@@ -359,6 +361,46 @@\n \treturn RTE_VHOST_MSG_RESULT_OK;\n }\n \n+static int\n+vhost_user_get_config(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+\t\t int main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\n+\tif (!dev->notify_ops->get_config) {\n+\t\tmsg->size = sizeof(uint64_t);\n+\t\treturn RTE_VHOST_MSG_RESULT_REPLY;\n+\t}\n+\n+\tif (dev->notify_ops->get_config(dev->vid,\n+\t\t\t\t\tmsg->payload.config.region,\n+\t\t\t\t\tmsg->payload.config.size) != 0) {\n+\t\tmsg->size = sizeof(uint64_t);\n+\t}\n+\n+\treturn RTE_VHOST_MSG_RESULT_REPLY;\n+}\n+\n+static int\n+vhost_user_set_config(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+\t\t int main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\n+\tif (!dev->notify_ops->set_config)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\tif (dev->notify_ops->set_config(dev->vid,\n+\t\t\t\t\tmsg->payload.config.region,\n+\t\t\t\t\tmsg->payload.config.offset,\n+\t\t\t\t\tmsg->payload.config.size,\n+\t\t\t\t\tmsg->payload.config.flags) != 0) {\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\t}\n+\n+\treturn RTE_VHOST_MSG_RESULT_OK;\n+}\n+\n /*\n * Reallocate virtio_dev and vhost_virtqueue data structure to make them on the\n * same numa node as the memory of vring descriptor.\n@@ -1725,6 +1767,8 @@ typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,\n \t[VHOST_USER_NET_SET_MTU] = vhost_user_net_set_mtu,\n \t[VHOST_USER_SET_SLAVE_REQ_FD] = vhost_user_set_req_fd,\n \t[VHOST_USER_IOTLB_MSG] = vhost_user_iotlb_msg,\n+\t[VHOST_USER_GET_CONFIG] = vhost_user_get_config,\n+\t[VHOST_USER_SET_CONFIG] = vhost_user_set_config,\n \t[VHOST_USER_POSTCOPY_ADVISE] = vhost_user_set_postcopy_advise,\n \t[VHOST_USER_POSTCOPY_LISTEN] = vhost_user_set_postcopy_listen,\n \t[VHOST_USER_POSTCOPY_END] = vhost_user_postcopy_end,\ndiff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h\nindex 2a650fe..057cdec 100644\n--- a/lib/librte_vhost/vhost_user.h\n+++ b/lib/librte_vhost/vhost_user.h\n@@ -12,6 +12,11 @@\n \n /* refer to hw/virtio/vhost-user.c */\n \n+/*\n+ * Maximum size of virtio device config space\n+ */\n+#define VHOST_USER_MAX_CONFIG_SIZE 256\n+\n #define VHOST_MEMORY_MAX_NREGIONS 8\n \n #define VHOST_USER_PROTOCOL_FEATURES\t((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \\\n@@ -49,6 +54,8 @@\n \tVHOST_USER_NET_SET_MTU = 20,\n \tVHOST_USER_SET_SLAVE_REQ_FD = 21,\n \tVHOST_USER_IOTLB_MSG = 22,\n+\tVHOST_USER_GET_CONFIG = 24,\n+\tVHOST_USER_SET_CONFIG = 25,\n \tVHOST_USER_CRYPTO_CREATE_SESS = 26,\n \tVHOST_USER_CRYPTO_CLOSE_SESS = 27,\n \tVHOST_USER_POSTCOPY_ADVISE = 28,\n@@ -60,6 +67,7 @@\n typedef enum VhostUserSlaveRequest {\n \tVHOST_USER_SLAVE_NONE = 0,\n \tVHOST_USER_SLAVE_IOTLB_MSG = 1,\n+\tVHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,\n \tVHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,\n \tVHOST_USER_SLAVE_MAX\n } VhostUserSlaveRequest;\n@@ -112,6 +120,13 @@\n \tuint64_t offset;\n } VhostUserVringArea;\n \n+typedef struct VhostUserConfig {\n+\tuint32_t offset;\n+\tuint32_t size;\n+\tuint32_t flags;\n+\tuint8_t region[VHOST_USER_MAX_CONFIG_SIZE];\n+} VhostUserConfig;\n+\n typedef struct VhostUserMsg {\n \tunion {\n \t\tuint32_t master; /* a VhostUserRequest value */\n@@ -131,6 +146,7 @@\n \t\tstruct vhost_vring_addr addr;\n \t\tVhostUserMemory memory;\n \t\tVhostUserLog log;\n+\t\tVhostUserConfig config;\n \t\tstruct vhost_iotlb_msg iotlb;\n \t\tVhostUserCryptoSessionParam crypto_session;\n \t\tVhostUserVringArea area;\n", "prefixes": [] }{ "id": 50482, "url": "