eliminate dependency on non-portable __SIZEOF_LONG__
Subsystems (2)
cover eliminate dependency on non-portable __SIZEOF_LONG__
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 equaly well use sizeof(long) instead.
Andre Muezerie (6):
drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__ lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- lib/mldev/mldev_utils_scalar.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
--
2.47.0.vfs.0.3
PATCH 1/6 drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
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 equaly well use sizeof(long) instead.
--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1 -1
@@ -29,7 +29,7 @@#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 BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.47.0.vfs.0.3
v2 cover eliminate dependency on non-portable __SIZEOF_LONG__
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.
v2:
* fixed typo in commit message
Andre Muezerie (6):
drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__ lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- lib/mldev/mldev_utils_scalar.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
--
2.47.0.vfs.0.3
PATCH v2 1/6 drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
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.
--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1 -1
@@ -29,7 +29,7 @@#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 BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 2/6 drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_bits.h +2 -2
@@ -14,10 +14,10 @@#endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#endif #ifndef GENMASK
drivers/common/nfp/nfp_platform.h +2 -2
@@ -14,8 +14,8 @@#define DMA_BIT_MASK (n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#define GENMASK (h, l) \ ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1)))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 3/6 drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +1 -1
@@ -14,7 +14,7 @@#define RETRIES 5#ifndef GENMASK -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#endif
drivers/dma/hisilicon/hisi_dmadev.h +1 -1
@@ -12,7 +12,7 @@#include <rte_dmadev_pmd.h> #define BIT (x) (1ul << (x)) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#define BF_SHF (x) rte_bsf64(x)
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 4/6 drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ena/base/ena_plat_dpdk.h +2 -2
@@ -97,11 +97,11 @@ extern int ena_logtype_com;#define ENA_MIN16 (x, y) ENA_MIN_T(uint16_t, (x), (y))#define ENA_MIN8 (x, y) ENA_MIN_T(uint8_t, (x), (y)) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#define U64_C (x) x ## ULL#define BIT (nr) RTE_BIT32(nr)#define BIT64 (nr) RTE_BIT64(nr) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#define GENMASK_ULL (h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
drivers/net/hns3/hns3_ethdev.h +1 -1
@@ -952,7 +952,7 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)#define BIT_ULL (x) (1ULL << (x)) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 5/6 drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/raw/ifpga/base/opae_osdep.h +2 -2
@@ -31,10 +31,10 @@ struct uuid {#ifndef LINUX_MACROS #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#endif #ifndef BIT #define BIT (a) (1UL << (a))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 6/6 lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- lib/mldev/mldev_utils_scalar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mldev/mldev_utils_scalar.h +1 -1
@@ -13,7 +13,7 @@#endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef GENMASK_U32
Signature · 1 line
2.47.0.vfs.0.3
v3 cover eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
v3:
* added prefix RTE_ to BITS_PER_LONG* and moved them to rte_common.h
* defined PLT_BITS_PER_LONG* in drivers/common/cnxk/roc_platform.h to avoid warnings from checkpatches.sh like:
Warning in drivers/common/cnxk/roc_bits.h:
Warning in drivers/common/cnxk/roc_ie_ot.h:
Warning in drivers/common/cnxk/roc_ie_ot_tls.h:
Use plt_ symbols instead of rte_ API in cnxk base driver
It can be seen that the same was done in the past for similar macros like PLT_CACHE_LINE_SIZE
v2:
* fixed typo in commit message
Andre Muezerie (7):
lib/eal: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__ lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- drivers/common/cnxk/cnxk_security_ar.h | 4 ++-- drivers/common/cnxk/roc_bits.h | 13 ++++--------- drivers/common/cnxk/roc_ie_ot.h | 4 ++-- drivers/common/cnxk/roc_ie_ot_tls.h | 5 +++-- drivers/common/cnxk/roc_platform.h | 2 ++ drivers/common/nfp/nfp_platform.h | 8 +++----- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- drivers/dma/hisilicon/hisi_dmadev.h | 3 +-- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- drivers/raw/ifpga/base/opae_osdep.h | 12 ++++-------- lib/eal/include/rte_common.h | 5 +++++ lib/mldev/mldev_utils_scalar.h | 6 +----- 14 files changed, 32 insertions(+), 45 deletions(-)
--
2.47.0.vfs.0.3
PATCH v3 1/7 lib/eal: eliminate dependency on non-portable __SIZEOF_LONG__
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.
--- lib/eal/include/rte_common.h | 5 +++++ 1 file changed, 5 insertions(+)
lib/eal/include/rte_common.h +5 -0
@@ -603,6 +603,11 @@ rte_is_aligned(const void * const __rte_restrict ptr, const unsigned int align)*/ #define RTE_BUILD_BUG_ON (condition) do { static_assert(!(condition), #condition); } while (0) +/*********** Data type size related macros ********/ + +#define RTE_BITS_PER_LONG (sizeof(long) * 8) +#define RTE_BITS_PER_LONG_LONG (sizeof(long long) * 8) +/*********** Cache line related macros ********/ /** Cache line mask. */
Signature · 1 line
2.47.0.vfs.0.3
PATCH v3 2/7 drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1 -2
@@ -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)))) struct mc_cmd_header { union {
Signature · 1 line
2.47.0.vfs.0.3
RE: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Quoted 29 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0
drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 7 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2@@ -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.
Quoted 5 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-1struct mc_cmd_header { union { --2.47.0.vfs.0.3
Re: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Quoted 32 lines · Konstantin Ananyev
Quoted 32 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0@@ -29,9 +29,8 @@#define le32_to_cpu rte_le_to_cpu_32#define le16_to_cpu rte_le_to_cpu_16
Quoted 11 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 4 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2-#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(andRTE_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.
--
Andre Muezerie
Quoted 5 lines
Quoted 5 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-1struct mc_cmd_header { union { --2.47.0.vfs.0.3
RE: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Quoted 42 lines
Quoted 30 lines
Quoted 30 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0@@ -29,9 +29,8 @@#define le32_to_cpu rte_le_to_cpu_32#define le16_to_cpu rte_le_to_cpu_16Quoted 11 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 4 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2-#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(andRTE_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.
Quoted 4 lines
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.
Quoted 8 lines
--
Andre MuezerieQuoted 5 lines
Quoted 5 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-1struct mc_cmd_header { union { --2.47.0.vfs.0.3
RE: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
Quoted 51 lines
-----Original Message-----
From: Konstantin Ananyev <[email protected]>
Sent: Friday, December 6, 2024 4:41 PM
To: Andre Muezerie <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v3 2/7]drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__Quoted 41 lines
Quoted 40 lines
Quoted 26 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 7 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2@@ -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(andRTE_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.
Quoted 6 lines
Quoted 4 lines
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.
Sorry meant to say: I am fine either way.
:)
Quoted 12 lines
Just thought that doing something like:
#defineGENMASK(h, l)RTE_GENMASK64(h, l)
Would be less work for you and less code churn.Quoted 8 lines
--
Andre MuezerieQuoted 5 lines
Quoted 5 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-1struct mc_cmd_header { union { --2.47.0.vfs.0.3
Re: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Konstantin AnanyevQuoted 47 lines · Konstantin Ananyev
Quoted 42 lines
Quoted 30 lines
Quoted 30 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0@@ -29,9 +29,8 @@#define le32_to_cpu rte_le_to_cpu_32#define le16_to_cpu rte_le_to_cpu_16Quoted 11 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 4 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2-#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(andRTE_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.Quoted 4 lines
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.
Quoted 5 lines
I am fine anyway.
Just thought that doing something like:
#defineGENMASK(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.
Quoted 8 lines
Quoted 8 lines
--
Andre MuezerieQuoted 5 lines
Quoted 5 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-1struct mc_cmd_header { union { --2.47.0.vfs.0.3
Re: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
06/12/2024 19:14, Andre Muezerie:
Quoted 54 lines · Konstantin Ananyev
Quoted 47 lines
Quoted 42 lines
Quoted 30 lines
Quoted 30 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/bus/fslmc/mc/fsl_mc_cmd.h +0
-0@@ -29,9 +29,8 @@#define le32_to_cpu rte_le_to_cpu_32#define le16_to_cpu rte_le_to_cpu_16Quoted 11 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h line 33
Quoted 4 lines
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1
-2-#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(andRTE_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.Quoted 4 lines
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.
Quoted 5 lines
I am fine anyway.
Just thought that doing something like:
#defineGENMASK(h, l)RTE_GENMASK64(h, l)
Would be less work for you and less code churn.
Quoted 3 lines
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.
PATCH v3 3/7 drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/common/cnxk/cnxk_security_ar.h | 4 ++-- drivers/common/cnxk/roc_bits.h | 13 ++++--------- drivers/common/cnxk/roc_ie_ot.h | 4 ++-- drivers/common/cnxk/roc_ie_ot_tls.h | 5 +++-- drivers/common/cnxk/roc_platform.h | 2 ++ drivers/common/nfp/nfp_platform.h | 8 +++----- 6 files changed, 16 insertions(+), 20 deletions(-)
drivers/common/cnxk/cnxk_security_ar.h +2 -2
@@ -13,8 +13,8 @@/* u64 array size to fit anti replay window bits */ #define AR_WIN_ARR_SZ \ - (PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX + 1, BITS_PER_LONG_LONG) / \ - BITS_PER_LONG_LONG) + (PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX + 1, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)#define WORD_SHIFT 6#define WORD_SIZE (1ULL << WORD_SHIFT)
drivers/common/cnxk/roc_bits.h +4 -9
@@ -5,6 +5,8 @@#ifndef _ROC_BITS_H_#define _ROC_BITS_H_ +#include <rte_common.h> +#ifndef BIT_ULL #define BIT_ULL (nr) (1ULL << (nr))#endif
@@ -13,20 +15,13 @@#define BIT (nr) (1UL << (nr))#endif -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#endif -#ifndef GENMASK -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (PLT_BITS_PER_LONG - 1 - (h))))#endif #ifndef GENMASK_ULL #define GENMASK_ULL (h, l) \ (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (~0ULL >> (PLT_BITS_PER_LONG_LONG - 1 - (h))))#endif #endif /* _ROC_BITS_H_ */
drivers/common/cnxk/roc_ie_ot.h +2 -2
@@ -168,8 +168,8 @@ roc_ie_ot_ucc_is_success(uint8_t ucc)/* u64 array size to fit anti replay window bits */ #define ROC_AR_WINBITS_SZ \ - (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) / \ - BITS_PER_LONG_LONG) + (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)#define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
drivers/common/cnxk/roc_ie_ot_tls.h +3 -2
@@ -13,8 +13,9 @@#define ROC_IE_OT_TLS_LOG_MIN_AR_WIN_SIZE_M1 5/* u64 array size to fit anti replay window bits */ -#define ROC_IE_OT_TLS_AR_WINBITS_SZ \ - (PLT_ALIGN_CEIL(ROC_IE_OT_TLS_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) / BITS_PER_LONG_LONG) +#define ROC_IE_OT_TLS_AR_WINBITS_SZ \ + (PLT_ALIGN_CEIL(ROC_IE_OT_TLS_AR_WIN_SIZE_MAX, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)/* CN10K TLS opcodes */ #define ROC_IE_OT_TLS_MAJOR_OP_RECORD_ENC 0x16UL
drivers/common/cnxk/roc_platform.h +2 -0
@@ -58,6 +58,8 @@#define PLT_ALIGN RTE_ALIGN#define PLT_ALIGN_MUL_CEIL RTE_ALIGN_MUL_CEIL#define PLT_MODEL_MZ_NAME "roc_model_mz" +#define PLT_BITS_PER_LONG RTE_BITS_PER_LONG +#define PLT_BITS_PER_LONG_LONG RTE_BITS_PER_LONG_LONG#define PLT_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE#define BITMASK_ULL GENMASK_ULL#define PLT_ALIGN_CEIL RTE_ALIGN_CEIL
drivers/common/nfp/nfp_platform.h +3 -5
@@ -9,19 +9,17 @@#include <stdint.h> #include <rte_bitops.h> +#include <rte_common.h> #define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d))#define DMA_BIT_MASK (n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#define GENMASK (h, l) \ - ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1))) + ((~0UL << (l)) & (~0UL >> (RTE_BITS_PER_LONG - (h) - 1)))#define GENMASK_ULL (h, l) \ - ((~0ULL << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - (h) - 1))) + ((~0ULL << (l)) & (~0ULL >> (RTE_BITS_PER_LONG_LONG - (h) - 1)))#define __bf_shf (x) rte_bsf64(x)
Signature · 1 line
2.47.0.vfs.0.3
PATCH v3 4/7 drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- drivers/dma/hisilicon/hisi_dmadev.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +1 -2
@@ -14,9 +14,8 @@#define RETRIES 5#ifndef GENMASK -#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))))#endif #define QDMA_CTRL_REGION_OFFSET 0
drivers/dma/hisilicon/hisi_dmadev.h +1 -2
@@ -12,9 +12,8 @@#include <rte_dmadev_pmd.h> #define BIT (x) (1ul << (x)) -#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))))#define BF_SHF (x) rte_bsf64(x)#define FIELD_GET (mask, reg) \ ((typeof(mask))(((reg) & (mask)) >> BF_SHF(mask)))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v3 5/7 drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/ena/base/ena_plat_dpdk.h +2 -4
@@ -97,14 +97,12 @@ extern int ena_logtype_com;#define ENA_MIN16 (x, y) ENA_MIN_T(uint16_t, (x), (y))#define ENA_MIN8 (x, y) ENA_MIN_T(uint8_t, (x), (y)) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)#define U64_C (x) x ## ULL#define BIT (nr) RTE_BIT32(nr)#define BIT64 (nr) RTE_BIT64(nr) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#define GENMASK_ULL (h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h)))) #define ena_trc_log(dev, level, fmt, arg...) \ ( \
drivers/net/hns3/hns3_ethdev.h +1 -2
@@ -952,9 +952,8 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)#define BIT_ULL (x) (1ULL << (x)) -#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))))#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y))#define rounddown (x, y) ((x) - ((x) % (y)))
Signature · 1 line
2.47.0.vfs.0.3
PATCH v3 6/7 drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/raw/ifpga/base/opae_osdep.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/raw/ifpga/base/opae_osdep.h +4 -8
@@ -9,6 +9,8 @@#include <stdbool.h> #include <pthread.h> +#include <rte_common.h> +#ifdef RTE_LIB_EAL #include "osdep_rte/osdep_generic.h" #else
@@ -30,12 +32,6 @@ struct uuid { };#ifndef LINUX_MACROS -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#endif #ifndef BIT #define BIT (a) (1UL << (a))#endif /* BIT */
@@ -43,11 +39,11 @@ struct uuid {#define BIT_ULL (a) (1ULL << (a))#endif /* BIT_ULL */ #ifndef GENMASK -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#endif /* GENMASK */ #ifndef GENMASK_ULL #define GENMASK_ULL (h, l) \ - (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (((~0ULL) << (l)) & (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h))))#endif /* GENMASK_ULL */ #endif /* LINUX_MACROS */
Signature · 1 line
2.47.0.vfs.0.3
PATCH v3 7/7 lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- lib/mldev/mldev_utils_scalar.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/mldev/mldev_utils_scalar.h +1 -5
@@ -12,12 +12,8 @@#define BIT (nr) (1UL << (nr))#endif -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef GENMASK_U32 -#define GENMASK_U32 (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK_U32 (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#endif /* float32: bit index of MSB & LSB of sign, exponent and mantissa */
Signature · 1 line
2.47.0.vfs.0.3
v4 cover eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
v4:
* rebased on latest main as previous patch was not applying cleanly anymore.
v3:
* added prefix RTE_ to BITS_PER_LONG* and moved them to rte_common.h
* defined PLT_BITS_PER_LONG* in drivers/common/cnxk/roc_platform.h to avoid warnings from checkpatches.sh like:
Warning in drivers/common/cnxk/roc_bits.h:
Warning in drivers/common/cnxk/roc_ie_ot.h:
Warning in drivers/common/cnxk/roc_ie_ot_tls.h:
Use plt_ symbols instead of rte_ API in cnxk base driver
It can be seen that the same was done in the past for similar macros like PLT_CACHE_LINE_SIZE
v2:
* fixed typo in commit message
Andre Muezerie (7):
eal: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
mldev: eliminate dependency on non-portable __SIZEOF_LONG__
drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- drivers/common/cnxk/cnxk_security_ar.h | 4 ++-- drivers/common/cnxk/roc_bits.h | 13 ++++--------- drivers/common/cnxk/roc_ie_ot.h | 4 ++-- drivers/common/cnxk/roc_ie_ot_tls.h | 5 +++-- drivers/common/cnxk/roc_platform.h | 2 ++ drivers/common/nfp/nfp_platform.h | 8 +++----- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- drivers/dma/hisilicon/hisi_dmadev.h | 3 +-- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- drivers/raw/ifpga/base/opae_osdep.h | 12 ++++-------- lib/eal/include/rte_common.h | 5 +++++ lib/mldev/mldev_utils_scalar.h | 6 +----- 14 files changed, 32 insertions(+), 45 deletions(-)
--
2.47.2.vfs.0.1
PATCH v4 1/7 eal: eliminate dependency on non-portable __SIZEOF_LONG__
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.
--- lib/eal/include/rte_common.h | 5 +++++ 1 file changed, 5 insertions(+)
lib/eal/include/rte_common.h +5 -0
@@ -679,6 +679,11 @@ rte_is_aligned(const void * const __rte_restrict ptr, const unsigned int align)*/ #define RTE_BUILD_BUG_ON (condition) do { static_assert(!(condition), #condition); } while (0) +/*********** Data type size related macros ********/ + +#define RTE_BITS_PER_LONG (sizeof(long) * 8) +#define RTE_BITS_PER_LONG_LONG (sizeof(long long) * 8) +/*********** Cache line related macros ********/ /** Cache line mask. */
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 2/7 drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/bus/fslmc/mc/fsl_mc_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bus/fslmc/mc/fsl_mc_cmd.h +1 -2
@@ -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)))) struct mc_cmd_header { union {
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 3/7 drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/common/cnxk/cnxk_security_ar.h | 4 ++-- drivers/common/cnxk/roc_bits.h | 13 ++++--------- drivers/common/cnxk/roc_ie_ot.h | 4 ++-- drivers/common/cnxk/roc_ie_ot_tls.h | 5 +++-- drivers/common/cnxk/roc_platform.h | 2 ++ drivers/common/nfp/nfp_platform.h | 8 +++----- 6 files changed, 16 insertions(+), 20 deletions(-)
drivers/common/cnxk/cnxk_security_ar.h +2 -2
@@ -13,8 +13,8 @@/* u64 array size to fit anti replay window bits */ #define AR_WIN_ARR_SZ \ - (PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX + 1, BITS_PER_LONG_LONG) / \ - BITS_PER_LONG_LONG) + (PLT_ALIGN_CEIL(CNXK_ON_AR_WIN_SIZE_MAX + 1, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)#define WORD_SHIFT 6#define WORD_SIZE (1ULL << WORD_SHIFT)
drivers/common/cnxk/roc_bits.h +4 -9
@@ -5,6 +5,8 @@#ifndef _ROC_BITS_H_#define _ROC_BITS_H_ +#include <rte_common.h> +#ifndef BIT_ULL #define BIT_ULL (nr) (1ULL << (nr))#endif
@@ -13,20 +15,13 @@#define BIT (nr) (1UL << (nr))#endif -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#endif -#ifndef GENMASK -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (PLT_BITS_PER_LONG - 1 - (h))))#endif #ifndef GENMASK_ULL #define GENMASK_ULL (h, l) \ (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (~0ULL >> (PLT_BITS_PER_LONG_LONG - 1 - (h))))#endif #endif /* _ROC_BITS_H_ */
drivers/common/cnxk/roc_ie_ot.h +2 -2
@@ -168,8 +168,8 @@ roc_ie_ot_ucc_is_success(uint8_t ucc)/* u64 array size to fit anti replay window bits */ #define ROC_AR_WINBITS_SZ \ - (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) / \ - BITS_PER_LONG_LONG) + (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)#define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
drivers/common/cnxk/roc_ie_ot_tls.h +3 -2
@@ -13,8 +13,9 @@#define ROC_IE_OT_TLS_LOG_MIN_AR_WIN_SIZE_M1 5/* u64 array size to fit anti replay window bits */ -#define ROC_IE_OT_TLS_AR_WINBITS_SZ \ - (PLT_ALIGN_CEIL(ROC_IE_OT_TLS_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) / BITS_PER_LONG_LONG) +#define ROC_IE_OT_TLS_AR_WINBITS_SZ \ + (PLT_ALIGN_CEIL(ROC_IE_OT_TLS_AR_WIN_SIZE_MAX, PLT_BITS_PER_LONG_LONG) / \ + PLT_BITS_PER_LONG_LONG)/* CN10K TLS opcodes */ #define ROC_IE_OT_TLS_MAJOR_OP_RECORD_ENC 0x16UL
drivers/common/cnxk/roc_platform.h +2 -0
@@ -58,6 +58,8 @@#define PLT_ALIGN RTE_ALIGN#define PLT_ALIGN_MUL_CEIL RTE_ALIGN_MUL_CEIL#define PLT_MODEL_MZ_NAME "roc_model_mz" +#define PLT_BITS_PER_LONG RTE_BITS_PER_LONG +#define PLT_BITS_PER_LONG_LONG RTE_BITS_PER_LONG_LONG#define PLT_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE#define BITMASK_ULL GENMASK_ULL#define PLT_ALIGN_CEIL RTE_ALIGN_CEIL
drivers/common/nfp/nfp_platform.h +3 -5
@@ -9,19 +9,17 @@#include <stdint.h> #include <rte_bitops.h> +#include <rte_common.h> #define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d))#define DMA_BIT_MASK (n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#define GENMASK (h, l) \ - ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1))) + ((~0UL << (l)) & (~0UL >> (RTE_BITS_PER_LONG - (h) - 1)))#define GENMASK_ULL (h, l) \ - ((~0ULL << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - (h) - 1))) + ((~0ULL << (l)) & (~0ULL >> (RTE_BITS_PER_LONG_LONG - (h) - 1)))#define __bf_shf (x) rte_bsf64(x)
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 4/7 drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- drivers/dma/hisilicon/hisi_dmadev.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +1 -2
@@ -14,9 +14,8 @@#define RETRIES 5#ifndef GENMASK -#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))))#endif #define QDMA_CTRL_REGION_OFFSET 0
drivers/dma/hisilicon/hisi_dmadev.h +1 -2
@@ -12,9 +12,8 @@#include <rte_dmadev_pmd.h> #define BIT (x) (1ul << (x)) -#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))))#define BF_SHF (x) rte_bsf64(x)#define FIELD_GET (mask, reg) \ ((typeof(mask))(((reg) & (mask)) >> BF_SHF(mask)))
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 5/7 drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/ena/base/ena_plat_dpdk.h +2 -4
@@ -97,14 +97,12 @@ extern int ena_logtype_com;#define ENA_MIN16 (x, y) ENA_MIN_T(uint16_t, (x), (y))#define ENA_MIN8 (x, y) ENA_MIN_T(uint8_t, (x), (y)) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8)#define U64_C (x) x ## ULL#define BIT (nr) RTE_BIT32(nr)#define BIT64 (nr) RTE_BIT64(nr) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#define GENMASK_ULL (h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h))))#define ena_trc_log (dev, level, fmt, ...) \ ( \
drivers/net/hns3/hns3_ethdev.h +1 -2
@@ -952,9 +952,8 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)#define BIT_ULL (x) (1ULL << (x)) -#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))))#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y))#define rounddown (x, y) ((x) - ((x) % (y)))
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 6/7 drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- drivers/raw/ifpga/base/opae_osdep.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/raw/ifpga/base/opae_osdep.h +4 -8
@@ -9,6 +9,8 @@#include <stdbool.h> #include <pthread.h> +#include <rte_common.h> +#ifdef RTE_LIB_EAL #include "osdep_rte/osdep_generic.h" #else
@@ -30,12 +32,6 @@ struct uuid { };#ifndef LINUX_MACROS -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) -#endif #ifndef BIT #define BIT (a) (1UL << (a))#endif /* BIT */
@@ -43,11 +39,11 @@ struct uuid {#define BIT_ULL (a) (1ULL << (a))#endif /* BIT_ULL */ #ifndef GENMASK -#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#endif /* GENMASK */ #ifndef GENMASK_ULL #define GENMASK_ULL (h, l) \ - (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + (((~0ULL) << (l)) & (~0ULL >> (RTE_BITS_PER_LONG_LONG - 1 - (h))))#endif /* GENMASK_ULL */ #endif /* LINUX_MACROS */
Signature · 1 line
2.47.2.vfs.0.1
PATCH v4 7/7 mldev: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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.
--- lib/mldev/mldev_utils_scalar.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/mldev/mldev_utils_scalar.h +1 -5
@@ -12,12 +12,8 @@#define BIT (nr) (1UL << (nr))#endif -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif -#ifndef GENMASK_U32 -#define GENMASK_U32 (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK_U32 (h, l) (((~0UL) << (l)) & (~0UL >> (RTE_BITS_PER_LONG - 1 - (h))))#endif /* float32: bit index of MSB & LSB of sign, exponent and mantissa */
Signature · 1 line
2.47.2.vfs.0.1
Quoted 36 lines · Andre Muezerie
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.v4:
* rebased on latest main as previous patch was not applying cleanly anymore.v3:
* added prefixRTE_to BITS_PER_LONG* and moved them torte_common.h
* defined PLT_BITS_PER_LONG* indrivers/common/cnxk/roc_platform.hto avoid warnings fromcheckpatches.shlike:Warning in
drivers/common/cnxk/roc_bits.h:
Warning indrivers/common/cnxk/roc_ie_ot.h:
Warning indrivers/common/cnxk/roc_ie_ot_tls.h:
Useplt_symbols instead ofrte_API in cnxk base driverIt can be seen that the same was done in the past for similar macros like
PLT_CACHE_LINE_SIZEv2:
* fixed typo in commit message
Quoted 9 lines
Andre Muezerie (7):
eal: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__
mldev: eliminate dependency on non-portable__SIZEOF_LONG__
Just out of interest, is there are reason why the simple solution of just putting "#define __SIZEOF_LONG__ (sizeof(long))" in a header file for MSVC is not done? Should be a couple of lines in a single patch, rather than a 7-patch series, no?
After all, just because something is non-standard, doesn't mean that we can't use it if its widely available.
/Bruce
Quoted 51 lines · Bruce Richardson
Quoted 36 lines · Andre Muezerie
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.v4:
* rebased on latest main as previous patch was not applying cleanly anymore.v3:
* added prefixRTE_to BITS_PER_LONG* and moved them torte_common.h
* defined PLT_BITS_PER_LONG* indrivers/common/cnxk/roc_platform.hto avoid warnings fromcheckpatches.shlike:Warning in
drivers/common/cnxk/roc_bits.h:
Warning indrivers/common/cnxk/roc_ie_ot.h:
Warning indrivers/common/cnxk/roc_ie_ot_tls.h:
Useplt_symbols instead ofrte_API in cnxk base driverIt can be seen that the same was done in the past for similar macros like
PLT_CACHE_LINE_SIZEv2:
* fixed typo in commit messageQuoted 9 lines
Andre Muezerie (7):
eal: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__
mldev: eliminate dependency on non-portable__SIZEOF_LONG__Just out of interest, is there are reason why the simple solution of just putting "#define
__SIZEOF_LONG__(sizeof(long))" in a header file for MSVC is not done? Should be a couple of lines in a single patch, rather than a 7-patch series, no?
Quoted 4 lines
After all, just because something is non-standard, doesn't mean that we can't use it if its widely available.
/Bruce
Yes, that can be done instead. I'll send out a new series with that approach.
Quoted 52 lines · Andre Muezerie
Quoted 51 lines · Bruce Richardson
Quoted 36 lines · Andre Muezerie
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.v4:
* rebased on latest main as previous patch was not applying cleanly anymore.v3:
* added prefixRTE_to BITS_PER_LONG* and moved them torte_common.h
* defined PLT_BITS_PER_LONG* indrivers/common/cnxk/roc_platform.hto avoid warnings fromcheckpatches.shlike:Warning in
drivers/common/cnxk/roc_bits.h:
Warning indrivers/common/cnxk/roc_ie_ot.h:
Warning indrivers/common/cnxk/roc_ie_ot_tls.h:
Useplt_symbols instead ofrte_API in cnxk base driverIt can be seen that the same was done in the past for similar macros like
PLT_CACHE_LINE_SIZEv2:
* fixed typo in commit messageQuoted 9 lines
Andre Muezerie (7):
eal: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__
mldev: eliminate dependency on non-portable__SIZEOF_LONG__Just out of interest, is there are reason why the simple solution of just putting "#define
__SIZEOF_LONG__(sizeof(long))" in a header file for MSVC is not done? Should be a couple of lines in a single patch, rather than a 7-patch series, no?
Quoted 7 lines
Quoted 4 lines
After all, just because something is non-standard, doesn't mean that we can't use it if its widely available.
/Bruce
Yes, that can be done instead. I'll send out a new series with that approach.
Maybe wait in case there is input from others before spending time on a patch? I think the simpler solution is better, but others may feel that removing the macro completely is the better approach.
/Bruce
Quoted 57 lines · Andre Muezerie
Quoted 55 lines · Bruce Richardson
Quoted 54 lines · Andre Muezerie
Quoted 36 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.v4:
* rebased on latest main as previous patch was not applying cleanly anymore.v3:
* added prefixRTE_to BITS_PER_LONG* and moved them torte_common.h
* defined PLT_BITS_PER_LONG* indrivers/common/cnxk/roc_platform.hto avoid warnings fromcheckpatches.shlike:Warning in
drivers/common/cnxk/roc_bits.h:
Warning indrivers/common/cnxk/roc_ie_ot.h:
Warning indrivers/common/cnxk/roc_ie_ot_tls.h:
Useplt_symbols instead ofrte_API in cnxk base driverIt can be seen that the same was done in the past for similar macros like
PLT_CACHE_LINE_SIZEv2:
* fixed typo in commit messageQuoted 9 lines
Andre Muezerie (7):
eal: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__
mldev: eliminate dependency on non-portable__SIZEOF_LONG__Just out of interest, is there are reason why the simple solution of just putting "#define
__SIZEOF_LONG__(sizeof(long))" in a header file for MSVC is not done? Should be a couple of lines in a single patch, rather than a 7-patch series, no?After all, just because something is non-standard, doesn't mean that we can't use it if its widely available.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
/Bruce
Yes, that can be done instead. I'll send out a new series with that approach.
Maybe wait in case there is input from others before spending time on a patch? I think the simpler solution is better, but others may feel that removing the macro completely is the better approach.
+1 to what Bruce suggested.
Quoted 59 lines · Konstantin Ananyev
Quoted 59 lines · Andre Muezerie
Quoted 57 lines · Bruce Richardson
Quoted 55 lines · Andre Muezerie
Quoted 36 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equally well use sizeof(long) instead.v4:
* rebased on latest main as previous patch was not applying cleanly anymore.v3:
* added prefixRTE_to BITS_PER_LONG* and moved them torte_common.h
* defined PLT_BITS_PER_LONG* indrivers/common/cnxk/roc_platform.hto avoid warnings fromcheckpatches.shlike:Warning in
drivers/common/cnxk/roc_bits.h:
Warning indrivers/common/cnxk/roc_ie_ot.h:
Warning indrivers/common/cnxk/roc_ie_ot_tls.h:
Useplt_symbols instead ofrte_API in cnxk base driverIt can be seen that the same was done in the past for similar macros like
PLT_CACHE_LINE_SIZEv2:
* fixed typo in commit messageQuoted 9 lines
Andre Muezerie (7):
eal: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__
mldev: eliminate dependency on non-portable__SIZEOF_LONG__Just out of interest, is there are reason why the simple solution of just putting "#define
__SIZEOF_LONG__(sizeof(long))" in a header file for MSVC is not done? Should be a couple of lines in a single patch, rather than a 7-patch series, no?After all, just because something is non-standard, doesn't mean that we can't use it if its widely available.
/Bruce
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yes, that can be done instead. I'll send out a new series with that approach.
Maybe wait in case there is input from others before spending time on a patch? I think the simpler solution is better, but others may feel that removing the macro completely is the better approach.
+1 to what Bruce suggested.
Thomas also mentioned he would prefer to minimize changes. I'm fine with that too, as that is good enough to get the code to compile with MSVC.
PATCH v5 1/1 eal: define __SIZEOF_LONG__ when using MSVC
In reply to Andre MuezerieMacro __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
The fix is to define __SIZEOF_LONG__ in a common header when MSVC is used.
--- lib/eal/include/rte_compat.h | 5 +++++ 1 file changed, 5 insertions(+)
lib/eal/include/rte_compat.h +5 -0
@@ -66,4 +66,9 @@ __attribute__((section(".text.internal")))#endif +#ifdef RTE_TOOLCHAIN_MSVC +#define __SIZEOF_LONG__ (sizeof(long)) +#define __SIZEOF_LONG_LONG__ (sizeof(long long)) +#endif +#endif /* _RTE_COMPAT_H_ */
Signature · 1 line
2.47.2.vfs.0.1
Re: [PATCH v5] eal: define __SIZEOF_LONG__ when using MSVC
Quoted 14 lines · Andre Muezerie
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
Quoted 7 lines
The fix is to define
__SIZEOF_LONG__in a common header when MSVC is used.Signed-off-by Andre Muezerie <[email protected]>--- lib/eal/include/rte_compat.h | 5 +++++ 1 file changed, 5 insertions(+)
rte_compat only deals with symbol versioning. I think a better location would be windows/rte_os.h.
Signature · 1 line
David Marchand
Re: [PATCH v5] eal: define __SIZEOF_LONG__ when using MSVC
Quoted 19 lines · David Marchand
Quoted 17 lines · Andre Muezerie
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 constantThe fix is to define
__SIZEOF_LONG__in a common header when MSVC is used.
Quoted 12 lines
Quoted 4 lines
Signed-off-by Andre Muezerie <[email protected]>--- lib/eal/include/rte_compat.h | 5 +++++ 1 file changed, 5 insertions(+)
rte_compatonly deals with symbol versioning. I think a better location would bewindows/rte_os.h.Signature · 1 line
David Marchand
Thanks for the suggestion. I updated the patch accordingly.
PATCH v6 1/1 eal: define __SIZEOF_LONG__ when using MSVC
In reply to Andre MuezerieMacro __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
The fix is to define __SIZEOF_LONG__ in a common header when MSVC is used.
--- lib/eal/windows/include/rte_os.h | 5 +++++ 1 file changed, 5 insertions(+)
lib/eal/windows/include/rte_os.h +5 -0
@@ -56,4 +56,9 @@ struct { \*/ typedef long long ssize_t ; +#ifdef RTE_TOOLCHAIN_MSVC +#define __SIZEOF_LONG__ (sizeof(long)) +#define __SIZEOF_LONG_LONG__ (sizeof(long long)) +#endif +#endif /* _RTE_OS_H_ */
Signature · 1 line
2.47.2.vfs.0.1
Re: [PATCH v6] eal: define __SIZEOF_LONG__ when using MSVC
Quoted 13 lines · Andre Muezerie
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
Quoted 8 lines
The fix is to define
__SIZEOF_LONG__in a common header when MSVC is used.Signed-off-by Andre Muezerie <[email protected]>--- lib/eal/windows/include/rte_os.h | 5 +++++ 1 file changed, 5 insertions(+)
RE: [PATCH v6] eal: define __SIZEOF_LONG__ when using MSVC
In reply to Andre MuezerieQuoted 27 lines
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 constantThe fix is to define
__SIZEOF_LONG__in a common header when MSVC is used.Signed-off-by Andre Muezerie <[email protected]>--- lib/eal/windows/include/rte_os.h | 5 +++++ 1 file changed, 5 insertions(+)lib/eal/windows/include/rte_os.h +0
-0
lib/eal/windows/include/rte_os.h struct { \
Quoted 10 lines
lib/eal/windows/include/rte_os.h +5
-1@@ -56,4 +56,9 @@ struct { \*/ typedef long long ssize_t ; +#ifdef RTE_TOOLCHAIN_MSVC +#define __SIZEOF_LONG__ (sizeof(long)) +#define __SIZEOF_LONG_LONG__ (sizeof(long long)) +#endif +#endif /* _RTE_OS_H_ */ --
Quoted 1 line
2.47.2.vfs.0.1
David Marchand
AppliedRe: [PATCH v6] eal: define __SIZEOF_LONG__ when using MSVC
In reply to Andre MuezerieQuoted 14 lines · Andre Muezerie
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
Quoted 4 lines
The fix is to define
__SIZEOF_LONG__in a common header when MSVC is used.Signed-off-by Andre Muezerie <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand
PATCH 2/6 drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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 equaly well use sizeof(long) instead.
--- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_bits.h +2 -2
@@ -14,10 +14,10 @@#endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#endif #ifndef GENMASK
drivers/common/nfp/nfp_platform.h +2 -2
@@ -14,8 +14,8 @@#define DMA_BIT_MASK (n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#define GENMASK (h, l) \ ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1)))
Signature · 1 line
2.47.0.vfs.0.3
RE: [PATCH 2/6] drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__
Quoted 45 lines
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equaly well use sizeof(long) instead.Signed-off-by Andre Muezerie <[email protected]>--- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/common/cnxk/roc_bits.hindex11216d9d63..aa4944ae7f100644drivers/common/cnxk/roc_bits.h +2
-2@@ -14,10 +14,10 @@#endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#endif #ifndef GENMASK drivers/common/nfp/nfp_platform.h +0
-0
drivers/common/nfp/nfp_platform.h line 18
Quoted 7 lines
drivers/common/nfp/nfp_platform.h +2
-2@@ -14,8 +14,8 @@#define DMA_BIT_MASK (n) ((1ULL << (n)) - 1) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)
This looks good to me, thanks.
Quoted 5 lines
drivers/common/nfp/nfp_platform.h +0
-1#define GENMASK (h, l) \ ((~0UL << (l)) & (~0UL >> (BITS_PER_LONG - (h) - 1))) --2.47.0.vfs.0.3
PATCH 3/6 drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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 equaly well use sizeof(long) instead.
--- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dpaa/dpaa_qdma.h +1 -1
@@ -14,7 +14,7 @@#define RETRIES 5#ifndef GENMASK -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#endif
drivers/dma/hisilicon/hisi_dmadev.h +1 -1
@@ -12,7 +12,7 @@#include <rte_dmadev_pmd.h> #define BIT (x) (1ul << (x)) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#define BF_SHF (x) rte_bsf64(x)
Signature · 1 line
2.47.0.vfs.0.3
PATCH 4/6 drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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 equaly well use sizeof(long) instead.
--- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ena/base/ena_plat_dpdk.h +2 -2
@@ -97,11 +97,11 @@ extern int ena_logtype_com;#define ENA_MIN16 (x, y) ENA_MIN_T(uint16_t, (x), (y))#define ENA_MIN8 (x, y) ENA_MIN_T(uint8_t, (x), (y)) -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#define U64_C (x) x ## ULL#define BIT (nr) RTE_BIT32(nr)#define BIT64 (nr) RTE_BIT64(nr) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))#define GENMASK_ULL (h, l) (((~0ULL) - (1ULL << (l)) + 1) & \ (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
drivers/net/hns3/hns3_ethdev.h +1 -1
@@ -952,7 +952,7 @@ static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw)#define BIT_ULL (x) (1ULL << (x)) -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#define GENMASK (h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
Signature · 1 line
2.47.0.vfs.0.3
PATCH 5/6 drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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 equaly well use sizeof(long) instead.
--- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/raw/ifpga/base/opae_osdep.h +2 -2
@@ -31,10 +31,10 @@ struct uuid {#ifndef LINUX_MACROS #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef BITS_PER_LONG_LONG -#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#define BITS_PER_LONG_LONG (sizeof(long long) * 8)#endif #ifndef BIT #define BIT (a) (1UL << (a))
Signature · 1 line
2.47.0.vfs.0.3
PATCH 6/6 lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__
In reply to Andre MuezerieMacro __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 equaly well use sizeof(long) instead.
--- lib/mldev/mldev_utils_scalar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mldev/mldev_utils_scalar.h +1 -1
@@ -13,7 +13,7 @@#endif #ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#define BITS_PER_LONG (sizeof(long) * 8)#endif #ifndef GENMASK_U32
Signature · 1 line
2.47.0.vfs.0.3
Quoted 35 lines · On Wed, 4 Dec 2024 12:09:49 -0800 Andre Muezerie…
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equaly well use sizeof(long) instead.Andre Muezerie (6):
drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__lib/mldev: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- lib/mldev/mldev_utils_scalar.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
Quoted 1 line
--
BITS_PER_LONG etc should be in rte_common.h not scattered all over these drivers.
Quoted 38 lines · Stephen Hemminger
Quoted 35 lines · On Wed, 4 Dec 2024 12:09:49 -0800 Andre Muezerie…
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 constantTurns out that the places where
__SIZEOF_LONG__is currently being used can equaly well use sizeof(long) instead.Andre Muezerie (6):
drivers/bus: eliminate dependency on non-portable__SIZEOF_LONG__drivers/common: eliminate dependency on non-portable__SIZEOF_LONG__drivers/dma: eliminate dependency on non-portable__SIZEOF_LONG__drivers/net: eliminate dependency on non-portable__SIZEOF_LONG__drivers/raw: eliminate dependency on non-portable__SIZEOF_LONG__lib/mldev: eliminate dependency on non-portable__SIZEOF_LONG__drivers/bus/fslmc/mc/fsl_mc_cmd.h | 2 +- drivers/common/cnxk/roc_bits.h | 4 ++-- drivers/common/nfp/nfp_platform.h | 4 ++-- drivers/dma/dpaa/dpaa_qdma.h | 2 +- drivers/dma/hisilicon/hisi_dmadev.h | 2 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 ++-- drivers/net/hns3/hns3_ethdev.h | 2 +- drivers/raw/ifpga/base/opae_osdep.h | 4 ++-- lib/mldev/mldev_utils_scalar.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
Quoted 4 lines
Quoted 1 line
--
BITS_PER_LONGetc should be inrte_common.hnot scattered all over these drivers.
Makes sense. I'll update the series, but will limit the additional changes to BITS_PER_LONG and BITS_PER_LONG_LONG to limit the size of this series.
--
Andre Muezerie