get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62228,
    "url": "http://patchwork.dpdk.org/api/patches/62228/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20191030143619.4007-5-olivier.matz@6wind.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": "<20191030143619.4007-5-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191030143619.4007-5-olivier.matz@6wind.com",
    "date": "2019-10-30T14:36:17",
    "name": "[v2,4/6] mempool: introduce function to get mempool page size",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e9f836772b9cdcc9e89acb4948fe2aa285f603d7",
    "submitter": {
        "id": 8,
        "url": "http://patchwork.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20191030143619.4007-5-olivier.matz@6wind.com/mbox/",
    "series": [
        {
            "id": 7161,
            "url": "http://patchwork.dpdk.org/api/series/7161/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=7161",
            "date": "2019-10-30T14:36:15",
            "name": "mempool: avoid objects allocations across pages",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/7161/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/62228/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/62228/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1973DA00BE;\n\tWed, 30 Oct 2019 15:37:33 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 770AE1C020;\n\tWed, 30 Oct 2019 15:37:06 +0100 (CET)",
            "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 8D03A1BF95\n for <dev@dpdk.org>; Wed, 30 Oct 2019 15:36:57 +0100 (CET)",
            "from glumotte.dev.6wind.com. (unknown [10.16.0.195])\n by proxy.6wind.com (Postfix) with ESMTP id D2FA7338A4C;\n Wed, 30 Oct 2019 15:36:55 +0100 (CET)"
        ],
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "Anatoly Burakov <anatoly.burakov@intel.com>,\n Andrew Rybchenko <arybchenko@solarflare.com>,\n Ferruh Yigit <ferruh.yigit@linux.intel.com>,\n \"Giridharan, Ganesan\" <ggiridharan@rbbn.com>,\n Jerin Jacob Kollanukkaran <jerinj@marvell.com>,\n \"Kiran Kumar Kokkilagadda\" <kirankumark@marvell.com>,\n Stephen Hemminger <sthemmin@microsoft.com>,\n Thomas Monjalon <thomas@monjalon.net>,\n Vamsi Krishna Attunuru <vattunuru@marvell.com>",
        "Date": "Wed, 30 Oct 2019 15:36:17 +0100",
        "Message-Id": "<20191030143619.4007-5-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20191030143619.4007-1-olivier.matz@6wind.com>",
        "References": "<20190719133845.32432-1-olivier.matz@6wind.com>\n <20191030143619.4007-1-olivier.matz@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 4/6] mempool: introduce function to get\n\tmempool page size",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "In rte_mempool_populate_default(), we determine the page size,\nwhich is needed for calc_size and allocation of memory.\n\nMove this in a function and export it, it will be used in next\ncommit.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\nReviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n lib/librte_mempool/rte_mempool.c           | 51 ++++++++++++++--------\n lib/librte_mempool/rte_mempool.h           |  7 +++\n lib/librte_mempool/rte_mempool_version.map |  1 +\n 3 files changed, 40 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex 213e574fc..758c5410b 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -414,6 +414,33 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\n \treturn ret;\n }\n \n+/* Get the minimal page size used in a mempool before populating it. */\n+int\n+rte_mempool_get_page_size(struct rte_mempool *mp, size_t *pg_sz)\n+{\n+\tbool need_iova_contig_obj;\n+\tbool alloc_in_ext_mem;\n+\tint ret;\n+\n+\t/* check if we can retrieve a valid socket ID */\n+\tret = rte_malloc_heap_socket_is_external(mp->socket_id);\n+\tif (ret < 0)\n+\t\treturn -EINVAL;\n+\talloc_in_ext_mem = (ret == 1);\n+\tneed_iova_contig_obj = !(mp->flags & MEMPOOL_F_NO_IOVA_CONTIG);\n+\n+\tif (!need_iova_contig_obj)\n+\t\t*pg_sz = 0;\n+\telse if (!alloc_in_ext_mem && rte_eal_iova_mode() == RTE_IOVA_VA)\n+\t\t*pg_sz = 0;\n+\telse if (rte_eal_has_hugepages() || alloc_in_ext_mem)\n+\t\t*pg_sz = get_min_page_size(mp->socket_id);\n+\telse\n+\t\t*pg_sz = getpagesize();\n+\n+\treturn 0;\n+}\n+\n /* Default function to populate the mempool: allocate memory in memzones,\n  * and populate them. Return the number of objects added, or a negative\n  * value on error.\n@@ -425,12 +452,11 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \tchar mz_name[RTE_MEMZONE_NAMESIZE];\n \tconst struct rte_memzone *mz;\n \tssize_t mem_size;\n-\tsize_t align, pg_sz, pg_shift;\n+\tsize_t align, pg_sz, pg_shift = 0;\n \trte_iova_t iova;\n \tunsigned mz_id, n;\n \tint ret;\n \tbool need_iova_contig_obj;\n-\tbool alloc_in_ext_mem;\n \n \tret = mempool_ops_alloc_once(mp);\n \tif (ret != 0)\n@@ -485,26 +511,13 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \t * synonymous with IOVA contiguousness will not hold.\n \t */\n \n-\t/* check if we can retrieve a valid socket ID */\n-\tret = rte_malloc_heap_socket_is_external(mp->socket_id);\n-\tif (ret < 0)\n-\t\treturn -EINVAL;\n-\talloc_in_ext_mem = (ret == 1);\n \tneed_iova_contig_obj = !(mp->flags & MEMPOOL_F_NO_IOVA_CONTIG);\n+\tret = rte_mempool_get_page_size(mp, &pg_sz);\n+\tif (ret < 0)\n+\t\treturn ret;\n \n-\tif (!need_iova_contig_obj) {\n-\t\tpg_sz = 0;\n-\t\tpg_shift = 0;\n-\t} else if (!alloc_in_ext_mem && rte_eal_iova_mode() == RTE_IOVA_VA) {\n-\t\tpg_sz = 0;\n-\t\tpg_shift = 0;\n-\t} else if (rte_eal_has_hugepages() || alloc_in_ext_mem) {\n-\t\tpg_sz = get_min_page_size(mp->socket_id);\n-\t\tpg_shift = rte_bsf32(pg_sz);\n-\t} else {\n-\t\tpg_sz = getpagesize();\n+\tif (pg_sz != 0)\n \t\tpg_shift = rte_bsf32(pg_sz);\n-\t}\n \n \tfor (mz_id = 0, n = mp->size; n > 0; mz_id++, n -= ret) {\n \t\tsize_t min_chunk_size;\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 8fa3c04e5..6d98b3743 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -1691,6 +1691,13 @@ uint32_t rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags,\n void rte_mempool_walk(void (*func)(struct rte_mempool *, void *arg),\n \t\t      void *arg);\n \n+/**\n+ * @internal Get page size used for mempool object allocation.\n+ */\n+__rte_experimental\n+int\n+rte_mempool_get_page_size(struct rte_mempool *mp, size_t *pg_sz);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map\nindex 17cbca460..4eff2767d 100644\n--- a/lib/librte_mempool/rte_mempool_version.map\n+++ b/lib/librte_mempool/rte_mempool_version.map\n@@ -56,5 +56,6 @@ DPDK_18.05 {\n EXPERIMENTAL {\n \tglobal:\n \n+\trte_mempool_get_page_size;\n \trte_mempool_ops_get_info;\n };\n",
    "prefixes": [
        "v2",
        "4/6"
    ]
}