get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 12415,
    "url": "http://patches.dpdk.org/api/patches/12415/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1462472982-49782-2-git-send-email-david.hunt@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1462472982-49782-2-git-send-email-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1462472982-49782-2-git-send-email-david.hunt@intel.com",
    "date": "2016-05-05T18:29:41",
    "name": "[dpdk-dev,1/2] mempool: add stack (fifo) mempool handler",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0b76062fc1abccffc44de421c7d0de519327a102",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1462472982-49782-2-git-send-email-david.hunt@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/12415/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/12415/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 CA7B75962;\n\tThu,  5 May 2016 20:30:23 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 997155962\n\tfor <dev@dpdk.org>; Thu,  5 May 2016 20:30:21 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga101.fm.intel.com with ESMTP; 05 May 2016 11:29:55 -0700",
            "from sie-lab-214-251.ir.intel.com (HELO silpixa373510.ir.intel.com)\n\t([10.237.214.251])\n\tby orsmga003.jf.intel.com with ESMTP; 05 May 2016 11:29:54 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,583,1455004800\"; d=\"scan'208\";a=\"799726912\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "olivier.matz@6wind.com",
        "Cc": "dev@dpdk.org,\n\tDavid Hunt <david.hunt@intel.com>",
        "Date": "Thu,  5 May 2016 19:29:41 +0100",
        "Message-Id": "<1462472982-49782-2-git-send-email-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1462472982-49782-1-git-send-email-david.hunt@intel.com>",
        "References": "<1462472982-49782-1-git-send-email-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/2] mempool: add stack (fifo) mempool handler",
        "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": "This is a mempool handler that is useful for pipelining apps, where\nthe mempool cache doesn't really work - example, where we have one\ncore doing rx (and alloc), and another core doing Tx (and return). In\nsuch a case, the mempool ring simply cycles through all the mbufs,\nresulting in a LLC miss on every mbuf allocated when the number of\nmbufs is large. A stack recycles buffers more effectively in this\ncase.\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n lib/librte_mempool/Makefile            |   1 +\n lib/librte_mempool/rte_mempool_stack.c | 154 +++++++++++++++++++++++++++++++++\n 2 files changed, 155 insertions(+)\n create mode 100644 lib/librte_mempool/rte_mempool_stack.c",
    "diff": "diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile\nindex f19366e..5aa9ef8 100644\n--- a/lib/librte_mempool/Makefile\n+++ b/lib/librte_mempool/Makefile\n@@ -44,6 +44,7 @@ LIBABIVER := 2\n SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c\n SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_handler.c\n SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_default.c\n+SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_stack.c\n # install includes\n SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h\n \ndiff --git a/lib/librte_mempool/rte_mempool_stack.c b/lib/librte_mempool/rte_mempool_stack.c\nnew file mode 100644\nindex 0000000..1874781\n--- /dev/null\n+++ b/lib/librte_mempool/rte_mempool_stack.c\n@@ -0,0 +1,154 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdio.h>\n+#include <rte_mempool.h>\n+#include <rte_malloc.h>\n+#include <string.h>\n+\n+struct rte_mempool_common_stack\n+{\n+\t/* Spinlock to protect access */\n+\trte_spinlock_t sl;\n+\n+\tuint32_t size;\n+\tuint32_t len;\n+\tvoid *objs[];\n+\n+#ifdef RTE_LIBRTE_MEMPOOL_DEBUG\n+#endif\n+};\n+\n+static void *\n+common_stack_alloc(struct rte_mempool *mp)\n+{\n+\tstruct rte_mempool_common_stack *s;\n+\tchar stack_name[RTE_RING_NAMESIZE];\n+\tunsigned n = mp->size;\n+\tint size = sizeof(*s) + (n+16)*sizeof(void*);\n+\n+\t/* Allocate our local memory structure */\n+\tsnprintf(stack_name, sizeof(stack_name), \"%s-common-stack\", mp->name);\n+\ts = rte_zmalloc_socket(stack_name,\n+\t\t\tsize,\n+\t\t\tRTE_CACHE_LINE_SIZE,\n+\t\t\tmp->socket_id);\n+\tif (s == NULL) {\n+\t\tRTE_LOG(ERR, MEMPOOL, \"Cannot allocate stack!\\n\");\n+\t\treturn NULL;\n+\t}\n+\n+\t/* And the spinlock we use to protect access */\n+\trte_spinlock_init(&s->sl);\n+\n+\ts->size = n;\n+\tmp->pool = (void *) s;\n+\trte_mempool_set_handler(mp, \"stack\");\n+\n+\treturn (void *) s;\n+}\n+\n+static int common_stack_put(void *p, void * const *obj_table,\n+\t\tunsigned n)\n+{\n+\tstruct rte_mempool_common_stack * s = (struct rte_mempool_common_stack *)p;\n+\tvoid **cache_objs;\n+\tunsigned index;\n+\n+\t/* Acquire lock */\n+\trte_spinlock_lock(&s->sl);\n+\tcache_objs = &s->objs[s->len];\n+\n+\t/* Is there sufficient space in the stack ? */\n+\tif((s->len + n) > s->size) {\n+\t\trte_spinlock_unlock(&s->sl);\n+\t\treturn -ENOENT;\n+\t}\n+\n+\t/* Add elements back into the cache */\n+\tfor (index = 0; index < n; ++index, obj_table++)\n+\t\tcache_objs[index] = *obj_table;\n+\n+\ts->len += n;\n+\n+\trte_spinlock_unlock(&s->sl);\n+\treturn 0;\n+}\n+\n+static int common_stack_get(void *p, void **obj_table,\n+\t\tunsigned n)\n+{\n+\tstruct rte_mempool_common_stack * s = (struct rte_mempool_common_stack *)p;\n+\tvoid **cache_objs;\n+\tunsigned index, len;\n+\n+\t/* Acquire lock */\n+\trte_spinlock_lock(&s->sl);\n+\n+\tif(unlikely(n > s->len)) {\n+\t\trte_spinlock_unlock(&s->sl);\n+\t\treturn -ENOENT;\n+\t}\n+\n+\tcache_objs = s->objs;\n+\n+\tfor (index = 0, len = s->len - 1; index < n; ++index, len--, obj_table++)\n+\t\t*obj_table = cache_objs[len];\n+\n+\ts->len -= n;\n+\trte_spinlock_unlock(&s->sl);\n+\treturn n;\n+}\n+\n+static unsigned common_stack_get_count(void *p)\n+{\n+\tstruct rte_mempool_common_stack * s = (struct rte_mempool_common_stack *)p;\n+\treturn s->len;\n+}\n+\n+static void\n+common_stack_free(void *p)\n+{\n+\trte_free((struct rte_mempool_common_stack *)p);\n+}\n+\n+static struct rte_mempool_handler handler_stack = {\n+\t.name = \"stack\",\n+\t.alloc = common_stack_alloc,\n+\t.free = common_stack_free,\n+\t.put = common_stack_put,\n+\t.get = common_stack_get,\n+\t.get_count = common_stack_get_count\n+};\n+\n+MEMPOOL_REGISTER_HANDLER(handler_stack);\n",
    "prefixes": [
        "dpdk-dev",
        "1/2"
    ]
}