From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Isaac Boukris" <iboukris@gmail.com>,
"Honnappa Nagarahalli" <honnappa.nagarahalli@arm.com>,
"Konstantin Ananyev" <konstantin.ananyev@huawei.com>
Cc: <dev@dpdk.org>
Subject: RE: [PATCH v2] lib/ring: do not allow zero size ring
Date: Tue, 11 Nov 2025 01:40:29 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65555@smartserver.smartshare.dk> (raw)
In-Reply-To: <20251110231546.576516-1-iboukris@gmail.com>
> diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
> index edd63aa535..0a9fc31530 100644
> --- a/lib/ring/rte_ring.c
> +++ b/lib/ring/rte_ring.c
> @@ -47,7 +47,7 @@ EAL_REGISTER_TAILQ(rte_ring_tailq)
> RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ)
>
> /* true if x is a power of 2 */
> -#define POWEROF2(x) ((((x)-1) & (x)) == 0)
> +#define POWEROF2(x) ((x != 0) && (((x)-1) & (x)) == 0)
Please remove this private macro and use the RTE_IS_POWER_OF_2() macro from rte_bitops.h instead.
With such modification,
Acked-by: Morten Brørup <mb@smartsharesystems.com>
<feature creep>
app/pdump/main.c also defines a POWEROF2() macro, which could be replaced by RTE_IS_POWER_OF_2().
But changing that is unrelated to your improvement in this patch, and should be an independent patch.
Not your responsibility to fix that; just mentioning it for someone to pick it up.
</feature creep>
next prev parent reply other threads:[~2025-11-11 0:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 22:28 [PATCH] " Isaac Boukris
2025-11-10 23:15 ` [PATCH v2] " Isaac Boukris
2025-11-10 23:26 ` Wathsala Vithanage
2025-11-11 0:40 ` Morten Brørup [this message]
2025-11-11 6:22 ` [PATCH v3] " Isaac Boukris
2025-11-11 8:24 ` Konstantin Ananyev
2025-11-11 12:25 ` 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=98CBD80474FA8B44BF855DF32C47DC35F65555@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=dev@dpdk.org \
--cc=honnappa.nagarahalli@arm.com \
--cc=iboukris@gmail.com \
--cc=konstantin.ananyev@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;
as well as URLs for NNTP newsgroup(s).