From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30875A0546; Fri, 30 Apr 2021 08:28:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37765410EF; Fri, 30 Apr 2021 08:28:49 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id DD80840688 for ; Fri, 30 Apr 2021 08:28:46 +0200 (CEST) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FWj7B4BHhzBrQP for ; Fri, 30 Apr 2021 14:26:14 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Fri, 30 Apr 2021 14:28:44 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 30 Apr 2021 14:28:47 +0800 Message-ID: <1619764130-57208-4-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619764130-57208-1-git-send-email-humin29@huawei.com> References: <1619408092-54050-1-git-send-email-humin29@huawei.com> <1619764130-57208-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 3/6] net/hns3: use RTE DIM instead of ARRAY SIZE X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng This patch uses RTE_DIM() instead of ARRAY_SIZE(). Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_cmd.c | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 -- drivers/net/hns3/hns3_flow.c | 18 +++++++++--------- drivers/net/hns3/hns3_intr.c | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index 8ebe5e5..44a4e28 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -241,7 +241,7 @@ hns3_is_special_opcode(uint16_t opcode) HNS3_OPC_QUERY_ALL_ERR_INFO,}; uint32_t i; - for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) + for (i = 0; i < RTE_DIM(spec_opcode); i++) if (spec_opcode[i] == opcode) return true; @@ -272,7 +272,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret) uint32_t i; - for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++) + for (i = 0; i < RTE_DIM(hns3_cmdq_status); i++) if (hns3_cmdq_status[i].imp_errcode == desc_ret) return hns3_cmdq_status[i].linux_errcode; diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 23f3722..a6622a6 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -1001,8 +1001,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) #define hns3_read_dev(a, reg) \ hns3_read_reg((a)->io_base, (reg)) -#define ARRAY_SIZE(x) RTE_DIM(x) - #define NEXT_ITEM_OF_ACTION(act, actions, index) \ do { \ act = (actions) + (index); \ diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 4511a49..49d6568 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1054,37 +1054,37 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, case RTE_FLOW_ITEM_TYPE_ETH: ret = hns3_parse_eth(item, rule, error); step_mngr->items = L2_next_items; - step_mngr->count = ARRAY_SIZE(L2_next_items); + step_mngr->count = RTE_DIM(L2_next_items); break; case RTE_FLOW_ITEM_TYPE_VLAN: ret = hns3_parse_vlan(item, rule, error); step_mngr->items = L2_next_items; - step_mngr->count = ARRAY_SIZE(L2_next_items); + step_mngr->count = RTE_DIM(L2_next_items); break; case RTE_FLOW_ITEM_TYPE_IPV4: ret = hns3_parse_ipv4(item, rule, error); step_mngr->items = L3_next_items; - step_mngr->count = ARRAY_SIZE(L3_next_items); + step_mngr->count = RTE_DIM(L3_next_items); break; case RTE_FLOW_ITEM_TYPE_IPV6: ret = hns3_parse_ipv6(item, rule, error); step_mngr->items = L3_next_items; - step_mngr->count = ARRAY_SIZE(L3_next_items); + step_mngr->count = RTE_DIM(L3_next_items); break; case RTE_FLOW_ITEM_TYPE_TCP: ret = hns3_parse_tcp(item, rule, error); step_mngr->items = L4_next_items; - step_mngr->count = ARRAY_SIZE(L4_next_items); + step_mngr->count = RTE_DIM(L4_next_items); break; case RTE_FLOW_ITEM_TYPE_UDP: ret = hns3_parse_udp(item, rule, error); step_mngr->items = L4_next_items; - step_mngr->count = ARRAY_SIZE(L4_next_items); + step_mngr->count = RTE_DIM(L4_next_items); break; case RTE_FLOW_ITEM_TYPE_SCTP: ret = hns3_parse_sctp(item, rule, error); step_mngr->items = L4_next_items; - step_mngr->count = ARRAY_SIZE(L4_next_items); + step_mngr->count = RTE_DIM(L4_next_items); break; default: return rte_flow_error_set(error, ENOTSUP, @@ -1188,7 +1188,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, "Fdir not supported in VF"); step_mngr.items = first_items; - step_mngr.count = ARRAY_SIZE(first_items); + step_mngr.count = RTE_DIM(first_items); for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->type == RTE_FLOW_ITEM_TYPE_VOID) continue; @@ -1202,7 +1202,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, if (ret) return ret; step_mngr.items = tunnel_next_items; - step_mngr.count = ARRAY_SIZE(tunnel_next_items); + step_mngr.count = RTE_DIM(tunnel_next_items); } else { ret = hns3_parse_normal(item, rule, &step_mngr, error); if (ret) diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index ba6a044..b743b41 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -2206,8 +2206,8 @@ hns3_handle_type_reg_error_data(struct hns3_hw *hw, type_id = err_info->type_id & HNS3_ERR_TYPE_MASK; is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET; - total_module = ARRAY_SIZE(hns3_hw_module_name); - total_type = ARRAY_SIZE(hns3_hw_error_type); + total_module = RTE_DIM(hns3_hw_module_name); + total_type = RTE_DIM(hns3_hw_error_type); hns3_err(hw, "total_module:%u, total_type:%u", total_module, total_type); -- 2.7.4