From patchwork Tue Feb 4 18:54:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150895 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 489D746190; Tue, 4 Feb 2025 19:54:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6C1A40288; Tue, 4 Feb 2025 19:54:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A4A4D400D6 for ; Tue, 4 Feb 2025 19:54:35 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id C09F0205491F; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C09F0205491F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695274; bh=oI5igbiKJ4u3yJHRsAkY4wJBz4x93bqxajNvJndiuec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aQUAKv71ltn6BAFD30qNZm2oY+M34atRyuJ46ZrZ+4b3C77xwglMhVMOmVYeRo9Qu O570H7geMSDPoVcX/F+IRK/xXqj2xBCPU7EDv5khomJ6qMR4e5w9G214gm8f2w3638 XWVjhR5Z2DIhu3J/R+R4m2ezhCPW3syCM4RzvJYU= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 1/7] eal: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:25 -0800 Message-Id: <1738695271-29948-2-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/eal/include/rte_common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 7a252c1997..47e3201006 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -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. */ From patchwork Tue Feb 4 18:54:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150896 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F212546190; Tue, 4 Feb 2025 19:54:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCA1140299; Tue, 4 Feb 2025 19:54:37 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AAC654025F for ; Tue, 4 Feb 2025 19:54:35 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id CCC272054921; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CCC272054921 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695274; bh=jObmWukmhWjWwHbnCI8j8lhSOECtu3Bmn/UVcLZKsO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJeTlGmCkjcKCbmhSbgTzGZu03aTyq2RBgU9+Txse5H9CE6TcW0roEqlL/Y8OA3Np FsExQifx3Mlhp+yvMZorrIJam6s5bwbvmk8LAZAa3zi7yrKA7bOq7d+LRbLGw+3Zzj gfXDXHHSTKIcEEqJWI+7U5AK5Jb2vlJvtiNQcoVU= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:26 -0800 Message-Id: <1738695271-29948-3-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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)))) struct mc_cmd_header { union { From patchwork Tue Feb 4 18:54:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150898 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BA4D46190; Tue, 4 Feb 2025 19:54:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30987402EB; Tue, 4 Feb 2025 19:54:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EB08C40288 for ; Tue, 4 Feb 2025 19:54:35 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id D8AD52054925; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D8AD52054925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695274; bh=x2D2pDb9A9yJZ/2q5mHmfZRZ1Cyf9hSLA7IJ0x8VmdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBx6DzugDtlaEtGrY5M00xLKk9lBfccvi0OqaggFtFuHuW90/6qNYwyrR5LTlP/z8 nBRqNExffOfTvlmhSqD5DEB0P/+81gYiExcP2x62OokiK3bVX2oK/6jYmaBfA2SQXR LUrWTBm/MWBcksaqxO8JcaQzU8lwyNQbtbwfeaNs= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 3/7] drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:27 -0800 Message-Id: <1738695271-29948-4-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Chaoyong He --- 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(-) diff --git a/drivers/common/cnxk/cnxk_security_ar.h b/drivers/common/cnxk/cnxk_security_ar.h index d0151a752c..9e88d0063b 100644 --- a/drivers/common/cnxk/cnxk_security_ar.h +++ b/drivers/common/cnxk/cnxk_security_ar.h @@ -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) diff --git a/drivers/common/cnxk/roc_bits.h b/drivers/common/cnxk/roc_bits.h index 11216d9d63..654e5a85d7 100644 --- a/drivers/common/cnxk/roc_bits.h +++ b/drivers/common/cnxk/roc_bits.h @@ -5,6 +5,8 @@ #ifndef _ROC_BITS_H_ #define _ROC_BITS_H_ +#include + #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_ */ diff --git a/drivers/common/cnxk/roc_ie_ot.h b/drivers/common/cnxk/roc_ie_ot.h index 1420e3d586..bfefe792b0 100644 --- a/drivers/common/cnxk/roc_ie_ot.h +++ b/drivers/common/cnxk/roc_ie_ot.h @@ -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 diff --git a/drivers/common/cnxk/roc_ie_ot_tls.h b/drivers/common/cnxk/roc_ie_ot_tls.h index 2d6a290d9b..ff86bcb877 100644 --- a/drivers/common/cnxk/roc_ie_ot_tls.h +++ b/drivers/common/cnxk/roc_ie_ot_tls.h @@ -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 diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h index 1eb54446a8..1ed03430f9 100644 --- a/drivers/common/cnxk/roc_platform.h +++ b/drivers/common/cnxk/roc_platform.h @@ -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 diff --git a/drivers/common/nfp/nfp_platform.h b/drivers/common/nfp/nfp_platform.h index 0b02fcf1e8..e34781a88d 100644 --- a/drivers/common/nfp/nfp_platform.h +++ b/drivers/common/nfp/nfp_platform.h @@ -9,19 +9,17 @@ #include #include +#include #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) From patchwork Tue Feb 4 18:54:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150897 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04EB146190; Tue, 4 Feb 2025 19:54:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0931F402E6; Tue, 4 Feb 2025 19:54:40 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id CD53440268 for ; Tue, 4 Feb 2025 19:54:35 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id E4C002054926; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E4C002054926 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695274; bh=P1QGJoWG+spNMbHHvZcZrfxtzPUaNB6VcncOpmVpNeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXgTD472yIq0/wxLEGk6YhYzEB5trvQMPUTZ88LSUuXv8IJ/PdblrSQn+2+RLV8WN 3HSsJgqSpCveReaf2yM7sB8XPruFdLomqBmnIEB8snsbTW/JcFGFqOXoWToeFTWLQr sKcanXxIv86nRCHAJEZrZ/riZ5r4uL5etA/AhM/w= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 4/7] drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:28 -0800 Message-Id: <1738695271-29948-5-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/dma/dpaa/dpaa_qdma.h | 3 +-- drivers/dma/hisilicon/hisi_dmadev.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dpaa/dpaa_qdma.h b/drivers/dma/dpaa/dpaa_qdma.h index 0b08909221..c017bec48f 100644 --- a/drivers/dma/dpaa/dpaa_qdma.h +++ b/drivers/dma/dpaa/dpaa_qdma.h @@ -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 diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h index 786fe3cc0e..d1b4ae7da8 100644 --- a/drivers/dma/hisilicon/hisi_dmadev.h +++ b/drivers/dma/hisilicon/hisi_dmadev.h @@ -12,9 +12,8 @@ #include #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))) From patchwork Tue Feb 4 18:54:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150901 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0265E46190; Tue, 4 Feb 2025 19:55:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5E37D40611; Tue, 4 Feb 2025 19:54:44 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 92B354025F for ; Tue, 4 Feb 2025 19:54:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id F10DA2054928; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F10DA2054928 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695274; bh=55+mhaD2WtYTNhJJ8h7nYwLY/wVmfFrCNTIHnjV9MdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0LEmO8ihr3Qa5lv2u7CMOvk9t8WCw4SkhNuhXFKs8cVzwF/b/+avHgLU2MhR2uTu jC3lFft+hBe8m1ZsI1KDzZGJfefMYUcclmToh3JBaJ9Jgc0efqgpYNqgjJmjzxW7ES yB+TyLBvwYTiN38bMKjzxxLu4MmvgzPksarfGGGE= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 5/7] drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:29 -0800 Message-Id: <1738695271-29948-6-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/net/ena/base/ena_plat_dpdk.h | 6 ++---- drivers/net/hns3/hns3_ethdev.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 3b574f888a..8ab1442c22 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -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, ...) \ ( \ diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 7824503bb8..c7ad9a61c7 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -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))) From patchwork Tue Feb 4 18:54:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150899 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0C1DD46190; Tue, 4 Feb 2025 19:55:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B9FC402F1; Tue, 4 Feb 2025 19:54:42 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 926FA400D6 for ; Tue, 4 Feb 2025 19:54:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 090AB210C317; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 090AB210C317 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695275; bh=K9WbGzwW0u4dl4hAUaee6yoC6zWGz2mcQLNEzNM7GAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sd/RCoBP+9yWnusrtP2MERFnaYrlsHm879uxzKZlWP2dg2MOUvBDL+o7fb2/TT0jV AfiVavWpttuVjrmc8Hcl8Dr0VWaW3ccMp0TLAYJKwWb3mxgOe1RerrsK7oJSb2NjRH kkpI/h4ZNkty3tUSDuaay5ACtoKNjr1bALMX9rg4= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 6/7] drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:30 -0800 Message-Id: <1738695271-29948-7-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/raw/ifpga/base/opae_osdep.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h index e35a21c80e..af61716f61 100644 --- a/drivers/raw/ifpga/base/opae_osdep.h +++ b/drivers/raw/ifpga/base/opae_osdep.h @@ -9,6 +9,8 @@ #include #include +#include + #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 */ From patchwork Tue Feb 4 18:54:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 150900 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 17D6F46190; Tue, 4 Feb 2025 19:55:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 40E9F4042E; Tue, 4 Feb 2025 19:54:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 95D4B40261 for ; Tue, 4 Feb 2025 19:54:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 1613E210C337; Tue, 4 Feb 2025 10:54:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1613E210C337 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738695275; bh=Olc5e6j9rVjMVE5alMZK5akwjazmT3nqLC42LRlQWaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FgRje70wujrdP0FPKJ+cT5DNawubeau7d0KHyY3dDanI4XNB/w/eR+edV9IjgXW3/ wSMe6YNe5pa1F1ISzODpKqrKTutjbPcmNU+kWmDyqFBIye+FCDwLHD2ch3rs+znENi o0LNlCQHGP89SjHoAzrWRnt3zWddSqFbuwrAEjug= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v4 7/7] mldev: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Tue, 4 Feb 2025 10:54:31 -0800 Message-Id: <1738695271-29948-8-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1738695271-29948-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/mldev/mldev_utils_scalar.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/mldev/mldev_utils_scalar.h b/lib/mldev/mldev_utils_scalar.h index 57e66ddb60..a9462089d7 100644 --- a/lib/mldev/mldev_utils_scalar.h +++ b/lib/mldev/mldev_utils_scalar.h @@ -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 */