From patchwork Thu Dec 5 04:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149033 X-Patchwork-Delegate: david.marchand@redhat.com 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 4CA6145E36; Thu, 5 Dec 2024 05:20:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEAC242792; Thu, 5 Dec 2024 05:20:40 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 810274275D for ; Thu, 5 Dec 2024 05:20:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id A3FD320ACD63; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A3FD320ACD63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=vkRxwUTOE9FcEWss9FH7hR8UxwAb9HOiZ551AoOSUd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7EpxdzUQOlKFOYLGJsf8qKM4Jka6TUdN1RF8enn9R2S4QJNzpB8inrMKohhJoisU iSIj3rPkGBjaaWumnsnkMA4oQoejR/HSTlNFAWFK44h/0NZyhnUruD25zRkVpCE7fV L5CzSw/UJ1NfrU4vditJxvSgCmL5UCr6Jfe4bCHU= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 1/7] lib/eal: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:23 -0800 Message-Id: <1733372429-3996-2-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 4d299f2b36..d2338366a4 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -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. */ From patchwork Thu Dec 5 04:20:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149032 X-Patchwork-Delegate: david.marchand@redhat.com 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 B03C845E36; Thu, 5 Dec 2024 05:20:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86C584278E; Thu, 5 Dec 2024 05:20:39 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 73DCE402C4 for ; Thu, 5 Dec 2024 05:20:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id B182820ACD64; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B182820ACD64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=3tK1fCjVGjxSi2ute6kVVTRjFnw7Wf+1h7igFnT3yBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHjAV9BH52JHYLavlkNrYTuRnkal2CyWkHc9CCcUDi6XMLD2uOuSCthHWrUb35B3Q cJ2Y3SRhaPUGqM+pT2nWCOTbJBeSyRxoy/h6fiCR+fP7R3gXdiVcGYEtneDMjdUg0M esJ8yVzv69NX/wo0E4PP6J2m7we5lLeK4v0aVDk0= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 2/7] drivers/bus: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:24 -0800 Message-Id: <1733372429-3996-3-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 Thu Dec 5 04:20:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149035 X-Patchwork-Delegate: david.marchand@redhat.com 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 4148445E36; Thu, 5 Dec 2024 05:21:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 686B14279B; Thu, 5 Dec 2024 05:20:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 90B7242788 for ; Thu, 5 Dec 2024 05:20:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id BE52720ACD65; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BE52720ACD65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=uSPetXAV64k/4HZvpDwPBOBourbctFQmbcEWt/YYIDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mLeUoRz8/4LfaR7zzoXzZq99Jev7i4065SKndI/WvBSWBmQJaSjC3Zuh1MseLWM6p BZFgkMiiwE1w5OZ1rhi8iaEX/j0fpO+qcXn6W1FYGWtQM385G1qFmN8bYpBuJjiOd2 9lymBj0NhFT6W5jMOeb+v4A58FG54cVvWDaU0XAc= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 3/7] drivers/common: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:25 -0800 Message-Id: <1733372429-3996-4-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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..2d94dd3f81 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..5df9c98b00 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 df4f88f288..6abbc672cc 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 Thu Dec 5 04:20:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149034 X-Patchwork-Delegate: david.marchand@redhat.com 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 6FBA445E36; Thu, 5 Dec 2024 05:20:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 311F442796; Thu, 5 Dec 2024 05:20:42 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A42EE42789 for ; Thu, 5 Dec 2024 05:20:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id CADFF20ACD66; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CADFF20ACD66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=aGgM1SDvmPyQWEN6hhq5oDwDupWGNTfcF6d+wXfKKDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rMqbFiNMN8VEHtmJ3SXZZEzkB1xTdHAzGzxopvIewogE485hnPcpggHJDPbBZE7TN wbhmH302U3BYSPv4z6Pk00pwn8yua1GBI1Xi6lQQq6lspNtx3Sa4Gu01YMuPgcuNan Hbhs5M04XrOHT27O+TlxSlDYC9pLBsLhlv2MyOtI= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 4/7] drivers/dma: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:26 -0800 Message-Id: <1733372429-3996-5-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 91eaf1455a..617e15fbc4 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 Thu Dec 5 04:20:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149036 X-Patchwork-Delegate: david.marchand@redhat.com 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 EEC3945E36; Thu, 5 Dec 2024 05:21:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C99B4279E; Thu, 5 Dec 2024 05:20:45 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3D3DC402AE for ; Thu, 5 Dec 2024 05:20:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id D77EC20ACD67; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D77EC20ACD67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=x5CYD+w0ybQBfSTzQ+oFyQ9fTL4MkbrPFavjapLOT/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qj9Uy95/ITZV2Un1D7R7IntqAZz+sgfXfGACMeFvv/GlN+dwLmGicCEglgDkdRt6j sFin1T+jX0OO/qDESNBQPQED2wr0pdM8HsAZcXOJl3H6nqEYeus9bkl7+6FOMtR49o 23j5cLh+XVpdox4FK/urmxNccCnfuGplpGYMb078= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 5/7] drivers/net: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:27 -0800 Message-Id: <1733372429-3996-6-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 1121460470..63f6ef70ee 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, arg...) \ ( \ 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 Thu Dec 5 04:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149038 X-Patchwork-Delegate: david.marchand@redhat.com 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 535CD45E36; Thu, 5 Dec 2024 05:21:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93880427A6; Thu, 5 Dec 2024 05:20:47 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 76EEE4275D for ; Thu, 5 Dec 2024 05:20:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id E42E820ACD68; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E42E820ACD68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=AbZpgVDbJraSbMGorMBAik84bEKC5Fb77OF7sFt1tbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQY6oQpupjBJTazgv0FSs8FvGzXyoMw/nbO2rXdmvCMopq+1nf69dAe4QFDTBpGIV I4QEfSZi7hWliaqsthivbpTH+azmnjGIAW0n45YH1hRG4uPO6Hz8ksbu9jNH687eqO dDJXfSto81l2G1uAO8pIPfaQ457ysyl1pRxB7jQg= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 6/7] drivers/raw: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:28 -0800 Message-Id: <1733372429-3996-7-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 cb780b1fed..e4767e2d7a 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 Thu Dec 5 04:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Muezerie X-Patchwork-Id: 149037 X-Patchwork-Delegate: david.marchand@redhat.com 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 EA2B145E36; Thu, 5 Dec 2024 05:21:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 398A9427A3; Thu, 5 Dec 2024 05:20:46 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5B0B7402C4 for ; Thu, 5 Dec 2024 05:20:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id F0B8020ACD69; Wed, 4 Dec 2024 20:20:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F0B8020ACD69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1733372435; bh=+XIiXvaq0e3ng/UD8hTdttldqQm7chp3clcB8SjAGwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1BcaAMTaBENBAfw/TMsOWVHMsSeBba/CDdqGUX4tw0nR+hEy805ICBnZnMmj+YDa xFdcoJ29eSnDOhK8athU42KQt0nSY/bjvBh8Drfi44ifDNt1oCJC17qstzymvWxNyw y/mOqAZOirhP8vXzlNZQ1DVIs1GOdXviH4miAO7s= From: Andre Muezerie To: dev@dpdk.org Cc: Andre Muezerie Subject: [PATCH v3 7/7] lib/mldev: eliminate dependency on non-portable __SIZEOF_LONG__ Date: Wed, 4 Dec 2024 20:20:29 -0800 Message-Id: <1733372429-3996-8-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1733372429-3996-1-git-send-email-andremue@linux.microsoft.com> References: <1733342995-3722-2-git-send-email-andremue@linux.microsoft.com> <1733372429-3996-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 */