From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 3/6] net/hns3: use RTE DIM instead of ARRAY SIZE
Date: Mon, 26 Apr 2021 11:34:49 +0800 [thread overview]
Message-ID: <1619408092-54050-4-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1619408092-54050-1-git-send-email-humin29@huawei.com>
From: Chengwen Feng <fengchengwen@huawei.com>
This patch uses RTE_DIM() instead of ARRAY_SIZE().
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
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 4651d5b..2eec895 100644
--- a/drivers/net/hns3/hns3_cmd.c
+++ b/drivers/net/hns3/hns3_cmd.c
@@ -245,7 +245,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;
@@ -276,7 +276,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 68541df..258e26d 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1004,8 +1004,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 cc7d7c6..3155d7f 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
next prev parent reply other threads:[~2021-04-26 3:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 3:34 [dpdk-dev] [PATCH 0/6] optimization and bugfix for hns3 PMD Min Hu (Connor)
2021-04-26 3:34 ` [dpdk-dev] [PATCH 1/6] net/hns3: delete some unused capabilities Min Hu (Connor)
2021-04-27 13:37 ` Ferruh Yigit
2021-04-27 14:26 ` Fengchengwen
2021-04-27 14:30 ` Ferruh Yigit
2021-04-26 3:34 ` [dpdk-dev] [PATCH 2/6] net/hns3: modify write reg opt API impl Min Hu (Connor)
2021-04-26 3:34 ` Min Hu (Connor) [this message]
2021-04-26 3:34 ` [dpdk-dev] [PATCH 4/6] net/hns3: improve IO path data cache usage Min Hu (Connor)
2021-04-26 3:34 ` [dpdk-dev] [PATCH 5/6] net/hns3: log fdir configuration Min Hu (Connor)
2021-04-27 13:39 ` Ferruh Yigit
2021-04-27 14:15 ` Fengchengwen
2021-04-27 14:25 ` Ferruh Yigit
2021-04-27 14:29 ` Fengchengwen
2021-04-26 3:34 ` [dpdk-dev] [PATCH 6/6] net/hns3: fix vector Rx burst default value Min Hu (Connor)
2021-04-27 13:46 ` Ferruh Yigit
2021-04-27 14:34 ` Fengchengwen
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 0/6] optimization and bugfix for hns3 PMD Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 1/6] net/hns3: delete some unused capabilities Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 2/6] net/hns3: modify write reg opt API impl Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 3/6] net/hns3: use RTE DIM instead of ARRAY SIZE Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 4/6] net/hns3: improve IO path data cache usage Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 5/6] net/hns3: log FDIR configuration Min Hu (Connor)
2021-04-28 9:53 ` [dpdk-dev] [PATCH v2 6/6] net/hns3: fix vector Rx burst can't exceed 32 Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 0/6] optimization and bugfix for hns3 PMD Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 1/6] net/hns3: delete some unused capabilities Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 2/6] net/hns3: modify write reg opt API impl Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 3/6] net/hns3: use RTE DIM instead of ARRAY SIZE Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 4/6] net/hns3: improve IO path data cache usage Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 5/6] net/hns3: log FDIR configuration Min Hu (Connor)
2021-04-30 6:28 ` [dpdk-dev] [PATCH v3 6/6] net/hns3: fix vector Rx burst can't exceed 32 Min Hu (Connor)
2021-05-04 16:03 ` [dpdk-dev] [PATCH v3 0/6] optimization and bugfix for hns3 PMD Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1619408092-54050-4-git-send-email-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).