Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/111616/?format=api
http://patchwork.dpdk.org/api/patches/111616/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1653298524-232138-10-git-send-email-andy.pei@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": "<1653298524-232138-10-git-send-email-andy.pei@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1653298524-232138-10-git-send-email-andy.pei@intel.com", "date": "2022-05-23T09:35:20", "name": "[v9,09/13] examples/vdpa: add virtio blk support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "158e4620d40de422ea8f66610df1126181344575", "submitter": { "id": 1185, "url": "http://patchwork.dpdk.org/api/people/1185/?format=api", "name": "Pei, Andy", "email": "andy.pei@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/1653298524-232138-10-git-send-email-andy.pei@intel.com/mbox/", "series": [ { "id": 23091, "url": "http://patchwork.dpdk.org/api/series/23091/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=23091", "date": "2022-05-23T09:35:11", "name": "add virtio_blk device support to vdpa/ifc", "version": 9, "mbox": "http://patchwork.dpdk.org/series/23091/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/111616/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/111616/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 1519CA04FD;\n\tMon, 23 May 2022 12:23:25 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B7BFD42B7D;\n\tMon, 23 May 2022 12:22:56 +0200 (CEST)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 0376B42B7B\n for <dev@dpdk.org>; Mon, 23 May 2022 12:22:54 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 May 2022 03:22:54 -0700", "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga006.jf.intel.com with ESMTP; 23 May 2022 03:22:51 -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=1653301375; x=1684837375;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=4BrY9sz/w3ltjbapBG7nfdew7ym66mv1zo884kKhm5Q=;\n b=EC0TpQDobeQScvGVmenR9/6NQgor7pBSQNWjgRL632VSdaNDoggqdyje\n QraozHTmCQaqUOos3BgE+V3hUqcCkQctluwbCkgCkbA7zi7EhQTPRS9Tm\n tNFwltzSVq0hBPSMQEa0A6YeGWXE/1ZxHWTJibLXlWVMtC27EAUW7FpVg\n 3USp3GDUqGNuKN+6hYDzSpSxh/GCRH18sGc5fyZitArOmG7vCanNaHrzn\n oV0e9jve8THukrz0I8Iv8I8fIClfEAaIK7o/iRrQDHYgF5kh02c8Px7P9\n IPMgj0nSt60Ux4BPFC+QR5KnRtB0K5opww5Wv/drdTFOnVr9UVNFFJEIZ A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10355\"; a=\"255239378\"", "E=Sophos;i=\"5.91,246,1647327600\"; d=\"scan'208\";a=\"255239378\"", "E=Sophos;i=\"5.91,246,1647327600\"; d=\"scan'208\";a=\"547889491\"" ], "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 v9 09/13] examples/vdpa: add virtio blk support", "Date": "Mon, 23 May 2022 17:35:20 +0800", "Message-Id": "<1653298524-232138-10-git-send-email-andy.pei@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1653298524-232138-1-git-send-email-andy.pei@intel.com>", "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1653298524-232138-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>\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": [ "v9", "09/13" ] }{ "id": 111616, "url": "