get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 71291,
    "url": "http://patches.dpdk.org/api/patches/71291/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200611213748.1967029-5-maxime.coquelin@redhat.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": "<20200611213748.1967029-5-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200611213748.1967029-5-maxime.coquelin@redhat.com",
    "date": "2020-06-11T21:37:38",
    "name": "[04/14] vhost: make vDPA framework bus agnostic",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "64bbd9914c9d4686e3a40fdadaedc164d8fb3842",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.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/20200611213748.1967029-5-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 10421,
            "url": "http://patches.dpdk.org/api/series/10421/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10421",
            "date": "2020-06-11T21:37:34",
            "name": "vDPA API and framework rework",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/10421/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/71291/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/71291/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B1333A00BE;\n\tThu, 11 Jun 2020 23:38:38 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BDD831515;\n\tThu, 11 Jun 2020 23:38:26 +0200 (CEST)",
            "from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com\n [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 3E1022BF5\n for <dev@dpdk.org>; Thu, 11 Jun 2020 23:38:25 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-401-5I1yGrGmMbmr9GiViM9ZtQ-1; Thu, 11 Jun 2020 17:38:22 -0400",
            "from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com\n [10.5.11.22])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1536A8018A2;\n Thu, 11 Jun 2020 21:38:21 +0000 (UTC)",
            "from localhost.localdomain (unknown [10.36.110.37])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 02BA5100238D;\n Thu, 11 Jun 2020 21:38:12 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1591911504;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=EGuyCFUnjqIDRW6XspXJvSc4Hfr9fxJzxWZvTJhn4jw=;\n b=J1No6TXljTT4Y9SBNBkgYTLVkY53S1rTA1m2X0t7rUpmIXJr+RdCAHtrR1uqgBJhla+9gl\n /+kN4RV4zFjYBMno1BV+99YnBw16zrojsJ0NZBV5QI+uenZnA6B7lRrILGkdnusE8LjXXp\n VCBsUEeQDn4smtJVZe1tr+9UDR8mJJk=",
        "X-MC-Unique": "5I1yGrGmMbmr9GiViM9ZtQ-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, matan@mellanox.com, xiao.w.wang@intel.com,\n zhihong.wang@intel.com, xiaolong.ye@intel.com, chenbo.xia@intel.com,\n david.marchand@redhat.com, amorenoz@redhat.com, shreyansh.jain@nxp.com,\n viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Thu, 11 Jun 2020 23:37:38 +0200",
        "Message-Id": "<20200611213748.1967029-5-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20200611213748.1967029-1-maxime.coquelin@redhat.com>",
        "References": "<20200611213748.1967029-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.22",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 04/14] vhost: make vDPA framework bus agnostic",
        "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 <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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch makes the vDPA framework to no more\nsupport only PCI devices, but any devices by relying\non the generic device name as identifier.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/vdpa/ifc/ifcvf_vdpa.c          |  6 +-\n drivers/vdpa/mlx5/mlx5_vdpa.c          |  8 +--\n drivers/vdpa/mlx5/mlx5_vdpa.h          |  2 +-\n examples/vdpa/main.c                   | 49 ++++++++--------\n lib/librte_vhost/rte_vdpa.h            | 42 +++++++-------\n lib/librte_vhost/rte_vhost_version.map |  1 +\n lib/librte_vhost/vdpa.c                | 79 +++++++++++---------------\n 7 files changed, 85 insertions(+), 102 deletions(-)",
    "diff": "diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c\nindex ec97178dcb..1fec1f1baf 100644\n--- a/drivers/vdpa/ifc/ifcvf_vdpa.c\n+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c\n@@ -47,7 +47,6 @@ static const char * const ifcvf_valid_arguments[] = {\n static int ifcvf_vdpa_logtype;\n \n struct ifcvf_internal {\n-\tstruct rte_vdpa_dev_addr dev_addr;\n \tstruct rte_pci_device *pdev;\n \tstruct ifcvf_hw hw;\n \tint vfio_container_fd;\n@@ -1176,8 +1175,6 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) |\n \t\t(1ULL << VHOST_F_LOG_ALL);\n \n-\tinternal->dev_addr.pci_addr = pci_dev->addr;\n-\tinternal->dev_addr.type = VDPA_ADDR_PCI;\n \tlist->internal = internal;\n \n \tif (rte_kvargs_count(kvlist, IFCVF_SW_FALLBACK_LM)) {\n@@ -1188,8 +1185,7 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t}\n \tinternal->sw_lm = sw_fallback_lm;\n \n-\tinternal->did = rte_vdpa_register_device(&internal->dev_addr,\n-\t\t\t\t&ifcvf_ops);\n+\tinternal->did = rte_vdpa_register_device(&pci_dev->device, &ifcvf_ops);\n \tif (internal->did < 0) {\n \t\tDRV_LOG(ERR, \"failed to register device %s\", pci_dev->name);\n \t\tgoto error;\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c\nindex 1113d6cef0..e8255c7d7e 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c\n@@ -501,14 +501,13 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tpriv->caps = attr.vdpa;\n \tpriv->log_max_rqt_size = attr.log_max_rqt_size;\n \tpriv->ctx = ctx;\n-\tpriv->dev_addr.pci_addr = pci_dev->addr;\n-\tpriv->dev_addr.type = VDPA_ADDR_PCI;\n+\tpriv->pci_dev = pci_dev;\n \tpriv->var = mlx5_glue->dv_alloc_var(ctx, 0);\n \tif (!priv->var) {\n \t\tDRV_LOG(ERR, \"Failed to allocate VAR %u.\\n\", errno);\n \t\tgoto error;\n \t}\n-\tpriv->id = rte_vdpa_register_device(&priv->dev_addr, &mlx5_vdpa_ops);\n+\tpriv->id = rte_vdpa_register_device(&pci_dev->device, &mlx5_vdpa_ops);\n \tif (priv->id < 0) {\n \t\tDRV_LOG(ERR, \"Failed to register vDPA device.\");\n \t\trte_errno = rte_errno ? rte_errno : EINVAL;\n@@ -550,8 +549,7 @@ mlx5_vdpa_pci_remove(struct rte_pci_device *pci_dev)\n \n \tpthread_mutex_lock(&priv_list_lock);\n \tTAILQ_FOREACH(priv, &priv_list, next) {\n-\t\tif (memcmp(&priv->dev_addr.pci_addr, &pci_dev->addr,\n-\t\t\t   sizeof(pci_dev->addr)) == 0) {\n+\t\tif (priv->pci_dev == pci_dev) {\n \t\t\tfound = 1;\n \t\t\tbreak;\n \t\t}\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h\nindex fcc216ac78..50ee3c5870 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.h\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h\n@@ -104,7 +104,7 @@ struct mlx5_vdpa_priv {\n \tint id; /* vDPA device id. */\n \tint vid; /* vhost device id. */\n \tstruct ibv_context *ctx; /* Device context. */\n-\tstruct rte_vdpa_dev_addr dev_addr;\n+\tstruct rte_pci_device *pci_dev;\n \tstruct mlx5_hca_vdpa_attr caps;\n \tuint32_t pdn; /* Protection Domain number. */\n \tstruct ibv_pd *pd;\ndiff --git a/examples/vdpa/main.c b/examples/vdpa/main.c\nindex d9a9112b16..c12da69574 100644\n--- a/examples/vdpa/main.c\n+++ b/examples/vdpa/main.c\n@@ -271,10 +271,14 @@ static void cmd_list_vdpa_devices_parsed(\n \tuint32_t queue_num;\n \tuint64_t features;\n \tstruct rte_vdpa_device *vdev;\n-\tstruct rte_pci_addr addr;\n+\tstruct rte_device *dev;\n+\tstruct rte_dev_iterator dev_iter;\n \n-\tcmdline_printf(cl, \"device id\\tdevice address\\tqueue num\\tsupported features\\n\");\n-\tfor (did = 0; did < dev_total; did++) {\n+\tcmdline_printf(cl, \"device id\\tdevice name\\tqueue num\\tsupported features\\n\");\n+\tRTE_DEV_FOREACH(dev, \"class=vdpa\", &dev_iter) {\n+\t\tdid = rte_vdpa_find_device_id_by_name(dev->name);\n+\t\tif (did < 0)\n+\t\t\tcontinue;\n \t\tvdev = rte_vdpa_get_device(did);\n \t\tif (!vdev)\n \t\t\tcontinue;\n@@ -290,11 +294,8 @@ static void cmd_list_vdpa_devices_parsed(\n \t\t\t\t\"for device id %d.\\n\", did);\n \t\t\tcontinue;\n \t\t}\n-\t\taddr = vdev->addr.pci_addr;\n-\t\tcmdline_printf(cl,\n-\t\t\t\"%d\\t\\t\" PCI_PRI_FMT \"\\t%\" PRIu32 \"\\t\\t0x%\" PRIx64 \"\\n\",\n-\t\t\tdid, addr.domain, addr.bus, addr.devid,\n-\t\t\taddr.function, queue_num, features);\n+\t\tcmdline_printf(cl, \"%d\\t\\t%s\\t\\t%\" PRIu32 \"\\t\\t0x%\" PRIx64 \"\\n\",\n+\t\t\tdid, dev->name, queue_num, features);\n \t}\n }\n \n@@ -324,17 +325,12 @@ static void cmd_create_vdpa_port_parsed(void *parsed_result,\n {\n \tint did;\n \tstruct cmd_create_result *res = parsed_result;\n-\tstruct rte_vdpa_dev_addr addr;\n \n \trte_strscpy(vports[devcnt].ifname, res->socket_path, MAX_PATH_LEN);\n-\tif (rte_pci_addr_parse(res->bdf, &addr.pci_addr) != 0) {\n-\t\tcmdline_printf(cl, \"Unable to parse the given bdf.\\n\");\n-\t\treturn;\n-\t}\n-\taddr.type = VDPA_ADDR_PCI;\n-\tdid = rte_vdpa_find_device_id(&addr);\n+\tdid = rte_vdpa_find_device_id_by_name(res->bdf);\n \tif (did < 0) {\n-\t\tcmdline_printf(cl, \"Unable to find vdpa device id.\\n\");\n+\t\tcmdline_printf(cl, \"Unable to find vdpa device id for %s.\\n\",\n+\t\t\t\tres->bdf);\n \t\treturn;\n \t}\n \n@@ -400,9 +396,11 @@ int\n main(int argc, char *argv[])\n {\n \tchar ch;\n-\tint i;\n+\tint did;\n \tint ret;\n \tstruct cmdline *cl;\n+\tstruct rte_device *dev;\n+\tstruct rte_dev_iterator dev_iter;\n \n \tret = rte_eal_init(argc, argv);\n \tif (ret < 0)\n@@ -428,13 +426,18 @@ main(int argc, char *argv[])\n \t\tcmdline_interact(cl);\n \t\tcmdline_stdin_exit(cl);\n \t} else {\n-\t\tfor (i = 0; i < RTE_MIN(MAX_VDPA_SAMPLE_PORTS, dev_total);\n-\t\t\t\ti++) {\n-\t\t\tvports[i].did = i;\n-\t\t\tsnprintf(vports[i].ifname, MAX_PATH_LEN, \"%s%d\",\n-\t\t\t\t\tiface, i);\n+\t\tRTE_DEV_FOREACH(dev, \"class=vdpa\", &dev_iter) {\n+\t\t\tdid = rte_vdpa_find_device_id_by_name(dev->name);\n+\t\t\tif (did < 0) {\n+\t\t\t\trte_panic(\"Failed to find device id for %s\\n\",\n+\t\t\t\t\t\tdev->name);\n+\t\t\t}\n+\t\t\tvports[devcnt].did = did;\n+\t\t\tsnprintf(vports[devcnt].ifname, MAX_PATH_LEN, \"%s%d\",\n+\t\t\t\t\tiface, devcnt);\n \n-\t\t\tstart_vdpa(&vports[i]);\n+\t\t\tstart_vdpa(&vports[devcnt]);\n+\t\t\tdevcnt++;\n \t\t}\n \n \t\tprintf(\"enter \\'q\\' to quit\\n\");\ndiff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h\nindex 3c400ee79b..33037d39ea 100644\n--- a/lib/librte_vhost/rte_vdpa.h\n+++ b/lib/librte_vhost/rte_vdpa.h\n@@ -18,25 +18,6 @@\n \n #define MAX_VDPA_NAME_LEN 128\n \n-enum vdpa_addr_type {\n-\tVDPA_ADDR_PCI,\n-\tVDPA_ADDR_MAX\n-};\n-\n-/**\n- * vdpa device address\n- */\n-struct rte_vdpa_dev_addr {\n-\t/** vdpa address type */\n-\tenum vdpa_addr_type type;\n-\n-\t/** vdpa pci address */\n-\tunion {\n-\t\tuint8_t __dummy[64];\n-\t\tstruct rte_pci_addr pci_addr;\n-\t};\n-};\n-\n /**\n  * vdpa device operations\n  */\n@@ -81,8 +62,8 @@ struct rte_vdpa_dev_ops {\n  * vdpa device structure includes device address and device operations.\n  */\n struct rte_vdpa_device {\n-\t/** vdpa device address */\n-\tstruct rte_vdpa_dev_addr addr;\n+\t/** Generic device information */\n+\tstruct rte_device *device;\n \t/** vdpa device operations */\n \tstruct rte_vdpa_dev_ops *ops;\n } __rte_cache_aligned;\n@@ -102,7 +83,7 @@ struct rte_vdpa_device {\n  */\n __rte_experimental\n int\n-rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,\n+rte_vdpa_register_device(struct rte_device *rte_dev,\n \t\tstruct rte_vdpa_dev_ops *ops);\n \n /**\n@@ -120,6 +101,21 @@ __rte_experimental\n int\n rte_vdpa_unregister_device(int did);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Find the device id of a vdpa device from its name\n+ *\n+ * @param name\n+ *  the vdpa device name\n+ * @return\n+ *  device id on success, -1 on failure\n+ */\n+__rte_experimental\n+int\n+rte_vdpa_find_device_id_by_name(const char *name);\n+\n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\n@@ -133,7 +129,7 @@ rte_vdpa_unregister_device(int did);\n  */\n __rte_experimental\n int\n-rte_vdpa_find_device_id(struct rte_vdpa_dev_addr *addr);\n+rte_vdpa_find_device_id(struct rte_vdpa_device *dev);\n \n /**\n  * @warning\ndiff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map\nindex 051d08c120..1abfff8a0c 100644\n--- a/lib/librte_vhost/rte_vhost_version.map\n+++ b/lib/librte_vhost/rte_vhost_version.map\n@@ -66,4 +66,5 @@ EXPERIMENTAL {\n \trte_vhost_get_vhost_ring_inflight;\n \trte_vhost_get_vring_base_from_inflight;\n \trte_vhost_slave_config_change;\n+\trte_vdpa_find_device_id_by_name;\n };\ndiff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c\nindex 61ab9aadb4..5abc5a2a7c 100644\n--- a/lib/librte_vhost/vdpa.c\n+++ b/lib/librte_vhost/vdpa.c\n@@ -18,43 +18,22 @@\n static struct rte_vdpa_device vdpa_devices[MAX_VHOST_DEVICE];\n static uint32_t vdpa_device_num;\n \n-static bool\n-is_same_vdpa_device(struct rte_vdpa_dev_addr *a,\n-\t\tstruct rte_vdpa_dev_addr *b)\n-{\n-\tbool ret = true;\n-\n-\tif (a->type != b->type)\n-\t\treturn false;\n-\n-\tswitch (a->type) {\n-\tcase VDPA_ADDR_PCI:\n-\t\tif (a->pci_addr.domain != b->pci_addr.domain ||\n-\t\t\t\ta->pci_addr.bus != b->pci_addr.bus ||\n-\t\t\t\ta->pci_addr.devid != b->pci_addr.devid ||\n-\t\t\t\ta->pci_addr.function != b->pci_addr.function)\n-\t\t\tret = false;\n-\t\tbreak;\n-\tdefault:\n-\t\tbreak;\n-\t}\n-\n-\treturn ret;\n-}\n-\n int\n-rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,\n+rte_vdpa_register_device(struct rte_device *rte_dev,\n \t\tstruct rte_vdpa_dev_ops *ops)\n {\n \tstruct rte_vdpa_device *dev;\n \tint i;\n \n-\tif (vdpa_device_num >= MAX_VHOST_DEVICE || addr == NULL || ops == NULL)\n+\tif (vdpa_device_num >= MAX_VHOST_DEVICE || ops == NULL)\n \t\treturn -1;\n \n \tfor (i = 0; i < MAX_VHOST_DEVICE; i++) {\n \t\tdev = &vdpa_devices[i];\n-\t\tif (dev->ops && is_same_vdpa_device(&dev->addr, addr))\n+\t\tif (dev->ops == NULL)\n+\t\t\tcontinue;\n+\n+\t\tif (dev->device == rte_dev)\n \t\t\treturn -1;\n \t}\n \n@@ -67,7 +46,7 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,\n \t\treturn -1;\n \n \tdev = &vdpa_devices[i];\n-\tmemcpy(&dev->addr, addr, sizeof(struct rte_vdpa_dev_addr));\n+\tdev->device = rte_dev;\n \tdev->ops = ops;\n \tvdpa_device_num++;\n \n@@ -87,12 +66,33 @@ rte_vdpa_unregister_device(int did)\n }\n \n int\n-rte_vdpa_find_device_id(struct rte_vdpa_dev_addr *addr)\n+rte_vdpa_find_device_id(struct rte_vdpa_device *dev)\n+{\n+\tstruct rte_vdpa_device *tmp_dev;\n+\tint i;\n+\n+\tif (dev == NULL)\n+\t\treturn -1;\n+\n+\tfor (i = 0; i < MAX_VHOST_DEVICE; ++i) {\n+\t\ttmp_dev = &vdpa_devices[i];\n+\t\tif (tmp_dev->ops == NULL)\n+\t\t\tcontinue;\n+\n+\t\tif (tmp_dev == dev)\n+\t\t\treturn i;\n+\t}\n+\n+\treturn -1;\n+}\n+\n+int\n+rte_vdpa_find_device_id_by_name(const char *name)\n {\n \tstruct rte_vdpa_device *dev;\n \tint i;\n \n-\tif (addr == NULL)\n+\tif (name == NULL)\n \t\treturn -1;\n \n \tfor (i = 0; i < MAX_VHOST_DEVICE; ++i) {\n@@ -100,7 +100,7 @@ rte_vdpa_find_device_id(struct rte_vdpa_dev_addr *addr)\n \t\tif (dev->ops == NULL)\n \t\t\tcontinue;\n \n-\t\tif (is_same_vdpa_device(&dev->addr, addr))\n+\t\tif (strcmp(dev->device->name, name) == 0)\n \t\t\treturn i;\n \t}\n \n@@ -236,21 +236,10 @@ static int\n vdpa_dev_match(struct rte_vdpa_device *dev,\n \t      const struct rte_device *rte_dev)\n {\n-\tstruct rte_vdpa_dev_addr addr;\n+\tif (dev->device == rte_dev)\n+\t\treturn 0;\n \n-\t/*  Only PCI bus supported for now */\n-\tif (strcmp(rte_dev->bus->name, \"pci\") != 0)\n-\t\treturn -1;\n-\n-\taddr.type = VDPA_ADDR_PCI;\n-\n-\tif (rte_pci_addr_parse(rte_dev->name, &addr.pci_addr) != 0)\n-\t\treturn -1;\n-\n-\tif (!is_same_vdpa_device(&dev->addr, &addr))\n-\t\treturn -1;\n-\n-\treturn 0;\n+\treturn -1;\n }\n \n /* Generic rte_vdpa_dev comparison function. */\n",
    "prefixes": [
        "04/14"
    ]
}