DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Xingui Yang <yangxingui@huawei.com>,
	Chengwen Feng <fengchengwen@huawei.com>
Cc: dev@dpdk.org, Joshua Washington <joshwash@google.com>,
	 Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v3 07/16] net/hns3: use common division round up macro
Date: Tue, 22 Sep 2026 18:07:30 -0700	[thread overview]
Message-ID: <20260923010742.2468145-8-joshwash@google.com> (raw)
In-Reply-To: <20260923010742.2468145-1-joshwash@google.com>

The RTE_DIV_ROUND_UP in rte_common.h makes DIV_ROUND_UP redundant.

Signed-off-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/hns3/hns3_ethdev.h | 2 --
 drivers/net/hns3/hns3_fdir.c   | 2 +-
 drivers/net/hns3/hns3_regs.c   | 8 ++++----
 drivers/net/hns3/hns3_rss.c    | 8 ++++----
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 209b042816..b4feff4b94 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -978,8 +978,6 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
 #define rounddown(x, y) ((x) - ((x) % (y)))
 
-#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
-
 /*
  * Because hardware always access register in little-endian mode based on hns3
  * network engine, so driver should also call rte_cpu_to_le_32 to convert data
diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c
index 50572ae430..dfcc5c0d99 100644
--- a/drivers/net/hns3/hns3_fdir.c
+++ b/drivers/net/hns3/hns3_fdir.c
@@ -129,7 +129,7 @@ static const struct key_info tuple_key_info[] = {
 #define MAX_KEY_LENGTH		400
 #define MAX_200B_KEY_LENGTH	200
 #define MAX_META_DATA_LENGTH	16
-#define MAX_KEY_DWORDS	DIV_ROUND_UP(MAX_KEY_LENGTH / HNS3_BITS_PER_BYTE, 4)
+#define MAX_KEY_DWORDS	RTE_DIV_ROUND_UP(MAX_KEY_LENGTH / HNS3_BITS_PER_BYTE, 4)
 #define MAX_KEY_BYTES	(MAX_KEY_DWORDS * 4)
 
 enum HNS3_FD_PACKET_TYPE {
diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c
index 5c74f9ae2e..066b836556 100644
--- a/drivers/net/hns3/hns3_regs.c
+++ b/drivers/net/hns3/hns3_regs.c
@@ -1034,8 +1034,8 @@ hns3_get_32_bit_regs(struct hns3_hw *hw, uint32_t regs_num, struct rte_dev_reg_i
 	if (regs_num == 0)
 		return 0;
 
-	cmd_num = DIV_ROUND_UP(regs_num + HNS3_32_BIT_DESC_NODATA_LEN,
-			       HNS3_32_BIT_REG_RTN_DATANUM);
+	cmd_num = RTE_DIV_ROUND_UP(regs_num + HNS3_32_BIT_DESC_NODATA_LEN,
+				   HNS3_32_BIT_REG_RTN_DATANUM);
 	desc = rte_zmalloc("hns3-32bit-regs",
 			   sizeof(struct hns3_cmd_desc) * cmd_num, 0);
 	if (desc == NULL) {
@@ -1093,8 +1093,8 @@ hns3_get_64_bit_regs(struct hns3_hw *hw, uint32_t regs_num, struct rte_dev_reg_i
 	if (regs_num == 0)
 		return 0;
 
-	cmd_num = DIV_ROUND_UP(regs_num + HNS3_64_BIT_DESC_NODATA_LEN,
-			       HNS3_64_BIT_REG_RTN_DATANUM);
+	cmd_num = RTE_DIV_ROUND_UP(regs_num + HNS3_64_BIT_DESC_NODATA_LEN,
+				   HNS3_64_BIT_REG_RTN_DATANUM);
 	desc = rte_zmalloc("hns3-64bit-regs",
 			   sizeof(struct hns3_cmd_desc) * cmd_num, 0);
 	if (desc == NULL) {
diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 508b3e26d0..6cb8d9482d 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -295,7 +295,7 @@ hns3_rss_set_algo_key(struct hns3_hw *hw, uint8_t hash_algo,
 
 	req = (struct hns3_rss_generic_config_cmd *)desc.data;
 
-	max_bd_num = DIV_ROUND_UP(key_len, HNS3_RSS_HASH_KEY_NUM);
+	max_bd_num = RTE_DIV_ROUND_UP(key_len, HNS3_RSS_HASH_KEY_NUM);
 	for (idx = 0; idx < max_bd_num; idx++) {
 		hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_GENERIC_CONFIG,
 					  false);
@@ -335,7 +335,7 @@ hns3_rss_get_algo_key(struct hns3_hw *hw,  uint8_t *hash_algo,
 	int ret;
 
 	req = (struct hns3_rss_generic_config_cmd *)desc.data;
-	max_bd_num = DIV_ROUND_UP(key_len, HNS3_RSS_HASH_KEY_NUM);
+	max_bd_num = RTE_DIV_ROUND_UP(key_len, HNS3_RSS_HASH_KEY_NUM);
 	for (idx = 0; idx < max_bd_num; idx++) {
 		hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_GENERIC_CONFIG,
 					  true);
@@ -381,7 +381,7 @@ hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, uint16_t size)
 	int ret;
 
 	req = (struct hns3_rss_indirection_table_cmd *)desc.data;
-	max_bd_num = DIV_ROUND_UP(size, HNS3_RSS_CFG_TBL_SIZE);
+	max_bd_num = RTE_DIV_ROUND_UP(size, HNS3_RSS_CFG_TBL_SIZE);
 	for (i = 0; i < max_bd_num; i++) {
 		hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INDIR_TABLE,
 					  false);
@@ -431,7 +431,7 @@ hns3_get_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, uint16_t size)
 	int ret;
 
 	req = (struct hns3_rss_indirection_table_cmd *)desc.data;
-	max_bd_num = DIV_ROUND_UP(size, HNS3_RSS_CFG_TBL_SIZE);
+	max_bd_num = RTE_DIV_ROUND_UP(size, HNS3_RSS_CFG_TBL_SIZE);
 	for (i = 0; i < max_bd_num; i++) {
 		hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INDIR_TABLE,
 					  true);
-- 
2.55.0.1082.g2b9226bbc0-goog


  parent reply	other threads:[~2026-09-23  1:08 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 22:30 [PATCH] eal: introduce division round up macro Joshua Washington
2026-08-13  1:29 ` Stephen Hemminger
2026-08-13 17:22 ` [PATCH v2 00/14] Introduce RTE_DIV_ROUND_UP Joshua Washington
2026-08-13 17:22   ` [PATCH v2 01/14] eal: introduce division round up macro Joshua Washington
2026-08-13 17:22   ` [PATCH v2 02/14] net/i40e: use common " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 03/14] net/idpf: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 04/14] net/ice: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 05/14] net/qede: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 06/14] net/rnp: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 07/14] net/hns3: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 08/14] net/hinic: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 09/14] net/bnx2x: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 10/14] net/cxgbe: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 11/14] net/ena: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 12/14] raw/ifpga/base: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 13/14] drivers: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 14/14] app/procinfo: " Joshua Washington
2026-08-15 15:32   ` [PATCH v2 00/14] Introduce RTE_DIV_ROUND_UP Stephen Hemminger
2026-09-22  0:36   ` Stephen Hemminger
2026-09-23  1:07 ` [PATCH v3 00/16] " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 01/16] eal: introduce division round up macro Joshua Washington
2026-09-23  7:29     ` Bruce Richardson
2026-09-24  7:47     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 02/16] net/i40e: use common " Joshua Washington
2026-09-23  7:30     ` Bruce Richardson
2026-09-23  7:35       ` Bruce Richardson
2026-09-29 22:44         ` Joshua Washington
2026-09-30  7:31           ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 03/16] net/idpf: " Joshua Washington
2026-09-23  7:31     ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 04/16] net/ice: " Joshua Washington
2026-09-23  7:31     ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 05/16] net/qede: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 06/16] net/rnp: " Joshua Washington
2026-09-23  1:07   ` Joshua Washington [this message]
2026-09-24  7:48     ` [PATCH v3 07/16] net/hns3: " fengchengwen
2026-09-23  1:07   ` [PATCH v3 08/16] net/hinic: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 09/16] net/bnx2x: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 10/16] net/cxgbe: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 11/16] net/ena: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 12/16] raw/ifpga/base: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 13/16] net/nfp: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 14/16] app/procinfo: " Joshua Washington
2026-09-24  7:49     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 15/16] app/test: " Joshua Washington
2026-09-23  7:36     ` Bruce Richardson
2026-09-24  7:51     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 16/16] app/test-compress-perf: " Joshua Washington
2026-09-23  7:36     ` Bruce Richardson
2026-09-24  7:51     ` fengchengwen
2026-09-23 17:32   ` [PATCH v3 00/16] Introduce RTE_DIV_ROUND_UP Stephen Hemminger
2026-10-06  2:30   ` [PATCH v4 00/15] " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 01/15] eal: introduce division round up macro Joshua Washington
2026-10-06  2:30     ` [PATCH v4 02/15] net/i40e: use common " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 03/15] net/idpf: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 04/15] net/ice: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 05/15] net/qede: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 06/15] net/rnp: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 07/15] net/hns3: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 08/15] net/hinic: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 09/15] net/bnx2x: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 10/15] net/cxgbe: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 11/15] net/ena: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 12/15] net/nfp: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 13/15] app/procinfo: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 14/15] app/test: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 15/15] app/test-compress-perf: " Joshua Washington
2026-10-06 16:38     ` [PATCH v4 00/15] Introduce RTE_DIV_ROUND_UP Stephen Hemminger
2026-10-07 20:21       ` Thomas Monjalon

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=20260923010742.2468145-8-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=yangxingui@huawei.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