get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 29336,
    "url": "https://patches.dpdk.org/api/patches/29336/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1506606959-76230-11-git-send-email-jianfeng.tan@intel.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": "<1506606959-76230-11-git-send-email-jianfeng.tan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1506606959-76230-11-git-send-email-jianfeng.tan@intel.com",
    "date": "2017-09-28T13:55:57",
    "name": "[dpdk-dev,v2,10/12] vhost: allocate virtio_net in memzone",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c12e82d293092a97252c69db23c91a17a8a13e42",
    "submitter": {
        "id": 313,
        "url": "https://patches.dpdk.org/api/people/313/?format=api",
        "name": "Jianfeng Tan",
        "email": "jianfeng.tan@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1506606959-76230-11-git-send-email-jianfeng.tan@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/29336/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/29336/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 640B21B21E;\n\tThu, 28 Sep 2017 15:55:11 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 201B71B1C5\n\tfor <dev@dpdk.org>; Thu, 28 Sep 2017 15:55:01 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Sep 2017 06:55:01 -0700",
            "from dpdk06.sh.intel.com ([10.67.110.196])\n\tby fmsmga006.fm.intel.com with ESMTP; 28 Sep 2017 06:54:59 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.42,450,1500966000\"; d=\"scan'208\";a=\"157117756\"",
        "From": "Jianfeng Tan <jianfeng.tan@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com, konstantin.ananyev@intel.com,\n\tpablo.de.lara.guarch@intel.com, thomas@monjalon.net,\n\tyliu@fridaylinux.org, maxime.coquelin@redhat.com, mtetsuyah@gmail.com,\n\tferruh.yigit@intel.com, Jianfeng Tan <jianfeng.tan@intel.com>",
        "Date": "Thu, 28 Sep 2017 13:55:57 +0000",
        "Message-Id": "<1506606959-76230-11-git-send-email-jianfeng.tan@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1506606959-76230-1-git-send-email-jianfeng.tan@intel.com>",
        "References": "<1503654052-84730-1-git-send-email-jianfeng.tan@intel.com>\n\t<1506606959-76230-1-git-send-email-jianfeng.tan@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 10/12] vhost: allocate virtio_net in memzone",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Instead of allocate on the stack, change to allocate in memzone\nso that we can retrieve them in secondary processes.\n\nTODO: numa awareness.\n\nSigned-off-by: Jianfeng Tan <jianfeng.tan@intel.com>\n---\n lib/librte_vhost/socket.c |  2 ++\n lib/librte_vhost/vhost.c  | 34 ++++++++++++++++++++++++++++++++--\n lib/librte_vhost/vhost.h  |  4 +++-\n 3 files changed, 37 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c\nindex 41aa3f9..35b9751 100644\n--- a/lib/librte_vhost/socket.c\n+++ b/lib/librte_vhost/socket.c\n@@ -606,6 +606,8 @@ rte_vhost_driver_register(const char *path, uint64_t flags)\n \tint ret = -1;\n \tstruct vhost_user_socket *vsocket;\n \n+\talloc_vhost_devices();\n+\n \tif (!path)\n \t\treturn -1;\n \ndiff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex 0b6aa1c..2b687ea 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -47,15 +47,45 @@\n #include <rte_memory.h>\n #include <rte_malloc.h>\n #include <rte_vhost.h>\n+#include <rte_memzone.h>\n \n #include \"vhost.h\"\n \n-struct virtio_net *vhost_devices[MAX_VHOST_DEVICE];\n+#define MZ_VHOST_DEVICES \"mz_vhost_devices\"\n+struct virtio_net **vhost_devices;\n+\n+void\n+alloc_vhost_devices(void)\n+{\n+\tconst struct rte_memzone *mz;\n+\n+\tif (vhost_devices != NULL)\n+\t\treturn;\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tmz = rte_memzone_reserve(MZ_VHOST_DEVICES,\n+\t\t\t\tMAX_VHOST_DEVICE * sizeof(*vhost_devices),\n+\t\t\t\trte_socket_id(), 0);\n+\t} else\n+\t\tmz = rte_memzone_lookup(MZ_VHOST_DEVICES);\n+\n+\tif (mz == NULL)\n+\t\trte_panic(\"Cannot allocate memzone for vhost_devices\\n\");\n+\n+\tvhost_devices = mz->addr;\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\tmemset(vhost_devices, 0,\n+\t\t       MAX_VHOST_DEVICE * sizeof(*vhost_devices));\n+}\n \n struct virtio_net *\n get_device(int vid)\n {\n-\tstruct virtio_net *dev = vhost_devices[vid];\n+\tstruct virtio_net *dev;\n+\n+\talloc_vhost_devices();\n+\n+\tdev = vhost_devices[vid];\n \n \tif (unlikely(!dev)) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG,\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 6fe72ae..bc1f31e 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -278,7 +278,7 @@ vhost_log_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \n extern uint64_t VHOST_FEATURES;\n #define MAX_VHOST_DEVICE\t1024\n-extern struct virtio_net *vhost_devices[MAX_VHOST_DEVICE];\n+extern struct virtio_net **vhost_devices;\n \n /* Convert guest physical address to host physical address */\n static __rte_always_inline phys_addr_t\n@@ -300,6 +300,8 @@ gpa_to_hpa(struct virtio_net *dev, uint64_t gpa, uint64_t size)\n \treturn 0;\n }\n \n+\n+void alloc_vhost_devices(void);\n struct virtio_net *get_device(int vid);\n \n int vhost_new_device(void);\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "10/12"
    ]
}