get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2513,
    "url": "https://patches.dpdk.org/api/patches/2513/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1422242440-28948-14-git-send-email-huawei.xie@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": "<1422242440-28948-14-git-send-email-huawei.xie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1422242440-28948-14-git-send-email-huawei.xie@intel.com",
    "date": "2015-01-26T03:20:39",
    "name": "[dpdk-dev,RFC,v2,13/14] multiple socket support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3c6ec7038472fd7e6a9e66fe47109e7560d60886",
    "submitter": {
        "id": 16,
        "url": "https://patches.dpdk.org/api/people/16/?format=api",
        "name": "Huawei Xie",
        "email": "huawei.xie@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1422242440-28948-14-git-send-email-huawei.xie@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2513/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2513/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id B0F405AC5;\n\tMon, 26 Jan 2015 04:21:50 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id CFE8D5ACD\n\tfor <dev@dpdk.org>; Mon, 26 Jan 2015 04:21:46 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP; 25 Jan 2015 19:17:32 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 25 Jan 2015 19:21:45 -0800",
            "from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com\n\t[10.239.29.90])\n\tby shvmail01.sh.intel.com with ESMTP id t0Q3Lgjt015691;\n\tMon, 26 Jan 2015 11:21:42 +0800",
            "from shecgisg003.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid t0Q3Lels029074; Mon, 26 Jan 2015 11:21:42 +0800",
            "(from hxie5@localhost)\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t0Q3LexA029070; \n\tMon, 26 Jan 2015 11:21:40 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,466,1418112000\"; d=\"scan'208\";a=\"642452782\"",
        "From": "Huawei Xie <huawei.xie@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 26 Jan 2015 11:20:39 +0800",
        "Message-Id": "<1422242440-28948-14-git-send-email-huawei.xie@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1422242440-28948-1-git-send-email-huawei.xie@intel.com>",
        "References": "<1422242440-28948-1-git-send-email-huawei.xie@intel.com>",
        "Subject": "[dpdk-dev] [RFC PATCH v2 13/14] multiple socket support",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "Signed-off-by: Huawei Xie <huawei.xie@intel.com>\n---\n lib/librte_vhost/vhost_user/vhost-net-user.c | 57 +++++++++++++++++++---------\n lib/librte_vhost/vhost_user/vhost-net-user.h |  1 -\n 2 files changed, 40 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c\nindex 71e5bbd..3a45a5e 100644\n--- a/lib/librte_vhost/vhost_user/vhost-net-user.c\n+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c\n@@ -54,7 +54,18 @@ static void vserver_new_vq_conn(int fd, void *data);\n static void vserver_message_handler(int fd, void *dat);\n struct vhost_net_device_ops const *ops;\n \n-static struct vhost_server *g_vhost_server;\n+struct connfd_ctx {\n+\tstruct vhost_server *vserver;\n+\tuint32_t fh;\n+};\n+\n+#define MAX_VHOST_SERVER 1024\n+static struct {\n+\tstruct vhost_server *server[MAX_VHOST_SERVER];\n+\tstruct fdset fdset;\t/**< The fd list this vhost server manages. */\n+} g_vhost_server;\n+\n+static int vserver_idx;\n \n static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_NONE] = \"VHOST_USER_NONE\",\n@@ -251,6 +262,7 @@ vserver_new_vq_conn(int fd, void *dat)\n {\n \tstruct vhost_server *vserver = (struct vhost_server *)dat;\n \tint conn_fd;\n+\tstruct connfd_ctx *ctx;\n \tint fh;\n \tstruct vhost_device_ctx vdev_ctx = { 0 };\n \n@@ -260,15 +272,24 @@ vserver_new_vq_conn(int fd, void *dat)\n \tif (conn_fd < 0)\n \t\treturn;\n \n+\tctx = calloc(1, sizeof(*ctx));\n+\tif (ctx == NULL) {\n+\t\tclose(conn_fd);\n+\t\treturn;\n+\t}\n+\n \tfh = ops->new_device(vdev_ctx);\n \tif (fh == -1) {\n+\t\tfree(ctx);\n \t\tclose(conn_fd);\n \t\treturn;\n \t}\n \tRTE_LOG(INFO, VHOST_CONFIG, \"new device, handle is %d\\n\", fh);\n \n-\tfdset_add(&vserver->fdset,\n-\t\tconn_fd, vserver_message_handler, NULL, (void *)fh);\n+\tctx->vserver = vserver;\n+\tctx->fh = fh;\n+\tfdset_add(&g_vhost_server.fdset,\n+\t\tconn_fd, vserver_message_handler, NULL, ctx);\n }\n \n /* callback when there is message on the connfd */\n@@ -276,19 +297,20 @@ static void\n vserver_message_handler(int connfd, void *dat)\n {\n \tstruct vhost_device_ctx ctx;\n-\tuint32_t fh = (uint32_t)dat;\n+\tstruct connfd_ctx *cfd_ctx = (struct connfd_ctx *)dat;\n \tstruct VhostUserMsg msg;\n \tuint64_t features;\n \tint ret;\n \n-\tctx.fh = fh;\n+\tctx.fh = cfd_ctx->fh;\n \tret = read_vhost_message(connfd, &msg);\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG,\n \t\t\t\"vhost read message failed\\n\");\n \n \t\tclose(connfd);\n-\t\tfdset_del(&g_vhost_server->fdset, connfd);\n+\t\tfdset_del(&g_vhost_server.fdset, connfd);\n+\t\tfree(cfd_ctx);\n \t\tuser_destroy_device(ctx);\n \t\tops->destroy_device(ctx);\n \n@@ -298,7 +320,8 @@ vserver_message_handler(int connfd, void *dat)\n \t\t\t\"vhost peer closed\\n\");\n \n \t\tclose(connfd);\n-\t\tfdset_del(&g_vhost_server->fdset, connfd);\n+\t\tfdset_del(&g_vhost_server.fdset, connfd);\n+\t\tfree(cfd_ctx);\n \t\tuser_destroy_device(ctx);\n \t\tops->destroy_device(ctx);\n \n@@ -309,7 +332,8 @@ vserver_message_handler(int connfd, void *dat)\n \t\t\t\"vhost read incorrect message\\n\");\n \n \t\tclose(connfd);\n-\t\tfdset_del(&g_vhost_server->fdset, connfd);\n+\t\tfdset_del(&g_vhost_server.fdset, connfd);\n+\t\tfree(cfd_ctx);\n \t\tuser_destroy_device(ctx);\n \t\tops->destroy_device(ctx);\n \n@@ -390,18 +414,19 @@ vserver_message_handler(int connfd, void *dat)\n int\n rte_vhost_driver_register(const char *path)\n {\n-\n \tstruct vhost_server *vserver;\n \n-\tif (g_vhost_server != NULL)\n+\tif (vserver_idx == 0) {\n+\t\tfdset_init(&g_vhost_server.fdset);\n+\t\tops = get_virtio_net_callbacks();\n+\t}\n+\tif (vserver_idx == MAX_VHOST_SERVER)\n \t\treturn -1;\n \n \tvserver = calloc(sizeof(struct vhost_server), 1);\n \tif (vserver == NULL)\n \t\treturn -1;\n \n-\tfdset_init(&vserver->fdset);\n-\n \tunlink(path);\n \n \tvserver->listenfd = uds_socket(path);\n@@ -411,13 +436,11 @@ rte_vhost_driver_register(const char *path)\n \t}\n \tvserver->path = path;\n \n-\tfdset_add(&vserver->fdset, vserver->listenfd,\n+\tfdset_add(&g_vhost_server.fdset, vserver->listenfd,\n \t\tvserver_new_vq_conn, NULL,\n \t\tvserver);\n \n-\tops = get_virtio_net_callbacks();\n-\n-\tg_vhost_server = vserver;\n+\tg_vhost_server.server[vserver_idx++] = vserver;\n \n \treturn 0;\n }\n@@ -426,7 +449,7 @@ rte_vhost_driver_register(const char *path)\n int\n rte_vhost_driver_session_start(void)\n {\n-\tfdset_event_dispatch(&g_vhost_server->fdset);\n+\tfdset_event_dispatch(&g_vhost_server.fdset);\n \treturn 0;\n }\n \ndiff --git a/lib/librte_vhost/vhost_user/vhost-net-user.h b/lib/librte_vhost/vhost_user/vhost-net-user.h\nindex 91e8fc3..e2a91a9 100644\n--- a/lib/librte_vhost/vhost_user/vhost-net-user.h\n+++ b/lib/librte_vhost/vhost_user/vhost-net-user.h\n@@ -43,7 +43,6 @@\n struct vhost_server {\n \tconst char *path; /**< The path the uds is bind to. */\n \tint listenfd;     /**< The listener sockfd. */\n-\tstruct fdset fdset; /**< The fd list this vhost server manages. */\n };\n \n /* refer to hw/virtio/vhost-user.c */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "v2",
        "13/14"
    ]
}