get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7358,
    "url": "https://patches.dpdk.org/api/patches/7358/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443776883-6654-1-git-send-email-bernard.iremonger@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": "<1443776883-6654-1-git-send-email-bernard.iremonger@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443776883-6654-1-git-send-email-bernard.iremonger@intel.com",
    "date": "2015-10-02T09:08:02",
    "name": "[dpdk-dev,1/2] xenvirt: add support for PCI Port Hotplug",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d9ba0253470cc86b0340591ff6a522bd3f0b90b3",
    "submitter": {
        "id": 91,
        "url": "https://patches.dpdk.org/api/people/91/?format=api",
        "name": "Iremonger, Bernard",
        "email": "bernard.iremonger@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443776883-6654-1-git-send-email-bernard.iremonger@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7358/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7358/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 5FC818D93;\n\tFri,  2 Oct 2015 11:08:10 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 0E695E72\n\tfor <dev@dpdk.org>; Fri,  2 Oct 2015 11:08:07 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga103.fm.intel.com with ESMTP; 02 Oct 2015 02:08:06 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga001.jf.intel.com with ESMTP; 02 Oct 2015 02:08:05 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt92985x8007631; Fri, 2 Oct 2015 10:08:05 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id t92985Bi006693;\n\tFri, 2 Oct 2015 10:08:05 +0100",
            "(from bairemon@localhost)\n\tby sivswdev01.ir.intel.com with  id t92985Jo006689;\n\tFri, 2 Oct 2015 10:08:05 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,622,1437462000\"; d=\"scan'208\";a=\"782610630\"",
        "From": "Bernard Iremonger <bernard.iremonger@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri,  2 Oct 2015 10:08:02 +0100",
        "Message-Id": "<1443776883-6654-1-git-send-email-bernard.iremonger@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<PATCH>",
        "References": "<PATCH>",
        "Subject": "[dpdk-dev] [PATCH 1/2] xenvirt: add support for PCI Port Hotplug",
        "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: Bernard Iremonger <bernard.iremonger@intel.com>\n---\n drivers/net/xenvirt/rte_eth_xenvirt.c | 63 +++++++++++++++++++++++++++++++----\n drivers/net/xenvirt/rte_xen_lib.c     | 26 ++++++++++++---\n drivers/net/xenvirt/rte_xen_lib.h     |  5 ++-\n 3 files changed, 83 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c\nindex b3383af..8923826 100644\n--- a/drivers/net/xenvirt/rte_eth_xenvirt.c\n+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -642,10 +642,14 @@ eth_dev_xenvirt_create(const char *name, const char *params,\n \tif (internals == NULL)\n \t\tgoto err;\n \n-\t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n-\tif (eth_dev == NULL)\n-\t\tgoto err;\n+\t/* find an ethdev entry */\n+\teth_dev = rte_eth_dev_allocated(name);\n+\tif (eth_dev == NULL) {\n+\t\t/* reserve an ethdev entry */\n+\t\teth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);\n+\t\tif (eth_dev == NULL)\n+\t\t\tgoto err;\n+\t}\n \n \tdata->dev_private = internals;\n \tdata->port_id = eth_dev->data->port_id;\n@@ -661,7 +665,7 @@ eth_dev_xenvirt_create(const char *name, const char *params,\n \n \teth_dev->data = data;\n \teth_dev->dev_ops = &ops;\n-\teth_dev->data->dev_flags = 0;\n+\teth_dev->data->dev_flags = RTE_PCI_DRV_DETACHABLE;\n \teth_dev->data->kdrv = RTE_KDRV_NONE;\n \teth_dev->data->drv_name = NULL;\n \teth_dev->driver = NULL;\n@@ -683,6 +687,38 @@ err:\n }\n \n \n+static int\n+eth_dev_xenvirt_free(const char *name, const unsigned numa_node)\n+{\n+\tstruct rte_eth_dev *eth_dev = NULL;\n+\n+\tRTE_LOG(DEBUG, PMD,\n+\t\t\"Free virtio rings backed ethdev on numa socket %u\\n\",\n+\t\tnuma_node);\n+\n+\t/* find an ethdev entry */\n+\teth_dev = rte_eth_dev_allocated(name);\n+\tif (eth_dev == NULL)\n+\t\treturn -1;\n+\n+\tif (eth_dev->data->dev_started == 1) {\n+\t\teth_dev_stop(eth_dev);\n+\t\teth_dev_close(eth_dev);\n+\t}\n+\n+\teth_dev->rx_pkt_burst = NULL;\n+\teth_dev->tx_pkt_burst = NULL;\n+\teth_dev->dev_ops = NULL;\n+\n+\trte_free(eth_dev->data);\n+\trte_free(eth_dev->data->dev_private);\n+\trte_free(eth_dev->data->mac_addrs);\n+\n+\tvirtio_idx--;\n+\n+\treturn 0;\n+}\n+\n /*TODO: Support multiple process model */\n static int\n rte_pmd_xenvirt_devinit(const char *name, const char *params)\n@@ -701,10 +737,25 @@ rte_pmd_xenvirt_devinit(const char *name, const char *params)\n \treturn 0;\n }\n \n+static int\n+rte_pmd_xenvirt_devuninit(const char *name)\n+{\n+\teth_dev_xenvirt_free(name, rte_socket_id());\n+\n+\tif (virtio_idx == 0) {\n+\t\tif (xenstore_uninit() != 0)\n+\t\t\tRTE_LOG(ERR, PMD, \"%s: xenstore uninit failed\\n\", __func__);\n+\n+\t\tgntalloc_close();\n+\t}\n+\treturn 0;\n+}\n+\n static struct rte_driver pmd_xenvirt_drv = {\n \t.name = \"eth_xenvirt\",\n \t.type = PMD_VDEV,\n \t.init = rte_pmd_xenvirt_devinit,\n+\t.uninit = rte_pmd_xenvirt_devuninit,\n };\n \n PMD_REGISTER_DRIVER(pmd_xenvirt_drv);\ndiff --git a/drivers/net/xenvirt/rte_xen_lib.c b/drivers/net/xenvirt/rte_xen_lib.c\nindex b3932f0..5900b53 100644\n--- a/drivers/net/xenvirt/rte_xen_lib.c\n+++ b/drivers/net/xenvirt/rte_xen_lib.c\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -50,6 +50,7 @@\n \n #include <rte_common.h>\n #include <rte_string_fns.h>\n+#include <rte_malloc.h>\n \n #include \"rte_xen_lib.h\"\n \n@@ -72,6 +73,8 @@ int gntalloc_fd = -1;\n static char *dompath = NULL;\n /* handle to xenstore read/write operations */\n static struct xs_handle *xs = NULL;\n+/* flag to indicate if xenstore cleanup is required */\n+static bool is_xenstore_cleaned_up;\n \n /*\n  * Reserve a virtual address space.\n@@ -275,7 +278,6 @@ xenstore_init(void)\n {\n \tunsigned int len, domid;\n \tchar *buf;\n-\tstatic int cleanup = 0;\n \tchar *end;\n \n \txs = xs_domain_open();\n@@ -301,16 +303,32 @@ xenstore_init(void)\n \n \txs_transaction_start(xs); /* When to stop transaction */\n \n-\tif (cleanup == 0) {\n+\tif (is_xenstore_cleaned_up == 0) {\n \t\tif (xenstore_cleanup())\n \t\t\treturn -1;\n-\t\tcleanup = 1;\n+\t\tis_xenstore_cleaned_up = 1;\n \t}\n \n \treturn 0;\n }\n \n int\n+xenstore_uninit(void)\n+{\n+\txs_close(xs);\n+\n+\tif (is_xenstore_cleaned_up == 0) {\n+\t\tif (xenstore_cleanup())\n+\t\t\treturn -1;\n+\t\tis_xenstore_cleaned_up = 1;\n+\t}\n+\tfree(dompath);\n+\tdompath = NULL;\n+\n+\treturn 0;\n+}\n+\n+int\n xenstore_write(const char *key_str, const char *val_str)\n {\n \tchar grant_path[PATH_MAX];\ndiff --git a/drivers/net/xenvirt/rte_xen_lib.h b/drivers/net/xenvirt/rte_xen_lib.h\nindex 0ba7148..d973eac 100644\n--- a/drivers/net/xenvirt/rte_xen_lib.h\n+++ b/drivers/net/xenvirt/rte_xen_lib.h\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -93,6 +93,9 @@ int\n xenstore_init(void);\n \n int\n+xenstore_uninit(void);\n+\n+int\n xenstore_write(const char *key_str, const char *val_str);\n \n int\n",
    "prefixes": [
        "dpdk-dev",
        "1/2"
    ]
}