Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/108884/?format=api
http://patches.dpdk.org/api/patches/108884/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1648392699-60113-5-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": "<1648392699-60113-5-git-send-email-andy.pei@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1648392699-60113-5-git-send-email-andy.pei@intel.com", "date": "2022-03-27T14:51:27", "name": "[v4,04/16] vdpa/ifc: add blk ops for ifc device", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "fd6d61168f333865ba86b1f231c9d42e81e5ddb8", "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/1648392699-60113-5-git-send-email-andy.pei@intel.com/mbox/", "series": [ { "id": 22255, "url": "http://patches.dpdk.org/api/series/22255/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22255", "date": "2022-03-27T14:51:23", "name": "add virtio_blk device support to vdpa/ifc", "version": 4, "mbox": "http://patches.dpdk.org/series/22255/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/108884/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/108884/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 6FC2BA034C;\n\tSun, 27 Mar 2022 17:36:12 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D88364287B;\n\tSun, 27 Mar 2022 17:35:54 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 048D142871\n for <dev@dpdk.org>; Sun, 27 Mar 2022 17:35:52 +0200 (CEST)", "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Mar 2022 08:35:52 -0700", "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga008.jf.intel.com with ESMTP; 27 Mar 2022 08:35:50 -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=1648395353; x=1679931353;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=/K8my91Bi3zBcNK1klWq65z4PAi11xo392zGrqZpMCM=;\n b=hQQzljwKXvwEGFy5QcKropAjL/7AdrO1ai8NMehvGfova/re9GjNPG11\n YgqWL7WlZB0Pf5QppgYS2EcY+kAT6wB9wRSeWd7Z87SxUNaAS0HNl3fPd\n WeSZ9AyG7IFqfpVYCHqM3MUvrgTYgQMSlDzG8DedfFkQX8PI7t4z1OFgD\n qi5dLHsyGSfxn88mnqvSiyPZkk86P3IzF+SVAR5BHSzY7NGTAlKYuMaF5\n M8c48qkC22tXF0eUaIKrUMG7iVXJ9BPHz3E0LRv4ge46NLtSffYw+IFY/\n 0nW6zoVbhqLap/yRLzUu4lda2olTHdJGQUtquyUpWXF+E/eKLDG+usVRE A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10299\"; a=\"259045638\"", "E=Sophos;i=\"5.90,215,1643702400\"; d=\"scan'208\";a=\"259045638\"", "E=Sophos;i=\"5.90,215,1643702400\"; d=\"scan'208\";a=\"562421517\"" ], "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", "Subject": "[PATCH v4 04/16] vdpa/ifc: add blk ops for ifc device", "Date": "Sun, 27 Mar 2022 22:51:27 +0800", "Message-Id": "<1648392699-60113-5-git-send-email-andy.pei@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1648392699-60113-1-git-send-email-andy.pei@intel.com>", "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1648392699-60113-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": "For virtio blk device, re-use part of ifc driver ops.\nImplement ifcvf_blk_get_config for virtio blk device.\nSupport VHOST_USER_PROTOCOL_F_CONFIG feature for virtio\nblk device.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/vdpa/ifc/base/ifcvf.h | 4 ++\n drivers/vdpa/ifc/ifcvf_vdpa.c | 85 ++++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 88 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h\nindex 01522c6..769c603 100644\n--- a/drivers/vdpa/ifc/base/ifcvf.h\n+++ b/drivers/vdpa/ifc/base/ifcvf.h\n@@ -66,6 +66,10 @@\n \n #define IFCVF_32_BIT_MASK\t\t0xffffffff\n \n+#ifndef VHOST_USER_PROTOCOL_F_CONFIG\n+#define VHOST_USER_PROTOCOL_F_CONFIG\t9\n+#endif\n+\n struct ifcvf_pci_cap {\n \tu8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */\n \tu8 cap_next; /* Generic PCI field: next ptr. */\ndiff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c\nindex e3210a8..8ee041f 100644\n--- a/drivers/vdpa/ifc/ifcvf_vdpa.c\n+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c\n@@ -1088,6 +1088,10 @@ struct rte_vdpa_dev_info {\n \t\t 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \\\n \t\t 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \\\n \t\t 1ULL << VHOST_USER_PROTOCOL_F_STATUS)\n+\n+#define VDPA_BLK_PROTOCOL_FEATURES \\\n+\t\t(1ULL << VHOST_USER_PROTOCOL_F_CONFIG)\n+\n static int\n ifcvf_get_protocol_features(struct rte_vdpa_device *vdev, uint64_t *features)\n {\n@@ -1200,6 +1204,85 @@ struct rte_vdpa_dev_info {\n \treturn device_id;\n }\n \n+static int\n+ifcvf_blk_get_config(int vid, uint8_t *config, uint32_t len)\n+{\n+\tstruct virtio_blk_config *dev_cfg;\n+\tstruct ifcvf_internal *internal;\n+\tstruct rte_vdpa_device *vdev;\n+\tstruct internal_list *list;\n+\tuint32_t i;\n+\tuint64_t capacity = 0;\n+\tuint8_t *byte;\n+\n+\tif (len < sizeof(struct virtio_blk_config)) {\n+\t\tDRV_LOG(ERR, \"Invalid len: %u, required: %u\",\n+\t\t\tlen, (uint32_t)sizeof(struct virtio_blk_config));\n+\t\treturn -1;\n+\t}\n+\n+\tvdev = rte_vhost_get_vdpa_device(vid);\n+\tlist = find_internal_resource_by_vdev(vdev);\n+\tif (list == NULL) {\n+\t\tDRV_LOG(ERR, \"Invalid vDPA device: %p\", vdev);\n+\t\treturn -1;\n+\t}\n+\n+\tinternal = list->internal;\n+\n+\tfor (i = 0; i < sizeof(struct virtio_blk_config); i++)\n+\t\tconfig[i] = *((u8 *)internal->hw.blk_cfg + i);\n+\n+\tdev_cfg = (struct virtio_blk_config *)internal->hw.blk_cfg;\n+\n+\t/* cannot read 64-bit register in one attempt, so read byte by byte. */\n+\tfor (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {\n+\t\tbyte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;\n+\t\tcapacity |= (uint64_t)*byte << (i * 8);\n+\t}\n+\tDRV_LOG(INFO, \"capacity : %\"PRIu64\"G\", capacity >> 21);\n+\n+\tDRV_LOG(INFO, \"size_max : 0x%08x\", dev_cfg->size_max);\n+\tDRV_LOG(INFO, \"seg_max : 0x%08x\", dev_cfg->seg_max);\n+\tDRV_LOG(INFO, \"blk_size : 0x%08x\", dev_cfg->blk_size);\n+\tDRV_LOG(INFO, \"geometry\");\n+\tDRV_LOG(INFO, \" cylinders: %u\", dev_cfg->geometry.cylinders);\n+\tDRV_LOG(INFO, \" heads : %u\", dev_cfg->geometry.heads);\n+\tDRV_LOG(INFO, \" sectors : %u\", dev_cfg->geometry.sectors);\n+\tDRV_LOG(INFO, \"num_queues: 0x%08x\", dev_cfg->num_queues);\n+\n+\tDRV_LOG(INFO, \"config: [%x] [%x] [%x] [%x] [%x] [%x] [%x] [%x]\\n\",\n+\t\tconfig[0], config[1], config[2], config[3], config[4],\n+\t\tconfig[5], config[6], config[7]);\n+\treturn 0;\n+}\n+\n+static int\n+ifcvf_blk_get_protocol_features(struct rte_vdpa_device *vdev,\n+\tuint64_t *features)\n+{\n+\tRTE_SET_USED(vdev);\n+\n+\t*features = VDPA_SUPPORTED_PROTOCOL_FEATURES;\n+\t*features |= VDPA_BLK_PROTOCOL_FEATURES;\n+\treturn 0;\n+}\n+\n+static struct rte_vdpa_dev_ops ifcvf_blk_ops = {\n+\t.get_queue_num = ifcvf_get_queue_num,\n+\t.get_features = ifcvf_get_vdpa_features,\n+\t.set_features = ifcvf_set_features,\n+\t.get_protocol_features = ifcvf_blk_get_protocol_features,\n+\t.dev_conf = ifcvf_dev_config,\n+\t.dev_close = ifcvf_dev_close,\n+\t.set_vring_state = NULL,\n+\t.migration_done = NULL,\n+\t.get_vfio_group_fd = ifcvf_get_vfio_group_fd,\n+\t.get_vfio_device_fd = ifcvf_get_vfio_device_fd,\n+\t.get_notify_area = ifcvf_get_notify_area,\n+\t.get_config = ifcvf_blk_get_config,\n+};\n+\n struct rte_vdpa_dev_info dev_info[] = {\n \t{\n \t\t.features = (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) |\n@@ -1212,7 +1295,7 @@ struct rte_vdpa_dev_info dev_info[] = {\n \t{\n \t\t.features = (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) |\n \t\t\t (1ULL << VHOST_F_LOG_ALL),\n-\t\t.ops = NULL,\n+\t\t.ops = &ifcvf_blk_ops,\n \t},\n };\n \n", "prefixes": [ "v4", "04/16" ] }{ "id": 108884, "url": "