Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/111681/?format=api
http://patches.dpdk.org/api/patches/111681/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1653360497-18080-10-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-10-git-send-email-andy.pei@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1653360497-18080-10-git-send-email-andy.pei@intel.com", "date": "2022-05-24T02:48:13", "name": "[v10,09/13] examples/vdpa: add virtio blk support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "158e4620d40de422ea8f66610df1126181344575", "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-10-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/111681/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/111681/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 53068A04FF;\n\tTue, 24 May 2022 05:36:24 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EA20542B82;\n\tTue, 24 May 2022 05:35:47 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 7CB7342B81\n for <dev@dpdk.org>; Tue, 24 May 2022 05:35:46 +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:46 -0700", "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga005.jf.intel.com with ESMTP; 23 May 2022 20:35:44 -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=1653363346; x=1684899346;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=FPsJGiFM70SNKVEuNQqDbe5xlnMDUXTHNdqeH2Oox1A=;\n b=jeI4Pf6gQc1nMBRCwgiWtJ8TRAUZ8SRAhwUWsUuyzltW5uXO3/2GUvyH\n cppD0OW4zbn3/zVKGSqJTn73yavs3aD9zX7DV0vUDUBbmncCRcb8LZlUh\n VHRU+CCQAZlJq89O7XgHqeoIlgmfhvf43/ROJPuOLHBazsclstq5Xx+Ai\n cgT1NCiKC2d0gVW3cZ8b0uecxKPsEoJJXv0ODN7jJcswcc3Ks6BWi+agD\n AIfTvWJfWmBy2mrmcr0pePvnMabcCRtHbu6ntfwN7ZzmwWfi2mqhr/af2\n Kv1oT2ylYZ1yh0B4VmXDWOy4DpnZTNaX4RTYsb0wl5jxeaOiUttTq/lJD A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10356\"; a=\"273533635\"", "E=Sophos;i=\"5.91,247,1647327600\"; d=\"scan'208\";a=\"273533635\"", "E=Sophos;i=\"5.91,247,1647327600\"; d=\"scan'208\";a=\"745047029\"" ], "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 09/13] examples/vdpa: add virtio blk support", "Date": "Tue, 24 May 2022 10:48:13 +0800", "Message-Id": "<1653360497-18080-10-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": "Add virtio blk device support to vDPA example.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n examples/vdpa/main.c | 56 ++++++++++++++++++++++++++++++++++++++++\n examples/vdpa/vdpa_blk_compact.h | 50 +++++++++++++++++++++++++++++++++++\n 2 files changed, 106 insertions(+)\n create mode 100644 examples/vdpa/vdpa_blk_compact.h", "diff": "diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c\nindex 5ab0765..7e11ef4 100644\n--- a/examples/vdpa/main.c\n+++ b/examples/vdpa/main.c\n@@ -20,6 +20,7 @@\n #include <cmdline_parse_string.h>\n #include <cmdline_parse_num.h>\n #include <cmdline.h>\n+#include \"vdpa_blk_compact.h\"\n \n #define MAX_PATH_LEN 128\n #define MAX_VDPA_SAMPLE_PORTS 1024\n@@ -159,8 +160,53 @@ struct vdpa_port {\n };\n \n static int\n+vdpa_blk_device_set_features_and_protocol(const char *path)\n+{\n+\tuint64_t protocol_features = 0;\n+\tint ret;\n+\n+\tret = rte_vhost_driver_set_features(path, VHOST_BLK_FEATURES);\n+\tif (ret != 0) {\n+\t\tRTE_LOG(ERR, VDPA,\n+\t\t\t\"rte_vhost_driver_set_features for %s failed.\\n\",\n+\t\t\tpath);\n+\t\tgoto out;\n+\t}\n+\n+\tret = rte_vhost_driver_disable_features(path,\n+\t\tVHOST_BLK_DISABLED_FEATURES);\n+\tif (ret != 0) {\n+\t\tRTE_LOG(ERR, VDPA,\n+\t\t\t\"rte_vhost_driver_disable_features for %s failed.\\n\",\n+\t\t\tpath);\n+\t\tgoto out;\n+\t}\n+\n+\tret = rte_vhost_driver_get_protocol_features(path, &protocol_features);\n+\tif (ret != 0) {\n+\t\tRTE_LOG(ERR, VDPA,\n+\t\t\t\"rte_vhost_driver_get_protocol_features for %s failed.\\n\",\n+\t\t\tpath);\n+\t\tgoto out;\n+\t}\n+\n+\tprotocol_features |= VHOST_BLK_PROTOCOL_FEATURES;\n+\n+\tret = rte_vhost_driver_set_protocol_features(path, protocol_features);\n+\tif (ret != 0) {\n+\t\tRTE_LOG(ERR, VDPA,\n+\t\t\t\"rte_vhost_driver_set_protocol_features for %s failed.\\n\",\n+\t\t\tpath);\n+\t}\n+\n+out:\n+\treturn ret;\n+}\n+\n+static int\n start_vdpa(struct vdpa_port *vport)\n {\n+\tuint32_t device_type = 0;\n \tint ret;\n \tchar *socket_path = vport->ifname;\n \n@@ -192,6 +238,16 @@ struct vdpa_port {\n \t\t\t\"attach vdpa device failed: %s\\n\",\n \t\t\tsocket_path);\n \n+\tret = rte_vhost_driver_get_vdpa_dev_type(socket_path, &device_type);\n+\tif (ret == 0 && device_type == RTE_VHOST_VDPA_DEVICE_TYPE_BLK) {\n+\t\tRTE_LOG(NOTICE, VDPA, \"%s is a blk device\\n\", socket_path);\n+\t\tret = vdpa_blk_device_set_features_and_protocol(socket_path);\n+\t\tif (ret != 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"set vhost blk driver features and protocol features failed: %s\\n\",\n+\t\t\t\tsocket_path);\n+\t}\n+\n \tif (rte_vhost_driver_start(socket_path) < 0)\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\"start vhost driver failed: %s\\n\",\ndiff --git a/examples/vdpa/vdpa_blk_compact.h b/examples/vdpa/vdpa_blk_compact.h\nnew file mode 100644\nindex 0000000..143548e\n--- /dev/null\n+++ b/examples/vdpa/vdpa_blk_compact.h\n@@ -0,0 +1,50 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 Intel Corporation\n+ */\n+\n+#ifndef _VDPA_BLK_COMPACT_H_\n+#define _VDPA_BLK_COMPACT_H_\n+\n+#include <rte_vhost.h>\n+\n+/* Feature bits */\n+#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */\n+#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */\n+#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */\n+#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available */\n+#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */\n+#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */\n+\n+/* Legacy feature bits */\n+#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */\n+#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */\n+#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */\n+\n+#define VHOST_BLK_FEATURES_BASE ((1ULL << VHOST_F_LOG_ALL) | \\\n+\t(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \\\n+\t(1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \\\n+\t(1ULL << VIRTIO_RING_F_EVENT_IDX) | \\\n+\t(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \\\n+\t(1ULL << VIRTIO_F_VERSION_1))\n+\n+#define VHOST_BLK_DISABLED_FEATURES_BASE ((1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \\\n+\t(1ULL << VIRTIO_RING_F_EVENT_IDX))\n+\n+#define VHOST_BLK_FEATURES (VHOST_BLK_FEATURES_BASE | \\\n+\t(1ULL << VIRTIO_BLK_F_SIZE_MAX) | (1ULL << VIRTIO_BLK_F_SEG_MAX) | \\\n+\t(1ULL << VIRTIO_BLK_F_GEOMETRY) | (1ULL << VIRTIO_BLK_F_BLK_SIZE) | \\\n+\t(1ULL << VIRTIO_BLK_F_TOPOLOGY) | (1ULL << VIRTIO_BLK_F_BARRIER) | \\\n+\t(1ULL << VIRTIO_BLK_F_SCSI) | (1ULL << VIRTIO_BLK_F_CONFIG_WCE) | \\\n+\t(1ULL << VIRTIO_BLK_F_MQ))\n+\n+/* Not supported features */\n+#define VHOST_BLK_DISABLED_FEATURES (VHOST_BLK_DISABLED_FEATURES_BASE | \\\n+\t(1ULL << VIRTIO_BLK_F_GEOMETRY) | (1ULL << VIRTIO_BLK_F_BARRIER) | \\\n+\t(1ULL << VIRTIO_BLK_F_SCSI) | (1ULL << VIRTIO_BLK_F_CONFIG_WCE))\n+\n+/* Vhost-blk support protocol features */\n+#define VHOST_BLK_PROTOCOL_FEATURES \\\n+\t((1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) | \\\n+\t(1ULL << VHOST_USER_PROTOCOL_F_CONFIG))\n+\n+#endif /* _VDPA_BLK_COMPACT_H_ */\n", "prefixes": [ "v10", "09/13" ] }{ "id": 111681, "url": "