get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 85561,
    "url": "https://patches.dpdk.org/api/patches/85561/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201220211405.313012-38-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": "<20201220211405.313012-38-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201220211405.313012-38-maxime.coquelin@redhat.com",
    "date": "2020-12-20T21:14:02",
    "name": "[37/40] net/virtio: introduce backend data",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4eb752a41472df3e9e0b443e9becc5d161a46da0",
    "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/20201220211405.313012-38-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 14390,
            "url": "https://patches.dpdk.org/api/series/14390/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14390",
            "date": "2020-12-20T21:13:25",
            "name": "net/virtio: Virtio PMD rework",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/14390/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/85561/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/85561/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 7E96AA09FD;\n\tSun, 20 Dec 2020 22:25:53 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D8091CEEE;\n\tSun, 20 Dec 2020 22:16:50 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by dpdk.org (Postfix) with ESMTP id 766D1CEE0\n for <dev@dpdk.org>; Sun, 20 Dec 2020 22:16:49 +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-531-o9WM2IXiMJ2KEdmiBk9yZg-1; Sun, 20 Dec 2020 16:16:46 -0500",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\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 CD1DA1005504;\n Sun, 20 Dec 2020 21:16:44 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.36.110.43])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 3739060C43;\n Sun, 20 Dec 2020 21:16:41 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1608499007;\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=l3zITSi7OoQVuppah+RVIxGZTK4BmjHp7Npgct7rNIU=;\n b=Yspif/uJJKAqeeGykt91YgkrCNWAgnCcO8LTQXR95Vj1JLXmXU0I8LwqXSlC3VJpTblSnx\n ty0K+X0+zsq+Pnvs2CgMKYCApeBszaYlyGKHZNPLDvYSeiAXn6kXC3mWI5oJDXHtq7PsVq\n MNYt9jX6AkCSsX63WroszDkUUzTEZUo=",
        "X-MC-Unique": "o9WM2IXiMJ2KEdmiBk9yZg-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": "Sun, 20 Dec 2020 22:14:02 +0100",
        "Message-Id": "<20201220211405.313012-38-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20201220211405.313012-1-maxime.coquelin@redhat.com>",
        "References": "<20201220211405.313012-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "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 37/40] net/virtio: introduce backend data",
        "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": "The goal of this patch is to introduce backend-specific\ndata in order to better isolate what is backend-specific\nfrom what is generic to Virtio-user.\n\nFor now, only Vhost-user protocol features are moved to\nVhost-user backend data.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/virtio/virtio_user/vhost.h        |  1 +\n drivers/net/virtio/virtio_user/vhost_kernel.c |  7 +++\n drivers/net/virtio/virtio_user/vhost_user.c   | 46 +++++++++++++++----\n drivers/net/virtio/virtio_user/vhost_vdpa.c   |  8 ++++\n .../net/virtio/virtio_user/virtio_user_dev.c  |  2 +\n .../net/virtio/virtio_user/virtio_user_dev.h  |  3 +-\n 6 files changed, 58 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h\nindex b488ac78a1..ee5598226d 100644\n--- a/drivers/net/virtio/virtio_user/vhost.h\n+++ b/drivers/net/virtio/virtio_user/vhost.h\n@@ -57,6 +57,7 @@ struct virtio_user_dev;\n \n struct virtio_user_backend_ops {\n \tint (*setup)(struct virtio_user_dev *dev);\n+\tint (*destroy)(struct virtio_user_dev *dev);\n \tint (*get_backend_features)(uint64_t *features);\n \tint (*set_owner)(struct virtio_user_dev *dev);\n \tint (*get_features)(struct virtio_user_dev *dev, uint64_t *features);\ndiff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c\nindex 2fd00afa84..023fddcd69 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel.c\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c\n@@ -357,6 +357,12 @@ vhost_kernel_setup(struct virtio_user_dev *dev)\n \treturn 0;\n }\n \n+static int\n+vhost_kernel_destroy(struct virtio_user_dev *dev)\n+{\n+\treturn 0;\n+}\n+\n static int\n vhost_kernel_set_backend(int vhostfd, int tapfd)\n {\n@@ -455,6 +461,7 @@ vhost_kernel_get_backend_features(uint64_t *features)\n \n struct virtio_user_backend_ops virtio_ops_kernel = {\n \t.setup = vhost_kernel_setup,\n+\t.destroy = vhost_kernel_destroy,\n \t.get_backend_features = vhost_kernel_get_backend_features,\n \t.set_owner = vhost_kernel_set_owner,\n \t.get_features = vhost_kernel_get_features,\ndiff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c\nindex f67c40e047..e96b1d8b9c 100644\n--- a/drivers/net/virtio/virtio_user/vhost_user.c\n+++ b/drivers/net/virtio/virtio_user/vhost_user.c\n@@ -17,6 +17,9 @@\n #include \"vhost.h\"\n #include \"virtio_user_dev.h\"\n \n+struct vhost_user_data {\n+\tuint64_t protocol_features;\n+};\n \n #ifndef VHOST_USER_F_PROTOCOL_FEATURES\n #define VHOST_USER_F_PROTOCOL_FEATURES 30\n@@ -274,6 +277,7 @@ static int\n vhost_user_get_features(struct virtio_user_dev *dev, uint64_t *features)\n {\n \tint ret;\n+\tstruct vhost_user_data *data = dev->backend_data;\n \tstruct vhost_user_msg msg = {\n \t\t.request = VHOST_USER_GET_FEATURES,\n \t\t.flags = VHOST_USER_VERSION,\n@@ -303,17 +307,17 @@ vhost_user_get_features(struct virtio_user_dev *dev, uint64_t *features)\n \t\treturn 0;\n \n \t/* Negotiate protocol features */\n-\tret = vhost_user_get_protocol_features(dev, &dev->protocol_features);\n+\tret = vhost_user_get_protocol_features(dev, &data->protocol_features);\n \tif (ret < 0)\n \t\tgoto err;\n \n-\tdev->protocol_features &= VHOST_USER_SUPPORTED_PROTOCOL_FEATURES;\n+\tdata->protocol_features &= VHOST_USER_SUPPORTED_PROTOCOL_FEATURES;\n \n-\tret = vhost_user_set_protocol_features(dev, dev->protocol_features);\n+\tret = vhost_user_set_protocol_features(dev, data->protocol_features);\n \tif (ret < 0)\n \t\tgoto err;\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)))\n+\tif (!(data->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)))\n \t\tdev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ);\n \n \treturn 0;\n@@ -429,12 +433,13 @@ vhost_user_set_memory_table(struct virtio_user_dev *dev)\n \tstruct walk_arg wa;\n \tint fds[VHOST_MEMORY_MAX_NREGIONS];\n \tint ret, fd_num;\n+\tstruct vhost_user_data *data = dev->backend_data;\n \tstruct vhost_user_msg msg = {\n \t\t.request = VHOST_USER_SET_MEM_TABLE,\n \t\t.flags = VHOST_USER_VERSION,\n \t};\n \n-\tif (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK))\n+\tif (data->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK))\n \t\tmsg.flags |= VHOST_USER_NEED_REPLY_MASK;\n \n \twa.region_nr = 0;\n@@ -613,6 +618,7 @@ static int\n vhost_user_get_status(struct virtio_user_dev *dev, uint8_t *status)\n {\n \tint ret;\n+\tstruct vhost_user_data *data = dev->backend_data;\n \tstruct vhost_user_msg msg = {\n \t\t.request = VHOST_USER_GET_STATUS,\n \t\t.flags = VHOST_USER_VERSION,\n@@ -629,7 +635,7 @@ vhost_user_get_status(struct virtio_user_dev *dev, uint8_t *status)\n \tif (!(dev->device_features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)))\n \t\treturn -ENOTSUP;\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))\n+\tif (!(data->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))\n \t\treturn -ENOTSUP;\n \n \tret = vhost_user_write(dev->vhostfd, &msg, NULL, 0);\n@@ -666,6 +672,7 @@ static int\n vhost_user_set_status(struct virtio_user_dev *dev, uint8_t status)\n {\n \tint ret;\n+\tstruct vhost_user_data *data = dev->backend_data;\n \tstruct vhost_user_msg msg = {\n \t\t.request = VHOST_USER_SET_STATUS,\n \t\t.flags = VHOST_USER_VERSION,\n@@ -673,7 +680,7 @@ vhost_user_set_status(struct virtio_user_dev *dev, uint8_t status)\n \t\t.payload.u64 = status,\n \t};\n \n-\tif (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK))\n+\tif (data->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK))\n \t\tmsg.flags |= VHOST_USER_NEED_REPLY_MASK;\n \n \t/*\n@@ -687,7 +694,7 @@ vhost_user_set_status(struct virtio_user_dev *dev, uint8_t status)\n \tif (!(dev->device_features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)))\n \t\treturn -ENOTSUP;\n \n-\tif (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))\n+\tif (!(data->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS)))\n \t\treturn -ENOTSUP;\n \n \tret = vhost_user_write(dev->vhostfd, &msg, NULL, 0);\n@@ -747,6 +754,17 @@ vhost_user_setup(struct virtio_user_dev *dev)\n \tint fd;\n \tint flag;\n \tstruct sockaddr_un un;\n+\tstruct vhost_user_data *data;\n+\n+\tdata = malloc(sizeof(*data));\n+\tif (!data) {\n+\t\tPMD_DRV_LOG(ERR, \"(%s) Failed to allocate Vhost-user data\\n\", dev->path);\n+\t\treturn -1;\n+\t}\n+\n+\tmemset(data, 0, sizeof(*data));\n+\n+\tdev->backend_data = data;\n \n \tfd = socket(AF_UNIX, SOCK_STREAM, 0);\n \tif (fd < 0) {\n@@ -781,6 +799,17 @@ vhost_user_setup(struct virtio_user_dev *dev)\n \treturn 0;\n }\n \n+static int\n+vhost_user_destroy(struct virtio_user_dev *dev)\n+{\n+\tif (dev->backend_data) {\n+\t\tfree(dev->backend_data);\n+\t\tdev->backend_data = NULL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n vhost_user_enable_queue_pair(struct virtio_user_dev *dev,\n \t\t\t     uint16_t pair_idx,\n@@ -815,6 +844,7 @@ vhost_user_get_backend_features(uint64_t *features)\n \n struct virtio_user_backend_ops virtio_ops_user = {\n \t.setup = vhost_user_setup,\n+\t.destroy = vhost_user_destroy,\n \t.get_backend_features = vhost_user_get_backend_features,\n \t.set_owner = vhost_user_set_owner,\n \t.get_features = vhost_user_get_features,\ndiff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c\nindex c826f333e0..b29426d767 100644\n--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c\n+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c\n@@ -287,6 +287,13 @@ vhost_vdpa_setup(struct virtio_user_dev *dev)\n \treturn 0;\n }\n \n+static int\n+vhost_vdpa_destroy(struct virtio_user_dev *dev __rte_unused)\n+{\n+\treturn;\n+\treturn 0;\n+}\n+\n static int\n vhost_vdpa_enable_queue_pair(struct virtio_user_dev *dev,\n \t\t\t       uint16_t pair_idx,\n@@ -322,6 +329,7 @@ vhost_vdpa_get_backend_features(uint64_t *features)\n \n struct virtio_user_backend_ops virtio_ops_vdpa = {\n \t.setup = vhost_vdpa_setup,\n+\t.destroy = vhost_vdpa_destroy,\n \t.get_backend_features = vhost_vdpa_get_backend_features,\n \t.set_owner = vhost_vdpa_set_owner,\n \t.get_features = vhost_vdpa_get_features,\ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c\nindex 974de133bc..8d19a0addd 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c\n@@ -620,6 +620,8 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev)\n \n \tif (dev->is_server)\n \t\tunlink(dev->path);\n+\n+\tdev->ops->destroy(dev);\n }\n \n uint8_t\ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h\nindex b2da2944e9..ec73d5de11 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h\n@@ -30,7 +30,6 @@ struct virtio_user_dev {\n \tint\t\tvhostfd;\n \tint\t\tlistenfd;   /* listening fd */\n \tbool\t\tis_server;  /* server or client mode */\n-\tuint64_t\tprotocol_features; /* negotiated protocol features*/\n \n \t/* for vhost_kernel backend */\n \tchar\t\t*ifname;\n@@ -66,6 +65,8 @@ struct virtio_user_dev {\n \tstruct virtio_user_backend_ops *ops;\n \tpthread_mutex_t\tmutex;\n \tbool\t\tstarted;\n+\n+\tvoid *backend_data;\n };\n \n int virtio_user_dev_set_features(struct virtio_user_dev *dev);\n",
    "prefixes": [
        "37/40"
    ]
}