get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7371,
    "url": "https://patches.dpdk.org/api/patches/7371/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443794485-215546-1-git-send-email-pablo.de.lara.guarch@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": "<1443794485-215546-1-git-send-email-pablo.de.lara.guarch@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1443794485-215546-1-git-send-email-pablo.de.lara.guarch@intel.com",
    "date": "2015-10-02T14:01:25",
    "name": "[dpdk-dev,v3] ring: add function to free a ring",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f60015f6e08ebc05c29a0df6ddd57638f9ff0818",
    "submitter": {
        "id": 9,
        "url": "https://patches.dpdk.org/api/people/9/?format=api",
        "name": "De Lara Guarch, Pablo",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443794485-215546-1-git-send-email-pablo.de.lara.guarch@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7371/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7371/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 B29C28E6E;\n\tFri,  2 Oct 2015 16:01:33 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id E108B8E67\n\tfor <dev@dpdk.org>; Fri,  2 Oct 2015 16:01:31 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga102.fm.intel.com with ESMTP; 02 Oct 2015 07:01:28 -0700",
            "from sie-lab-214-036.ir.intel.com (HELO\n\tsie-lab-214-174.ir.intel.com) ([10.237.214.36])\n\tby orsmga002.jf.intel.com with ESMTP; 02 Oct 2015 07:01:28 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,623,1437462000\"; d=\"scan'208\";a=\"817961085\"",
        "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri,  2 Oct 2015 15:01:25 +0100",
        "Message-Id": "<1443794485-215546-1-git-send-email-pablo.de.lara.guarch@intel.com>",
        "X-Mailer": "git-send-email 2.4.3",
        "In-Reply-To": "<1442930122-119572-1-git-send-email-pablo.de.lara.guarch@intel.com>",
        "References": "<1442930122-119572-1-git-send-email-pablo.de.lara.guarch@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3] ring: add function to free a ring",
        "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": "From: \"Pablo de Lara\" <pablo.de.lara.guarch@intel.com>\n\nWhen creating a ring, a memzone is created to allocate it in memory,\nbut the ring could not be freed, as memzones could not be.\n\nSince memzones can be freed now, then rings can be as well,\ntaking into account if they were initialized using pre-allocated memory\n(in which case, memory should be freed externally) or using rte_memzone_reserve\n(with rte_ring_create), freeing the memory with rte_memzone_free.\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\nChanges in v3:\n - Simplify patch using stored memzone address in ring structure\n - Change copyright date\n\nChanges in v2:\n - Include note in release notes\n - Add error log when ring cannot be freed\n\nThis patch depends on patch \"rte_ring: store memzone pointer inside ring\"\n\n doc/guides/rel_notes/release_2_2.rst |  4 +++\n lib/librte_ring/rte_ring.c           | 47 +++++++++++++++++++++++++++++++++++-\n lib/librte_ring/rte_ring.h           |  7 ++++++\n lib/librte_ring/rte_ring_version.map |  7 ++++++\n 4 files changed, 64 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst\nindex 5687676..24937ac 100644\n--- a/doc/guides/rel_notes/release_2_2.rst\n+++ b/doc/guides/rel_notes/release_2_2.rst\n@@ -4,6 +4,10 @@ DPDK Release 2.2\n New Features\n ------------\n \n+* **Enabled freeing of rte_ring.**\n+\n+  New function rte_ring_free() allows the user to free a ring\n+  if it was created with rte_ring_create().\n \n Resolved Issues\n ---------------\ndiff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c\nindex 4e78e14..d80faf3 100644\n--- a/lib/librte_ring/rte_ring.c\n+++ b/lib/librte_ring/rte_ring.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@@ -209,6 +209,51 @@ rte_ring_create(const char *name, unsigned count, int socket_id,\n \treturn r;\n }\n \n+/* free the ring */\n+void\n+rte_ring_free(struct rte_ring *r)\n+{\n+\tstruct rte_ring_list *ring_list = NULL;\n+\tstruct rte_tailq_entry *te;\n+\n+\tif (r == NULL)\n+\t\treturn;\n+\n+\t/*\n+\t * Ring was not created with rte_ring_create,\n+\t * therefore, there is no memzone to free.\n+\t */\n+\tif (r->memzone == NULL) {\n+\t\tRTE_LOG(ERR, RING, \"Cannot free ring (not created with rte_ring_create()\");\n+\t\treturn;\n+\t}\n+\n+\tif (rte_memzone_free(r->memzone) != 0) {\n+\t\tRTE_LOG(ERR, RING, \"Cannot free memory\\n\");\n+\t\treturn;\n+\t}\n+\n+\tring_list = RTE_TAILQ_CAST(rte_ring_tailq.head, rte_ring_list);\n+\trte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);\n+\n+\t/* find out tailq entry */\n+\tTAILQ_FOREACH(te, ring_list, next) {\n+\t\tif (te->data == (void *) r)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (te == NULL) {\n+\t\trte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);\n+\t\treturn;\n+\t}\n+\n+\tTAILQ_REMOVE(ring_list, te, next);\n+\n+\trte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);\n+\n+\trte_free(te);\n+}\n+\n /*\n  * change the high water mark. If *count* is 0, water marking is\n  * disabled\ndiff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h\nindex df45f3f..fb5a626 100644\n--- a/lib/librte_ring/rte_ring.h\n+++ b/lib/librte_ring/rte_ring.h\n@@ -304,6 +304,13 @@ int rte_ring_init(struct rte_ring *r, const char *name, unsigned count,\n  */\n struct rte_ring *rte_ring_create(const char *name, unsigned count,\n \t\t\t\t int socket_id, unsigned flags);\n+/**\n+ * De-allocate all memory used by the ring.\n+ *\n+ * @param r\n+ *   Ring to free\n+ */\n+void rte_ring_free(struct rte_ring *r);\n \n /**\n  * Change the high water mark.\ndiff --git a/lib/librte_ring/rte_ring_version.map b/lib/librte_ring/rte_ring_version.map\nindex 982fdd1..5474b98 100644\n--- a/lib/librte_ring/rte_ring_version.map\n+++ b/lib/librte_ring/rte_ring_version.map\n@@ -11,3 +11,10 @@ DPDK_2.0 {\n \n \tlocal: *;\n };\n+\n+DPDK_2.2 {\n+\tglobal:\n+\n+\trte_ring_free;\n+\n+} DPDK_2.0;\n",
    "prefixes": [
        "dpdk-dev",
        "v3"
    ]
}