get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64850,
    "url": "http://patches.dpdk.org/api/patches/64850/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200117145754.11682-4-olivier.matz@6wind.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": "<20200117145754.11682-4-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200117145754.11682-4-olivier.matz@6wind.com",
    "date": "2020-01-17T14:57:54",
    "name": "[v2,3/3,20.05] mempool: return 0 if area is too small on populate",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ad879d9d5e98c7f9c9760f3b0e93ab877cb369d4",
    "submitter": {
        "id": 8,
        "url": "http://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.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/20200117145754.11682-4-olivier.matz@6wind.com/mbox/",
    "series": [
        {
            "id": 8198,
            "url": "http://patches.dpdk.org/api/series/8198/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8198",
            "date": "2020-01-17T14:57:51",
            "name": "mempool: fix mempool virt populate with small chunks",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/8198/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64850/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/64850/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 0C828A051A;\n\tFri, 17 Jan 2020 15:58:31 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F3C562BC8;\n\tFri, 17 Jan 2020 15:58:19 +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 22B8D29C6;\n Fri, 17 Jan 2020 15:58:15 +0100 (CET)",
            "from glumotte.dev.6wind.com. (unknown [10.16.0.195])\n by proxy.6wind.com (Postfix) with ESMTP id 0447736DD34;\n Fri, 17 Jan 2020 15:58:15 +0100 (CET)"
        ],
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "\"Zhang, AlvinX\" <alvinx.zhang@intel.com>,\n \"Burakov, Anatoly\" <anatoly.burakov@intel.com>,\n Andrew Rybchenko <arybchenko@solarflare.com>,\n Bruce Richardson <bruce.richardson@intel.com>,\n David Marchand <david.marchand@redhat.com>, dpdk stable <stable@dpdk.org>",
        "Date": "Fri, 17 Jan 2020 15:57:54 +0100",
        "Message-Id": "<20200117145754.11682-4-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200117145754.11682-1-olivier.matz@6wind.com>",
        "References": "<20200109132720.15664-1-olivier.matz@6wind.com>\n <20200117145754.11682-1-olivier.matz@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 3/3] [20.05] mempool: return 0 if area is too\n\tsmall on populate",
        "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": "Change rte_mempool_populate_iova() and rte_mempool_populate_iova() to\nreturn 0 instead of -EINVAL when there is not enough room to store one\nobject, as it can be helpful for applications to distinguish this\nspecific case.\n\nAs this is an ABI change, use symbol versioning to preserve old\nbehavior for binary applications.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n examples/ntb/ntb_fwd.c                     |  2 +-\n lib/librte_mempool/meson.build             |  1 +\n lib/librte_mempool/rte_mempool.c           | 76 ++++++++++++++++++----\n lib/librte_mempool/rte_mempool.h           | 14 ++--\n lib/librte_mempool/rte_mempool_version.map |  7 ++\n 5 files changed, 84 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c\nindex c914256dd..99a43688c 100644\n--- a/examples/ntb/ntb_fwd.c\n+++ b/examples/ntb/ntb_fwd.c\n@@ -1313,7 +1313,7 @@ ntb_mbuf_pool_create(uint16_t mbuf_seg_size, uint32_t nb_mbuf,\n \t\t\t\t\tmz->len - ntb_info.ntb_hdr_size,\n \t\t\t\t\tntb_mempool_mz_free,\n \t\t\t\t\t(void *)(uintptr_t)mz);\n-\t\tif (ret < 0) {\n+\t\tif (ret <= 0) {\n \t\t\trte_memzone_free(mz);\n \t\t\trte_mempool_free(mp);\n \t\t\treturn NULL;\ndiff --git a/lib/librte_mempool/meson.build b/lib/librte_mempool/meson.build\nindex f8710b61b..4fe267cd8 100644\n--- a/lib/librte_mempool/meson.build\n+++ b/lib/librte_mempool/meson.build\n@@ -18,3 +18,4 @@ deps += ['ring']\n \n # memseg walk is not yet part of stable API\n allow_experimental_apis = true\n+use_function_versioning = true\ndiff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex b434d9f17..0ebb21eec 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -31,6 +31,7 @@\n #include <rte_string_fns.h>\n #include <rte_spinlock.h>\n #include <rte_tailq.h>\n+#include <rte_function_versioning.h>\n \n #include \"rte_mempool.h\"\n \n@@ -293,12 +294,17 @@ mempool_ops_alloc_once(struct rte_mempool *mp)\n \treturn 0;\n }\n \n+__vsym int\n+rte_mempool_populate_iova_v20_0_1(struct rte_mempool *mp, char *vaddr,\n+\trte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb,\n+\tvoid *opaque);\n+\n /* Add objects in the pool, using a physically contiguous memory\n  * zone. Return the number of objects added, or a negative value\n  * on error.\n  */\n-static int\n-__rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n+__vsym int\n+rte_mempool_populate_iova_v20_0_1(struct rte_mempool *mp, char *vaddr,\n \trte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb,\n \tvoid *opaque)\n {\n@@ -355,21 +361,34 @@ __rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n \trte_free(memhdr);\n \treturn ret;\n }\n+BIND_DEFAULT_SYMBOL(rte_mempool_populate_iova, _v20_0_1, 20.0.1);\n+MAP_STATIC_SYMBOL(\n+\tint rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n+\t\t\t\trte_iova_t iova, size_t len,\n+\t\t\t\trte_mempool_memchunk_free_cb_t *free_cb,\n+\t\t\t\tvoid *opaque),\n+\trte_mempool_populate_iova_v20_0_1);\n+\n+__vsym int\n+rte_mempool_populate_iova_v20_0(struct rte_mempool *mp, char *vaddr,\n+\trte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb,\n+\tvoid *opaque);\n \n-int\n-rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n+__vsym int\n+rte_mempool_populate_iova_v20_0(struct rte_mempool *mp, char *vaddr,\n \trte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb,\n \tvoid *opaque)\n {\n \tint ret;\n \n-\tret = __rte_mempool_populate_iova(mp, vaddr, iova, len, free_cb,\n+\tret = rte_mempool_populate_iova_v20_0_1(mp, vaddr, iova, len, free_cb,\n \t\t\t\t\topaque);\n \tif (ret == 0)\n \t\tret = -EINVAL;\n \n \treturn ret;\n }\n+VERSION_SYMBOL(rte_mempool_populate_iova, _v20_0, 20.0);\n \n static rte_iova_t\n get_iova(void *addr)\n@@ -384,11 +403,16 @@ get_iova(void *addr)\n \treturn ms->iova + RTE_PTR_DIFF(addr, ms->addr);\n }\n \n+__vsym int\n+rte_mempool_populate_virt_v20_0_1(struct rte_mempool *mp, char *addr,\n+\tsize_t len, size_t pg_sz, rte_mempool_memchunk_free_cb_t *free_cb,\n+\tvoid *opaque);\n+\n /* Populate the mempool with a virtual area. Return the number of\n  * objects added, or a negative value on error.\n  */\n-int\n-rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\n+__vsym int\n+rte_mempool_populate_virt_v20_0_1(struct rte_mempool *mp, char *addr,\n \tsize_t len, size_t pg_sz, rte_mempool_memchunk_free_cb_t *free_cb,\n \tvoid *opaque)\n {\n@@ -421,7 +445,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\n \t\t\t\tbreak;\n \t\t}\n \n-\t\tret = __rte_mempool_populate_iova(mp, addr + off, iova,\n+\t\tret = rte_mempool_populate_iova_v20_0_1(mp, addr + off, iova,\n \t\t\tphys_len, free_cb, opaque);\n \t\tif (ret == 0)\n \t\t\tcontinue;\n@@ -432,15 +456,41 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\n \t\tcnt += ret;\n \t}\n \n-\tif (cnt == 0)\n-\t\treturn -EINVAL;\n-\n \treturn cnt;\n \n  fail:\n \trte_mempool_free_memchunks(mp);\n \treturn ret;\n }\n+BIND_DEFAULT_SYMBOL(rte_mempool_populate_virt, _v20_0_1, 20.0.1);\n+MAP_STATIC_SYMBOL(\n+\tint rte_mempool_populate_virt(struct rte_mempool *mp,\n+\t\t\t\tchar *addr, size_t len, size_t pg_sz,\n+\t\t\t\trte_mempool_memchunk_free_cb_t *free_cb,\n+\t\t\t\tvoid *opaque),\n+\trte_mempool_populate_virt_v20_0_1);\n+\n+__vsym int\n+rte_mempool_populate_virt_v20_0(struct rte_mempool *mp, char *addr,\n+\tsize_t len, size_t pg_sz, rte_mempool_memchunk_free_cb_t *free_cb,\n+\tvoid *opaque);\n+\n+__vsym int\n+rte_mempool_populate_virt_v20_0(struct rte_mempool *mp, char *addr,\n+\tsize_t len, size_t pg_sz, rte_mempool_memchunk_free_cb_t *free_cb,\n+\tvoid *opaque)\n+{\n+\tint ret;\n+\n+\tret = rte_mempool_populate_virt_v20_0_1(mp, addr, len, pg_sz,\n+\t\t\t\t\t\tfree_cb, opaque);\n+\n+\tif (ret == 0)\n+\t\tret = -EINVAL;\n+\n+\treturn ret;\n+}\n+VERSION_SYMBOL(rte_mempool_populate_virt, _v20_0, 20.0);\n \n /* Get the minimal page size used in a mempool before populating it. */\n int\n@@ -601,6 +651,8 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \t\t\t\tmz->len, pg_sz,\n \t\t\t\trte_mempool_memchunk_mz_free,\n \t\t\t\t(void *)(uintptr_t)mz);\n+\t\tif (ret == 0) /* should not happen */\n+\t\t\tret = -ENOBUFS;\n \t\tif (ret < 0) {\n \t\t\trte_memzone_free(mz);\n \t\t\tgoto fail;\n@@ -692,6 +744,8 @@ rte_mempool_populate_anon(struct rte_mempool *mp)\n \n \tret = rte_mempool_populate_virt(mp, addr, size, getpagesize(),\n \t\trte_mempool_memchunk_anon_free, addr);\n+\tif (ret == 0) /* should not happen */\n+\t\tret = -ENOBUFS;\n \tif (ret < 0) {\n \t\trte_errno = -ret;\n \t\tgoto fail;\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 0a1dc6059..5a106a432 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -1106,9 +1106,12 @@ rte_mempool_free(struct rte_mempool *mp);\n  * @param opaque\n  *   An opaque argument passed to free_cb.\n  * @return\n- *   The number of objects added on success.\n+ *   The number of objects added on success (strictly positive).\n  *   On error, the chunk is not added in the memory list of the\n- *   mempool and a negative errno is returned.\n+ *   mempool the following code is returned:\n+ *     (0): not enough room in chunk for one object.\n+ *     (-ENOSPC): mempool is already populated.\n+ *     (-ENOMEM): allocation failure.\n  */\n int rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n \trte_iova_t iova, size_t len, rte_mempool_memchunk_free_cb_t *free_cb,\n@@ -1133,9 +1136,12 @@ int rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,\n  * @param opaque\n  *   An opaque argument passed to free_cb.\n  * @return\n- *   The number of objects added on success.\n+ *   The number of objects added on success (strictly positive).\n  *   On error, the chunk is not added in the memory list of the\n- *   mempool and a negative errno is returned.\n+ *   mempool the following code is returned:\n+ *     (0): not enough room in chunk for one object.\n+ *     (-ENOSPC): mempool is already populated.\n+ *     (-ENOMEM): allocation failure.\n  */\n int\n rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\ndiff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map\nindex d002dfc46..34d977e47 100644\n--- a/lib/librte_mempool/rte_mempool_version.map\n+++ b/lib/librte_mempool/rte_mempool_version.map\n@@ -35,6 +35,13 @@ DPDK_20.0 {\n \tlocal: *;\n };\n \n+DPDK_20.0.1 {\n+\tglobal:\n+\n+\trte_mempool_populate_iova;\n+\trte_mempool_populate_virt;\n+} DPDK_20.0;\n+\n EXPERIMENTAL {\n \tglobal:\n \n",
    "prefixes": [
        "v2",
        "3/3",
        "20.05"
    ]
}