Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/14438/?format=api
http://patches.dpdk.org/api/patches/14438/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1467157658-28935-2-git-send-email-l@nofutznetworks.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": "<1467157658-28935-2-git-send-email-l@nofutznetworks.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1467157658-28935-2-git-send-email-l@nofutznetworks.com", "date": "2016-06-28T23:47:36", "name": "[dpdk-dev,v5,1/3] mempool: deprecate specific get and put functions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "efea07040a029eee281d8c0fda2e25721cebfd06", "submitter": { "id": 441, "url": "http://patches.dpdk.org/api/people/441/?format=api", "name": "Lazaros Koromilas", "email": "l@nofutznetworks.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1467157658-28935-2-git-send-email-l@nofutznetworks.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/14438/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/14438/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 AFF072BF3;\n\tWed, 29 Jun 2016 01:47:53 +0200 (CEST)", "from mail-pa0-f44.google.com (mail-pa0-f44.google.com\n\t[209.85.220.44]) by dpdk.org (Postfix) with ESMTP id BF8A82BF2\n\tfor <dev@dpdk.org>; Wed, 29 Jun 2016 01:47:51 +0200 (CEST)", "by mail-pa0-f44.google.com with SMTP id b13so10971979pat.0\n\tfor <dev@dpdk.org>; Tue, 28 Jun 2016 16:47:51 -0700 (PDT)", "from lap-3.2f30.org\n\t(cpc92320-cmbg19-2-0-cust3.5-4.cable.virginm.net. [82.13.64.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tp63sm608488pfp.65.2016.06.28.16.47.47\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 28 Jun 2016 16:47:50 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=nofutznetworks-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=9sos0PvkYIOOdYGya//OkVzPo3PZA92XYYjKL/FbJA0=;\n\tb=qmglnWs90qj8dLx9oAxmyEfyjpwMYc1Ka9+reMQsmau43I/D/efDAGeh66AdN8jRxT\n\tccvrh34N0oecEJ6VItV7eb7ziVcSy786vL0jjnLZvIV/ikrvftf3ju04Bv6f/YsqeRzI\n\tS+gDWHeDgHmwgR8bwM3vYZBghXDD5SMQpxvCwebWG62HGbQfWqT898k1k+n0mj0Qpd8F\n\tWwH5MntW4pE8Yvj00B/Np7fsE7PcWbo3FJ5PNAjEN0hz/wH99neea8zgMXkCJbiwG0xT\n\t7vOzhpGra1G5WeoV+FH8pNbjRchBqQr13MLGWUv0oF8P+q6tl1BKmCIuvW0cX/Un8T87\n\t3Gfw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=9sos0PvkYIOOdYGya//OkVzPo3PZA92XYYjKL/FbJA0=;\n\tb=KR0jbbABPOinAvOhmy9QvUTaiaYyl9O6SMjTggenqNw7GODoiQ+dTi/o5eOv8B8sA1\n\tCd/39OTcudXzVd+EwToNN8MG84vLIg4UZkvS3fCSokPeq+nOuBV8BcrUeygNefDQyoJX\n\tsPBvBH4laaH81AASDR+OHL0AhIEWYW9FjbNizbCYbJnPL/k7I5KU92FQ0nm+AWVY+wxb\n\tEJ3JB7oof+vrnxmbej3kNhBmtbLB8YyNd0sv2Ys9PLQ9D6Nppu/gISSHoQWd0uMCB81/\n\t8C8RDNKQ3nGGGb7YNX6t/pb/UQuDswqTQ5fnsSZYnFoo0IAToK7Gmx7fMhpp63mdihmp\n\ttuLQ==", "X-Gm-Message-State": "ALyK8tIB1UmQIo9M3mdfelxKS63nE93gqY8JKzDsfe+IXkob5lKYSao4MvDNBrGVKUEIRA==", "X-Received": "by 10.66.191.138 with SMTP id gy10mr6327062pac.53.1467157670737; \n\tTue, 28 Jun 2016 16:47:50 -0700 (PDT)", "From": "Lazaros Koromilas <l@nofutznetworks.com>", "To": "dev@dpdk.org", "Cc": "Olivier Matz <olivier.matz@6wind.com>", "Date": "Wed, 29 Jun 2016 00:47:36 +0100", "Message-Id": "<1467157658-28935-2-git-send-email-l@nofutznetworks.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1467157658-28935-1-git-send-email-l@nofutznetworks.com>", "References": "<1467042637-22907-1-git-send-email-olivier.matz@6wind.com>\n\t<1467157658-28935-1-git-send-email-l@nofutznetworks.com>", "Subject": "[dpdk-dev] [PATCH v5 1/3] mempool: deprecate specific get and put\n\tfunctions", "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 commit introduces the API calls:\n\n rte_mempool_generic_put(mp, obj_table, n, is_mp)\n rte_mempool_generic_get(mp, obj_table, n, is_mc)\n\nDeprecates the API calls:\n\n rte_mempool_mp_put_bulk(mp, obj_table, n)\n rte_mempool_sp_put_bulk(mp, obj_table, n)\n rte_mempool_mp_put(mp, obj)\n rte_mempool_sp_put(mp, obj)\n rte_mempool_mc_get_bulk(mp, obj_table, n)\n rte_mempool_sc_get_bulk(mp, obj_table, n)\n rte_mempool_mc_get(mp, obj_p)\n rte_mempool_sc_get(mp, obj_p)\n\nWe also check cookies in one place now.\n\nSigned-off-by: Lazaros Koromilas <l@nofutznetworks.com>\nAcked-by: Olivier Matz <olivier.matz@6wind.com>\n---\n app/test/test_mempool.c | 10 +--\n lib/librte_mempool/rte_mempool.h | 115 ++++++++++++++++++++---------\n lib/librte_mempool/rte_mempool_version.map | 2 +\n 3 files changed, 87 insertions(+), 40 deletions(-)", "diff": "diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c\nindex 31582d8..55c2cbc 100644\n--- a/app/test/test_mempool.c\n+++ b/app/test/test_mempool.c\n@@ -338,7 +338,7 @@ static int test_mempool_single_producer(void)\n \t\t\tprintf(\"obj not owned by this mempool\\n\");\n \t\t\tRET_ERR();\n \t\t}\n-\t\trte_mempool_sp_put(mp_spsc, obj);\n+\t\trte_mempool_put(mp_spsc, obj);\n \t\trte_spinlock_lock(&scsp_spinlock);\n \t\tscsp_obj_table[i] = NULL;\n \t\trte_spinlock_unlock(&scsp_spinlock);\n@@ -371,7 +371,7 @@ static int test_mempool_single_consumer(void)\n \t\trte_spinlock_unlock(&scsp_spinlock);\n \t\tif (i >= MAX_KEEP)\n \t\t\tcontinue;\n-\t\tif (rte_mempool_sc_get(mp_spsc, &obj) < 0)\n+\t\tif (rte_mempool_get(mp_spsc, &obj) < 0)\n \t\t\tbreak;\n \t\trte_spinlock_lock(&scsp_spinlock);\n \t\tscsp_obj_table[i] = obj;\n@@ -477,13 +477,13 @@ test_mempool_basic_ex(struct rte_mempool *mp)\n \t}\n \n \tfor (i = 0; i < MEMPOOL_SIZE; i ++) {\n-\t\tif (rte_mempool_mc_get(mp, &obj[i]) < 0) {\n+\t\tif (rte_mempool_get(mp, &obj[i]) < 0) {\n \t\t\tprintf(\"test_mp_basic_ex fail to get object for [%u]\\n\",\n \t\t\t\ti);\n \t\t\tgoto fail_mp_basic_ex;\n \t\t}\n \t}\n-\tif (rte_mempool_mc_get(mp, &err_obj) == 0) {\n+\tif (rte_mempool_get(mp, &err_obj) == 0) {\n \t\tprintf(\"test_mempool_basic_ex get an impossible obj\\n\");\n \t\tgoto fail_mp_basic_ex;\n \t}\n@@ -494,7 +494,7 @@ test_mempool_basic_ex(struct rte_mempool *mp)\n \t}\n \n \tfor (i = 0; i < MEMPOOL_SIZE; i++)\n-\t\trte_mempool_mp_put(mp, obj[i]);\n+\t\trte_mempool_put(mp, obj[i]);\n \n \tif (rte_mempool_full(mp) != 1) {\n \t\tprintf(\"test_mempool_basic_ex the mempool should be full\\n\");\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 0a1777c..a48f46d 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -957,8 +957,8 @@ void rte_mempool_dump(FILE *f, struct rte_mempool *mp);\n * Mono-producer (0) or multi-producers (1).\n */\n static inline void __attribute__((always_inline))\n-__mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n-\t\t unsigned n, int is_mp)\n+__mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,\n+\t\t unsigned n, int is_mp)\n {\n \tstruct rte_mempool_cache *cache;\n \tuint32_t index;\n@@ -1016,7 +1016,7 @@ ring_enqueue:\n \n \n /**\n- * Put several objects back in the mempool (multi-producers safe).\n+ * Put several objects back in the mempool.\n *\n * @param mp\n * A pointer to the mempool structure.\n@@ -1024,16 +1024,37 @@ ring_enqueue:\n * A pointer to a table of void * pointers (objects).\n * @param n\n * The number of objects to add in the mempool from the obj_table.\n+ * @param is_mp\n+ * Mono-producer (0) or multi-producers (1).\n */\n static inline void __attribute__((always_inline))\n+rte_mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,\n+\t\t\tunsigned n, int is_mp)\n+{\n+\t__mempool_check_cookies(mp, obj_table, n, 0);\n+\t__mempool_generic_put(mp, obj_table, n, is_mp);\n+}\n+\n+/**\n+ * @deprecated\n+ * Put several objects back in the mempool (multi-producers safe).\n+ *\n+ * @param mp\n+ * A pointer to the mempool structure.\n+ * @param obj_table\n+ * A pointer to a table of void * pointers (objects).\n+ * @param n\n+ * The number of objects to add in the mempool from the obj_table.\n+ */\n+__rte_deprecated static inline void __attribute__((always_inline))\n rte_mempool_mp_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n \t\t\tunsigned n)\n {\n-\t__mempool_check_cookies(mp, obj_table, n, 0);\n-\t__mempool_put_bulk(mp, obj_table, n, 1);\n+\trte_mempool_generic_put(mp, obj_table, n, 1);\n }\n \n /**\n+ * @deprecated\n * Put several objects back in the mempool (NOT multi-producers safe).\n *\n * @param mp\n@@ -1043,12 +1064,11 @@ rte_mempool_mp_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n * @param n\n * The number of objects to add in the mempool from obj_table.\n */\n-static inline void\n+__rte_deprecated static inline void __attribute__((always_inline))\n rte_mempool_sp_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n \t\t\tunsigned n)\n {\n-\t__mempool_check_cookies(mp, obj_table, n, 0);\n-\t__mempool_put_bulk(mp, obj_table, n, 0);\n+\trte_mempool_generic_put(mp, obj_table, n, 0);\n }\n \n /**\n@@ -1069,11 +1089,12 @@ static inline void __attribute__((always_inline))\n rte_mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n \t\t unsigned n)\n {\n-\t__mempool_check_cookies(mp, obj_table, n, 0);\n-\t__mempool_put_bulk(mp, obj_table, n, !(mp->flags & MEMPOOL_F_SP_PUT));\n+\trte_mempool_generic_put(mp, obj_table, n,\n+\t\t\t\t!(mp->flags & MEMPOOL_F_SP_PUT));\n }\n \n /**\n+ * @deprecated\n * Put one object in the mempool (multi-producers safe).\n *\n * @param mp\n@@ -1081,13 +1102,14 @@ rte_mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table,\n * @param obj\n * A pointer to the object to be added.\n */\n-static inline void __attribute__((always_inline))\n+__rte_deprecated static inline void __attribute__((always_inline))\n rte_mempool_mp_put(struct rte_mempool *mp, void *obj)\n {\n-\trte_mempool_mp_put_bulk(mp, &obj, 1);\n+\trte_mempool_generic_put(mp, &obj, 1, 1);\n }\n \n /**\n+ * @deprecated\n * Put one object back in the mempool (NOT multi-producers safe).\n *\n * @param mp\n@@ -1095,10 +1117,10 @@ rte_mempool_mp_put(struct rte_mempool *mp, void *obj)\n * @param obj\n * A pointer to the object to be added.\n */\n-static inline void __attribute__((always_inline))\n+__rte_deprecated static inline void __attribute__((always_inline))\n rte_mempool_sp_put(struct rte_mempool *mp, void *obj)\n {\n-\trte_mempool_sp_put_bulk(mp, &obj, 1);\n+\trte_mempool_generic_put(mp, &obj, 1, 0);\n }\n \n /**\n@@ -1134,8 +1156,8 @@ rte_mempool_put(struct rte_mempool *mp, void *obj)\n * - <0: Error; code of ring dequeue function.\n */\n static inline int __attribute__((always_inline))\n-__mempool_get_bulk(struct rte_mempool *mp, void **obj_table,\n-\t\t unsigned n, int is_mc)\n+__mempool_generic_get(struct rte_mempool *mp, void **obj_table,\n+\t\t unsigned n, int is_mc)\n {\n \tint ret;\n \tstruct rte_mempool_cache *cache;\n@@ -1197,7 +1219,7 @@ ring_dequeue:\n }\n \n /**\n- * Get several objects from the mempool (multi-consumers safe).\n+ * Get several objects from the mempool.\n *\n * If cache is enabled, objects will be retrieved first from cache,\n * subsequently from the common pool. Note that it can return -ENOENT when\n@@ -1210,21 +1232,50 @@ ring_dequeue:\n * A pointer to a table of void * pointers (objects) that will be filled.\n * @param n\n * The number of objects to get from mempool to obj_table.\n+ * @param is_mc\n+ * Mono-consumer (0) or multi-consumers (1).\n * @return\n * - 0: Success; objects taken.\n * - -ENOENT: Not enough entries in the mempool; no object is retrieved.\n */\n static inline int __attribute__((always_inline))\n-rte_mempool_mc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n+rte_mempool_generic_get(struct rte_mempool *mp, void **obj_table, unsigned n,\n+\t\t\tint is_mc)\n {\n \tint ret;\n-\tret = __mempool_get_bulk(mp, obj_table, n, 1);\n+\tret = __mempool_generic_get(mp, obj_table, n, is_mc);\n \tif (ret == 0)\n \t\t__mempool_check_cookies(mp, obj_table, n, 1);\n \treturn ret;\n }\n \n /**\n+ * @deprecated\n+ * Get several objects from the mempool (multi-consumers safe).\n+ *\n+ * If cache is enabled, objects will be retrieved first from cache,\n+ * subsequently from the common pool. Note that it can return -ENOENT when\n+ * the local cache and common pool are empty, even if cache from other\n+ * lcores are full.\n+ *\n+ * @param mp\n+ * A pointer to the mempool structure.\n+ * @param obj_table\n+ * A pointer to a table of void * pointers (objects) that will be filled.\n+ * @param n\n+ * The number of objects to get from mempool to obj_table.\n+ * @return\n+ * - 0: Success; objects taken.\n+ * - -ENOENT: Not enough entries in the mempool; no object is retrieved.\n+ */\n+__rte_deprecated static inline int __attribute__((always_inline))\n+rte_mempool_mc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n+{\n+\treturn rte_mempool_generic_get(mp, obj_table, n, 1);\n+}\n+\n+/**\n+ * @deprecated\n * Get several objects from the mempool (NOT multi-consumers safe).\n *\n * If cache is enabled, objects will be retrieved first from cache,\n@@ -1243,14 +1294,10 @@ rte_mempool_mc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n * - -ENOENT: Not enough entries in the mempool; no object is\n * retrieved.\n */\n-static inline int __attribute__((always_inline))\n+__rte_deprecated static inline int __attribute__((always_inline))\n rte_mempool_sc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n {\n-\tint ret;\n-\tret = __mempool_get_bulk(mp, obj_table, n, 0);\n-\tif (ret == 0)\n-\t\t__mempool_check_cookies(mp, obj_table, n, 1);\n-\treturn ret;\n+\treturn rte_mempool_generic_get(mp, obj_table, n, 0);\n }\n \n /**\n@@ -1278,15 +1325,12 @@ rte_mempool_sc_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n static inline int __attribute__((always_inline))\n rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n {\n-\tint ret;\n-\tret = __mempool_get_bulk(mp, obj_table, n,\n-\t\t\t\t !(mp->flags & MEMPOOL_F_SC_GET));\n-\tif (ret == 0)\n-\t\t__mempool_check_cookies(mp, obj_table, n, 1);\n-\treturn ret;\n+\treturn rte_mempool_generic_get(mp, obj_table, n,\n+\t\t\t\t !(mp->flags & MEMPOOL_F_SC_GET));\n }\n \n /**\n+ * @deprecated\n * Get one object from the mempool (multi-consumers safe).\n *\n * If cache is enabled, objects will be retrieved first from cache,\n@@ -1302,13 +1346,14 @@ rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned n)\n * - 0: Success; objects taken.\n * - -ENOENT: Not enough entries in the mempool; no object is retrieved.\n */\n-static inline int __attribute__((always_inline))\n+__rte_deprecated static inline int __attribute__((always_inline))\n rte_mempool_mc_get(struct rte_mempool *mp, void **obj_p)\n {\n-\treturn rte_mempool_mc_get_bulk(mp, obj_p, 1);\n+\treturn rte_mempool_generic_get(mp, obj_p, 1, 1);\n }\n \n /**\n+ * @deprecated\n * Get one object from the mempool (NOT multi-consumers safe).\n *\n * If cache is enabled, objects will be retrieved first from cache,\n@@ -1324,10 +1369,10 @@ rte_mempool_mc_get(struct rte_mempool *mp, void **obj_p)\n * - 0: Success; objects taken.\n * - -ENOENT: Not enough entries in the mempool; no object is retrieved.\n */\n-static inline int __attribute__((always_inline))\n+__rte_deprecated static inline int __attribute__((always_inline))\n rte_mempool_sc_get(struct rte_mempool *mp, void **obj_p)\n {\n-\treturn rte_mempool_sc_get_bulk(mp, obj_p, 1);\n+\treturn rte_mempool_generic_get(mp, obj_p, 1, 0);\n }\n \n /**\ndiff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map\nindex 9bcbf17..6d4fc4a 100644\n--- a/lib/librte_mempool/rte_mempool_version.map\n+++ b/lib/librte_mempool/rte_mempool_version.map\n@@ -22,6 +22,8 @@ DPDK_16.07 {\n \trte_mempool_check_cookies;\n \trte_mempool_create_empty;\n \trte_mempool_free;\n+\trte_mempool_generic_get;\n+\trte_mempool_generic_put;\n \trte_mempool_mem_iter;\n \trte_mempool_obj_iter;\n \trte_mempool_ops_table;\n", "prefixes": [ "dpdk-dev", "v5", "1/3" ] }{ "id": 14438, "url": "