Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/69220/?format=api
http://patches.dpdk.org/api/patches/69220/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200424032159.992-3-joyce.kong@arm.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": "<20200424032159.992-3-joyce.kong@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200424032159.992-3-joyce.kong@arm.com", "date": "2020-04-24T03:21:55", "name": "[v9,2/6] test/bitops: add bit operation test case", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d987b5f4aa41c341f68edf012ba001ed10f35d33", "submitter": { "id": 970, "url": "http://patches.dpdk.org/api/people/970/?format=api", "name": "Joyce Kong", "email": "joyce.kong@arm.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200424032159.992-3-joyce.kong@arm.com/mbox/", "series": [ { "id": 9606, "url": "http://patches.dpdk.org/api/series/9606/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9606", "date": "2020-04-24T03:21:53", "name": "implement common bit operation APIs", "version": 9, "mbox": "http://patches.dpdk.org/series/9606/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/69220/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/69220/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 80B87A00C4;\n\tFri, 24 Apr 2020 05:22:48 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0006E1C0C0;\n\tFri, 24 Apr 2020 05:22:47 +0200 (CEST)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 501E41C027\n for <dev@dpdk.org>; Fri, 24 Apr 2020 05:22:46 +0200 (CEST)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB767C14;\n Thu, 23 Apr 2020 20:22:45 -0700 (PDT)", "from net-arm-thunderx2-03.shanghai.arm.com\n (net-arm-thunderx2-03.shanghai.arm.com [10.169.41.185])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7518A3F68F;\n Thu, 23 Apr 2020 20:22:40 -0700 (PDT)" ], "From": "Joyce Kong <joyce.kong@arm.com>", "To": "thomas@monjalon.net, stephen@networkplumber.org,\n david.marchand@redhat.com,\n mb@smartsharesystems.com, jerinj@marvell.com, bruce.richardson@intel.com,\n ravi1.kumar@amd.com, rmody@marvell.com, shshaikh@marvell.com,\n xuanziyang2@huawei.com, cloud.wangxiaoyun@huawei.com,\n zhouguoyang@huawei.com, honnappa.nagarahalli@arm.com, gavin.hu@arm.com,\n phil.yang@arm.com", "Cc": "nd@arm.com,\n\tdev@dpdk.org", "Date": "Fri, 24 Apr 2020 11:21:55 +0800", "Message-Id": "<20200424032159.992-3-joyce.kong@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<20200424032159.992-1-joyce.kong@arm.com>", "<1571125801-45773-1-git-send-email-joyce.kong@arm.com>" ], "References": [ "<20200424032159.992-1-joyce.kong@arm.com>", "<1571125801-45773-1-git-send-email-joyce.kong@arm.com>" ], "Subject": "[dpdk-dev] [PATCH v9 2/6] test/bitops: add bit operation test case", "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": "Add test cases for setting bit, clearing bit, testing\nand setting bit, testing and clearing bit operation.\n\nSigned-off-by: Joyce Kong <joyce.kong@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\nReviewed-by: Phil Yang <phil.yang@arm.com>\n---\n MAINTAINERS | 1 +\n app/test/Makefile | 1 +\n app/test/autotest_data.py | 6 ++\n app/test/meson.build | 2 +\n app/test/test_bitops.c | 137 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 147 insertions(+)\n create mode 100644 app/test/test_bitops.c", "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex c5c255994..361d27d17 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -244,6 +244,7 @@ F: app/test/test_bitmap.c\n Bitops\n M: Joyce Kong <joyce.kong@arm.com>\n F: lib/librte_eal/include/rte_bitops.h\n+F: app/test/test_bitops.c\n \n MCSlock - EXPERIMENTAL\n M: Phil Yang <phil.yang@arm.com>\ndiff --git a/app/test/Makefile b/app/test/Makefile\nindex be53d33c3..a51a8181f 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -70,6 +70,7 @@ SRCS-y += test_ticketlock.c\n SRCS-y += test_memory.c\n SRCS-y += test_memzone.c\n SRCS-y += test_bitmap.c\n+SRCS-y += test_bitops.c\n SRCS-y += test_reciprocal_division.c\n SRCS-y += test_reciprocal_division_perf.c\n SRCS-y += test_fbarray.c\ndiff --git a/app/test/autotest_data.py b/app/test/autotest_data.py\nindex 7b1d01389..fc3fcc159 100644\n--- a/app/test/autotest_data.py\n+++ b/app/test/autotest_data.py\n@@ -404,6 +404,12 @@\n \"Func\": default_autotest,\n \"Report\": None,\n },\n+ {\n+ \"Name\": \"Bitops test\",\n+ \"Command\": \"bitops_test\",\n+ \"Func\": default_autotest,\n+ \"Report\": None,\n+ },\n {\n \"Name\": \"Hash multiwriter autotest\",\n \"Command\": \"hash_multiwriter_autotest\",\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 04b59cffa..d1d5cc122 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -12,6 +12,7 @@ test_sources = files('commands.c',\n \t'test_alarm.c',\n \t'test_atomic.c',\n \t'test_barrier.c',\n+\t'test_bitops.c',\n \t'test_bpf.c',\n \t'test_byteorder.c',\n \t'test_cmdline.c',\n@@ -160,6 +161,7 @@ fast_tests = [\n ['acl_autotest', true],\n ['alarm_autotest', false],\n ['atomic_autotest', false],\n+ ['bitops_autotest', true],\n ['byteorder_autotest', true],\n ['cmdline_autotest', true],\n ['common_autotest', true],\ndiff --git a/app/test/test_bitops.c b/app/test/test_bitops.c\nnew file mode 100644\nindex 000000000..01245b17c\n--- /dev/null\n+++ b/app/test/test_bitops.c\n@@ -0,0 +1,137 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019 Arm Limited\n+ */\n+\n+#include <rte_launch.h>\n+#include <rte_bitops.h>\n+#include \"test.h\"\n+\n+uint32_t val32;\n+uint64_t val64;\n+\n+#define MAX_BITS_32 32\n+#define MAX_BITS_64 64\n+/*\n+ * Bitops functions\n+ * ================\n+ *\n+ * - The main test function performs several subtests.\n+ * - Check bit operations on one core.\n+ * - Initialize valXX to specified values, then set each bit of valXX\n+ * to 1 one by one in \"test_bitops_set_relaxed\".\n+ *\n+ * - Clear each bit of valXX to 0 one by one in \"test_bitops_clear_relaxed\".\n+ *\n+ * - Function \"test_bitops_test_set_clear_relaxed\" checks whether each bit\n+ * of valXX can do \"test and set\" and \"test and clear\" correctly.\n+ */\n+\n+static int\n+test_bitops_set_relaxed(void)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\trte_set_bit32_relaxed(i, &val32);\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\tif (!rte_get_bit32_relaxed(i, &val32)) {\n+\t\t\tprintf(\"Failed to set bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\trte_set_bit64_relaxed(i, &val64);\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\tif (!rte_get_bit64_relaxed(i, &val64)) {\n+\t\t\tprintf(\"Failed to set bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_bitops_clear_relaxed(void)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\trte_clear_bit32_relaxed(i, &val32);\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\tif (rte_get_bit32_relaxed(i, &val32)) {\n+\t\t\tprintf(\"Failed to clear bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\trte_clear_bit64_relaxed(i, &val64);\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\tif (rte_get_bit64_relaxed(i, &val64)) {\n+\t\t\tprintf(\"Failed to clear bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_bitops_test_set_clear_relaxed(void)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\trte_test_and_set_bit32_relaxed(i, &val32);\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\tif (!rte_test_and_clear_bit32_relaxed(i, &val32)) {\n+\t\t\tprintf(\"Failed to set and test bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t}\n+\n+\tfor (i = 0; i < MAX_BITS_32; i++)\n+\t\tif (rte_get_bit32_relaxed(i, &val32)) {\n+\t\t\tprintf(\"Failed to test and clear bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\trte_test_and_set_bit64_relaxed(i, &val64);\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\tif (!rte_test_and_clear_bit64_relaxed(i, &val64)) {\n+\t\t\tprintf(\"Failed to set and test bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\tfor (i = 0; i < MAX_BITS_64; i++)\n+\t\tif (rte_get_bit64_relaxed(i, &val64)) {\n+\t\t\tprintf(\"Failed to test and clear bit in relaxed version.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_bitops(void)\n+{\n+\tval32 = 0;\n+\tval64 = 0;\n+\n+\tif (test_bitops_set_relaxed() < 0)\n+\t\treturn TEST_FAILED;\n+\n+\tif (test_bitops_clear_relaxed() < 0)\n+\t\treturn TEST_FAILED;\n+\n+\tif (test_bitops_test_set_clear_relaxed() < 0)\n+\t\treturn TEST_FAILED;\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+REGISTER_TEST_COMMAND(bitops_autotest, test_bitops);\n", "prefixes": [ "v9", "2/6" ] }{ "id": 69220, "url": "