DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: dev@dpdk.org
Cc: "Dmitry Kozlyuk" <dmitry.kozliuk@gmail.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"Chengwen Feng" <fengchengwen@huawei.com>
Subject: [PATCH v2 2/4] eal: deduplicate roundup code
Date: Thu, 25 Aug 2022 18:37:07 +0300	[thread overview]
Message-ID: <20220825153709.33181-3-dmitry.kozliuk@gmail.com> (raw)
In-Reply-To: <20220825153709.33181-1-dmitry.kozliuk@gmail.com>

RTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL().
In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2,
so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/include/rte_common.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index d517e9f75f..b65555bac6 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -425,9 +425,7 @@ rte_is_aligned(void *ptr, unsigned align)
 #define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1)
 
 /** Return the first cache-aligned value greater or equal to size. */
-#define RTE_CACHE_LINE_ROUNDUP(size) \
-	(RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / \
-	RTE_CACHE_LINE_SIZE))
+#define RTE_CACHE_LINE_ROUNDUP(size) RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE)
 
 /** Cache line size in terms of log2 */
 #if RTE_CACHE_LINE_SIZE == 64
-- 
2.33.1


  parent reply	other threads:[~2022-08-25 15:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21 20:50 [PATCH 0/3] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-21 20:50 ` [PATCH 1/3] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-22  7:14   ` Morten Brørup
2022-08-21 20:50 ` [PATCH 2/3] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-22  7:24   ` Morten Brørup
2022-08-22 14:06     ` Bruce Richardson
2022-08-21 20:50 ` [PATCH 3/3] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-22  7:25   ` Morten Brørup
2022-08-22 14:06 ` [PATCH 0/3] eal: small rte_common.h fixes and cleanup Bruce Richardson
2022-08-24  3:52 ` fengchengwen
2022-08-25 15:37 ` [PATCH v2 0/4] " Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-25 15:37   ` Dmitry Kozlyuk [this message]
2022-08-25 15:37   ` [PATCH v2 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-25 22:33   ` [PATCH v3 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 2/4] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-27 11:32     ` [PATCH v4 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 2/4] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-29  8:29         ` Bruce Richardson
2022-09-21  9:27         ` David Marchand
2022-09-21 11:37         ` David Marchand
2022-09-21 13:30       ` [PATCH v4 0/4] eal: small rte_common.h fixes and cleanup David Marchand

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=20220825153709.33181-3-dmitry.kozliuk@gmail.com \
    --to=dmitry.kozliuk@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=mb@smartsharesystems.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).