get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87330,
    "url": "https://patches.dpdk.org/api/patches/87330/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210126101639.250481-43-maxime.coquelin@redhat.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20210126101639.250481-43-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210126101639.250481-43-maxime.coquelin@redhat.com",
    "date": "2021-01-26T10:16:37",
    "name": "[v4,42/44] net/virtio: move Vhost-vDPA data to its backend",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "68ad249bcd910cfee374a1f936af91793cc6e2a0",
    "submitter": {
        "id": 512,
        "url": "https://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210126101639.250481-43-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 14950,
            "url": "https://patches.dpdk.org/api/series/14950/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14950",
            "date": "2021-01-26T10:15:55",
            "name": "net/virtio: Virtio PMD rework",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/14950/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/87330/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/87330/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 6ED4DA052A;\n\tTue, 26 Jan 2021 11:23:48 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2AC5F141419;\n\tTue, 26 Jan 2021 11:18:49 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [63.128.21.124])\n by mails.dpdk.org (Postfix) with ESMTP id 5A24A14139C\n for <dev@dpdk.org>; Tue, 26 Jan 2021 11:18:43 +0100 (CET)",
            "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-600-I6o6Lx1FP0GRzzY7EKFJOQ-1; Tue, 26 Jan 2021 05:18:40 -0500",
            "from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com\n [10.5.11.11])\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 92973107ACE3;\n Tue, 26 Jan 2021 10:18:39 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.36.110.31])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 2DC8A6F45C;\n Tue, 26 Jan 2021 10:18:38 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1611656322;\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=McSWAqejzhNrGLvEwHZtxqni+Nwru3475wu9cOsF6gQ=;\n b=iX9jfMo5b6GHdIAdcT+6kGcNAphuXIWMrmI2Rk3WErsIsYKaJlKRbGx5TkHpVqqJIa0eiE\n CwPlmAIAvYjg9afvs3WL2GT2akV2AhcLycANnpb6Vtc4R7GmXV4Za8PtgXcYGZwNa5v3MW\n 1x3d4BNH41N/XJqBoo56wUR728afUhM=",
        "X-MC-Unique": "I6o6Lx1FP0GRzzY7EKFJOQ-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com,\n amorenoz@redhat.com, david.marchand@redhat.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Tue, 26 Jan 2021 11:16:37 +0100",
        "Message-Id": "<20210126101639.250481-43-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20210126101639.250481-1-maxime.coquelin@redhat.com>",
        "References": "<20210126101639.250481-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "Subject": "[dpdk-dev] [PATCH v4 42/44] net/virtio: move Vhost-vDPA data to its\n backend",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "As done earlier for Vhost-user and Vhost-kernel, this\npatch moves the Vhost-vDPA specific data to its backend\nfile.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n drivers/net/virtio/virtio_user/vhost_vdpa.c   | 120 +++++++++++++-----\n .../net/virtio/virtio_user/virtio_user_dev.h  |   5 -\n 2 files changed, 89 insertions(+), 36 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c\nindex 5e3778b682..e2d6d3504d 100644\n--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c\n+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c\n@@ -13,6 +13,11 @@\n #include \"vhost.h\"\n #include \"virtio_user_dev.h\"\n \n+struct vhost_vdpa_data {\n+\tint vhostfd;\n+\tuint64_t protocol_features;\n+};\n+\n #define VHOST_VDPA_SUPPORTED_BACKEND_FEATURES\t\t\\\n \t(1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2\t|\t\\\n \t1ULL << VHOST_BACKEND_F_IOTLB_BATCH)\n@@ -88,27 +93,34 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg)\n static int\n vhost_vdpa_set_owner(struct virtio_user_dev *dev)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_OWNER, NULL);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_OWNER, NULL);\n }\n \n static int\n vhost_vdpa_get_protocol_features(struct virtio_user_dev *dev, uint64_t *features)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_GET_BACKEND_FEATURES, features);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_GET_BACKEND_FEATURES, features);\n }\n \n static int\n vhost_vdpa_set_protocol_features(struct virtio_user_dev *dev, uint64_t features)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_BACKEND_FEATURES, &features);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_BACKEND_FEATURES, &features);\n }\n \n static int\n vhost_vdpa_get_features(struct virtio_user_dev *dev, uint64_t *features)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n \tint ret;\n \n-\tret = vhost_vdpa_ioctl(dev->vhostfd, VHOST_GET_FEATURES, features);\n+\tret = vhost_vdpa_ioctl(data->vhostfd, VHOST_GET_FEATURES, features);\n \tif (ret) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to get features\");\n \t\treturn -1;\n@@ -118,15 +130,15 @@ vhost_vdpa_get_features(struct virtio_user_dev *dev, uint64_t *features)\n \t*features &= ~(1ULL << VIRTIO_NET_F_MQ);\n \n \t/* Negotiated vDPA backend features */\n-\tret = vhost_vdpa_get_protocol_features(dev, &dev->protocol_features);\n+\tret = vhost_vdpa_get_protocol_features(dev, &data->protocol_features);\n \tif (ret < 0) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to get backend features\");\n \t\treturn -1;\n \t}\n \n-\tdev->protocol_features &= VHOST_VDPA_SUPPORTED_BACKEND_FEATURES;\n+\tdata->protocol_features &= VHOST_VDPA_SUPPORTED_BACKEND_FEATURES;\n \n-\tret = vhost_vdpa_set_protocol_features(dev, dev->protocol_features);\n+\tret = vhost_vdpa_set_protocol_features(dev, data->protocol_features);\n \tif (ret < 0) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to set backend features\");\n \t\treturn -1;\n@@ -138,21 +150,24 @@ vhost_vdpa_get_features(struct virtio_user_dev *dev, uint64_t *features)\n static int\n vhost_vdpa_set_features(struct virtio_user_dev *dev, uint64_t features)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n \t/* WORKAROUND */\n \tfeatures |= 1ULL << VIRTIO_F_IOMMU_PLATFORM;\n \n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_FEATURES, &features);\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_FEATURES, &features);\n }\n \n static int\n vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n \tstruct vhost_msg msg = {};\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH)))\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH)))\n \t\treturn 0;\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n \t\tPMD_DRV_LOG(ERR, \"IOTLB_MSG_V2 not supported by the backend.\");\n \t\treturn -1;\n \t}\n@@ -160,7 +175,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)\n \tmsg.type = VHOST_IOTLB_MSG_V2;\n \tmsg.iotlb.type = VHOST_IOTLB_BATCH_BEGIN;\n \n-\tif (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n+\tif (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to send IOTLB batch begin (%s)\",\n \t\t\t\tstrerror(errno));\n \t\treturn -1;\n@@ -172,12 +187,13 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)\n static int\n vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n \tstruct vhost_msg msg = {};\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH)))\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_BATCH)))\n \t\treturn 0;\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n \t\tPMD_DRV_LOG(ERR, \"IOTLB_MSG_V2 not supported by the backend.\");\n \t\treturn -1;\n \t}\n@@ -185,7 +201,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)\n \tmsg.type = VHOST_IOTLB_MSG_V2;\n \tmsg.iotlb.type = VHOST_IOTLB_BATCH_END;\n \n-\tif (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n+\tif (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to send IOTLB batch end (%s)\",\n \t\t\t\tstrerror(errno));\n \t\treturn -1;\n@@ -198,9 +214,10 @@ static int\n vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,\n \t\t\t\t  uint64_t iova, size_t len)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n \tstruct vhost_msg msg = {};\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n \t\tPMD_DRV_LOG(ERR, \"IOTLB_MSG_V2 not supported by the backend.\");\n \t\treturn -1;\n \t}\n@@ -215,7 +232,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,\n \tPMD_DRV_LOG(DEBUG, \"%s: iova: 0x%\" PRIx64 \", addr: %p, len: 0x%zx\",\n \t\t\t__func__, iova, addr, len);\n \n-\tif (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n+\tif (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to send IOTLB update (%s)\",\n \t\t\t\tstrerror(errno));\n \t\treturn -1;\n@@ -228,9 +245,10 @@ static int\n vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,\n \t\t\t\t  uint64_t iova, size_t len)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n \tstruct vhost_msg msg = {};\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n+\tif (!(data->protocol_features & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2))) {\n \t\tPMD_DRV_LOG(ERR, \"IOTLB_MSG_V2 not supported by the backend.\");\n \t\treturn -1;\n \t}\n@@ -243,7 +261,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,\n \tPMD_DRV_LOG(DEBUG, \"%s: iova: 0x%\" PRIx64 \", len: 0x%zx\",\n \t\t\t__func__, iova, len);\n \n-\tif (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n+\tif (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to send IOTLB invalidate (%s)\",\n \t\t\t\tstrerror(errno));\n \t\treturn -1;\n@@ -353,55 +371,73 @@ vhost_vdpa_set_memory_table(struct virtio_user_dev *dev)\n static int\n vhost_vdpa_set_vring_enable(struct virtio_user_dev *dev, struct vhost_vring_state *state)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_VDPA_SET_VRING_ENABLE, state);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_VDPA_SET_VRING_ENABLE, state);\n }\n \n static int\n vhost_vdpa_set_vring_num(struct virtio_user_dev *dev, struct vhost_vring_state *state)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_VRING_NUM, state);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_VRING_NUM, state);\n }\n \n static int\n vhost_vdpa_set_vring_base(struct virtio_user_dev *dev, struct vhost_vring_state *state)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_VRING_BASE, state);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_VRING_BASE, state);\n }\n \n static int\n vhost_vdpa_get_vring_base(struct virtio_user_dev *dev, struct vhost_vring_state *state)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_GET_VRING_BASE, state);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_GET_VRING_BASE, state);\n }\n \n static int\n vhost_vdpa_set_vring_call(struct virtio_user_dev *dev, struct vhost_vring_file *file)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_VRING_CALL, file);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_VRING_CALL, file);\n }\n \n static int\n vhost_vdpa_set_vring_kick(struct virtio_user_dev *dev, struct vhost_vring_file *file)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_VRING_KICK, file);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_VRING_KICK, file);\n }\n \n static int\n vhost_vdpa_set_vring_addr(struct virtio_user_dev *dev, struct vhost_vring_addr *addr)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_SET_VRING_ADDR, addr);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_SET_VRING_ADDR, addr);\n }\n \n static int\n vhost_vdpa_get_status(struct virtio_user_dev *dev, uint8_t *status)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_VDPA_GET_STATUS, status);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_VDPA_GET_STATUS, status);\n }\n \n static int\n vhost_vdpa_set_status(struct virtio_user_dev *dev, uint8_t status)\n {\n-\treturn vhost_vdpa_ioctl(dev->vhostfd, VHOST_VDPA_SET_STATUS, &status);\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\treturn vhost_vdpa_ioctl(data->vhostfd, VHOST_VDPA_SET_STATUS, &status);\n }\n \n /**\n@@ -414,27 +450,49 @@ vhost_vdpa_set_status(struct virtio_user_dev *dev, uint8_t status)\n static int\n vhost_vdpa_setup(struct virtio_user_dev *dev)\n {\n+\tstruct vhost_vdpa_data *data;\n \tuint32_t did = (uint32_t)-1;\n \n-\tdev->vhostfd = open(dev->path, O_RDWR);\n-\tif (dev->vhostfd < 0) {\n+\tdata = malloc(sizeof(*data));\n+\tif (!data) {\n+\t\tPMD_DRV_LOG(ERR, \"(%s) Faidle to allocate backend data\", dev->path);\n+\t\treturn -1;\n+\t}\n+\n+\tdata->vhostfd = open(dev->path, O_RDWR);\n+\tif (data->vhostfd < 0) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to open %s: %s\\n\",\n \t\t\t\tdev->path, strerror(errno));\n+\t\tfree(data);\n \t\treturn -1;\n \t}\n \n-\tif (ioctl(dev->vhostfd, VHOST_VDPA_GET_DEVICE_ID, &did) < 0 ||\n+\tif (ioctl(data->vhostfd, VHOST_VDPA_GET_DEVICE_ID, &did) < 0 ||\n \t\t\tdid != VIRTIO_ID_NETWORK) {\n \t\tPMD_DRV_LOG(ERR, \"Invalid vdpa device ID: %u\\n\", did);\n+\t\tclose(data->vhostfd);\n+\t\tfree(data);\n \t\treturn -1;\n \t}\n \n+\tdev->backend_data = data;\n+\n \treturn 0;\n }\n \n static int\n-vhost_vdpa_destroy(struct virtio_user_dev *dev __rte_unused)\n+vhost_vdpa_destroy(struct virtio_user_dev *dev)\n {\n+\tstruct vhost_vdpa_data *data = dev->backend_data;\n+\n+\tif (!data)\n+\t\treturn 0;\n+\n+\tclose(data->vhostfd);\n+\n+\tfree(data);\n+\tdev->backend_data = NULL;\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h\nindex 36a9cadcad..8a62f7ea79 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h\n@@ -29,10 +29,6 @@ struct virtio_user_dev {\n \tenum virtio_user_backend_type backend_type;\n \tbool\t\tis_server;  /* server or client mode */\n \n-\t/* for vhost_vdpa backend */\n-\tint\t\tvhostfd;\n-\n-\t/* for both vhost_user and vhost_kernel */\n \tint\t\tcallfds[VIRTIO_MAX_VIRTQUEUES];\n \tint\t\tkickfds[VIRTIO_MAX_VIRTQUEUES];\n \tint\t\tmac_specified;\n@@ -45,7 +41,6 @@ struct virtio_user_dev {\n \tuint64_t\tdevice_features; /* supported features by device */\n \tuint64_t\tfrontend_features; /* enabled frontend features */\n \tuint64_t\tunsupported_features; /* unsupported features mask */\n-\tuint64_t\tprotocol_features; /* negotiated protocol features */\n \tuint8_t\t\tstatus;\n \tuint16_t\tnet_status;\n \tuint16_t\tport_id;\n",
    "prefixes": [
        "v4",
        "42/44"
    ]
}