get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60964,
    "url": "http://patches.dpdk.org/api/patches/60964/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191011121458.56388-3-mb@smartsharesystems.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": "<20191011121458.56388-3-mb@smartsharesystems.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191011121458.56388-3-mb@smartsharesystems.com",
    "date": "2019-10-11T12:14:58",
    "name": "[v8,2/2] mbuf: add unit test for bulk alloc/free functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "88792bb167c8013fffd8585840161ae755e0f293",
    "submitter": {
        "id": 591,
        "url": "http://patches.dpdk.org/api/people/591/?format=api",
        "name": "Morten Brørup",
        "email": "mb@smartsharesystems.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191011121458.56388-3-mb@smartsharesystems.com/mbox/",
    "series": [
        {
            "id": 6803,
            "url": "http://patches.dpdk.org/api/series/6803/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6803",
            "date": "2019-10-11T12:14:56",
            "name": "mbuf: add bulk free function",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/6803/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60964/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/60964/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 3C7A61EAA2;\n\tFri, 11 Oct 2019 14:15:07 +0200 (CEST)",
            "from smartserver.smartsharesystems.com\n\t(smartserver.smartsharesystems.com [77.243.40.215])\n\tby dpdk.org (Postfix) with ESMTP id D449D1EA6A\n\tfor <dev@dpdk.org>; Fri, 11 Oct 2019 14:15:01 +0200 (CEST)",
            "from dkrd2.smartsharesys.local ([192.168.4.12]) by\n\tsmartserver.smartsharesystems.com with Microsoft\n\tSMTPSVC(6.0.3790.4675); Fri, 11 Oct 2019 14:15:01 +0200"
        ],
        "From": "=?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "To": "dev@dpdk.org",
        "Cc": "olivier.matz@6wind.com, stephen@networkplumber.org,\n\tharry.van.haaren@intel.com, konstantin.ananyev@intel.com, \n\tmattias.ronnblom@ericsson.com, bruce.richardson@intel.com, \n\tarybchenko@solarflare.com, =?utf-8?q?Morten_Br=C3=B8rup?=\n\t<mb@smartsharesystems.com>",
        "Date": "Fri, 11 Oct 2019 12:14:58 +0000",
        "Message-Id": "<20191011121458.56388-3-mb@smartsharesystems.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191011121458.56388-1-mb@smartsharesystems.com>",
        "References": "<20191011121458.56388-1-mb@smartsharesystems.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-OriginalArrivalTime": "11 Oct 2019 12:15:01.0522 (UTC)\n\tFILETIME=[81B3B720:01D5802D]",
        "Subject": "[dpdk-dev] [PATCH v8 2/2] mbuf: add unit test for bulk alloc/free\n\tfunctions",
        "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 unit test for functions for allocating and freeing a bulk of mbufs.\n\nSigned-off-by: Morten Brørup <mb@smartsharesystems.com>\n---\n app/test/test_mbuf.c | 171 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 171 insertions(+)",
    "diff": "diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c\nindex 2a97afe20..fbce0ca7c 100644\n--- a/app/test/test_mbuf.c\n+++ b/app/test/test_mbuf.c\n@@ -12,6 +12,7 @@\n #include <sys/queue.h>\n \n #include <rte_common.h>\n+#include <rte_errno.h>\n #include <rte_debug.h>\n #include <rte_log.h>\n #include <rte_memory.h>\n@@ -545,6 +546,170 @@ test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)\n \treturn ret;\n }\n \n+/*\n+ * test bulk allocation and bulk free of mbufs\n+ */\n+static int\n+test_pktmbuf_pool_bulk(void)\n+{\n+\tstruct rte_mempool *pool = NULL;\n+\tstruct rte_mempool *pool2 = NULL;\n+\tunsigned int i;\n+\tstruct rte_mbuf *m;\n+\tstruct rte_mbuf *mbufs[NB_MBUF];\n+\tint ret = 0;\n+\n+\t/* We cannot use the preallocated mbuf pools because their caches\n+\t * prevent us from bulk allocating all objects in them.\n+\t * So we create our own mbuf pools without caches.\n+\t */\n+\tprintf(\"Create mbuf pools for bulk allocation.\\n\");\n+\tpool = rte_pktmbuf_pool_create(\"test_pktmbuf_bulk\",\n+\t\t\tNB_MBUF, 0, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY);\n+\tif (pool == NULL) {\n+\t\tprintf(\"rte_pktmbuf_pool_create() failed. rte_errno %d\\n\",\n+\t\t       rte_errno);\n+\t\tgoto err;\n+\t}\n+\tpool2 = rte_pktmbuf_pool_create(\"test_pktmbuf_bulk2\",\n+\t\t\tNB_MBUF, 0, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY);\n+\tif (pool2 == NULL) {\n+\t\tprintf(\"rte_pktmbuf_pool_create() failed. rte_errno %d\\n\",\n+\t\t       rte_errno);\n+\t\tgoto err;\n+\t}\n+\n+\t/* Preconditions: Mempools must be full. */\n+\tif (!(rte_mempool_full(pool) && rte_mempool_full(pool2))) {\n+\t\tprintf(\"Test precondition failed: mempools not full\\n\");\n+\t\tgoto err;\n+\t}\n+\tif (!(rte_mempool_avail_count(pool) == NB_MBUF &&\n+\t\t\trte_mempool_avail_count(pool2) == NB_MBUF)) {\n+\t\tprintf(\"Test precondition failed: mempools: %u+%u != %u+%u\",\n+\t\t       rte_mempool_avail_count(pool),\n+\t\t       rte_mempool_avail_count(pool2),\n+\t\t       NB_MBUF, NB_MBUF);\n+\t\tgoto err;\n+\t}\n+\n+\tprintf(\"Test single bulk alloc, followed by multiple bulk free.\\n\");\n+\n+\t/* Bulk allocate all mbufs in the pool, in one go. */\n+\tret = rte_pktmbuf_alloc_bulk(pool, mbufs, NB_MBUF);\n+\tif (ret != 0) {\n+\t\tprintf(\"rte_pktmbuf_alloc_bulk() failed: %d\\n\", ret);\n+\t\tgoto err;\n+\t}\n+\t/* Test that they have been removed from the pool. */\n+\tif (!rte_mempool_empty(pool)) {\n+\t\tprintf(\"mempool not empty\\n\");\n+\t\tgoto err;\n+\t}\n+\t/* Bulk free all mbufs, in four steps. */\n+\tfor (i = 0; i < NB_MBUF; i += NB_MBUF / 4) {\n+\t\trte_pktmbuf_free_bulk(&mbufs[i], NB_MBUF / 4);\n+\t\t/* Test that they have been returned to the pool. */\n+\t\tif (rte_mempool_avail_count(pool) != i + NB_MBUF / 4) {\n+\t\t\tprintf(\"mempool avail count incorrect\\n\");\n+\t\t\tgoto err;\n+\t\t}\n+\t}\n+\n+\tprintf(\"Test multiple bulk alloc, followed by single bulk free.\\n\");\n+\n+\t/* Bulk allocate all mbufs in the pool, in four steps. */\n+\tfor (i = 0; i < NB_MBUF; i += NB_MBUF / 4) {\n+\t\tret = rte_pktmbuf_alloc_bulk(pool, &mbufs[i], NB_MBUF / 4);\n+\t\tif (ret != 0) {\n+\t\t\tprintf(\"rte_pktmbuf_alloc_bulk() failed: %d\\n\", ret);\n+\t\t\tgoto err;\n+\t\t}\n+\t}\n+\t/* Test that they have been removed from the pool. */\n+\tif (!rte_mempool_empty(pool)) {\n+\t\tprintf(\"mempool not empty\\n\");\n+\t\tgoto err;\n+\t}\n+\t/* Bulk free all mbufs, in one go. */\n+\trte_pktmbuf_free_bulk(mbufs, NB_MBUF);\n+\t/* Test that they have been returned to the pool. */\n+\tif (!rte_mempool_full(pool)) {\n+\t\tprintf(\"mempool not full\\n\");\n+\t\tgoto err;\n+\t}\n+\n+\tprintf(\"Test bulk free of single long chain.\\n\");\n+\n+\t/* Bulk allocate all mbufs in the pool, in one go. */\n+\tret = rte_pktmbuf_alloc_bulk(pool, mbufs, NB_MBUF);\n+\tif (ret != 0) {\n+\t\tprintf(\"rte_pktmbuf_alloc_bulk() failed: %d\\n\", ret);\n+\t\tgoto err;\n+\t}\n+\t/* Create a long mbuf chain. */\n+\tfor (i = 1; i < NB_MBUF; i++) {\n+\t\tret = rte_pktmbuf_chain(mbufs[0], mbufs[i]);\n+\t\tif (ret != 0) {\n+\t\t\tprintf(\"rte_pktmbuf_chain() failed: %d\\n\", ret);\n+\t\t\tgoto err;\n+\t\t}\n+\t\tmbufs[i] = NULL;\n+\t}\n+\t/* Free the mbuf chain containing all the mbufs. */\n+\trte_pktmbuf_free_bulk(mbufs, 1);\n+\t/* Test that they have been returned to the pool. */\n+\tif (!rte_mempool_full(pool)) {\n+\t\tprintf(\"mempool not full\\n\");\n+\t\tgoto err;\n+\t}\n+\n+\tprintf(\"Test bulk free of multiple chains using multiple pools.\\n\");\n+\n+\t/* Create mbuf chains containing mbufs from different pools. */\n+\tfor (i = 0; i < NB_MBUF * 2; i++) {\n+\t\tm = rte_pktmbuf_alloc((i & 4) ? pool2 : pool);\n+\t\tif (m == NULL) {\n+\t\t\tprintf(\"rte_pktmbuf_alloc() failed (%u)\\n\", i);\n+\t\t\tgoto err;\n+\t\t}\n+\t\tif ((i % 16) == 0) {\n+\t\t\tmbufs[i / 16] = m;\n+\t\t} else {\n+\t\t\trte_pktmbuf_chain(mbufs[i / 16], m);\n+\t\t}\n+\t}\n+\t/* Test that both pools have been emptied. */\n+\tif (!(rte_mempool_empty(pool) && rte_mempool_empty(pool2))) {\n+\t\tprintf(\"mempools not empty\\n\");\n+\t\tgoto err;\n+\t}\n+\t/* Free one mbuf chain. */\n+\trte_pktmbuf_free_bulk(mbufs, 1);\n+\t/* Test that the segments have been returned to the pools. */\n+\tif (!(rte_mempool_avail_count(pool) == 8 &&\n+\t\t\trte_mempool_avail_count(pool2) == 8)) {\n+\t\tprintf(\"all segments of first mbuf have not been returned\\n\");\n+\t\tgoto err;\n+\t}\n+\t/* Free the remaining mbuf chains. */\n+\trte_pktmbuf_free_bulk(&mbufs[1], NB_MBUF * 2 / 16 - 1);\n+\t/* Test that they have been returned to the pools. */\n+\tif (!(rte_mempool_full(pool) && rte_mempool_full(pool2))) {\n+\t\tprintf(\"mempools not full\\n\");\n+\t\tgoto err;\n+\t}\n+\n+\trte_mempool_free(pool);\n+\trte_mempool_free(pool2);\n+\treturn 0;\n+\n+err:\n+\trte_mempool_free(pool);\n+\trte_mempool_free(pool2);\n+\treturn -1;\n+}\n+\n /*\n  * test that the pointer to the data on a packet mbuf is set properly\n  */\n@@ -1162,6 +1327,12 @@ test_mbuf(void)\n \t\tgoto err;\n \t}\n \n+\t/* test bulk mbuf alloc and free */\n+\tif (test_pktmbuf_pool_bulk() < 0) {\n+\t\tprintf(\"test_pktmbuf_pool_bulk() failed\\n\");\n+\t\tgoto err;\n+\t}\n+\n \t/* test that the pointer to the data on a packet mbuf is set properly */\n \tif (test_pktmbuf_pool_ptr(pktmbuf_pool) < 0) {\n \t\tprintf(\"test_pktmbuf_pool_ptr() failed\\n\");\n",
    "prefixes": [
        "v8",
        "2/2"
    ]
}