Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/66412/?format=api
http://patches.dpdk.org/api/patches/66412/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200309095410.28983-7-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-7-joyce.kong@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200309095410.28983-7-joyce.kong@arm.com", "date": "2020-03-09T09:54:10", "name": "[v7,6/6] net/hinic: use common rte bit operation APIs instead", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c65b61d793b6323eb99ac72ddccf515bc6dd4cbb", "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-7-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/66412/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/66412/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 DCF17A052E;\n\tMon, 9 Mar 2020 10:55:42 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C0DF21C11F;\n\tMon, 9 Mar 2020 10:55:06 +0100 (CET)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 3BD8E1C11E\n for <dev@dpdk.org>; Mon, 9 Mar 2020 10:55:05 +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 BA9BE101E;\n Mon, 9 Mar 2020 02:55:04 -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 A0B1C3F67D;\n Mon, 9 Mar 2020 02:54:59 -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:10 +0800", "Message-Id": "<20200309095410.28983-7-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>" ], "Subject": "[dpdk-dev] [PATCH v7 6/6] net/hinic: use common rte bit operation\n\tAPIs instead", "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": "Remove its own bit operation APIs and use the common one,\nthis can reduce the code duplication largely.\n\nSigned-off-by: Joyce Kong <joyce.kong@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\n---\n drivers/net/hinic/Makefile | 1 +\n drivers/net/hinic/base/hinic_compat.h | 33 +--------------------------\n drivers/net/hinic/hinic_pmd_ethdev.c | 18 ++++++++-------\n drivers/net/hinic/hinic_pmd_ethdev.h | 2 +-\n drivers/net/hinic/meson.build | 2 ++\n 5 files changed, 15 insertions(+), 41 deletions(-)", "diff": "diff --git a/drivers/net/hinic/Makefile b/drivers/net/hinic/Makefile\nindex 87fd843e4..f087baac5 100644\n--- a/drivers/net/hinic/Makefile\n+++ b/drivers/net/hinic/Makefile\n@@ -9,6 +9,7 @@ include $(RTE_SDK)/mk/rte.vars.mk\n LIB = librte_pmd_hinic.a\n \n CFLAGS += -O3\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n CFLAGS += $(WERROR_FLAGS)\n \n ifeq ($(CONFIG_RTE_ARCH_ARM64),y)\ndiff --git a/drivers/net/hinic/base/hinic_compat.h b/drivers/net/hinic/base/hinic_compat.h\nindex b72e8cfe2..7fab6dc29 100644\n--- a/drivers/net/hinic/base/hinic_compat.h\n+++ b/drivers/net/hinic/base/hinic_compat.h\n@@ -18,6 +18,7 @@\n #include <rte_spinlock.h>\n #include <rte_cycles.h>\n #include <rte_log.h>\n+#include <rte_pmd_bitops.h>\n \n typedef uint8_t u8;\n typedef int8_t s8;\n@@ -116,38 +117,6 @@ extern int hinic_logtype;\n \n #define HINIC_PAGE_SIZE_DPDK\t6\n \n-static inline int hinic_test_bit(int nr, volatile unsigned long *addr)\n-{\n-\tint res;\n-\n-\tres = ((*addr) & (1UL << nr)) != 0;\n-\treturn res;\n-}\n-\n-static inline void hinic_set_bit(unsigned int nr, volatile unsigned long *addr)\n-{\n-\t__sync_fetch_and_or(addr, (1UL << nr));\n-}\n-\n-static inline void hinic_clear_bit(int nr, volatile unsigned long *addr)\n-{\n-\t__sync_fetch_and_and(addr, ~(1UL << nr));\n-}\n-\n-static inline int hinic_test_and_clear_bit(int nr, volatile unsigned long *addr)\n-{\n-\tunsigned long mask = (1UL << nr);\n-\n-\treturn __sync_fetch_and_and(addr, ~mask) & mask;\n-}\n-\n-static inline int hinic_test_and_set_bit(int nr, volatile unsigned long *addr)\n-{\n-\tunsigned long mask = (1UL << nr);\n-\n-\treturn __sync_fetch_and_or(addr, mask) & mask;\n-}\n-\n void *dma_zalloc_coherent(void *dev, size_t size, dma_addr_t *dma_handle,\n \t\t\t gfp_t flag);\n void *dma_zalloc_coherent_aligned(void *dev, size_t size,\ndiff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c\nindex 803a39e2d..c53980f44 100644\n--- a/drivers/net/hinic/hinic_pmd_ethdev.c\n+++ b/drivers/net/hinic/hinic_pmd_ethdev.c\n@@ -269,7 +269,7 @@ static void hinic_dev_interrupt_handler(void *param)\n \tstruct rte_eth_dev *dev = param;\n \tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n \n-\tif (!hinic_test_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status)) {\n+\tif (!rte_get_bit32_relaxed(HINIC_DEV_INTR_EN, &nic_dev->dev_status)) {\n \t\tPMD_DRV_LOG(WARNING, \"Device's interrupt is disabled, ignore interrupt event, dev_name: %s, port_id: %d\",\n \t\t\t nic_dev->proc_dev_name, dev->data->port_id);\n \t\treturn;\n@@ -1076,7 +1076,7 @@ static int hinic_dev_start(struct rte_eth_dev *dev)\n \tif (dev->data->dev_conf.intr_conf.lsc != 0)\n \t\t(void)hinic_link_update(dev, 0);\n \n-\thinic_set_bit(HINIC_DEV_START, &nic_dev->dev_status);\n+\trte_set_bit32_relaxed(HINIC_DEV_START, &nic_dev->dev_status);\n \n \treturn 0;\n \n@@ -1201,7 +1201,8 @@ static void hinic_dev_stop(struct rte_eth_dev *dev)\n \tname = dev->data->name;\n \tport_id = dev->data->port_id;\n \n-\tif (!hinic_test_and_clear_bit(HINIC_DEV_START, &nic_dev->dev_status)) {\n+\tif (!rte_test_and_clear_bit32_relaxed(HINIC_DEV_START,\n+\t\t\t\t\t &nic_dev->dev_status)) {\n \t\tPMD_DRV_LOG(INFO, \"Device %s already stopped\", name);\n \t\treturn;\n \t}\n@@ -1246,7 +1247,7 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tint ret, retries = 0;\n \n-\thinic_clear_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status);\n+\trte_clear_bit32_relaxed(HINIC_DEV_INTR_EN, &nic_dev->dev_status);\n \n \t/* disable msix interrupt in hardware */\n \thinic_set_msix_state(nic_dev->hwdev, 0, HINIC_MSIX_DISABLE);\n@@ -2845,7 +2846,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n \n-\tif (hinic_test_and_set_bit(HINIC_DEV_CLOSE, &nic_dev->dev_status)) {\n+\tif (rte_test_and_set_bit32_relaxed(HINIC_DEV_CLOSE,\n+\t\t\t\t\t &nic_dev->dev_status)) {\n \t\tPMD_DRV_LOG(WARNING, \"Device %s already closed\",\n \t\t\t dev->data->name);\n \t\treturn;\n@@ -3042,7 +3044,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \t\t\t eth_dev->data->name);\n \t\tgoto enable_intr_fail;\n \t}\n-\thinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status);\n+\trte_set_bit32_relaxed(HINIC_DEV_INTR_EN, &nic_dev->dev_status);\n \n \t/* initialize filter info */\n \tfilter_info = &nic_dev->filter;\n@@ -3054,7 +3056,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \tTAILQ_INIT(&nic_dev->filter_fdir_rule_list);\n \tTAILQ_INIT(&nic_dev->hinic_flow_list);\n \n-\thinic_set_bit(HINIC_DEV_INIT, &nic_dev->dev_status);\n+\trte_set_bit32_relaxed(HINIC_DEV_INIT, &nic_dev->dev_status);\n \tPMD_DRV_LOG(INFO, \"Initialize %s in primary successfully\",\n \t\t eth_dev->data->name);\n \n@@ -3110,7 +3112,7 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)\n \tstruct hinic_nic_dev *nic_dev;\n \n \tnic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n-\thinic_clear_bit(HINIC_DEV_INIT, &nic_dev->dev_status);\n+\trte_clear_bit32_relaxed(HINIC_DEV_INIT, &nic_dev->dev_status);\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\ndiff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h\nindex 3e3f3b360..114f1df92 100644\n--- a/drivers/net/hinic/hinic_pmd_ethdev.h\n+++ b/drivers/net/hinic/hinic_pmd_ethdev.h\n@@ -171,7 +171,7 @@ struct hinic_nic_dev {\n \tunsigned int flags;\n \tstruct nic_service_cap nic_cap;\n \tu32 rx_mode_status;\t/* promisc or allmulticast */\n-\tunsigned long dev_status;\n+\tu32 dev_status;\n \n \tchar proc_dev_name[HINIC_DEV_NAME_LEN];\n \t/* PF0->COS4, PF1->COS5, PF2->COS6, PF3->COS7,\ndiff --git a/drivers/net/hinic/meson.build b/drivers/net/hinic/meson.build\nindex bc7e24639..8c7ee9dfc 100644\n--- a/drivers/net/hinic/meson.build\n+++ b/drivers/net/hinic/meson.build\n@@ -1,6 +1,8 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(c) 2017 Huawei Technologies Co., Ltd\n \n+allow_experimental_apis = true\n+\n subdir('base')\n objs = [base_objs]\n \n", "prefixes": [ "v7", "6/6" ] }{ "id": 66412, "url": "