Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/49181/?format=api
http://patches.dpdk.org/api/patches/49181/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/fc7478baf7daf301eaaeb5f753459f1ef204653c.1545307762.git.anatoly.burakov@intel.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": "<fc7478baf7daf301eaaeb5f753459f1ef204653c.1545307762.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/fc7478baf7daf301eaaeb5f753459f1ef204653c.1545307762.git.anatoly.burakov@intel.com", "date": "2018-12-20T12:09:48", "name": "[v2,2/4] common: add bsf64 and bsf32_safe functions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "5c2ff12431c3432905baf58ce6ba72c0552d644c", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.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/fc7478baf7daf301eaaeb5f753459f1ef204653c.1545307762.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2897, "url": "http://patches.dpdk.org/api/series/2897/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2897", "date": "2018-12-20T12:09:48", "name": "[v2,1/4] bitmap: remove deprecated bsf64 function", "version": 2, "mbox": "http://patches.dpdk.org/series/2897/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/49181/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/49181/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 773181BC7F;\n\tThu, 20 Dec 2018 13:10:01 +0100 (CET)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 359C31BC75\n\tfor <dev@dpdk.org>; Thu, 20 Dec 2018 13:09:59 +0100 (CET)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Dec 2018 04:09:58 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby FMSMGA003.fm.intel.com with ESMTP; 20 Dec 2018 04:09:57 -0800", "from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com\n\t[10.243.17.64])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\twBKC9uwx014132; Thu, 20 Dec 2018 12:09:56 GMT", "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBKC9unE001192;\n\tThu, 20 Dec 2018 12:09:56 GMT", "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBKC9urU001188;\n\tThu, 20 Dec 2018 12:09:56 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,376,1539673200\"; d=\"scan'208\";a=\"119938850\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "John McNamara <john.mcnamara@intel.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>,\n\tjerin.jacob@caviumnetworks.com, thomas@monjalon.net", "Date": "Thu, 20 Dec 2018 12:09:48 +0000", "Message-Id": "<fc7478baf7daf301eaaeb5f753459f1ef204653c.1545307762.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<ec15434d0c3ac3c9c0f6d89a865120b29bb6737a.1545307762.git.anatoly.burakov@intel.com>", "<1cf22c82b6ca7561966be674afb8a02add0913b9.1544550999.git.anatoly.burakov@intel.com>" ], "References": [ "<ec15434d0c3ac3c9c0f6d89a865120b29bb6737a.1545307762.git.anatoly.burakov@intel.com>", "<1cf22c82b6ca7561966be674afb8a02add0913b9.1544550999.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 2/4] common: add bsf64 and bsf32_safe functions", "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 an rte_bsf64 function that follows the convention of existing\nrte_bsf32 function. Also, add missing implementation for safe\nversion of rte_bsf32, and implement unit tests for all recently\nadded bsf varieties.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n doc/guides/rel_notes/release_19_02.rst | 4 +-\n lib/librte_eal/common/include/rte_common.h | 43 +++++++++++++++++++++-\n test/test/test_common.c | 41 ++++++++++++++++++++-\n 3 files changed, 84 insertions(+), 4 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst\nindex c4cce4c98..0f446ed74 100644\n--- a/doc/guides/rel_notes/release_19_02.rst\n+++ b/doc/guides/rel_notes/release_19_02.rst\n@@ -100,7 +100,9 @@ API Changes\n \n \n * eal: function ``rte_bsf64`` in ``rte_bitmap.h`` has been renamed to\n- ``rte_bsf64_safe`` and moved to ``rte_common.h``.\n+ ``rte_bsf64_safe`` and moved to ``rte_common.h``. A new ``rte_bsf64`` function\n+ has been added in ``rte_common.h`` that follows convention set by existing\n+ ``rte_bsf32`` function.\n \n \n ABI Changes\ndiff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h\nindex 66cdf60b2..d102f2cec 100644\n--- a/lib/librte_eal/common/include/rte_common.h\n+++ b/lib/librte_eal/common/include/rte_common.h\n@@ -447,6 +447,30 @@ rte_bsf32(uint32_t v)\n \treturn (uint32_t)__builtin_ctz(v);\n }\n \n+/**\n+ * Searches the input parameter for the least significant set bit\n+ * (starting from zero). Safe version (checks for input parameter being zero).\n+ *\n+ * @warning ``pos`` must be a valid pointer. It is not checked!\n+ *\n+ * @param v\n+ * The input parameter.\n+ * @param pos\n+ * If ``v`` was not 0, this value will contain position of least significant\n+ * bit within the input parameter.\n+ * @return\n+ * Returns 0 if ``v`` was 0, otherwise returns 1.\n+ */\n+static inline int\n+rte_bsf32_safe(uint64_t v, uint32_t *pos)\n+{\n+\tif (v == 0)\n+\t\treturn 0;\n+\n+\t*pos = rte_bsf32(v);\n+\treturn 1;\n+}\n+\n /**\n * Return the rounded-up log2 of a integer.\n *\n@@ -482,6 +506,23 @@ rte_fls_u32(uint32_t x)\n \treturn (x == 0) ? 0 : 32 - __builtin_clz(x);\n }\n \n+/**\n+ * Searches the input parameter for the least significant set bit\n+ * (starting from zero).\n+ * If a least significant 1 bit is found, its bit index is returned.\n+ * If the content of the input parameter is zero, then the content of the return\n+ * value is undefined.\n+ * @param v\n+ * input parameter, should not be zero.\n+ * @return\n+ * least significant set bit in the input parameter.\n+ */\n+static inline int\n+rte_bsf64(uint64_t v)\n+{\n+\treturn (uint32_t)__builtin_ctzll(v);\n+}\n+\n /**\n * Searches the input parameter for the least significant set bit\n * (starting from zero). Safe version (checks for input parameter being zero).\n@@ -502,7 +543,7 @@ rte_bsf64_safe(uint64_t v, uint32_t *pos)\n \tif (v == 0)\n \t\treturn 0;\n \n-\t*pos = __builtin_ctzll(v);\n+\t*pos = rte_bsf64(v);\n \treturn 1;\n }\n \ndiff --git a/test/test/test_common.c b/test/test/test_common.c\nindex c6d17baae..4a42aaed8 100644\n--- a/test/test/test_common.c\n+++ b/test/test/test_common.c\n@@ -50,12 +50,48 @@ test_macros(int __rte_unused unused_parm)\n \treturn 0;\n }\n \n+static int\n+test_bsf(void)\n+{\n+\tuint32_t shift, pos;\n+\n+\t/* safe versions should be able to handle 0 */\n+\tif (rte_bsf32_safe(0, &pos) != 0)\n+\t\tFAIL(\"rte_bsf32_safe\");\n+\tif (rte_bsf64_safe(0, &pos) != 0)\n+\t\tFAIL(\"rte_bsf64_safe\");\n+\n+\tfor (shift = 0; shift < 63; shift++) {\n+\t\tuint32_t val32;\n+\t\tuint64_t val64;\n+\n+\t\tval64 = 1ULL << shift;\n+\t\tif ((uint32_t)rte_bsf64(val64) != shift)\n+\t\t\tFAIL(\"rte_bsf64\");\n+\t\tif (rte_bsf64_safe(val64, &pos) != 1)\n+\t\t\tFAIL(\"rte_bsf64_safe\");\n+\t\tif (pos != shift)\n+\t\t\tFAIL(\"rte_bsf64_safe\");\n+\n+\t\tif (shift > 31)\n+\t\t\tcontinue;\n+\n+\t\tval32 = 1U << shift;\n+\t\tif ((uint32_t)rte_bsf32(val32) != shift)\n+\t\t\tFAIL(\"rte_bsf32\");\n+\t\tif (rte_bsf32_safe(val32, &pos) != 1)\n+\t\t\tFAIL(\"rte_bsf32_safe\");\n+\t\tif (pos != shift)\n+\t\t\tFAIL(\"rte_bsf32_safe\");\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n test_misc(void)\n {\n \tchar memdump[] = \"memdump_test\";\n-\tif (rte_bsf32(129))\n-\t\tFAIL(\"rte_bsf32\");\n \n \trte_memdump(stdout, \"test\", memdump, sizeof(memdump));\n \trte_hexdump(stdout, \"test\", memdump, sizeof(memdump));\n@@ -226,6 +262,7 @@ test_common(void)\n \tret |= test_align();\n \tret |= test_macros(0);\n \tret |= test_misc();\n+\tret |= test_bsf();\n \tret |= test_log2();\n \tret |= test_fls();\n \n", "prefixes": [ "v2", "2/4" ] }{ "id": 49181, "url": "