DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: Konstantin Ananyev <konstantin.ananyev@huawei.com>, dev@dpdk.org
Subject: Re: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Date: Tue, 04 Feb 2025 16:58:47 +0100	[thread overview]
Message-ID: <1783033.jNaZZp9DzI@thomas> (raw)
In-Reply-To: <20241206181404.GA14561@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>

06/12/2024 19:14, Andre Muezerie:
> On Fri, Dec 06, 2024 at 04:41:16PM +0000, Konstantin Ananyev wrote:
> > 
> > > > > Macro __SIZEOF_LONG__ is not standardized and MSVC does not define it.
> > > > > Therefore the errors below are seen with MSVC:
> > > > >
> > > > > ../lib/mldev/mldev_utils_scalar.c(465): error C2065:
> > > > >     '__SIZEOF_LONG__': undeclared identifier
> > > > > ../lib/mldev/mldev_utils_scalar.c(478): error C2051:
> > > > >     case expression not constant
> > > > >
> > > > > ../lib/mldev/mldev_utils_scalar_bfloat16.c(33): error C2065:
> > > > >     '__SIZEOF_LONG__': undeclared identifier
> > > > > ../lib/mldev/mldev_utils_scalar_bfloat16.c(49): error C2051:
> > > > >     case expression not constant
> > > > >
> > > > > Turns out that the places where __SIZEOF_LONG__ is currently
> > > > > being used can equally well use sizeof(long) instead.
> > > > >
> > > > > Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> > > > > ---
> > > > >  drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +--
> > > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/drivers/bus/fslmc/mc/fsl_mc_cmd.h b/drivers/bus/fslmc/mc/fsl_mc_cmd.h
> > > > > index a768774c89..f27a18905d 100644
> > > > > --- a/drivers/bus/fslmc/mc/fsl_mc_cmd.h
> > > > > +++ b/drivers/bus/fslmc/mc/fsl_mc_cmd.h
> > > > > @@ -29,9 +29,8 @@
> > > > >  #define le32_to_cpu	rte_le_to_cpu_32
> > > > >  #define le16_to_cpu	rte_le_to_cpu_16
> > > > >
> > > > > -#define BITS_PER_LONG	(__SIZEOF_LONG__ * 8)
> > > > >  #define GENMASK(h, l) \
> > > > > -		(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
> > > > > +		(((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))
> > > >
> > > > Inside
> > > > There are macros: RTE_GENMASK64 (and RTE_GENMASK32).
> > > > Which as I understand does same thing.
> > > > Might be better to just use these ones instead of hand-crafting
> > > > same thing over different PMDs.
> > > >
> > > 
> > > I agree. I can submit a separate patch for that once this series aimed at
> > > unblocking MSVC from being used on this code goes in, if that is OK. If
> > > instead you feel strongly that this change should be made as part of this
> > > series let me know.
> > 
> > I am fine anyway.
> > Just thought that doing something like:
> > #define GENMASK(h, l)	RTE_GENMASK64(h, l)
> > Would be less work for you and less code churn.
> > 
> 
> I thought about that option too, but getting rid of that "redefine" and just 
> replace all occurrences of GENMASK would be better I think, despite
> the code churn.

Yes please, it is better to remove these macros and directly use RTE_ equivalents where needed.
Thanks.






  reply	other threads:[~2025-02-04 15:58 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 20:09 [PATCH 0/6] " Andre Muezerie
2024-12-04 20:09 ` [PATCH 1/6] drivers/bus: " Andre Muezerie
2024-12-04 21:41   ` [PATCH v2 0/6] " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 1/6] drivers/bus: " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 2/6] drivers/common: " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 3/6] drivers/dma: " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 4/6] drivers/net: " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 5/6] drivers/raw: " Andre Muezerie
2024-12-04 21:41     ` [PATCH v2 6/6] lib/mldev: " Andre Muezerie
2024-12-05  4:20   ` [PATCH v3 0/7] " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 1/7] lib/eal: " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 2/7] drivers/bus: " Andre Muezerie
2024-12-06 12:22       ` Konstantin Ananyev
2024-12-06 16:19         ` Andre Muezerie
2024-12-06 16:41           ` Konstantin Ananyev
2024-12-06 16:43             ` Konstantin Ananyev
2024-12-06 18:14             ` Andre Muezerie
2025-02-04 15:58               ` Thomas Monjalon [this message]
2024-12-05  4:20     ` [PATCH v3 3/7] drivers/common: " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 4/7] drivers/dma: " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 5/7] drivers/net: " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 6/7] drivers/raw: " Andre Muezerie
2024-12-05  4:20     ` [PATCH v3 7/7] lib/mldev: " Andre Muezerie
2025-02-04 18:54   ` [PATCH v4 0/7] " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 1/7] eal: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 2/7] drivers/bus: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 3/7] drivers/common: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 4/7] drivers/dma: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 5/7] drivers/net: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 6/7] drivers/raw: " Andre Muezerie
2025-02-04 18:54     ` [PATCH v4 7/7] mldev: " Andre Muezerie
2025-02-05  9:15     ` [PATCH v4 0/7] " Bruce Richardson
2025-02-05 15:37       ` Andre Muezerie
2025-02-05 15:47         ` Bruce Richardson
2025-02-05 15:50           ` Konstantin Ananyev
2024-12-04 20:09 ` [PATCH 2/6] drivers/common: " Andre Muezerie
2024-12-05  1:14   ` Chaoyong He
2024-12-04 20:09 ` [PATCH 3/6] drivers/dma: " Andre Muezerie
2024-12-04 20:09 ` [PATCH 4/6] drivers/net: " Andre Muezerie
2024-12-04 20:09 ` [PATCH 5/6] drivers/raw: " Andre Muezerie
2024-12-04 20:09 ` [PATCH 6/6] lib/mldev: " Andre Muezerie
2024-12-04 21:50 ` [PATCH 0/6] " Stephen Hemminger
2024-12-05  4:19   ` Andre Muezerie

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=1783033.jNaZZp9DzI@thomas \
    --to=thomas@monjalon.net \
    --cc=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --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).