get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42504,
    "url": "http://patchwork.dpdk.org/api/patches/42504/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/19df594b15fcecefc3d9790e7f7b426a4f609a10.1530881548.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<19df594b15fcecefc3d9790e7f7b426a4f609a10.1530881548.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/19df594b15fcecefc3d9790e7f7b426a4f609a10.1530881548.git.anatoly.burakov@intel.com",
    "date": "2018-07-06T13:17:28",
    "name": "[RFC,07/11] malloc: enable creating new malloc heaps",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2d548239ff53657523433ddba4e0ecb57a74afe2",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/19df594b15fcecefc3d9790e7f7b426a4f609a10.1530881548.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 453,
            "url": "http://patchwork.dpdk.org/api/series/453/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=453",
            "date": "2018-07-06T13:17:21",
            "name": "Support externally allocated memory in DPDK",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/453/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/42504/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/42504/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 685201BF0E;\n\tFri,  6 Jul 2018 15:17:49 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 2AA5A1BE4E\n\tfor <dev@dpdk.org>; Fri,  6 Jul 2018 15:17:38 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 06:17:35 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga005.fm.intel.com with ESMTP; 06 Jul 2018 06:17:34 -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\tw66DHY8f027488; Fri, 6 Jul 2018 14:17:34 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w66DHY5w003797;\n\tFri, 6 Jul 2018 14:17:34 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w66DHXaI003793;\n\tFri, 6 Jul 2018 14:17:33 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,316,1526367600\"; d=\"scan'208\";a=\"243136088\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "srinath.mannam@broadcom.com, scott.branden@broadcom.com,\n\tajit.khaparde@broadcom.com",
        "Date": "Fri,  6 Jul 2018 14:17:28 +0100",
        "Message-Id": "<19df594b15fcecefc3d9790e7f7b426a4f609a10.1530881548.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1530881548.git.anatoly.burakov@intel.com>",
            "<cover.1530881548.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1530881548.git.anatoly.burakov@intel.com>",
            "<cover.1530881548.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [RFC 07/11] malloc: enable creating new malloc heaps",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add API to allow creating new malloc heaps. They will be created\nwith indexes higher than heaps reserved for NUMA sockets, and up to\nRTE_MAX_HEAPS.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/include/rte_malloc.h | 21 ++++++++++\n lib/librte_eal/common/malloc_heap.c        | 16 ++++++++\n lib/librte_eal/common/malloc_heap.h        |  3 ++\n lib/librte_eal/common/rte_malloc.c         | 46 ++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map         |  1 +\n 5 files changed, 87 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h\nindex f1bcd9b65..fa6de073a 100644\n--- a/lib/librte_eal/common/include/rte_malloc.h\n+++ b/lib/librte_eal/common/include/rte_malloc.h\n@@ -253,6 +253,27 @@ rte_malloc_from_heap(const char *heap_name, const char *type, size_t size,\n void\n rte_free(void *ptr);\n \n+/**\n+ * Creates a new empty malloc heap with a specified name.\n+ *\n+ * @note Concurrently creating or destroying heaps is not safe.\n+ *\n+ * @note This function does not need to be called in multiple processes, as\n+ *   multiprocess synchronization will happen automatically as far as heap data\n+ *   is concerned. However, before accessing pointers to memory in this heap, it\n+ *   is responsibility of the user to ensure that the heap memory is accessible\n+ *   in all processes.\n+ *\n+ * @param heap_name\n+ *   Name of the heap to create.\n+ *\n+ * @return\n+ *   - 0 on successful creation.\n+ *   - -1 on error.\n+ */\n+int __rte_experimental\n+rte_malloc_heap_create(const char *heap_name);\n+\n /**\n  * If malloc debug is enabled, check a memory block for header\n  * and trailer markers to indicate that all is well with the block.\ndiff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c\nindex a33acc252..f5d103626 100644\n--- a/lib/librte_eal/common/malloc_heap.c\n+++ b/lib/librte_eal/common/malloc_heap.c\n@@ -892,6 +892,22 @@ malloc_heap_dump(struct malloc_heap *heap, FILE *f)\n \trte_spinlock_unlock(&heap->lock);\n }\n \n+int\n+malloc_heap_create(struct malloc_heap *heap, const char *heap_name)\n+{\n+\t/* initialize empty heap */\n+\theap->alloc_count = 0;\n+\theap->first = NULL;\n+\theap->last = NULL;\n+\tLIST_INIT(heap->free_head);\n+\trte_spinlock_init(&heap->lock);\n+\theap->total_size = 0;\n+\n+\t/* set up name */\n+\tstrlcpy(heap->name, heap_name, RTE_HEAP_NAME_MAX_LEN);\n+\treturn 0;\n+}\n+\n int\n rte_eal_malloc_heap_init(void)\n {\ndiff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h\nindex a7e408c99..aa819ef65 100644\n--- a/lib/librte_eal/common/malloc_heap.h\n+++ b/lib/librte_eal/common/malloc_heap.h\n@@ -35,6 +35,9 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size,\n \t\tunsigned int heap_id, unsigned int flags, size_t align,\n \t\tsize_t bound, bool contig);\n \n+int\n+malloc_heap_create(struct malloc_heap *heap, const char *heap_name);\n+\n int\n malloc_heap_find_named_heap_idx(const char *name);\n \ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex 215876a59..e000dc5b7 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -12,6 +12,7 @@\n #include <rte_memory.h>\n #include <rte_eal.h>\n #include <rte_eal_memconfig.h>\n+#include <rte_errno.h>\n #include <rte_branch_prediction.h>\n #include <rte_debug.h>\n #include <rte_launch.h>\n@@ -272,3 +273,48 @@ rte_malloc_virt2iova(const void *addr)\n \n \treturn ms->iova + RTE_PTR_DIFF(addr, ms->addr);\n }\n+\n+int\n+rte_malloc_heap_create(const char *heap_name)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\tstruct malloc_heap *heap = NULL;\n+\tint i;\n+\n+\t/* iova_addrs is allowed to be NULL */\n+\tif (heap_name == NULL ||\n+\t\t\tstrnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) == 0 ||\n+\t\t\tstrnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) ==\n+\t\t\t\tRTE_HEAP_NAME_MAX_LEN) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\t/* check if there is space in the heap list, or if heap with this name\n+\t * already exists. start from non-socket heaps.\n+\t */\n+\tfor (i = rte_socket_count(); i < RTE_MAX_HEAPS; i++) {\n+\t\tstruct malloc_heap *tmp = &mcfg->malloc_heaps[i];\n+\t\t/* existing heap */\n+\t\tif (strncmp(heap_name, tmp->name,\n+\t\t\t\tRTE_HEAP_NAME_MAX_LEN) == 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"Heap %s already exists\\n\",\n+\t\t\t\theap_name);\n+\t\t\trte_errno = EEXIST;\n+\t\t\treturn -1;\n+\t\t}\n+\t\t/* empty heap */\n+\t\tif (strnlen(tmp->name, RTE_HEAP_NAME_MAX_LEN) == 0) {\n+\t\t\theap = tmp;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (heap == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot create new heap: no space\\n\");\n+\t\trte_errno = ENOSPC;\n+\t\treturn -1;\n+\t}\n+\n+\t/* we're sure that we can create a new heap, so do it */\n+\treturn malloc_heap_create(heap, heap_name);\n+}\n+\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 716a7585d..f3c375156 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -280,6 +280,7 @@ EXPERIMENTAL {\n \trte_malloc_dump_heaps;\n \trte_malloc_from_heap;\n \trte_malloc_get_stats_from_heap;\n+\trte_malloc_heap_create;\n \trte_mem_alloc_validator_register;\n \trte_mem_alloc_validator_unregister;\n \trte_mem_event_callback_register;\n",
    "prefixes": [
        "RFC",
        "07/11"
    ]
}