get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/106683/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 106683,
    "url": "http://patches.dpdk.org/api/patches/106683/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1643425417-215270-2-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": "<1643425417-215270-2-git-send-email-andy.pei@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1643425417-215270-2-git-send-email-andy.pei@intel.com",
    "date": "2022-01-29T03:03:23",
    "name": "[v3,01/15] vdpa/ifc: add support for virtio blk device",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "bd9fd814546b57aa0b9169572e8027c88ef5fda2",
    "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/1643425417-215270-2-git-send-email-andy.pei@intel.com/mbox/",
    "series": [
        {
            "id": 21420,
            "url": "http://patches.dpdk.org/api/series/21420/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21420",
            "date": "2022-01-29T03:03:22",
            "name": "add virtio_blk device support to vdpa/ifc",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/21420/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/106683/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/106683/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 9FB2CA00C4;\n\tSat, 29 Jan 2022 04:09:36 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 89AEE426DB;\n\tSat, 29 Jan 2022 04:09:36 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id A024B40143\n for <dev@dpdk.org>; Sat, 29 Jan 2022 04:09:34 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Jan 2022 19:09:33 -0800",
            "from dpdk-dipei.sh.intel.com ([10.67.111.91])\n by fmsmga008.fm.intel.com with ESMTP; 28 Jan 2022 19:09:32 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1643425774; x=1674961774;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=rFUz/SVjhGgn20xUFjFFemaWcitUduNA2brEvZV/5+I=;\n b=m7bRTxN+A0LUFDHU7z39YJJj0WqkaEDTmvz++Npw/dkasgKKKM1fxVpb\n BKwHhYyq5EWmnE9iwfT0RfvuRQoKqYftgZvHrkd9h3ymEuzw74h4kpc7P\n HiiIsQJTQGJbsPJMReDtpSo2C/8CCrGsK0uL2LHfmvjXg4dXAkKhN4URR\n EJg6JdB2QvSbrDpy2/KHff2h2/Zv4hAj/3dqU73+f5JVMKPTNZAzlk4t8\n 01Ltm33EAyuK4SYTx0AK+qnUk4qEakrZuGCyYMU6kkdc+lhIVg9ro0W43\n vMRnB7EQizHvuyEVUiJH6jNNr2A0BHCXCSfepr2rmq3O6X0E3b/xlS26g w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10241\"; a=\"271699050\"",
            "E=Sophos;i=\"5.88,325,1635231600\"; d=\"scan'208\";a=\"271699050\"",
            "E=Sophos;i=\"5.88,325,1635231600\"; d=\"scan'208\";a=\"582047757\""
        ],
        "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 v3 01/15] vdpa/ifc: add support for virtio blk device",
        "Date": "Sat, 29 Jan 2022 11:03:23 +0800",
        "Message-Id": "<1643425417-215270-2-git-send-email-andy.pei@intel.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1643425417-215270-1-git-send-email-andy.pei@intel.com>",
        "References": "<1643093258-47258-2-git-send-email-andy.pei@intel.com>\n <1643425417-215270-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": "Re-use the vdpa/ifc code, distinguish blk and net device by pci_device_id.\nBlk and net device are implemented with proper feature and ops.\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\n---\n drivers/vdpa/ifc/base/ifcvf.h | 16 +++++++-\n drivers/vdpa/ifc/ifcvf_vdpa.c | 92 +++++++++++++++++++++++++++++++++++++++----\n 2 files changed, 98 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h\nindex 573a35f..01522c6 100644\n--- a/drivers/vdpa/ifc/base/ifcvf.h\n+++ b/drivers/vdpa/ifc/base/ifcvf.h\n@@ -5,8 +5,17 @@\n #ifndef _IFCVF_H_\n #define _IFCVF_H_\n \n+#include <linux/virtio_blk.h>\n #include \"ifcvf_osdep.h\"\n \n+#define IFCVF_NET\t0\n+#define IFCVF_BLK\t1\n+\n+/* for BLK */\n+#define IFCVF_BLK_TRANSITIONAL_DEVICE_ID    0x1001\n+#define IFCVF_BLK_MODERN_DEVICE_ID          0x1042\n+#define IFCVF_BLK_DEVICE_ID                 0x0002\n+\n #define IFCVF_VENDOR_ID\t\t0x1AF4\n #define IFCVF_DEVICE_ID\t\t0x1041\n #define IFCVF_SUBSYS_VENDOR_ID\t0x8086\n@@ -57,7 +66,6 @@\n \n #define IFCVF_32_BIT_MASK\t\t0xffffffff\n \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. */\n@@ -126,7 +134,11 @@ struct ifcvf_hw {\n \tu8     notify_region;\n \tu32    notify_off_multiplier;\n \tstruct ifcvf_pci_common_cfg *common_cfg;\n-\tstruct ifcvf_net_config *dev_cfg;\n+\tunion {\n+\t\tstruct ifcvf_net_config *net_cfg;\n+\t\tstruct virtio_blk_config *blk_cfg;\n+\t\tvoid *dev_cfg;\n+\t};\n \tu8     *isr;\n \tu16    *notify_base;\n \tu16    *notify_addr[IFCVF_MAX_QUEUES * 2];\ndiff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c\nindex 3853c4c..96b67dd 100644\n--- a/drivers/vdpa/ifc/ifcvf_vdpa.c\n+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c\n@@ -58,6 +58,7 @@ struct ifcvf_internal {\n \tstruct rte_vdpa_device *vdev;\n \tuint16_t max_queues;\n \tuint64_t features;\n+\tint device_type;\n \trte_atomic32_t started;\n \trte_atomic32_t dev_attached;\n \trte_atomic32_t running;\n@@ -75,6 +76,12 @@ struct internal_list {\n \tstruct ifcvf_internal *internal;\n };\n \n+/* vdpa device info includes device features and devcic operation. */\n+struct rte_vdpa_dev_info {\n+\tuint64_t features;\n+\tstruct rte_vdpa_dev_ops *ops;\n+};\n+\n TAILQ_HEAD(internal_list_head, internal_list);\n static struct internal_list_head internal_list =\n \tTAILQ_HEAD_INITIALIZER(internal_list);\n@@ -1170,6 +1177,48 @@ struct internal_list {\n \treturn 0;\n }\n \n+static int16_t\n+ifcvf_pci_get_device_type(struct rte_pci_device *pci_dev)\n+{\n+\tuint16_t pci_device_id = pci_dev->id.device_id;\n+\tuint16_t device_id;\n+\n+\tif (pci_device_id < 0x1000 || pci_device_id > 0x107f) {\n+\t\tDRV_LOG(ERR, \"Probe device is not a virtio device\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (pci_device_id < 0x1040) {\n+\t\t/* Transitional devices: use the PCI subsystem device id as\n+\t\t * virtio device id, same as legacy driver always did.\n+\t\t */\n+\t\tdevice_id = pci_dev->id.subsystem_device_id;\n+\t} else {\n+\t\t/* Modern devices: simply use PCI device id,\n+\t\t * but start from 0x1040.\n+\t\t */\n+\t\tdevice_id = pci_device_id - 0x1040;\n+\t}\n+\n+\treturn device_id;\n+}\n+\n+struct rte_vdpa_dev_info dev_info[] = {\n+\t{\n+\t\t.features = (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) |\n+\t\t\t    (1ULL << VIRTIO_NET_F_CTRL_VQ) |\n+\t\t\t    (1ULL << VIRTIO_NET_F_STATUS) |\n+\t\t\t    (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) |\n+\t\t\t    (1ULL << VHOST_F_LOG_ALL),\n+\t\t.ops = &ifcvf_ops,\n+\t},\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},\n+};\n+\n static int\n ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tstruct rte_pci_device *pci_dev)\n@@ -1181,6 +1230,7 @@ struct internal_list {\n \tint sw_fallback_lm = 0;\n \tstruct rte_kvargs *kvlist = NULL;\n \tint ret = 0;\n+\tint16_t device_id;\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n@@ -1230,13 +1280,24 @@ struct internal_list {\n \tinternal->configured = 0;\n \tinternal->max_queues = IFCVF_MAX_QUEUES;\n \tfeatures = ifcvf_get_features(&internal->hw);\n-\tinternal->features = (features &\n-\t\t~(1ULL << VIRTIO_F_IOMMU_PLATFORM)) |\n-\t\t(1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) |\n-\t\t(1ULL << VIRTIO_NET_F_CTRL_VQ) |\n-\t\t(1ULL << VIRTIO_NET_F_STATUS) |\n-\t\t(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) |\n-\t\t(1ULL << VHOST_F_LOG_ALL);\n+\n+\tdevice_id = ifcvf_pci_get_device_type(pci_dev);\n+\tif (device_id < 0) {\n+\t\tDRV_LOG(ERR, \"failed to get device %s type\", pci_dev->name);\n+\t\tgoto error;\n+\t}\n+\n+\tif (device_id == VIRTIO_ID_NET) {\n+\t\tinternal->device_type = IFCVF_NET;\n+\t\tinternal->features = features &\n+\t\t\t\t\t~(1ULL << VIRTIO_F_IOMMU_PLATFORM);\n+\t\tinternal->features |= dev_info[IFCVF_NET].features;\n+\t} else if (device_id == VIRTIO_ID_BLOCK) {\n+\t\tinternal->device_type = IFCVF_BLK;\n+\t\tinternal->features = features &\n+\t\t\t\t\t~(1ULL << VIRTIO_F_IOMMU_PLATFORM);\n+\t\tinternal->features |= dev_info[IFCVF_BLK].features;\n+\t}\n \n \tlist->internal = internal;\n \n@@ -1248,7 +1309,8 @@ struct internal_list {\n \t}\n \tinternal->sw_lm = sw_fallback_lm;\n \n-\tinternal->vdev = rte_vdpa_register_device(&pci_dev->device, &ifcvf_ops);\n+\tinternal->vdev = rte_vdpa_register_device(&pci_dev->device,\n+\t\t\t\tdev_info[internal->device_type].ops);\n \tif (internal->vdev == NULL) {\n \t\tDRV_LOG(ERR, \"failed to register device %s\", pci_dev->name);\n \t\tgoto error;\n@@ -1316,6 +1378,20 @@ struct internal_list {\n \t  .subsystem_device_id = IFCVF_SUBSYS_DEVICE_ID,\n \t},\n \n+\t{ .class_id = RTE_CLASS_ANY_ID,\n+\t  .vendor_id = IFCVF_VENDOR_ID,\n+\t  .device_id = IFCVF_BLK_TRANSITIONAL_DEVICE_ID,\n+\t  .subsystem_vendor_id = IFCVF_SUBSYS_VENDOR_ID,\n+\t  .subsystem_device_id = IFCVF_BLK_DEVICE_ID,\n+\t},\n+\n+\t{ .class_id = RTE_CLASS_ANY_ID,\n+\t  .vendor_id = IFCVF_VENDOR_ID,\n+\t  .device_id = IFCVF_BLK_MODERN_DEVICE_ID,\n+\t  .subsystem_vendor_id = IFCVF_SUBSYS_VENDOR_ID,\n+\t  .subsystem_device_id = IFCVF_BLK_DEVICE_ID,\n+\t},\n+\n \t{ .vendor_id = 0, /* sentinel */\n \t},\n };\n",
    "prefixes": [
        "v3",
        "01/15"
    ]
}