Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/66407/?format=api
http://patches.dpdk.org/api/patches/66407/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200309095410.28983-2-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": "<20200309095410.28983-2-joyce.kong@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200309095410.28983-2-joyce.kong@arm.com", "date": "2020-03-09T09:54:05", "name": "[v7,1/6] lib/eal: implement the family of PMD bit operation APIs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8cebd0925ca8370c80a0d3efac2cc3407816c776", "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/20200309095410.28983-2-joyce.kong@arm.com/mbox/", "series": [ { "id": 8838, "url": "http://patches.dpdk.org/api/series/8838/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8838", "date": "2020-03-09T09:54:04", "name": "implement common rte bit operation APIs in PMDs", "version": 7, "mbox": "http://patches.dpdk.org/series/8838/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/66407/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/66407/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 BD514A052E;\n\tMon, 9 Mar 2020 10:54:40 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 08E141C0AA;\n\tMon, 9 Mar 2020 10:54:37 +0100 (CET)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id D64173B5\n for <dev@dpdk.org>; Mon, 9 Mar 2020 10:54:35 +0100 (CET)", "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 56E747FA;\n Mon, 9 Mar 2020 02:54:35 -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 1968D3F67D;\n Mon, 9 Mar 2020 02:54:29 -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, phil.yang@arm.com,\n gavin.hu@arm.com", "Cc": "nd@arm.com,\n\tdev@dpdk.org", "Date": "Mon, 9 Mar 2020 17:54:05 +0800", "Message-Id": "<20200309095410.28983-2-joyce.kong@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<20200309095410.28983-1-joyce.kong@arm.com>", "<1571125801-45773-1-git-send-email-joyce.kong@arm.com>" ], "References": [ "<20200309095410.28983-1-joyce.kong@arm.com>", "<1571125801-45773-1-git-send-email-joyce.kong@arm.com>" ], "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v7 1/6] lib/eal: implement the family of PMD bit\n\toperation APIs", "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": "Bitwise operation APIs are defined and used in a lot of PMDs,\nwhich caused a huge code duplication. To reduce duplication,\nthis patch consolidates them into a common API family.\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>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\n---\n MAINTAINERS | 4 +\n doc/api/doxy-api-index.md | 5 +-\n drivers/net/Makefile | 1 +\n lib/librte_eal/common/Makefile | 1 +\n .../common/include/rte_pmd_bitops.h | 257 ++++++++++++++++++\n lib/librte_eal/common/meson.build | 3 +-\n 6 files changed, 268 insertions(+), 3 deletions(-)\n create mode 100644 lib/librte_eal/common/include/rte_pmd_bitops.h", "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex f4e0ed8e0..071daf887 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -244,6 +244,10 @@ M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n F: lib/librte_eal/common/include/rte_bitmap.h\n F: app/test/test_bitmap.c\n \n+PMD Bitops\n+M: Joyce Kong <joyce.kong@arm.com>\n+F: lib/librte_eal/common/include/rte_pmd_bitops.h\n+\n MCSlock - EXPERIMENTAL\n M: Phil Yang <phil.yang@arm.com>\n F: lib/librte_eal/common/include/generic/rte_mcslock.h\ndiff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md\nindex dff496be0..64ab142f3 100644\n--- a/doc/api/doxy-api-index.md\n+++ b/doc/api/doxy-api-index.md\n@@ -35,6 +35,7 @@ The public API headers are grouped by topics:\n [vfio] (@ref rte_vfio.h)\n \n - **device specific**:\n+ [pmd_bitops] (@ref rte_pmd_bitops.h),\n [softnic] (@ref rte_eth_softnic.h),\n [bond] (@ref rte_eth_bond.h),\n [vhost] (@ref rte_vhost.h),\n@@ -133,12 +134,12 @@ The public API headers are grouped by topics:\n [BPF] (@ref rte_bpf.h)\n \n - **containers**:\n+ [bitmap] (@ref rte_bitmap.h),\n [mbuf] (@ref rte_mbuf.h),\n [mbuf pool ops] (@ref rte_mbuf_pool_ops.h),\n [ring] (@ref rte_ring.h),\n [stack] (@ref rte_stack.h),\n- [tailq] (@ref rte_tailq.h),\n- [bitmap] (@ref rte_bitmap.h)\n+ [tailq] (@ref rte_tailq.h)\n \n - **packet framework**:\n * [port] (@ref rte_port.h):\ndiff --git a/drivers/net/Makefile b/drivers/net/Makefile\nindex 4a7f155fc..1a3202d1c 100644\n--- a/drivers/net/Makefile\n+++ b/drivers/net/Makefile\n@@ -3,6 +3,7 @@\n \n include $(RTE_SDK)/mk/rte.vars.mk\n \n+INC := rte_pmd_bitops.h\n # set in mk/toolchain/xxx/rte.toolchain-compat.mk\n ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d)\n $(warning thunderx pmd is not supported by old compilers)\ndiff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile\nindex c2c6d92cd..24a5ae94f 100644\n--- a/lib/librte_eal/common/Makefile\n+++ b/lib/librte_eal/common/Makefile\n@@ -19,6 +19,7 @@ INC += rte_malloc.h rte_keepalive.h rte_time.h\n INC += rte_service.h rte_service_component.h\n INC += rte_bitmap.h rte_vfio.h rte_hypervisor.h rte_test.h\n INC += rte_reciprocal.h rte_fbarray.h rte_uuid.h\n+INC += rte_pmd_bitops.h\n \n GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h\n GENERIC_INC += rte_memcpy.h rte_cpuflags.h\ndiff --git a/lib/librte_eal/common/include/rte_pmd_bitops.h b/lib/librte_eal/common/include/rte_pmd_bitops.h\nnew file mode 100644\nindex 000000000..b7801e01e\n--- /dev/null\n+++ b/lib/librte_eal/common/include/rte_pmd_bitops.h\n@@ -0,0 +1,257 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Arm Limited\n+ */\n+\n+#ifndef _RTE_PMD_BITOPS_H_\n+#define _RTE_PMD_BITOPS_H_\n+\n+/**\n+ * @file\n+ * Bit Operations\n+ *\n+ * This file defines a API for bit operations without/with memory ordering.\n+ */\n+\n+#include <stdint.h>\n+#include <rte_debug.h>\n+#include <rte_compat.h>\n+\n+/*---------------------------- 32 bit operations ----------------------------*/\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Get the target bit from a 32-bit value without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The target bit.\n+ */\n+__rte_experimental\n+static inline uint32_t\n+rte_get_bit32_relaxed(unsigned int nr, volatile uint32_t *addr)\n+{\n+\tRTE_ASSERT(nr < 32);\n+\n+\tuint32_t mask = UINT32_C(1) << nr;\n+\treturn (*addr) & mask;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Set the target bit in a 32-bit value to 1 without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to set.\n+ * @param addr\n+ * The address holding the bit.\n+ */\n+__rte_experimental\n+static inline void\n+rte_set_bit32_relaxed(unsigned int nr, volatile uint32_t *addr)\n+{\n+\tRTE_ASSERT(nr < 32);\n+\n+\tuint32_t mask = UINT32_C(1) << nr;\n+\t*addr = (*addr) | mask;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Clear the target bit in a 32-bit value to 0 without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to clear.\n+ * @param addr\n+ * The address holding the bit.\n+ */\n+__rte_experimental\n+static inline void\n+rte_clear_bit32_relaxed(unsigned int nr, volatile uint32_t *addr)\n+{\n+\tRTE_ASSERT(nr < 32);\n+\n+\tuint32_t mask = UINT32_C(1) << nr;\n+\t*addr = (*addr) & (~mask);\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Return the original bit from a 32-bit value, then set it to 1 without\n+ * memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get and set.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The original bit.\n+ */\n+__rte_experimental\n+static inline uint32_t\n+rte_test_and_set_bit32_relaxed(unsigned int nr, volatile uint32_t *addr)\n+{\n+\tRTE_ASSERT(nr < 32);\n+\n+\tuint32_t mask = UINT32_C(1) << nr;\n+\tuint32_t val = *addr;\n+\t*addr = (*addr) | mask;\n+\treturn val & mask;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Return the original bit from a 32-bit value, then clear it to 0 without\n+ * memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get and clear.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The original bit.\n+ */\n+__rte_experimental\n+static inline uint32_t\n+rte_test_and_clear_bit32_relaxed(unsigned int nr, volatile uint32_t *addr)\n+{\n+\tRTE_ASSERT(nr < 32);\n+\n+\tuint32_t mask = UINT32_C(1) << nr;\n+\tuint32_t val = *addr;\n+\t*addr = (*addr) & (~mask);\n+\treturn val & mask;\n+}\n+\n+/*---------------------------- 64 bit operations ----------------------------*/\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Get the target bit from a 64-bit value without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The target bit.\n+ */\n+__rte_experimental\n+static inline uint64_t\n+rte_get_bit64_relaxed(unsigned int nr, volatile uint64_t *addr)\n+{\n+\tRTE_ASSERT(nr < 64);\n+\n+\tuint64_t mask = UINT64_C(1) << nr;\n+\treturn (*addr) & mask;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Set the target bit in a 64-bit value to 1 without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to set.\n+ * @param addr\n+ * The address holding the bit.\n+ */\n+__rte_experimental\n+static inline void\n+rte_set_bit64_relaxed(unsigned int nr, volatile uint64_t *addr)\n+{\n+\tRTE_ASSERT(nr < 64);\n+\n+\tuint64_t mask = UINT64_C(1) << nr;\n+\t(*addr) = (*addr) | mask;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Clear the target bit in a 64-bit value to 0 without memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to clear.\n+ * @param addr\n+ * The address holding the bit.\n+ */\n+__rte_experimental\n+static inline void\n+rte_clear_bit64_relaxed(unsigned int nr, volatile uint64_t *addr)\n+{\n+\tRTE_ASSERT(nr < 64);\n+\n+\tuint64_t mask = UINT64_C(1) << nr;\n+\t*addr = (*addr) & (~mask);\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Return the original bit from a 64-bit value, then set it to 1 without\n+ * memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get and set.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The original bit.\n+ */\n+__rte_experimental\n+static inline uint64_t\n+rte_test_and_set_bit64_relaxed(unsigned int nr, volatile uint64_t *addr)\n+{\n+\tRTE_ASSERT(nr < 64);\n+\n+\tuint64_t mask = UINT64_C(1) << nr;\n+\tuint64_t val = *addr;\n+\t*addr = (*addr) | mask;\n+\treturn val;\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice\n+ *\n+ * Return the original bit from a 64-bit value, then clear it to 0 without\n+ * memory ordering.\n+ *\n+ * @param nr\n+ * The target bit to get and clear.\n+ * @param addr\n+ * The address holding the bit.\n+ * @return\n+ * The original bit.\n+ */\n+__rte_experimental\n+static inline uint64_t\n+rte_test_and_clear_bit64_relaxed(unsigned int nr, volatile uint64_t *addr)\n+{\n+\tRTE_ASSERT(nr < 64);\n+\n+\tuint64_t mask = UINT64_C(1) << nr;\n+\tuint64_t val = *addr;\n+\t*addr = (*addr) & (~mask);\n+\treturn val & mask;\n+}\n+\n+#endif /* _RTE_PMD_BITOPS_H_ */\ndiff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build\nindex 2b97715a2..0862ae64c 100644\n--- a/lib/librte_eal/common/meson.build\n+++ b/lib/librte_eal/common/meson.build\n@@ -50,9 +50,9 @@ common_objs += eal_common_arch_objs\n \n common_headers = files(\n \t'include/rte_alarm.h',\n+\t'include/rte_bitmap.h',\n \t'include/rte_branch_prediction.h',\n \t'include/rte_bus.h',\n-\t'include/rte_bitmap.h',\n \t'include/rte_class.h',\n \t'include/rte_common.h',\n \t'include/rte_compat.h',\n@@ -78,6 +78,7 @@ common_headers = files(\n \t'include/rte_pci_dev_feature_defs.h',\n \t'include/rte_pci_dev_features.h',\n \t'include/rte_per_lcore.h',\n+\t'include/rte_pmd_bitops.h',\n \t'include/rte_random.h',\n \t'include/rte_reciprocal.h',\n \t'include/rte_service.h',\n", "prefixes": [ "v7", "1/6" ] }{ "id": 66407, "url": "